aboutsummaryrefslogtreecommitdiff
path: root/src/core/core.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-11-13 20:37:37 +0000
committerChristian Grothoff <christian@grothoff.org>2010-11-13 20:37:37 +0000
commitdb6c313c75a36bc4a27971d7bd8da3e938c7c02a (patch)
treeea4dac1648edb33ccafb1b12652236261f538abd /src/core/core.h
parent56f7c4934c0d9c18370fdcff5e5a3cd29363d474 (diff)
downloadgnunet-db6c313c75a36bc4a27971d7bd8da3e938c7c02a.tar.gz
gnunet-db6c313c75a36bc4a27971d7bd8da3e938c7c02a.zip
the big core API/protocol change, breaks all testcases using core, since the code is still buggy
Diffstat (limited to 'src/core/core.h')
-rw-r--r--src/core/core.h143
1 files changed, 123 insertions, 20 deletions
diff --git a/src/core/core.h b/src/core/core.h
index 021aa4184..a8d90b81a 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -22,6 +22,17 @@
22 * @file core/core.h 22 * @file core/core.h
23 * @brief common internal definitions for core service 23 * @brief common internal definitions for core service
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 *
26 * TODO:
27 * - bound message queue size
28 * - on disconnect from core, signal disconnect for all peers
29 * and clean up peer records
30 * - create / destroy peer records on connect/disconnect events
31 * - implement iterator API
32 * - implement re-configure API
33 * - check on peer-related events that connection is known
34 * (if not, GNUNET_break + reconnect)
35 * - handle atsi records
25 */ 36 */
26#include "gnunet_bandwidth_lib.h" 37#include "gnunet_bandwidth_lib.h"
27#include "gnunet_crypto_lib.h" 38#include "gnunet_crypto_lib.h"
@@ -112,9 +123,10 @@ struct ConnectNotifyMessage
112 struct GNUNET_MessageHeader header; 123 struct GNUNET_MessageHeader header;
113 124
114 /** 125 /**
115 * Distance to the peer. 126 * Number of ATS key-value pairs that follow this struct
127 * (excluding the 0-terminator).
116 */ 128 */
117 uint32_t distance GNUNET_PACKED; 129 uint32_t ats_count GNUNET_PACKED;
118 130
119 /** 131 /**
120 * Currently observed latency. 132 * Currently observed latency.
@@ -126,6 +138,12 @@ struct ConnectNotifyMessage
126 */ 138 */
127 struct GNUNET_PeerIdentity peer; 139 struct GNUNET_PeerIdentity peer;
128 140
141 /**
142 * First of the ATS information blocks (we must have at least
143 * one due to the 0-termination requirement).
144 */
145 struct GNUNET_TRANSPORT_ATS_Information ats;
146
129}; 147};
130 148
131 149
@@ -141,14 +159,10 @@ struct PeerStatusNotifyMessage
141 struct GNUNET_MessageHeader header; 159 struct GNUNET_MessageHeader header;
142 160
143 /** 161 /**
144 * Distance to the peer. 162 * Number of ATS key-value pairs that follow this struct
145 */ 163 * (excluding the 0-terminator).
146 uint32_t distance GNUNET_PACKED;
147
148 /**
149 * Currently observed latency.
150 */ 164 */
151 struct GNUNET_TIME_RelativeNBO latency; 165 uint32_t ats_count GNUNET_PACKED;
152 166
153 /** 167 /**
154 * When the peer would time out (unless we see activity) 168 * When the peer would time out (unless we see activity)
@@ -170,6 +184,12 @@ struct PeerStatusNotifyMessage
170 */ 184 */
171 struct GNUNET_PeerIdentity peer; 185 struct GNUNET_PeerIdentity peer;
172 186
187 /**
188 * First of the ATS information blocks (we must have at least
189 * one due to the 0-termination requirement).
190 */
191 struct GNUNET_TRANSPORT_ATS_Information ats;
192
173}; 193};
174 194
175 195
@@ -197,7 +217,6 @@ struct DisconnectNotifyMessage
197}; 217};
198 218
199 219
200
201/** 220/**
202 * Message sent by the service to clients to notify them about 221 * Message sent by the service to clients to notify them about
203 * messages being received or transmitted. This overall message is 222 * messages being received or transmitted. This overall message is
@@ -216,9 +235,10 @@ struct NotifyTrafficMessage
216 struct GNUNET_MessageHeader header; 235 struct GNUNET_MessageHeader header;
217 236
218 /** 237 /**
219 * Distance to the peer. 238 * Number of ATS key-value pairs that follow this struct
239 * (excluding the 0-terminator).
220 */ 240 */
221 uint32_t distance GNUNET_PACKED; 241 uint32_t ats_count GNUNET_PACKED;
222 242
223 /** 243 /**
224 * Currently observed latency. 244 * Currently observed latency.
@@ -230,6 +250,12 @@ struct NotifyTrafficMessage
230 */ 250 */
231 struct GNUNET_PeerIdentity peer; 251 struct GNUNET_PeerIdentity peer;
232 252
253 /**
254 * First of the ATS information blocks (we must have at least
255 * one due to the 0-termination requirement).
256 */
257 struct GNUNET_TRANSPORT_ATS_Information ats;
258
233}; 259};
234 260
235 261
@@ -245,9 +271,9 @@ struct RequestInfoMessage
245 struct GNUNET_MessageHeader header; 271 struct GNUNET_MessageHeader header;
246 272
247 /** 273 /**
248 * Always zero. 274 * Unique request ID.
249 */ 275 */
250 uint32_t reserved GNUNET_PACKED; 276 uint32_t rim_id GNUNET_PACKED;
251 277
252 /** 278 /**
253 * Limit the number of bytes of outbound traffic to this 279 * Limit the number of bytes of outbound traffic to this
@@ -296,10 +322,9 @@ struct ConfigurationInfoMessage
296 int32_t reserved_amount GNUNET_PACKED; 322 int32_t reserved_amount GNUNET_PACKED;
297 323
298 /** 324 /**
299 * Available bandwidth in for this peer. 325 * Unique request ID.
300 * 0 if we have been disconnected.
301 */ 326 */
302 struct GNUNET_BANDWIDTH_Value32NBO bw_in; 327 uint32_t rim_id GNUNET_PACKED;
303 328
304 /** 329 /**
305 * Available bandwidth out for this peer, 330 * Available bandwidth out for this peer,
@@ -314,7 +339,85 @@ struct ConfigurationInfoMessage
314 uint64_t preference; 339 uint64_t preference;
315 340
316 /** 341 /**
317 * Identity of the receiver or sender. 342 * Identity of the peer.
343 */
344 struct GNUNET_PeerIdentity peer;
345
346};
347
348
349/**
350 * Client notifying core about the maximum-priority
351 * message it has in the queue for a particular target.
352 */
353struct SendMessageRequest
354{
355 /**
356 * Header with type GNUNET_MESSAGE_TYPE_CORE_SEND_REQUEST
357 */
358 struct GNUNET_MessageHeader header;
359
360 /**
361 * How important is this message?
362 */
363 uint32_t priority GNUNET_PACKED;
364
365 /**
366 * By what time would the sender really like to see this
367 * message transmitted?
368 */
369 struct GNUNET_TIME_AbsoluteNBO deadline;
370
371 /**
372 * Identity of the intended target.
373 */
374 struct GNUNET_PeerIdentity peer;
375
376 /**
377 * How large is the client's message queue for this peer?
378 */
379 uint32_t queue_size GNUNET_PACKED;
380
381 /**
382 * How large is the message?
383 */
384 uint16_t size GNUNET_PACKED;
385
386 /**
387 * Counter for this peer to match SMRs to replies.
388 */
389 uint16_t smr_id GNUNET_PACKED;
390
391};
392
393
394/**
395 * Core notifying client that it is allowed to now
396 * transmit a message to the given target
397 * (response to GNUNET_MESSAGE_TYPE_CORE_SEND_REQUEST).
398 */
399struct SendMessageReady
400{
401 /**
402 * Header with type GNUNET_MESSAGE_TYPE_CORE_SEND_READY
403 */
404 struct GNUNET_MessageHeader header;
405
406 /**
407 * How many bytes are allowed for transmission?
408 * Guaranteed to be at least as big as the requested size,
409 * or ZERO if the request is rejected (will timeout,
410 * peer disconnected, queue full, etc.).
411 */
412 uint16_t size GNUNET_PACKED;
413
414 /**
415 * smr_id from the request.
416 */
417 uint16_t smr_id GNUNET_PACKED;
418
419 /**
420 * Identity of the intended target.
318 */ 421 */
319 struct GNUNET_PeerIdentity peer; 422 struct GNUNET_PeerIdentity peer;
320 423
@@ -322,8 +425,8 @@ struct ConfigurationInfoMessage
322 425
323 426
324/** 427/**
325 * Client asking core to transmit a particular message to 428 * Client asking core to transmit a particular message to a particular
326 * a particular target. 429 * target (responsde to GNUNET_MESSAGE_TYPE_CORE_SEND_READY).
327 */ 430 */
328struct SendMessage 431struct SendMessage
329{ 432{