diff options
Diffstat (limited to 'src/transport/plugin_transport_udp.h')
-rw-r--r-- | src/transport/plugin_transport_udp.h | 107 |
1 files changed, 77 insertions, 30 deletions
diff --git a/src/transport/plugin_transport_udp.h b/src/transport/plugin_transport_udp.h index 44791668b..3770b3b70 100644 --- a/src/transport/plugin_transport_udp.h +++ b/src/transport/plugin_transport_udp.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) 2010, 2011 Christian Grothoff (and other contributing authors) | 3 | (C) 2010-2014 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -47,6 +47,7 @@ | |||
47 | #define PLUGIN_NAME "udp" | 47 | #define PLUGIN_NAME "udp" |
48 | 48 | ||
49 | #define DEBUG_UDP GNUNET_NO | 49 | #define DEBUG_UDP GNUNET_NO |
50 | |||
50 | #define DEBUG_UDP_BROADCASTING GNUNET_NO | 51 | #define DEBUG_UDP_BROADCASTING GNUNET_NO |
51 | 52 | ||
52 | /** | 53 | /** |
@@ -126,6 +127,8 @@ struct UDPMessage | |||
126 | 127 | ||
127 | struct UDP_MessageWrapper; | 128 | struct UDP_MessageWrapper; |
128 | 129 | ||
130 | struct PrettyPrinterContext; | ||
131 | |||
129 | 132 | ||
130 | /** | 133 | /** |
131 | * Encapsulation of all of the state of the plugin. | 134 | * Encapsulation of all of the state of the plugin. |
@@ -140,7 +143,7 @@ struct Plugin | |||
140 | 143 | ||
141 | /** | 144 | /** |
142 | * Session of peers with whom we are currently connected, | 145 | * Session of peers with whom we are currently connected, |
143 | * map of peer identity to 'struct PeerSession'. | 146 | * map of peer identity to `struct Session *`. |
144 | */ | 147 | */ |
145 | struct GNUNET_CONTAINER_MultiPeerMap *sessions; | 148 | struct GNUNET_CONTAINER_MultiPeerMap *sessions; |
146 | 149 | ||
@@ -150,9 +153,13 @@ struct Plugin | |||
150 | struct GNUNET_CONTAINER_Heap *defrag_ctxs; | 153 | struct GNUNET_CONTAINER_Heap *defrag_ctxs; |
151 | 154 | ||
152 | /** | 155 | /** |
153 | * ID of select task | 156 | * ID of select task for IPv4 |
154 | */ | 157 | */ |
155 | GNUNET_SCHEDULER_TaskIdentifier select_task; | 158 | GNUNET_SCHEDULER_TaskIdentifier select_task; |
159 | |||
160 | /** | ||
161 | * ID of select task for IPv6 | ||
162 | */ | ||
156 | GNUNET_SCHEDULER_TaskIdentifier select_task_v6; | 163 | GNUNET_SCHEDULER_TaskIdentifier select_task_v6; |
157 | 164 | ||
158 | /** | 165 | /** |
@@ -175,12 +182,6 @@ struct Plugin | |||
175 | */ | 182 | */ |
176 | char *bind6_address; | 183 | char *bind6_address; |
177 | 184 | ||
178 | |||
179 | /** | ||
180 | * Bytes currently in buffer | ||
181 | */ | ||
182 | int64_t bytes_in_buffer; | ||
183 | |||
184 | /** | 185 | /** |
185 | * Handle to NAT traversal support. | 186 | * Handle to NAT traversal support. |
186 | */ | 187 | */ |
@@ -196,13 +197,11 @@ struct Plugin | |||
196 | */ | 197 | */ |
197 | struct GNUNET_NETWORK_FDSet *ws_v4; | 198 | struct GNUNET_NETWORK_FDSet *ws_v4; |
198 | 199 | ||
199 | |||
200 | /** | 200 | /** |
201 | * The read socket for IPv4 | 201 | * The read socket for IPv4 |
202 | */ | 202 | */ |
203 | struct GNUNET_NETWORK_Handle *sockv4; | 203 | struct GNUNET_NETWORK_Handle *sockv4; |
204 | 204 | ||
205 | |||
206 | /** | 205 | /** |
207 | * FD Read set | 206 | * FD Read set |
208 | */ | 207 | */ |
@@ -219,20 +218,64 @@ struct Plugin | |||
219 | struct GNUNET_NETWORK_Handle *sockv6; | 218 | struct GNUNET_NETWORK_Handle *sockv6; |
220 | 219 | ||
221 | /** | 220 | /** |
222 | * Beacon broadcasting | 221 | * Tokenizer for inbound IPv6 messages. |
223 | * ------------------- | ||
224 | */ | 222 | */ |
223 | struct GNUNET_SERVER_MessageStreamTokenizer *broadcast_ipv6_mst; | ||
225 | 224 | ||
226 | /** | 225 | /** |
227 | * Broadcast interval | 226 | * Tokenizer for inbound IPv4 messages. |
228 | */ | 227 | */ |
229 | struct GNUNET_TIME_Relative broadcast_interval; | 228 | struct GNUNET_SERVER_MessageStreamTokenizer *broadcast_ipv4_mst; |
230 | 229 | ||
231 | /** | 230 | /** |
232 | * Tokenizer for inbound messages. | 231 | * Head of DLL of broadcast addresses |
233 | */ | 232 | */ |
234 | struct GNUNET_SERVER_MessageStreamTokenizer *broadcast_ipv6_mst; | 233 | struct BroadcastAddress *broadcast_tail; |
235 | struct GNUNET_SERVER_MessageStreamTokenizer *broadcast_ipv4_mst; | 234 | |
235 | /** | ||
236 | * Tail of DLL of broadcast addresses | ||
237 | */ | ||
238 | struct BroadcastAddress *broadcast_head; | ||
239 | |||
240 | /** | ||
241 | * Head of messages in IPv4 queue. | ||
242 | */ | ||
243 | struct UDP_MessageWrapper *ipv4_queue_head; | ||
244 | |||
245 | /** | ||
246 | * Tail of messages in IPv4 queue. | ||
247 | */ | ||
248 | struct UDP_MessageWrapper *ipv4_queue_tail; | ||
249 | |||
250 | /** | ||
251 | * Head of messages in IPv6 queue. | ||
252 | */ | ||
253 | struct UDP_MessageWrapper *ipv6_queue_head; | ||
254 | |||
255 | /** | ||
256 | * Tail of messages in IPv6 queue. | ||
257 | */ | ||
258 | struct UDP_MessageWrapper *ipv6_queue_tail; | ||
259 | |||
260 | /** | ||
261 | * Running pretty printers: head | ||
262 | */ | ||
263 | struct PrettyPrinterContext *ppc_dll_head; | ||
264 | |||
265 | /** | ||
266 | * Running pretty printers: tail | ||
267 | */ | ||
268 | struct PrettyPrinterContext *ppc_dll_tail; | ||
269 | |||
270 | /** | ||
271 | * Function to call about session status changes. | ||
272 | */ | ||
273 | GNUNET_TRANSPORT_SessionInfoCallback sic; | ||
274 | |||
275 | /** | ||
276 | * Closure for @e sic. | ||
277 | */ | ||
278 | void *sic_cls; | ||
236 | 279 | ||
237 | /** | 280 | /** |
238 | * IPv6 multicast address | 281 | * IPv6 multicast address |
@@ -240,28 +283,37 @@ struct Plugin | |||
240 | struct sockaddr_in6 ipv6_multicast_address; | 283 | struct sockaddr_in6 ipv6_multicast_address; |
241 | 284 | ||
242 | /** | 285 | /** |
243 | * DLL of broadcast addresses | 286 | * Broadcast interval |
244 | */ | 287 | */ |
245 | struct BroadcastAddress *broadcast_tail; | 288 | struct GNUNET_TIME_Relative broadcast_interval; |
246 | struct BroadcastAddress *broadcast_head; | 289 | |
290 | /** | ||
291 | * Bytes currently in buffer | ||
292 | */ | ||
293 | int64_t bytes_in_buffer; | ||
247 | 294 | ||
248 | /** | 295 | /** |
249 | * Is IPv6 enabled: GNUNET_YES or GNUNET_NO | 296 | * Address options |
297 | */ | ||
298 | uint32_t myoptions; | ||
299 | |||
300 | /** | ||
301 | * Is IPv6 enabled: #GNUNET_YES or #GNUNET_NO | ||
250 | */ | 302 | */ |
251 | int enable_ipv6; | 303 | int enable_ipv6; |
252 | 304 | ||
253 | /** | 305 | /** |
254 | * Is IPv4 enabled: GNUNET_YES or GNUNET_NO | 306 | * Is IPv4 enabled: #GNUNET_YES or #GNUNET_NO |
255 | */ | 307 | */ |
256 | int enable_ipv4; | 308 | int enable_ipv4; |
257 | 309 | ||
258 | /** | 310 | /** |
259 | * Is broadcasting enabled: GNUNET_YES or GNUNET_NO | 311 | * Is broadcasting enabled: #GNUNET_YES or #GNUNET_NO |
260 | */ | 312 | */ |
261 | int enable_broadcasting; | 313 | int enable_broadcasting; |
262 | 314 | ||
263 | /** | 315 | /** |
264 | * Is receiving broadcasts enabled: GNUNET_YES or GNUNET_NO | 316 | * Is receiving broadcasts enabled: #GNUNET_YES or #GNUNET_NO |
265 | */ | 317 | */ |
266 | int enable_broadcasting_receiving; | 318 | int enable_broadcasting_receiving; |
267 | 319 | ||
@@ -280,11 +332,6 @@ struct Plugin | |||
280 | */ | 332 | */ |
281 | uint16_t aport; | 333 | uint16_t aport; |
282 | 334 | ||
283 | struct UDP_MessageWrapper *ipv4_queue_head; | ||
284 | struct UDP_MessageWrapper *ipv4_queue_tail; | ||
285 | |||
286 | struct UDP_MessageWrapper *ipv6_queue_head; | ||
287 | struct UDP_MessageWrapper *ipv6_queue_tail; | ||
288 | }; | 335 | }; |
289 | 336 | ||
290 | 337 | ||