--- gvpe/src/device.h 2003/04/02 03:25:17 1.3 +++ gvpe/src/device.h 2003/04/06 20:01:52 1.4 @@ -28,13 +28,19 @@ struct net_packet { u32 len; // actually u16, but padding... - u8 &operator[] (u16 offset); + u8 &operator[] (u16 offset) const; void skip_hdr (u16 hdrsize) { memmove ((void *)&(*this)[0], (void *)&(*this)[hdrsize], len -= hdrsize); } + void set (const net_packet &pkt) + { + len = pkt.len; + memcpy (&((*this)[0]), &(pkt[0]), len); + } + bool is_arp () { return (*this)[12] == 0x08 && (*this)[13] == 0x06 // 0806 protocol @@ -52,7 +58,7 @@ }; inline -u8 &net_packet::operator[] (u16 offset) +u8 &net_packet::operator[] (u16 offset) const { return ((data_packet *)this)->data_[offset]; }