X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/tripe/blobdiff_plain/17f0adc158c071dda3ef19ece1ac755b3d250bdd..2de0ad0f5c5871d482d778908d08d0dd1b01c821:/tripe.h diff --git a/tripe.h b/tripe.h index 420a6fdf..1f73d6ba 100644 --- a/tripe.h +++ b/tripe.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: tripe.h,v 1.11 2002/01/13 14:57:42 mdw Exp $ + * $Id: tripe.h,v 1.15 2003/05/16 12:09:03 mdw Exp $ * * Main header file for TrIPE * @@ -29,6 +29,18 @@ /*----- Revision history --------------------------------------------------* * * $Log: tripe.h,v $ + * Revision 1.15 2003/05/16 12:09:03 mdw + * Allow binding to a chosen address. + * + * Revision 1.14 2003/04/06 10:36:33 mdw + * Rearrange so as not to include Linux headers unless we need to. + * + * Revision 1.13 2003/04/06 10:26:35 mdw + * Report peer name on decrypt errors. + * + * Revision 1.12 2003/04/06 10:25:17 mdw + * Support Linux TUN/TAP device. Fix some bugs. + * * Revision 1.11 2002/01/13 14:57:42 mdw * Fix crap typo. * @@ -147,6 +159,7 @@ #define TUN_NOTDEF 0 #define TUN_UNET 1 #define TUN_BSD 2 +#define TUN_LINUX 3 /* --- Trace flags --- */ @@ -300,6 +313,7 @@ typedef union addr { typedef struct keyset { struct keyset *next; /* Next active keyset in the list */ unsigned ref; /* Reference count for keyset */ + struct peer *p; /* Pointer to peer structure */ time_t t_exp; /* Expiry time for this keyset */ unsigned long sz_exp; /* Data limit for the keyset */ T( unsigned seq; ) /* Sequence number for tracing */ @@ -375,10 +389,19 @@ enum { * Used to maintain system-specific information about the tunnel interface. */ +#if TUN_TYPE == TUN_LINUX +# include +# include +#endif + typedef struct tunnel { -#if TUN_TYPE == TUN_UNET +#if TUN_TYPE == TUN_UNET sel_file f; /* Selector for Usernet device */ struct peer *p; /* Pointer to my peer */ +#elif TUN_TYPE == TUN_LINUX + sel_file f; /* Selector for TUN/TAP device */ + struct peer *p; /* Pointer to my peer */ + char ifn[IFNAMSIZ]; /* Interface name buffer */ #elif TUN_TYPE == TUN_BSD sel_file f; /* Selector for tunnel device */ struct peer *p; /* Pointer to my peer */ @@ -598,6 +621,7 @@ extern void ks_drop(keyset */*ks*/); * * Arguments: @const void *k@ = pointer to key material * @size_t x, y, z@ = offsets into key material (see below) + * @peer *p@ = pointer to peer information * * Returns: A pointer to the new keyset. * @@ -617,7 +641,8 @@ extern void ks_drop(keyset */*ks*/); */ extern keyset *ks_gen(const void */*k*/, - size_t /*x*/, size_t /*y*/, size_t /*z*/); + size_t /*x*/, size_t /*y*/, size_t /*z*/, + peer */*p*/); /* --- @ks_tregen@ --- * * @@ -871,14 +896,15 @@ extern const addr *p_addr(peer */*p*/); /* --- @p_init@ --- * * - * Arguments: @unsigned port@ = port number to listen to + * Arguments: @struct in_addr addr@ = address to bind to + * @unsigned port@ = port number to listen to * * Returns: --- * * Use: Initializes the peer system; creates the socket. */ -extern void p_init(unsigned /*port*/); +extern void p_init(struct in_addr /*addr*/, unsigned /*port*/); /* --- @p_port@ --- * *