GNUnet  0.17.6
gnunet_core_service.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2009-2017 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  */
36 #ifndef GNUNET_CORE_SERVICE_H
37 #define GNUNET_CORE_SERVICE_H
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #if 0 /* keep Emacsens' auto-indent happy */
42 }
43 #endif
44 #endif
45 
46 #include "gnunet_util_lib.h"
48 
52 #define GNUNET_CORE_VERSION 0x00000001
53 
55 
61 {
66 
71 
77 
82 
87 
92 
97 
103 };
104 
105 
112 {
117 
122 
128 
133 };
134 
135 
140 {
145 
150 
155 
159  uint32_t reserved;
160 
166 };
167 
168 
170 
174 struct GNUNET_CORE_Handle;
175 
176 
185 typedef void *(*GNUNET_CORE_ConnectEventHandler) (
186  void *cls,
187  const struct GNUNET_PeerIdentity *peer,
188  struct GNUNET_MQ_Handle *mq);
189 
190 
200  void *cls,
201  const struct GNUNET_PeerIdentity *peer,
202  void *peer_cls);
203 
204 
218  void *cls,
219  const struct GNUNET_PeerIdentity *my_identity);
220 
221 
246 struct GNUNET_CORE_Handle *
248  void *cls,
252  const struct GNUNET_MQ_MessageHandler *handlers);
253 
254 
260 void
262 
263 
271 struct GNUNET_MQ_Handle *
273  const struct GNUNET_PeerIdentity *pid);
274 
275 
280 
281 
296 {
301 
306 
311 
318 
328 
334 
341 
350 };
351 
352 
363  void *cls,
364  const struct GNUNET_PeerIdentity *pid,
367 
368 
388  void *peer_cb_cls);
389 
390 
396 void
398 
399 
412 int
414  const struct GNUNET_PeerIdentity *pid);
415 
416 
430 struct GNUNET_MQ_Handle *
432  const struct GNUNET_PeerIdentity *target);
433 
434 
435 #if 0 /* keep Emacsens' auto-indent happy */
436 {
437 #endif
438 #ifdef __cplusplus
439 }
440 #endif
441 
442 /* ifndef GNUNET_CORE_SERVICE_H */
443 #endif
444  /* end of group core */
446  /* end of backbone addition */
448 
449 /* end of gnunet_core_service.h */
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
void * connects(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq)
Definition: 010.c:2
void disconnects(void *cls, const struct GNUNET_PeerIdentity *peer)
Definition: 011.c:2
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
Definition: gnunet-abd.c:61
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
static char * init
Set to the name of a service to start.
Definition: gnunet-arm.c:74
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
static struct GNUNET_CADET_Handle * mh
Cadet handle.
Definition: gnunet-cadet.c:92
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
enum State state
current state of profiling
static struct GNUNET_PeerIdentity my_identity
Identity of this peer.
static struct GNUNET_PeerIdentity pid
Identity of the peer we transmit to / connect to.
void(* GNUNET_CORE_DisconnectEventHandler)(void *cls, const struct GNUNET_PeerIdentity *peer, void *peer_cls)
Method called whenever a peer disconnects.
struct GNUNET_MQ_Handle * GNUNET_CORE_mq_create(struct GNUNET_CORE_Handle *h, const struct GNUNET_PeerIdentity *target)
Create a message queue for sending messages to a peer with CORE.
void(* GNUNET_CORE_MonitorCallback)(void *cls, const struct GNUNET_PeerIdentity *pid, enum GNUNET_CORE_KxState state, struct GNUNET_TIME_Absolute timeout)
Function called by the monitor callback whenever a peer's connection status changes.
void *(* GNUNET_CORE_ConnectEventHandler)(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq)
Method called whenever a given peer connects.
struct GNUNET_CORE_Handle * GNUNET_CORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, GNUNET_CORE_StartupCallback init, GNUNET_CORE_ConnectEventHandler connects, GNUNET_CORE_DisconnectEventHandler disconnects, const struct GNUNET_MQ_MessageHandler *handlers)
Connect to the core service.
Definition: core_api.c:692
struct GNUNET_CORE_MonitorHandle * GNUNET_CORE_monitor_start(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CORE_MonitorCallback peer_cb, void *peer_cb_cls)
Monitor connectivity and KX status of all peers known to CORE.
GNUNET_CORE_KxState
State machine for our P2P encryption handshake.
void GNUNET_CORE_monitor_stop(struct GNUNET_CORE_MonitorHandle *mh)
Stop monitoring CORE activity.
struct GNUNET_MQ_Handle * GNUNET_CORE_get_mq(const struct GNUNET_CORE_Handle *h, const struct GNUNET_PeerIdentity *pid)
Obtain the message queue for a connected peer.
Definition: core_api.c:761
void(* GNUNET_CORE_StartupCallback)(void *cls, const struct GNUNET_PeerIdentity *my_identity)
Function called after GNUNET_CORE_connect has succeeded (or failed for good).
int GNUNET_CORE_is_peer_connected_sync(const struct GNUNET_CORE_Handle *h, const struct GNUNET_PeerIdentity *pid)
Check if the given peer is currently connected.
void GNUNET_CORE_disconnect(struct GNUNET_CORE_Handle *handle)
Disconnect from the core service.
Definition: core_api.c:730
@ GNUNET_CORE_KX_PEER_DISCONNECT
Last state of a KX (when it is being terminated).
@ GNUNET_CORE_KX_STATE_UP
The other peer has confirmed our session key + PING with a PONG message encrypted with their session ...
@ GNUNET_CORE_KX_STATE_DOWN
No handshake yet.
@ GNUNET_CORE_KX_CORE_DISCONNECT
This is not a state in a peer's state machine, but a special value used with the GNUNET_CORE_MonitorC...
@ GNUNET_CORE_KX_STATE_KEY_SENT
We've sent our session key.
@ GNUNET_CORE_KX_STATE_KEY_RECEIVED
We've received the other peers session key.
@ GNUNET_CORE_KX_ITERATION_FINISHED
This is not a state in a peer's state machine, but a special value used with the GNUNET_CORE_MonitorC...
@ GNUNET_CORE_KX_STATE_REKEY_SENT
We're rekeying (or had a timeout), so we have sent the other peer our new ephemeral key,...
#define GNUNET_NETWORK_STRUCT_BEGIN
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32.
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;.
#define GNUNET_PACKED
gcc-ism to get packed structs.
Message transmitted with the signed ephemeral key of a peer.
struct GNUNET_PeerIdentity origin_identity
Public key of the signing peer (persistent version, not the ephemeral public key).
struct GNUNET_MessageHeader header
Message type is GNUNET_MESSAGE_TYPE_CORE_EPHEMERAL_KEY.
int32_t sender_status
Status of the sender (should be in enum PeerStateMachine), nbo.
struct GNUNET_TIME_AbsoluteNBO expiration_time
When does the given ephemeral key expire (end of validity).
struct GNUNET_CRYPTO_EddsaSignature signature
An ECC signature of the origin_identity asserting the validity of the given ephemeral key.
struct GNUNET_TIME_AbsoluteNBO creation_time
At what time was this key created (beginning of validity).
struct GNUNET_CRYPTO_EccSignaturePurpose purpose
Information about what is being signed.
struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key
Ephemeral public ECC key.
Context for the core service connection.
Definition: core_api.c:78
void * cls
Closure for the various callbacks.
Definition: core_api.c:87
Handle to a CORE monitoring operation.
GNUNET_CORE_MonitorCallback peer_cb
Function called with the peer.
void * peer_cb_cls
Closure for peer_cb.
header of what an ECC signature signs this must be followed by "size - 8" bytes of the actual signed ...
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and encr...
an ECC signature using EdDSA.
Handle to a message queue.
Definition: mq.c:86
Message handler for a specific message type.
Header for all communications.
The identity of the host (wraps the signing key of the peer).
Time for absolute time used by GNUnet, in microseconds and in network byte order.
Time for absolute times used by GNUnet, in microseconds.
We're sending an (encrypted) PING to the other peer to check if it can decrypt.
struct GNUNET_MessageHeader header
Message type is GNUNET_MESSAGE_TYPE_CORE_PING.
uint32_t iv_seed
Seed for the IV.
struct GNUNET_PeerIdentity target
Intended target of the PING, used primarily to check that decryption actually worked.
uint32_t challenge
Random number chosen to make replay harder.
Response to a PING.
uint32_t challenge
Random number to make replay attacks harder.
struct GNUNET_MessageHeader header
Message type is GNUNET_MESSAGE_TYPE_CORE_PONG.
uint32_t reserved
Reserved, always zero.
uint32_t iv_seed
Seed for the IV.
struct GNUNET_PeerIdentity target
Intended target of the PING, used primarily to check that decryption actually worked.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.