diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-30 12:44:32 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-30 12:44:32 +0000 |
commit | 0cccabf5c6afcff54573de1b4ed761085a27310d (patch) | |
tree | b64756aa7ace520419f102c50f6dbeb771040463 /src/include/gnunet_tun_lib.h | |
parent | 9ff99f23db620008bc3525f798bc395915c2e68b (diff) | |
download | gnunet-0cccabf5c6afcff54573de1b4ed761085a27310d.tar.gz gnunet-0cccabf5c6afcff54573de1b4ed761085a27310d.zip |
-renaming some fields, fixing byte order issues
Diffstat (limited to 'src/include/gnunet_tun_lib.h')
-rw-r--r-- | src/include/gnunet_tun_lib.h | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/src/include/gnunet_tun_lib.h b/src/include/gnunet_tun_lib.h index 61eb86389..fd5d70a3d 100644 --- a/src/include/gnunet_tun_lib.h +++ b/src/include/gnunet_tun_lib.h | |||
@@ -70,13 +70,13 @@ struct GNUNET_TUN_Layer2PacketHeader | |||
70 | */ | 70 | */ |
71 | struct GNUNET_TUN_IPv4Header | 71 | struct GNUNET_TUN_IPv4Header |
72 | { | 72 | { |
73 | unsigned header_length:4 GNUNET_PACKED; | 73 | unsigned int header_length:4 GNUNET_PACKED; |
74 | unsigned version:4 GNUNET_PACKED; | 74 | unsigned int version:4 GNUNET_PACKED; |
75 | uint8_t diff_serv; | 75 | uint8_t diff_serv; |
76 | uint16_t total_length GNUNET_PACKED; | 76 | uint16_t total_length GNUNET_PACKED; |
77 | uint16_t identification GNUNET_PACKED; | 77 | uint16_t identification GNUNET_PACKED; |
78 | unsigned flags:3 GNUNET_PACKED; | 78 | unsigned int flags:3 GNUNET_PACKED; |
79 | unsigned fragmentation_offset:13 GNUNET_PACKED; | 79 | unsigned int fragmentation_offset:13 GNUNET_PACKED; |
80 | uint8_t ttl; | 80 | uint8_t ttl; |
81 | uint8_t protocol; | 81 | uint8_t protocol; |
82 | uint16_t checksum GNUNET_PACKED; | 82 | uint16_t checksum GNUNET_PACKED; |
@@ -90,10 +90,10 @@ struct GNUNET_TUN_IPv4Header | |||
90 | */ | 90 | */ |
91 | struct GNUNET_TUN_IPv6Header | 91 | struct GNUNET_TUN_IPv6Header |
92 | { | 92 | { |
93 | unsigned traffic_class_h:4 GNUNET_PACKED; | 93 | unsigned int traffic_class_h:4 GNUNET_PACKED; |
94 | unsigned version:4 GNUNET_PACKED; | 94 | unsigned int version:4 GNUNET_PACKED; |
95 | unsigned traffic_class_l:4 GNUNET_PACKED; | 95 | unsigned int traffic_class_l:4 GNUNET_PACKED; |
96 | unsigned flow_label:20 GNUNET_PACKED; | 96 | unsigned int flow_label:20 GNUNET_PACKED; |
97 | uint16_t payload_length GNUNET_PACKED; | 97 | uint16_t payload_length GNUNET_PACKED; |
98 | uint8_t next_header; | 98 | uint8_t next_header; |
99 | uint8_t hop_limit; | 99 | uint8_t hop_limit; |
@@ -107,28 +107,42 @@ struct GNUNET_TUN_IPv6Header | |||
107 | */ | 107 | */ |
108 | struct GNUNET_TUN_TcpHeader | 108 | struct GNUNET_TUN_TcpHeader |
109 | { | 109 | { |
110 | unsigned spt:16 GNUNET_PACKED; | 110 | uint16_t source_port GNUNET_PACKED; |
111 | unsigned dpt:16 GNUNET_PACKED; | 111 | uint16_t destination_port GNUNET_PACKED; |
112 | unsigned seq:32 GNUNET_PACKED; | 112 | uint32_t seq GNUNET_PACKED; |
113 | unsigned ack:32 GNUNET_PACKED; | 113 | uint32_t ack GNUNET_PACKED; |
114 | #if __BYTE_ORDER == __LITTLE_ENDIAN | ||
114 | /** | 115 | /** |
115 | * Reserved. | 116 | * Reserved. |
116 | */ | 117 | */ |
117 | unsigned rsv:4 GNUNET_PACKED; | 118 | unsigned int reserved : 4 GNUNET_PACKED; |
118 | /** | 119 | /** |
119 | * Number of 32-bit words in TCP header. | 120 | * Number of 32-bit words in TCP header. |
120 | */ | 121 | */ |
121 | unsigned off:4 GNUNET_PACKED; | 122 | unsigned int off : 4 GNUNET_PACKED; |
122 | unsigned flg:8 GNUNET_PACKED; | 123 | #elif __BYTE_ORDER == __BIG_ENDIAN |
124 | /** | ||
125 | * Number of 32-bit words in TCP header. | ||
126 | */ | ||
127 | unsigned int off : 4 GNUNET_PACKED; | ||
128 | /** | ||
129 | * Reserved. | ||
130 | */ | ||
131 | unsigned int reserved : 4 GNUNET_PACKED; | ||
132 | #endif | ||
133 | uint8_t flags; | ||
134 | |||
123 | /** | 135 | /** |
124 | * Window size. | 136 | * Window size. |
125 | */ | 137 | */ |
126 | unsigned wsz:16 GNUNET_PACKED; | 138 | uint16_t window_size GNUNET_PACKED; |
127 | unsigned crc:16 GNUNET_PACKED; | 139 | |
140 | uint16_t crc GNUNET_PACKED; | ||
141 | |||
128 | /** | 142 | /** |
129 | * Urgent pointer. | 143 | * Urgent pointer. |
130 | */ | 144 | */ |
131 | unsigned urg:16 GNUNET_PACKED; | 145 | uint16_t urgent_pointer GNUNET_PACKED; |
132 | }; | 146 | }; |
133 | 147 | ||
134 | 148 | ||
@@ -137,8 +151,8 @@ struct GNUNET_TUN_TcpHeader | |||
137 | */ | 151 | */ |
138 | struct GNUNET_TUN_UdpHeader | 152 | struct GNUNET_TUN_UdpHeader |
139 | { | 153 | { |
140 | uint16_t spt GNUNET_PACKED; | 154 | uint16_t source_port GNUNET_PACKED; |
141 | uint16_t dpt GNUNET_PACKED; | 155 | uint16_t destination_port GNUNET_PACKED; |
142 | uint16_t len GNUNET_PACKED; | 156 | uint16_t len GNUNET_PACKED; |
143 | uint16_t crc GNUNET_PACKED; | 157 | uint16_t crc GNUNET_PACKED; |
144 | }; | 158 | }; |