1 | /* |
1 | /* |
2 | device.h -- generic header for device.c |
2 | device.h -- generic header for device.c |
|
|
3 | Copyright (C) 2003 Marc Lehmann <pcg@goof.com> |
3 | |
4 | |
4 | This program is free software; you can redistribute it and/or modify |
5 | This program is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by |
6 | it under the terms of the GNU General Public License as published by |
6 | the Free Software Foundation; either version 2 of the License, or |
7 | the Free Software Foundation; either version 2 of the License, or |
7 | (at your option) any later version. |
8 | (at your option) any later version. |
… | |
… | |
22 | #define IFNAMESIZE 256 // be conservative |
23 | #define IFNAMESIZE 256 // be conservative |
23 | |
24 | |
24 | #include "gettext.h" |
25 | #include "gettext.h" |
25 | |
26 | |
26 | #include "global.h" |
27 | #include "global.h" |
|
|
28 | #include "util.h" |
27 | |
29 | |
28 | struct net_packet { |
30 | struct net_packet { |
29 | u32 len; // actually u16, but padding... |
31 | u32 len; // actually u16, but padding... |
30 | |
32 | |
31 | u8 &operator[] (u16 offset) const; |
33 | u8 &operator[] (u16 offset) const; |
… | |
… | |
84 | u8 &net_packet::operator[] (u16 offset) const |
86 | u8 &net_packet::operator[] (u16 offset) const |
85 | { |
87 | { |
86 | return ((data_packet *)this)->data_[offset]; |
88 | return ((data_packet *)this)->data_[offset]; |
87 | } |
89 | } |
88 | |
90 | |
89 | typedef u8 mac[6]; |
|
|
90 | |
|
|
91 | struct tap_packet : net_packet { |
91 | struct tap_packet : net_packet { |
92 | mac dst; |
92 | mac dst; |
93 | mac src; |
93 | mac src; |
94 | u8 data[MAXSIZE - 12]; |
94 | u8 data[MAXSIZE - 12]; |
95 | }; |
95 | }; |