--- gvpe/src/device.h 2008/08/07 17:54:27 1.22 +++ gvpe/src/device.h 2011/09/16 18:01:26 1.25 @@ -58,6 +58,11 @@ memmove ((void *)&(*this)[0], (void *)&(*this)[hdrsize], len); } + u16 ipv4_hdr_len () const + { + return ((*this)[0] & 15) << 2; + } + void set (const net_packet &pkt) { len = pkt.len; @@ -97,13 +102,13 @@ u8 data_[MAXSIZE]; }; -inline +inline u8 &net_packet::operator[] (u16 offset) const { return ((data_packet *)this)->data_[offset]; } -inline +inline u8 *net_packet::at (u16 offset) const { return &((*this)[offset]);