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