--- gvpe/src/device.h 2003/04/06 20:01:52 1.4 +++ gvpe/src/device.h 2003/10/14 17:01:07 1.8 @@ -19,7 +19,7 @@ #ifndef VPE_DEVICE_H__ #define VPE_DEVICE_H__ -#include +#define IFNAMESIZE 256 // be conservative #include "gettext.h" @@ -30,9 +30,16 @@ u8 &operator[] (u16 offset) const; + void unshift_hdr (u16 hdrsize) + { + memmove ((void *)&(*this)[hdrsize], (void *)&(*this)[0], len); + len += hdrsize; + } + void skip_hdr (u16 hdrsize) { - memmove ((void *)&(*this)[0], (void *)&(*this)[hdrsize], len -= hdrsize); + len -= hdrsize; + memmove ((void *)&(*this)[0], (void *)&(*this)[hdrsize], len); } void set (const net_packet &pkt) @@ -71,23 +78,28 @@ u8 data[MAXSIZE - 12]; }; -struct tap_device { +struct tap_device_base { int fd; - // linux tuntap - char ifrname[IFNAMSIZ + 1]; + // network interface name or identifier + char ifrname[IFNAMESIZE + 1]; char *device; tap_device (); ~tap_device (); + //bool open (); + //void close (); + const char *interface () { return ifrname; } - const char *info () { return _("Linux tun/tap device"); } + const char *info (); tap_packet *recv (); void send (tap_packet *pkt); }; +//extern tap_device *tap_device (); + #endif