GNUnet  0.11.x
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  */
33 #ifndef GNUNET_CORE_SERVICE_H
34 #define GNUNET_CORE_SERVICE_H
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #if 0 /* keep Emacsens' auto-indent happy */
39 }
40 #endif
41 #endif
42 
43 #include "gnunet_util_lib.h"
45 
49 #define GNUNET_CORE_VERSION 0x00000001
50 
51 
55 struct GNUNET_CORE_Handle;
56 
57 
66 typedef void *(*GNUNET_CORE_ConnectEventHandler) (
67  void *cls,
68  const struct GNUNET_PeerIdentity *peer,
69  struct GNUNET_MQ_Handle *mq);
70 
71 
81  void *cls,
82  const struct GNUNET_PeerIdentity *peer,
83  void *peer_cls);
84 
85 
98 typedef void (*GNUNET_CORE_StartupCallback) (
99  void *cls,
100  const struct GNUNET_PeerIdentity *my_identity);
101 
102 
127 struct GNUNET_CORE_Handle *
129  void *cls,
133  const struct GNUNET_MQ_MessageHandler *handlers);
134 
135 
141 void
143 
144 
152 struct GNUNET_MQ_Handle *
154  const struct GNUNET_PeerIdentity *pid);
155 
156 
161 
162 
177 {
182 
187 
192 
199 
209 
215 
222 
231 };
232 
233 
244  void *cls,
245  const struct GNUNET_PeerIdentity *pid,
248 
249 
269  void *peer_cb_cls);
270 
271 
277 void
279 
280 
293 int
295  const struct GNUNET_PeerIdentity *pid);
296 
297 
311 struct GNUNET_MQ_Handle *
313  const struct GNUNET_PeerIdentity *target);
314 
315 
316 #if 0 /* keep Emacsens' auto-indent happy */
317 {
318 #endif
319 #ifdef __cplusplus
320 }
321 #endif
322 
323 /* ifndef GNUNET_CORE_SERVICE_H */
324 #endif
325  /* end of group core */
327 
328 /* end of gnunet_core_service.h */
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
Context for the core service connection.
Definition: core_api.c:77
static struct GNUNET_CADET_Handle * mh
Cadet handle.
Definition: gnunet-cadet.c:92
void(* GNUNET_CORE_DisconnectEventHandler)(void *cls, const struct GNUNET_PeerIdentity *peer, void *peer_cls)
Method called whenever a peer disconnects.
Handle to a CORE monitoring operation.
void * cls
Closure for the various callbacks.
Definition: core_api.c:87
void(* GNUNET_CORE_StartupCallback)(void *cls, const struct GNUNET_PeerIdentity *my_identity)
Function called after GNUNET_CORE_connect has succeeded (or failed for good).
GNUNET_CORE_KxState
State machine for our P2P encryption handshake.
static struct GNUNET_PeerIdentity my_identity
Identity of this peer.
We&#39;ve received the other peers session key.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
void *(* GNUNET_CORE_ConnectEventHandler)(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq)
Method called whenever a given peer connects.
enum State state
current state of profiling
static struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
Definition: gnunet-abd.c:61
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
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&#39;s connection status changes.
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
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.
Message handler for a specific message type.
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
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
This is not a state in a peer&#39;s state machine, but a special value used with the GNUNET_CORE_MonitorC...
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_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_disconnect(struct GNUNET_CORE_Handle *handle)
Disconnect from the core service.
Definition: core_api.c:730
The other peer has confirmed our session key + PING with a PONG message encrypted with their session ...
static char * init
Set to the name of a service to start.
Definition: gnunet-arm.c:74
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
Handle to a message queue.
Definition: mq.c:85
The identity of the host (wraps the signing key of the peer).
void GNUNET_CORE_monitor_stop(struct GNUNET_CORE_MonitorHandle *mh)
Stop monitoring CORE activity.
configuration data
Definition: configuration.c:85
void * peer_cb_cls
Closure for peer_cb.
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
GNUNET_CORE_MonitorCallback peer_cb
Function called with the peer.
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.
Last state of a KX (when it is being terminated).
Time for absolute times used by GNUnet, in microseconds.
We&#39;ve sent our session key.
static struct GNUNET_PeerIdentity pid
Identity of the peer we transmit to / connect to.
This is not a state in a peer&#39;s state machine, but a special value used with the GNUNET_CORE_MonitorC...
We&#39;re rekeying (or had a timeout), so we have sent the other peer our new ephemeral key...