X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/tripe/blobdiff_plain/bd58d532a19be319c83478ab89906415ef8861c3..b9066fbb5c1c160eb305a33a3335b77d17e0f502:/tripe.h diff --git a/tripe.h b/tripe.h index 320a2ca5..c8ad9ae1 100644 --- a/tripe.h +++ b/tripe.h @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -111,6 +112,7 @@ #define TUN_UNET 1 #define TUN_BSD 2 #define TUN_LINUX 3 +#define TUN_SLIP 4 /* --- Trace flags --- */ @@ -263,6 +265,16 @@ enum { # include #endif +#if TUN_TYPE == TUN_SLIP + typedef struct slipif { + struct slipif *next; /* Next one in the list */ + int ifd, ofd; /* File descriptors to talk on */ + char *name; /* Interface name */ + unsigned f; /* Various flags */ +# define SLIPIFF_INUSE 1u /* Interface is in use */ + } slipif; +#endif + typedef struct tunnel { #if TUN_TYPE == TUN_UNET sel_file f; /* Selector for Usernet device */ @@ -275,6 +287,16 @@ typedef struct tunnel { sel_file f; /* Selector for tunnel device */ struct peer *p; /* Pointer to my peer */ unsigned n; /* Number of my tunnel device */ +#elif TUN_TYPE == TUN_SLIP + slipif *sl; /* My interface record */ + sel_file f; /* Selector for SLIP tty */ + struct peer *p; /* Pointer to my peer */ + unsigned st; /* Current parser state */ +# define SLIPST_ESC 1u /* Last saw an escape character */ +# define SLIPST_BAD 2u /* This packet is malformed */ +# define SLIPST_EOF 4u /* File descriptor reported EOF */ + size_t n; /* Number of bytes used in buffer */ + octet buf[PKBUFSZ]; /* Buffer for incoming data */ #else # error "No support for this tunnel type" #endif