aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_tun_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-30 12:52:51 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-30 12:52:51 +0000
commit300938a19ff92cc2c1488771aa40633a5e2fd316 (patch)
treea9b62319695097a18e6abb1eed4ffab4640bc402 /src/include/gnunet_tun_lib.h
parent0cccabf5c6afcff54573de1b4ed761085a27310d (diff)
downloadgnunet-300938a19ff92cc2c1488771aa40633a5e2fd316.tar.gz
gnunet-300938a19ff92cc2c1488771aa40633a5e2fd316.zip
-docu
Diffstat (limited to 'src/include/gnunet_tun_lib.h')
-rw-r--r--src/include/gnunet_tun_lib.h76
1 files changed, 74 insertions, 2 deletions
diff --git a/src/include/gnunet_tun_lib.h b/src/include/gnunet_tun_lib.h
index fd5d70a3d..4e824a9f5 100644
--- a/src/include/gnunet_tun_lib.h
+++ b/src/include/gnunet_tun_lib.h
@@ -70,17 +70,52 @@ struct GNUNET_TUN_Layer2PacketHeader
70 */ 70 */
71struct GNUNET_TUN_IPv4Header 71struct GNUNET_TUN_IPv4Header
72{ 72{
73#if __BYTE_ORDER == __LITTLE_ENDIAN
73 unsigned int header_length:4 GNUNET_PACKED; 74 unsigned int header_length:4 GNUNET_PACKED;
74 unsigned int version:4 GNUNET_PACKED; 75 unsigned int version:4 GNUNET_PACKED;
76#elif __BYTE_ORDER == __BIG_ENDIAN
77 unsigned int version:4 GNUNET_PACKED;
78 unsigned int header_length:4 GNUNET_PACKED;
79#endif
75 uint8_t diff_serv; 80 uint8_t diff_serv;
81
82 /**
83 * Length of the packet, including this header.
84 */
76 uint16_t total_length GNUNET_PACKED; 85 uint16_t total_length GNUNET_PACKED;
86
87 /**
88 * Unique random ID for matching up fragments.
89 */
77 uint16_t identification GNUNET_PACKED; 90 uint16_t identification GNUNET_PACKED;
91
78 unsigned int flags:3 GNUNET_PACKED; 92 unsigned int flags:3 GNUNET_PACKED;
93
79 unsigned int fragmentation_offset:13 GNUNET_PACKED; 94 unsigned int fragmentation_offset:13 GNUNET_PACKED;
95
96 /**
97 * How many more hops can this packet be forwarded?
98 */
80 uint8_t ttl; 99 uint8_t ttl;
100
101 /**
102 * L4-protocol, for example, IPPROTO_UDP or IPPROTO_TCP.
103 */
81 uint8_t protocol; 104 uint8_t protocol;
105
106 /**
107 * Checksum.
108 */
82 uint16_t checksum GNUNET_PACKED; 109 uint16_t checksum GNUNET_PACKED;
110
111 /**
112 * Origin of the packet.
113 */
83 struct in_addr source_address GNUNET_PACKED; 114 struct in_addr source_address GNUNET_PACKED;
115
116 /**
117 * Destination of the packet.
118 */
84 struct in_addr destination_address GNUNET_PACKED; 119 struct in_addr destination_address GNUNET_PACKED;
85}; 120};
86 121
@@ -90,26 +125,59 @@ struct GNUNET_TUN_IPv4Header
90 */ 125 */
91struct GNUNET_TUN_IPv6Header 126struct GNUNET_TUN_IPv6Header
92{ 127{
128#if __BYTE_ORDER == __LITTLE_ENDIAN
93 unsigned int traffic_class_h:4 GNUNET_PACKED; 129 unsigned int traffic_class_h:4 GNUNET_PACKED;
94 unsigned int version:4 GNUNET_PACKED; 130 unsigned int version:4 GNUNET_PACKED;
95 unsigned int traffic_class_l:4 GNUNET_PACKED; 131 unsigned int traffic_class_l:4 GNUNET_PACKED;
96 unsigned int flow_label:20 GNUNET_PACKED; 132 unsigned int flow_label:20 GNUNET_PACKED;
133#elif __BYTE_ORDER == __BIG_ENDIAN
134 unsigned int version:4 GNUNET_PACKED;
135 unsigned int traffic_class:8 GNUNET_PACKED;
136 unsigned int flow_label:20 GNUNET_PACKED;
137#endif
138 /**
139 * Length of the payload, excluding this header.
140 */
97 uint16_t payload_length GNUNET_PACKED; 141 uint16_t payload_length GNUNET_PACKED;
142
143 /**
144 * For example, IPPROTO_UDP or IPPROTO_TCP.
145 */
98 uint8_t next_header; 146 uint8_t next_header;
147
148 /**
149 * How many more hops can this packet be forwarded?
150 */
99 uint8_t hop_limit; 151 uint8_t hop_limit;
152
153 /**
154 * Origin of the packet.
155 */
100 struct in6_addr source_address GNUNET_PACKED; 156 struct in6_addr source_address GNUNET_PACKED;
157
158 /**
159 * Destination of the packet.
160 */
101 struct in6_addr destination_address GNUNET_PACKED; 161 struct in6_addr destination_address GNUNET_PACKED;
102}; 162};
103 163
104 164
105/** 165/**
106 * TCP packet header (FIXME: rename!) 166 * TCP packet header.
107 */ 167 */
108struct GNUNET_TUN_TcpHeader 168struct GNUNET_TUN_TcpHeader
109{ 169{
110 uint16_t source_port GNUNET_PACKED; 170 uint16_t source_port GNUNET_PACKED;
111 uint16_t destination_port GNUNET_PACKED; 171 uint16_t destination_port GNUNET_PACKED;
172
173 /**
174 * Sequence number.
175 */
112 uint32_t seq GNUNET_PACKED; 176 uint32_t seq GNUNET_PACKED;
177
178 /**
179 * Acknowledgement number.
180 */
113 uint32_t ack GNUNET_PACKED; 181 uint32_t ack GNUNET_PACKED;
114#if __BYTE_ORDER == __LITTLE_ENDIAN 182#if __BYTE_ORDER == __LITTLE_ENDIAN
115 /** 183 /**
@@ -137,6 +205,9 @@ struct GNUNET_TUN_TcpHeader
137 */ 205 */
138 uint16_t window_size GNUNET_PACKED; 206 uint16_t window_size GNUNET_PACKED;
139 207
208 /**
209 * Checksum.
210 */
140 uint16_t crc GNUNET_PACKED; 211 uint16_t crc GNUNET_PACKED;
141 212
142 /** 213 /**
@@ -147,7 +218,7 @@ struct GNUNET_TUN_TcpHeader
147 218
148 219
149/** 220/**
150 * UDP packet header (FIXME: rename!) 221 * UDP packet header.
151 */ 222 */
152struct GNUNET_TUN_UdpHeader 223struct GNUNET_TUN_UdpHeader
153{ 224{
@@ -187,6 +258,7 @@ struct GNUNET_TUN_DnsHeader
187#define GNUNET_TUN_ICMPTYPE6_ECHO_REQUEST 128 258#define GNUNET_TUN_ICMPTYPE6_ECHO_REQUEST 128
188#define GNUNET_TUN_ICMPTYPE6_ECHO_REPLY 129 259#define GNUNET_TUN_ICMPTYPE6_ECHO_REPLY 129
189 260
261
190/** 262/**
191 * ICMP header. 263 * ICMP header.
192 */ 264 */