diff options
Diffstat (limited to 'src/cadet/cadet.h')
-rw-r--r-- | src/cadet/cadet.h | 65 |
1 files changed, 39 insertions, 26 deletions
diff --git a/src/cadet/cadet.h b/src/cadet/cadet.h index 9b2050e67..29400e39f 100644 --- a/src/cadet/cadet.h +++ b/src/cadet/cadet.h | |||
@@ -35,18 +35,18 @@ extern "C" { | |||
35 | 35 | ||
36 | #include <stdint.h> | 36 | #include <stdint.h> |
37 | 37 | ||
38 | #if !defined(GNUNET_CULL_LOGGING) | 38 | #if ! defined(GNUNET_CULL_LOGGING) |
39 | #define CADET_TIMING_START \ | 39 | #define CADET_TIMING_START \ |
40 | struct GNUNET_TIME_Absolute __timestamp; \ | 40 | struct GNUNET_TIME_Absolute __timestamp; \ |
41 | __timestamp = GNUNET_TIME_absolute_get() | 41 | __timestamp = GNUNET_TIME_absolute_get () |
42 | 42 | ||
43 | #define CADET_TIMING_END \ | 43 | #define CADET_TIMING_END \ |
44 | struct GNUNET_TIME_Relative __duration; \ | 44 | struct GNUNET_TIME_Relative __duration; \ |
45 | __duration = GNUNET_TIME_absolute_get_duration(__timestamp); \ | 45 | __duration = GNUNET_TIME_absolute_get_duration (__timestamp); \ |
46 | LOG(GNUNET_ERROR_TYPE_INFO, \ | 46 | LOG (GNUNET_ERROR_TYPE_INFO, \ |
47 | " %s duration %s\n", \ | 47 | " %s duration %s\n", \ |
48 | __FUNCTION__, \ | 48 | __FUNCTION__, \ |
49 | GNUNET_STRINGS_relative_time_to_string(__duration, GNUNET_YES)); | 49 | GNUNET_STRINGS_relative_time_to_string (__duration, GNUNET_YES)); |
50 | #else | 50 | #else |
51 | #define CADET_TIMING_START | 51 | #define CADET_TIMING_START |
52 | #define CADET_TIMING_END | 52 | #define CADET_TIMING_END |
@@ -99,7 +99,8 @@ GNUNET_NETWORK_STRUCT_BEGIN | |||
99 | /** | 99 | /** |
100 | * Number uniquely identifying a channel of a client. | 100 | * Number uniquely identifying a channel of a client. |
101 | */ | 101 | */ |
102 | struct GNUNET_CADET_ClientChannelNumber { | 102 | struct GNUNET_CADET_ClientChannelNumber |
103 | { | ||
103 | /** | 104 | /** |
104 | * Values for channel numbering. | 105 | * Values for channel numbering. |
105 | * Local channel numbers given by the service (incoming) are | 106 | * Local channel numbers given by the service (incoming) are |
@@ -114,7 +115,8 @@ struct GNUNET_CADET_ClientChannelNumber { | |||
114 | /** | 115 | /** |
115 | * Message for a client to create and destroy channels. | 116 | * Message for a client to create and destroy channels. |
116 | */ | 117 | */ |
117 | struct GNUNET_CADET_PortMessage { | 118 | struct GNUNET_CADET_PortMessage |
119 | { | ||
118 | /** | 120 | /** |
119 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN | 121 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN |
120 | * or #GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE | 122 | * or #GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE |
@@ -133,7 +135,8 @@ struct GNUNET_CADET_PortMessage { | |||
133 | /** | 135 | /** |
134 | * Message for a client to create channels. | 136 | * Message for a client to create channels. |
135 | */ | 137 | */ |
136 | struct GNUNET_CADET_LocalChannelCreateMessage { | 138 | struct GNUNET_CADET_LocalChannelCreateMessage |
139 | { | ||
137 | /** | 140 | /** |
138 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_CREATE | 141 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_CREATE |
139 | * | 142 | * |
@@ -166,7 +169,8 @@ struct GNUNET_CADET_LocalChannelCreateMessage { | |||
166 | /** | 169 | /** |
167 | * Message for or to a client to destroy tunnel. | 170 | * Message for or to a client to destroy tunnel. |
168 | */ | 171 | */ |
169 | struct GNUNET_CADET_LocalChannelDestroyMessage { | 172 | struct GNUNET_CADET_LocalChannelDestroyMessage |
173 | { | ||
170 | /** | 174 | /** |
171 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_DESTROY | 175 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_DESTROY |
172 | */ | 176 | */ |
@@ -182,7 +186,8 @@ struct GNUNET_CADET_LocalChannelDestroyMessage { | |||
182 | /** | 186 | /** |
183 | * Message for cadet data traffic. | 187 | * Message for cadet data traffic. |
184 | */ | 188 | */ |
185 | struct GNUNET_CADET_LocalData { | 189 | struct GNUNET_CADET_LocalData |
190 | { | ||
186 | /** | 191 | /** |
187 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA | 192 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA |
188 | */ | 193 | */ |
@@ -209,7 +214,8 @@ struct GNUNET_CADET_LocalData { | |||
209 | * Message to allow the client send more data to the service | 214 | * Message to allow the client send more data to the service |
210 | * (always service -> client). | 215 | * (always service -> client). |
211 | */ | 216 | */ |
212 | struct GNUNET_CADET_LocalAck { | 217 | struct GNUNET_CADET_LocalAck |
218 | { | ||
213 | /** | 219 | /** |
214 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK | 220 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK |
215 | */ | 221 | */ |
@@ -227,7 +233,8 @@ struct GNUNET_CADET_LocalAck { | |||
227 | * | 233 | * |
228 | * TODO: split into two messages! | 234 | * TODO: split into two messages! |
229 | */ | 235 | */ |
230 | struct GNUNET_CADET_LocalInfo { | 236 | struct GNUNET_CADET_LocalInfo |
237 | { | ||
231 | /** | 238 | /** |
232 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL or | 239 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL or |
233 | * #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER | 240 | * #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER |
@@ -249,7 +256,8 @@ struct GNUNET_CADET_LocalInfo { | |||
249 | /** | 256 | /** |
250 | * Message to inform the client about channels in the service. | 257 | * Message to inform the client about channels in the service. |
251 | */ | 258 | */ |
252 | struct GNUNET_CADET_RequestPathInfoMessage { | 259 | struct GNUNET_CADET_RequestPathInfoMessage |
260 | { | ||
253 | /** | 261 | /** |
254 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PATH | 262 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PATH |
255 | */ | 263 | */ |
@@ -270,7 +278,8 @@ struct GNUNET_CADET_RequestPathInfoMessage { | |||
270 | /** | 278 | /** |
271 | * Message to inform the client about channels in the service. | 279 | * Message to inform the client about channels in the service. |
272 | */ | 280 | */ |
273 | struct GNUNET_CADET_ChannelInfoMessage { | 281 | struct GNUNET_CADET_ChannelInfoMessage |
282 | { | ||
274 | /** | 283 | /** |
275 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL. | 284 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL. |
276 | */ | 285 | */ |
@@ -293,7 +302,8 @@ struct GNUNET_CADET_ChannelInfoMessage { | |||
293 | /** | 302 | /** |
294 | * Message to as the service about information on a channel. | 303 | * Message to as the service about information on a channel. |
295 | */ | 304 | */ |
296 | struct GNUNET_CADET_RequestChannelInfoMessage { | 305 | struct GNUNET_CADET_RequestChannelInfoMessage |
306 | { | ||
297 | /** | 307 | /** |
298 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_CHANNEL. | 308 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_CHANNEL. |
299 | */ | 309 | */ |
@@ -309,7 +319,8 @@ struct GNUNET_CADET_RequestChannelInfoMessage { | |||
309 | /** | 319 | /** |
310 | * Message to inform the client about one of the paths known to the service. | 320 | * Message to inform the client about one of the paths known to the service. |
311 | */ | 321 | */ |
312 | struct GNUNET_CADET_LocalInfoPath { | 322 | struct GNUNET_CADET_LocalInfoPath |
323 | { | ||
313 | /** | 324 | /** |
314 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PATH. | 325 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PATH. |
315 | */ | 326 | */ |
@@ -325,7 +336,8 @@ struct GNUNET_CADET_LocalInfoPath { | |||
325 | /** | 336 | /** |
326 | * Message to inform the client about one of the peers in the service. | 337 | * Message to inform the client about one of the peers in the service. |
327 | */ | 338 | */ |
328 | struct GNUNET_CADET_LocalInfoPeers { | 339 | struct GNUNET_CADET_LocalInfoPeers |
340 | { | ||
329 | /** | 341 | /** |
330 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS | 342 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS |
331 | */ | 343 | */ |
@@ -358,7 +370,8 @@ struct GNUNET_CADET_LocalInfoPeers { | |||
358 | * | 370 | * |
359 | * TODO: split into two messages! | 371 | * TODO: split into two messages! |
360 | */ | 372 | */ |
361 | struct GNUNET_CADET_LocalInfoTunnel { | 373 | struct GNUNET_CADET_LocalInfoTunnel |
374 | { | ||
362 | /** | 375 | /** |
363 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL | 376 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL |
364 | * or #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS | 377 | * or #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS |
@@ -406,7 +419,7 @@ GNUNET_NETWORK_STRUCT_END | |||
406 | * @return String representing FWD or BCK. | 419 | * @return String representing FWD or BCK. |
407 | */ | 420 | */ |
408 | char * | 421 | char * |
409 | GC_f2s(int fwd); | 422 | GC_f2s (int fwd); |
410 | 423 | ||
411 | 424 | ||
412 | /** | 425 | /** |
@@ -418,7 +431,7 @@ GC_f2s(int fwd); | |||
418 | * @return True if bigger (arg1) has a higher value than smaller (arg 2). | 431 | * @return True if bigger (arg1) has a higher value than smaller (arg 2). |
419 | */ | 432 | */ |
420 | int | 433 | int |
421 | GC_is_pid_bigger(uint32_t bigger, uint32_t smaller); | 434 | GC_is_pid_bigger (uint32_t bigger, uint32_t smaller); |
422 | 435 | ||
423 | 436 | ||
424 | /** | 437 | /** |
@@ -430,7 +443,7 @@ GC_is_pid_bigger(uint32_t bigger, uint32_t smaller); | |||
430 | * @return Highest ACK value from the two. | 443 | * @return Highest ACK value from the two. |
431 | */ | 444 | */ |
432 | uint32_t | 445 | uint32_t |
433 | GC_max_pid(uint32_t a, uint32_t b); | 446 | GC_max_pid (uint32_t a, uint32_t b); |
434 | 447 | ||
435 | 448 | ||
436 | /** | 449 | /** |
@@ -442,7 +455,7 @@ GC_max_pid(uint32_t a, uint32_t b); | |||
442 | * @return Lowest ACK value from the two. | 455 | * @return Lowest ACK value from the two. |
443 | */ | 456 | */ |
444 | uint32_t | 457 | uint32_t |
445 | GC_min_pid(uint32_t a, uint32_t b); | 458 | GC_min_pid (uint32_t a, uint32_t b); |
446 | 459 | ||
447 | 460 | ||
448 | /** | 461 | /** |
@@ -455,7 +468,7 @@ GC_min_pid(uint32_t a, uint32_t b); | |||
455 | * @return The size of the output. | 468 | * @return The size of the output. |
456 | */ | 469 | */ |
457 | size_t | 470 | size_t |
458 | GC_bin2s(void *bin, unsigned int len, char **output); | 471 | GC_bin2s (void *bin, unsigned int len, char **output); |
459 | 472 | ||
460 | 473 | ||
461 | /** | 474 | /** |
@@ -469,7 +482,7 @@ GC_bin2s(void *bin, unsigned int len, char **output); | |||
469 | * @return Human readable string description. | 482 | * @return Human readable string description. |
470 | */ | 483 | */ |
471 | const char * | 484 | const char * |
472 | GC_m2s(uint16_t m); | 485 | GC_m2s (uint16_t m); |
473 | 486 | ||
474 | #if 0 /* keep Emacsens' auto-indent happy */ | 487 | #if 0 /* keep Emacsens' auto-indent happy */ |
475 | { | 488 | { |