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.20 by pcg, Tue Apr 26 00:55:56 2005 UTC vs.
Revision 1.21 by pcg, Sun Dec 2 00:09:36 2007 UTC

27#define IFNAMESIZE 256 // be conservative 27#define IFNAMESIZE 256 // be conservative
28 28
29#include "global.h" 29#include "global.h"
30#include "util.h" 30#include "util.h"
31 31
32struct net_packet { 32struct net_packet
33{
33 u32 len; // actually u16, but padding... 34 u32 len; // actually u16, but padding...
34 35
35 u8 &operator[] (u16 offset) const; 36 u8 &operator[] (u16 offset) const;
36 u8 *at (u16 offset) const; 37 u8 *at (u16 offset) const;
37 38
79 80
80 void *operator new (size_t s); 81 void *operator new (size_t s);
81 void operator delete (void *p); 82 void operator delete (void *p);
82}; 83};
83 84
84struct data_packet : net_packet { 85struct data_packet : net_packet
86{
85 u8 data_[MAXSIZE]; 87 u8 data_[MAXSIZE];
86}; 88};
87 89
88inline 90inline
89u8 &net_packet::operator[] (u16 offset) const 91u8 &net_packet::operator[] (u16 offset) const
95u8 *net_packet::at (u16 offset) const 97u8 *net_packet::at (u16 offset) const
96{ 98{
97 return &((*this)[offset]); 99 return &((*this)[offset]);
98} 100}
99 101
100struct tap_packet : net_packet { 102struct tap_packet : net_packet
103{
101 mac dst; 104 mac dst;
102 mac src; 105 mac src;
103 u8 data[MAXSIZE - 12]; 106 u8 data[MAXSIZE - 12];
104}; 107};
105 108
106struct tap_device { 109struct tap_device
110{
107 int fd; 111 int fd;
108 112
109 // network interface name or identifier 113 // network interface name or identifier
110 char ifrname[IFNAMESIZE + 1]; 114 char ifrname[IFNAMESIZE + 1];
111 115

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines