ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/device.h
(Generate patch)

Comparing gvpe/src/device.h (file contents):
Revision 1.24 by root, Fri Sep 16 17:59:46 2011 UTC vs.
Revision 1.26 by root, Wed Jul 17 16:40:57 2013 UTC

40#include "util.h" 40#include "util.h"
41 41
42struct net_packet 42struct net_packet
43{ 43{
44 u32 len; // actually u16, but padding... 44 u32 len; // actually u16, but padding...
45 // upto 4 bytes at the end might get overwritten when decrypting,
46 // which means len, above, is regularly overwritten with part
47 // of the random prefix when RAND_BYTES=12.
45 48
46 u8 &operator[] (u16 offset) const; 49 u8 &operator[] (u16 offset) const;
47 u8 *at (u16 offset) const; 50 u8 *at (u16 offset) const;
48 51
49 void unshift_hdr (u16 hdrsize) 52 void unshift_hdr (u16 hdrsize)
56 { 59 {
57 len -= hdrsize; 60 len -= hdrsize;
58 memmove ((void *)&(*this)[0], (void *)&(*this)[hdrsize], len); 61 memmove ((void *)&(*this)[0], (void *)&(*this)[hdrsize], len);
59 } 62 }
60 63
61 void skip_ipv4_hdr (u16 extra = 0) 64 u16 ipv4_hdr_len () const
62 { 65 {
63 skip_hdr ((((*this)[0] & 15) << 2) + extra); 66 return ((*this)[0] & 15) << 2;
64 } 67 }
65 68
66 void set (const net_packet &pkt) 69 void set (const net_packet &pkt)
67 { 70 {
68 len = pkt.len; 71 len = pkt.len;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines