aboutsummaryrefslogtreecommitdiff
path: root/src/core/core.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/core.h')
-rw-r--r--src/core/core.h328
1 files changed, 0 insertions, 328 deletions
diff --git a/src/core/core.h b/src/core/core.h
deleted file mode 100644
index 4d8619a29..000000000
--- a/src/core/core.h
+++ /dev/null
@@ -1,328 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2009-2014 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file core/core.h
23 * @brief common internal definitions for core service
24 * @author Christian Grothoff
25 */
26#ifndef CORE_H
27#define CORE_H
28
29#include "gnunet_bandwidth_lib.h"
30#include "gnunet_transport_service.h"
31#include "gnunet_crypto_lib.h"
32#include "gnunet_time_lib.h"
33
34/**
35 * General core debugging.
36 */
37#define DEBUG_CORE GNUNET_EXTRA_LOGGING
38
39/**
40 * Definition of bits in the InitMessage's options field that specify
41 * which events this client cares about. Note that inbound messages
42 * for handlers that were specifically registered are always
43 * transmitted to the client.
44 */
45#define GNUNET_CORE_OPTION_NOTHING 0
46
47/**
48 * Client cares about connectivity changes.
49 */
50#define GNUNET_CORE_OPTION_SEND_STATUS_CHANGE 4
51
52/**
53 * Client wants all inbound messages in full.
54 */
55#define GNUNET_CORE_OPTION_SEND_FULL_INBOUND 8
56
57/**
58 * Client just wants the 4-byte message headers of
59 * all inbound messages.
60 */
61#define GNUNET_CORE_OPTION_SEND_HDR_INBOUND 16
62
63/**
64 * Client wants all outbound messages in full.
65 */
66#define GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND 32
67
68/**
69 * Client just wants the 4-byte message headers of
70 * all outbound messages.
71 */
72#define GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND 64
73
74
75GNUNET_NETWORK_STRUCT_BEGIN
76
77/**
78 * Message transmitted core clients to gnunet-service-core
79 * to start the interaction. This header is followed by
80 * uint16_t type values specifying which messages this
81 * client is interested in.
82 */
83struct InitMessage
84{
85 /**
86 * Header with type #GNUNET_MESSAGE_TYPE_CORE_INIT.
87 */
88 struct GNUNET_MessageHeader header;
89
90 /**
91 * Options, see GNUNET_CORE_OPTION_ values.
92 */
93 uint32_t options GNUNET_PACKED;
94};
95
96
97/**
98 * Message transmitted by the gnunet-service-core process
99 * to its clients in response to an INIT message.
100 */
101struct InitReplyMessage
102{
103 /**
104 * Header with type #GNUNET_MESSAGE_TYPE_CORE_INIT_REPLY
105 */
106 struct GNUNET_MessageHeader header;
107
108 /**
109 * Always zero.
110 */
111 uint32_t reserved GNUNET_PACKED;
112
113 /**
114 * Public key of the local peer.
115 */
116 struct GNUNET_PeerIdentity my_identity;
117};
118
119
120/**
121 * Message sent by the service to clients to notify them
122 * about a peer connecting.
123 */
124struct ConnectNotifyMessage
125{
126 /**
127 * Header with type #GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT
128 */
129 struct GNUNET_MessageHeader header;
130
131 /**
132 * Always zero.
133 */
134 uint32_t reserved GNUNET_PACKED;
135
136 /**
137 * Identity of the connecting peer.
138 */
139 struct GNUNET_PeerIdentity peer;
140};
141
142
143/**
144 * Message sent by the service to clients to notify them
145 * about a peer disconnecting.
146 */
147struct DisconnectNotifyMessage
148{
149 /**
150 * Header with type #GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT.
151 */
152 struct GNUNET_MessageHeader header;
153
154 /**
155 * Always zero.
156 */
157 uint32_t reserved GNUNET_PACKED;
158
159 /**
160 * Identity of the connecting peer.
161 */
162 struct GNUNET_PeerIdentity peer;
163};
164
165
166/**
167 * Message sent by the service to clients to notify them about
168 * messages being received or transmitted. This overall message is
169 * followed by the real message, or just the header of the real
170 * message (depending on the client's preferences). The receiver can
171 * tell if it got the full message or only a partial message by
172 * looking at the size field in the header of NotifyTrafficMessage and
173 * checking it with the size field in the message that follows.
174 */
175struct NotifyTrafficMessage
176{
177 /**
178 * Header with type #GNUNET_MESSAGE_TYPE_CORE_NOTIFY_INBOUND
179 * or #GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND.
180 */
181 struct GNUNET_MessageHeader header;
182
183 /**
184 * Identity of the receiver or sender.
185 */
186 struct GNUNET_PeerIdentity peer;
187
188 /* Followed by payload (message or just header), variable size */
189};
190
191
192/**
193 * Client notifying core about the maximum-priority
194 * message it has in the queue for a particular target.
195 */
196struct SendMessageRequest
197{
198 /**
199 * Header with type #GNUNET_MESSAGE_TYPE_CORE_SEND_REQUEST
200 */
201 struct GNUNET_MessageHeader header;
202
203 /**
204 * How important is this message?
205 */
206 uint32_t priority GNUNET_PACKED;
207
208 /**
209 * By what time would the sender really like to see this
210 * message transmitted?
211 */
212 struct GNUNET_TIME_AbsoluteNBO deadline;
213
214 /**
215 * Identity of the intended target.
216 */
217 struct GNUNET_PeerIdentity peer;
218
219 /**
220 * Always zero.
221 */
222 uint32_t reserved GNUNET_PACKED;
223
224 /**
225 * How large is the message?
226 */
227 uint16_t size GNUNET_PACKED;
228
229 /**
230 * Counter for this peer to match SMRs to replies.
231 */
232 uint16_t smr_id GNUNET_PACKED;
233};
234
235
236/**
237 * Core notifying client that it is allowed to now
238 * transmit a message to the given target
239 * (response to #GNUNET_MESSAGE_TYPE_CORE_SEND_REQUEST).
240 */
241struct SendMessageReady
242{
243 /**
244 * Header with type #GNUNET_MESSAGE_TYPE_CORE_SEND_READY
245 */
246 struct GNUNET_MessageHeader header;
247
248 /**
249 * How many bytes are allowed for transmission?
250 * Guaranteed to be at least as big as the requested size,
251 * or ZERO if the request is rejected (will timeout,
252 * peer disconnected, queue full, etc.).
253 */
254 uint16_t size GNUNET_PACKED;
255
256 /**
257 * smr_id from the request.
258 */
259 uint16_t smr_id GNUNET_PACKED;
260
261 /**
262 * Identity of the intended target.
263 */
264 struct GNUNET_PeerIdentity peer;
265};
266
267
268/**
269 * Client asking core to transmit a particular message to a particular
270 * target (response to #GNUNET_MESSAGE_TYPE_CORE_SEND_READY).
271 */
272struct SendMessage
273{
274 /**
275 * Header with type #GNUNET_MESSAGE_TYPE_CORE_SEND
276 */
277 struct GNUNET_MessageHeader header;
278
279 /**
280 * How important is this message? Contains a
281 * `enum GNUNET_MQ_PriorityPreferences` in NBO.
282 */
283 uint32_t priority GNUNET_PACKED;
284
285 /**
286 * By what time would the sender really like to see this
287 * message transmitted?
288 */
289 struct GNUNET_TIME_AbsoluteNBO deadline;
290
291 /**
292 * Identity of the intended receiver.
293 */
294 struct GNUNET_PeerIdentity peer;
295};
296
297
298/**
299 * Message sent by the service to monitor clients to notify them
300 * about a peer changing status.
301 */
302struct MonitorNotifyMessage
303{
304 /**
305 * Header with type #GNUNET_MESSAGE_TYPE_CORE_MONITOR_NOTIFY
306 */
307 struct GNUNET_MessageHeader header;
308
309 /**
310 * New peer state, an `enum GNUNET_CORE_KxState` in NBO.
311 */
312 uint32_t state GNUNET_PACKED;
313
314 /**
315 * Identity of the peer.
316 */
317 struct GNUNET_PeerIdentity peer;
318
319 /**
320 * How long will we stay in this state (if nothing else happens)?
321 */
322 struct GNUNET_TIME_AbsoluteNBO timeout;
323};
324
325
326GNUNET_NETWORK_STRUCT_END
327#endif
328/* end of core.h */