GNUnet  0.17.6
gnunet-service-cadet_peer.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2001-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  */
20 
27 #ifndef GNUNET_SERVICE_CADET_PEER_H
28 #define GNUNET_SERVICE_CADET_PEER_H
29 
30 #include "gnunet-service-cadet.h"
31 #include "gnunet_hello_lib.h"
32 
33 
41 const char *
42 GCP_2s (const struct CadetPeer *peer);
43 
44 
56 struct CadetPeer *
57 GCP_get (const struct GNUNET_PeerIdentity *peer_id,
58  int create);
59 
60 
76 double
78  unsigned int off);
79 
80 
87 const struct GNUNET_PeerIdentity *
88 GCP_get_id (struct CadetPeer *cp);
89 
90 
97 void
99  void *cls);
100 
101 
108 unsigned int
109 GCP_count_paths (const struct CadetPeer *cp);
110 
111 
118 void
119 GCP_drop_owned_paths (struct CadetPeer *cp);
120 
121 
131 typedef int
132 (*GCP_PathIterator) (void *cls,
133  struct CadetPeerPath *path,
134  unsigned int off);
135 
136 
145 unsigned int
146 GCP_iterate_paths (struct CadetPeer *cp,
147  GCP_PathIterator callback,
148  void *callback_cls);
149 
158 unsigned int
160  GCP_PathIterator callback,
161  void *callback_cls);
162 
163 
174 unsigned int
175 GCP_iterate_paths_at (struct CadetPeer *cp,
176  unsigned int dist,
177  GCP_PathIterator callback,
178  void *callback_cls);
179 
180 
188 void
189 GCP_path_entry_remove (struct CadetPeer *cp,
190  struct CadetPeerPathEntry *entry,
191  unsigned int off);
192 
193 
201 void
202 GCP_path_entry_add (struct CadetPeer *cp,
203  struct CadetPeerPathEntry *entry,
204  unsigned int off);
205 
206 
214 struct CadetTunnel *
215 GCP_get_tunnel (struct CadetPeer *cp,
216  int create);
217 
218 
226 void
227 GCP_drop_tunnel (struct CadetPeer *cp,
228  struct CadetTunnel *t);
229 
230 
243 GCP_attach_path (struct CadetPeer *cp,
244  struct CadetPeerPath *path,
245  unsigned int off,
246  int force);
247 
248 
258 void
259 GCP_detach_path (struct CadetPeer *cp,
260  struct CadetPeerPath *path,
261  struct GNUNET_CONTAINER_HeapNode *hn);
262 
263 
270 void
271 GCP_add_connection (struct CadetPeer *cp,
272  struct CadetConnection *cc);
273 
274 
281 void
282 GCP_remove_connection (struct CadetPeer *cp,
283  struct CadetConnection *cc);
284 
285 
293 void
294 GCP_set_hello (struct CadetPeer *cp,
295  const struct GNUNET_HELLO_Message *hello);
296 
297 
303 void
304 GCP_destroy_all_peers (void);
305 
306 
317 
318 
328 typedef void
330  int available);
331 
332 
343 GCP_request_mq (struct CadetPeer *cp,
345  void *cb_cls);
346 
347 
354 int
356 
357 
369 void
370 GCP_send (struct GCP_MessageQueueManager *mqm,
371  struct GNUNET_MQ_Envelope *env);
372 
373 
383 void
384 GCP_send_ooo (struct CadetPeer *cp,
385  struct GNUNET_MQ_Envelope *env);
386 
387 
396 void
398  struct GNUNET_MQ_Envelope *last_env);
399 
400 
407 void
408 GCP_set_mq (struct CadetPeer *cp,
409  struct GNUNET_MQ_Handle *mq);
410 
418 int
419 GCP_check_monotime_sig (struct CadetPeer *peer, const struct
421 
429 int
431  struct GNUNET_TIME_AbsoluteNBO monotime);
432 
433 #endif
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
static char * peer_id
Option –peer.
Definition: gnunet-cadet.c:42
static int create
Create DID Document Flag.
Definition: gnunet-did.c:71
Information we track per peer.
int GCP_check_monotime_sig(struct CadetPeer *peer, const struct GNUNET_CADET_ConnectionCreateMessage *msg)
Checking the signature for a monotime of a GNUNET_CADET_ConnectionCreateMessage.
void GCP_add_connection(struct CadetPeer *cp, struct CadetConnection *cc)
Add a connection to this cp.
void GCP_detach_path(struct CadetPeer *cp, struct CadetPeerPath *path, struct GNUNET_CONTAINER_HeapNode *hn)
This peer can no longer own path as the path has been extended and a peer further down the line is no...
void GCP_path_entry_add(struct CadetPeer *cp, struct CadetPeerPathEntry *entry, unsigned int off)
Add an entry to the DLL of all of the paths that this peer is on.
void GCP_set_hello(struct CadetPeer *cp, const struct GNUNET_HELLO_Message *hello)
We got a HELLO for a cp, remember it, and possibly trigger adequate actions (like trying to connect).
int GCP_has_core_connection(struct CadetPeer *cp)
Test if cp has a core-level connection.
int(* GCP_PathIterator)(void *cls, struct CadetPeerPath *path, unsigned int off)
Peer path iterator.
struct GNUNET_CONTAINER_HeapNode * GCP_attach_path(struct CadetPeer *cp, struct CadetPeerPath *path, unsigned int off, int force)
Try adding a path to this cp.
unsigned int GCP_count_paths(const struct CadetPeer *cp)
Count the number of known paths toward the peer.
void GCP_path_entry_remove(struct CadetPeer *cp, struct CadetPeerPathEntry *entry, unsigned int off)
Remove an entry from the DLL of all of the paths that this peer is on.
void GCP_send_ooo(struct CadetPeer *cp, struct GNUNET_MQ_Envelope *env)
Send the message in env to cp, overriding queueing logic.
int GCP_check_and_update_monotime(struct CadetPeer *peer, struct GNUNET_TIME_AbsoluteNBO monotime)
Checking if a monotime value is newer than the last monotime value received from a peer.
struct CadetTunnel * GCP_get_tunnel(struct CadetPeer *cp, int create)
Get the tunnel towards a peer.
void GCP_request_mq_cancel(struct GCP_MessageQueueManager *mqm, struct GNUNET_MQ_Envelope *last_env)
Stops message queue change notifications and sends a last message.
unsigned int GCP_iterate_paths_at(struct CadetPeer *cp, unsigned int dist, GCP_PathIterator callback, void *callback_cls)
Iterate over the paths to peer where peer is at distance dist from us.
const char * GCP_2s(const struct CadetPeer *peer)
Get the static string for a peer ID.
double GCP_get_desirability_of_path(struct CadetPeer *cp, unsigned int off)
Calculate how desirable a path is for cp if cp is at offset off in the path.
void GCP_set_mq(struct CadetPeer *cp, struct GNUNET_MQ_Handle *mq)
Set the message queue to mq for peer cp and notify watchers.
const struct GNUNET_PeerIdentity * GCP_get_id(struct CadetPeer *cp)
Obtain the peer identity for a struct CadetPeer.
void GCP_drop_tunnel(struct CadetPeer *cp, struct CadetTunnel *t)
The tunnel to the given peer no longer exists, remove it from our data structures,...
void GCP_drop_owned_paths(struct CadetPeer *cp)
Drop all paths owned by this peer, and do not allow new ones to be added: We are shutting down.
struct CadetPeer * GCP_get(const struct GNUNET_PeerIdentity *peer_id, int create)
Retrieve the CadetPeer structure associated with the peer.
unsigned int GCP_iterate_indirect_paths(struct CadetPeer *cp, GCP_PathIterator callback, void *callback_cls)
Iterate over the paths to a peer without direct link.
void GCP_destroy_all_peers(void)
Clean up all entries about all peers.
void GCP_send(struct GCP_MessageQueueManager *mqm, struct GNUNET_MQ_Envelope *env)
Send the message in env via a mqm.
void GCP_remove_connection(struct CadetPeer *cp, struct CadetConnection *cc)
Remove a connection that went via this cp.
unsigned int GCP_iterate_paths(struct CadetPeer *cp, GCP_PathIterator callback, void *callback_cls)
Iterate over the paths to a peer.
void(* GCP_MessageQueueNotificationCallback)(void *cls, int available)
Function to call with updated message queue object.
struct GCP_MessageQueueManager * GCP_request_mq(struct CadetPeer *cp, GCP_MessageQueueNotificationCallback cb, void *cb_cls)
Start message queue change notifications.
void GCP_iterate_all(GNUNET_CONTAINER_PeerMapIterator iter, void *cls)
Iterate over all known peers.
static struct GNUNET_SCHEDULER_Task * t
Main task.
Helper library for handling HELLOs.
enum GNUNET_GenericReturnValue(* GNUNET_CONTAINER_PeerMapIterator)(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Iterator over hash map entries.
Low-level connection to a destination.
Entry in a peer path.
Information regarding a possible path to reach a peer.
Peer description.
Struct containing all information regarding a tunnel to a peer.
Data structure used to track whom we have to notify about changes to our message queue.
struct CadetPeer * cp
The peer this is for.
GCP_MessageQueueNotificationCallback cb
Function to call with updated message queue object.
Message for cadet connection creation.
A HELLO message is used to exchange information about transports with other peers.
Handle to a message queue.
Definition: mq.c:86
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.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.