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