#include <assert.h>
#include <ctype.h>
#include <errno.h>
+#include <limits.h>
#include <signal.h>
#include <stdarg.h>
#include <stddef.h>
#define TUN_UNET 1
#define TUN_BSD 2
#define TUN_LINUX 3
+#define TUN_SLIP 4
/* --- Trace flags --- */
# include <linux/if_tun.h>
#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 */
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