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.17 by pcg, Thu Mar 3 16:54:34 2005 UTC vs.
Revision 1.21 by pcg, Sun Dec 2 00:09:36 2007 UTC

14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with gvpe; if not, write to the Free Software 18 along with gvpe; if not, write to the Free Software
19 Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20*/ 20*/
21 21
22#ifndef VPE_DEVICE_H__ 22#ifndef GVPE_DEVICE_H__
23#define VPE_DEVICE_H__ 23#define GVPE_DEVICE_H__
24
25#include "config.h"
24 26
25#define IFNAMESIZE 256 // be conservative 27#define IFNAMESIZE 256 // be conservative
26
27#include "gettext.h"
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
117 //bool open (); 121 //bool open ();
118 //void close (); 122 //void close ();
119 123
120 const char *interface () { return ifrname; } 124 const char *interface () { return ifrname; }
121 const char *info (); 125 const char *info ();
126 const char *if_up ();
122 127
123 tap_packet *recv (); 128 tap_packet *recv ();
124 void send (tap_packet *pkt); 129 void send (tap_packet *pkt);
125}; 130};
126 131

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines