diff options
author | t3sserakt <t3ss@posteo.de> | 2019-07-21 20:18:24 +0200 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2019-07-21 20:18:24 +0200 |
commit | f096bdce8eaeaabc42f2a015bf29c422b3d25719 (patch) | |
tree | 694c140bd741f7b1c24b5e55e8644002ae53cae4 /src/include | |
parent | dfeef02bf7882cdfb952430cfbdb9793ecd780e2 (diff) | |
parent | 160edc4127f1698cca25d5708157ea3187421596 (diff) | |
download | gnunet-f096bdce8eaeaabc42f2a015bf29c422b3d25719.tar.gz gnunet-f096bdce8eaeaabc42f2a015bf29c422b3d25719.zip |
Merge branch 'cadet-new-options'
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_cadet_service.h | 58 | ||||
-rw-r--r-- | src/include/gnunet_mq_lib.h | 20 |
2 files changed, 30 insertions, 48 deletions
diff --git a/src/include/gnunet_cadet_service.h b/src/include/gnunet_cadet_service.h index a11c5f3cb..ba4d60eb8 100644 --- a/src/include/gnunet_cadet_service.h +++ b/src/include/gnunet_cadet_service.h | |||
@@ -93,49 +93,6 @@ struct GNUNET_CADET_ChannelTunnelNumber | |||
93 | uint32_t cn GNUNET_PACKED; | 93 | uint32_t cn GNUNET_PACKED; |
94 | }; | 94 | }; |
95 | 95 | ||
96 | |||
97 | /** | ||
98 | * Channel options. Second line indicates filed in the | ||
99 | * CadetChannelInfo union carrying the answer. | ||
100 | * | ||
101 | * @deprecated we should replace channel options with per-envelope | ||
102 | * options, and then re-use the options from `enum GNUNET_MQ_PriorityPreferences`. | ||
103 | */ | ||
104 | enum GNUNET_CADET_ChannelOption | ||
105 | { | ||
106 | /** | ||
107 | * Default options: unreliable, default buffering, not out of order. | ||
108 | */ | ||
109 | GNUNET_CADET_OPTION_DEFAULT = 0x0, | ||
110 | |||
111 | /** | ||
112 | * Disable buffering on intermediate nodes (for minimum latency). | ||
113 | * Yes/No. | ||
114 | */ | ||
115 | GNUNET_CADET_OPTION_NOBUFFER = 0x1, | ||
116 | |||
117 | /** | ||
118 | * Enable channel reliability, lost messages will be retransmitted. | ||
119 | * Yes/No. | ||
120 | */ | ||
121 | GNUNET_CADET_OPTION_RELIABLE = 0x2, | ||
122 | |||
123 | /** | ||
124 | * Enable out of order delivery of messages. | ||
125 | * Set bit for out-of-order delivery. | ||
126 | */ | ||
127 | GNUNET_CADET_OPTION_OUT_OF_ORDER = 0x4, | ||
128 | |||
129 | /** | ||
130 | * Who is the peer at the other end of the channel. | ||
131 | * Only for use in @c GNUNET_CADET_channel_get_info | ||
132 | * struct GNUNET_PeerIdentity *peer | ||
133 | */ | ||
134 | GNUNET_CADET_OPTION_PEER = 0x8 | ||
135 | |||
136 | }; | ||
137 | |||
138 | |||
139 | /** | 96 | /** |
140 | * Method called whenever a peer connects to a port in MQ-based CADET. | 97 | * Method called whenever a peer connects to a port in MQ-based CADET. |
141 | * | 98 | * |
@@ -259,7 +216,6 @@ GNUNET_CADET_close_port (struct GNUNET_CADET_Port *p); | |||
259 | * - Each message type callback in @a handlers | 216 | * - Each message type callback in @a handlers |
260 | * @param destination Peer identity the channel should go to. | 217 | * @param destination Peer identity the channel should go to. |
261 | * @param port Identification of the destination port. | 218 | * @param port Identification of the destination port. |
262 | * @param options CadetOption flag field, with all desired option bits set to 1. | ||
263 | * @param window_changes Function called when the transmit window size changes. | 219 | * @param window_changes Function called when the transmit window size changes. |
264 | * Can be NULL if this data is of no interest. | 220 | * Can be NULL if this data is of no interest. |
265 | * TODO Not yet implemented. | 221 | * TODO Not yet implemented. |
@@ -272,7 +228,6 @@ GNUNET_CADET_channel_create (struct GNUNET_CADET_Handle *h, | |||
272 | void *channel_cls, | 228 | void *channel_cls, |
273 | const struct GNUNET_PeerIdentity *destination, | 229 | const struct GNUNET_PeerIdentity *destination, |
274 | const struct GNUNET_HashCode *port, | 230 | const struct GNUNET_HashCode *port, |
275 | enum GNUNET_CADET_ChannelOption options, | ||
276 | GNUNET_CADET_WindowSizeEventHandler window_changes, | 231 | GNUNET_CADET_WindowSizeEventHandler window_changes, |
277 | GNUNET_CADET_DisconnectEventHandler disconnects, | 232 | GNUNET_CADET_DisconnectEventHandler disconnects, |
278 | const struct GNUNET_MQ_MessageHandler *handlers); | 233 | const struct GNUNET_MQ_MessageHandler *handlers); |
@@ -324,6 +279,16 @@ GNUNET_CADET_receive_done (struct GNUNET_CADET_Channel *channel); | |||
324 | const struct GNUNET_HashCode * | 279 | const struct GNUNET_HashCode * |
325 | GC_u2h (uint32_t port); | 280 | GC_u2h (uint32_t port); |
326 | 281 | ||
282 | enum GNUNET_CADET_ChannelInfoOption | ||
283 | { | ||
284 | /** | ||
285 | * Who is the peer at the other end of the channel. | ||
286 | * Only for use in @c GNUNET_CADET_channel_get_info | ||
287 | * struct GNUNET_PeerIdentity *peer | ||
288 | */ | ||
289 | GNUNET_CADET_OPTION_PEER = 0x0 | ||
290 | |||
291 | }; | ||
327 | 292 | ||
328 | /** | 293 | /** |
329 | * Union to retrieve info about a channel. | 294 | * Union to retrieve info about a channel. |
@@ -347,13 +312,12 @@ union GNUNET_CADET_ChannelInfo | |||
347 | * Get information about a channel. | 312 | * Get information about a channel. |
348 | * | 313 | * |
349 | * @param channel Channel handle. | 314 | * @param channel Channel handle. |
350 | * @param option Query type GNUNET_CADET_OPTION_* | ||
351 | * @param ... dependant on option, currently not used | 315 | * @param ... dependant on option, currently not used |
352 | * @return Union with an answer to the query. | 316 | * @return Union with an answer to the query. |
353 | */ | 317 | */ |
354 | const union GNUNET_CADET_ChannelInfo * | 318 | const union GNUNET_CADET_ChannelInfo * |
355 | GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel, | 319 | GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel, |
356 | enum GNUNET_CADET_ChannelOption option, | 320 | enum GNUNET_CADET_ChannelInfoOption option, |
357 | ...); | 321 | ...); |
358 | 322 | ||
359 | 323 | ||
diff --git a/src/include/gnunet_mq_lib.h b/src/include/gnunet_mq_lib.h index 81100d7d8..f3073d54b 100644 --- a/src/include/gnunet_mq_lib.h +++ b/src/include/gnunet_mq_lib.h | |||
@@ -296,7 +296,7 @@ enum GNUNET_MQ_PriorityPreferences | |||
296 | /** | 296 | /** |
297 | * Flag to indicate that out-of-order delivery is OK. | 297 | * Flag to indicate that out-of-order delivery is OK. |
298 | */ | 298 | */ |
299 | GNUNET_MQ_PREF_OUT_OF_ORDER = 256 | 299 | GNUNET_MQ_PREF_OUT_OF_ORDER = 256, |
300 | 300 | ||
301 | }; | 301 | }; |
302 | 302 | ||
@@ -386,6 +386,24 @@ typedef void (*GNUNET_MQ_ErrorHandler) (void *cls, enum GNUNET_MQ_Error error); | |||
386 | * @param[in|out] env element to insert at the tail | 386 | * @param[in|out] env element to insert at the tail |
387 | */ | 387 | */ |
388 | void | 388 | void |
389 | GNUNET_MQ_dll_insert_head (struct GNUNET_MQ_Envelope **env_head, | ||
390 | struct GNUNET_MQ_Envelope **env_tail, | ||
391 | struct GNUNET_MQ_Envelope *env); | ||
392 | |||
393 | |||
394 | /** | ||
395 | * Insert @a env into the envelope DLL starting at @a env_head | ||
396 | * Note that @a env must not be in any MQ while this function | ||
397 | * is used with DLLs defined outside of the MQ module. This | ||
398 | * is just in case some application needs to also manage a | ||
399 | * FIFO of envelopes independent of MQ itself and wants to | ||
400 | * re-use the pointers internal to @a env. Use with caution. | ||
401 | * | ||
402 | * @param[in|out] env_head of envelope DLL | ||
403 | * @param[in|out] env_tail tail of envelope DLL | ||
404 | * @param[in|out] env element to insert at the tail | ||
405 | */ | ||
406 | void | ||
389 | GNUNET_MQ_dll_insert_tail (struct GNUNET_MQ_Envelope **env_head, | 407 | GNUNET_MQ_dll_insert_tail (struct GNUNET_MQ_Envelope **env_head, |
390 | struct GNUNET_MQ_Envelope **env_tail, | 408 | struct GNUNET_MQ_Envelope **env_tail, |
391 | struct GNUNET_MQ_Envelope *env); | 409 | struct GNUNET_MQ_Envelope *env); |