GNUnet  0.10.x
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 
70 double
72  unsigned int off);
73 
74 
81 const struct GNUNET_PeerIdentity *
82 GCP_get_id(struct CadetPeer *cp);
83 
84 
91 void
93  void *cls);
94 
95 
102 unsigned int
103 GCP_count_paths(const struct CadetPeer *cp);
104 
105 
112 void
113 GCP_drop_owned_paths(struct CadetPeer *cp);
114 
115 
125 typedef int
126 (*GCP_PathIterator) (void *cls,
127  struct CadetPeerPath *path,
128  unsigned int off);
129 
130 
139 unsigned int
140 GCP_iterate_paths(struct CadetPeer *cp,
141  GCP_PathIterator callback,
142  void *callback_cls);
143 
152 unsigned int
154  GCP_PathIterator callback,
155  void *callback_cls);
156 
157 
168 unsigned int
170  unsigned int dist,
171  GCP_PathIterator callback,
172  void *callback_cls);
173 
174 
182 void
184  struct CadetPeerPathEntry *entry,
185  unsigned int off);
186 
187 
195 void
196 GCP_path_entry_add(struct CadetPeer *cp,
197  struct CadetPeerPathEntry *entry,
198  unsigned int off);
199 
200 
208 struct CadetTunnel *
209 GCP_get_tunnel(struct CadetPeer *cp,
210  int create);
211 
212 
220 void
221 GCP_drop_tunnel(struct CadetPeer *cp,
222  struct CadetTunnel *t);
223 
224 
237 GCP_attach_path(struct CadetPeer *cp,
238  struct CadetPeerPath *path,
239  unsigned int off,
240  int force);
241 
242 
252 void
253 GCP_detach_path(struct CadetPeer *cp,
254  struct CadetPeerPath *path,
255  struct GNUNET_CONTAINER_HeapNode *hn);
256 
257 
264 void
265 GCP_add_connection(struct CadetPeer *cp,
266  struct CadetConnection *cc);
267 
268 
275 void
277  struct CadetConnection *cc);
278 
279 
287 void
288 GCP_set_hello(struct CadetPeer *cp,
289  const struct GNUNET_HELLO_Message *hello);
290 
291 
297 void
299 
300 
311 
312 
322 typedef void
324  int available);
325 
326 
337 GCP_request_mq(struct CadetPeer *cp,
339  void *cb_cls);
340 
341 
348 int
350 
351 
363 void
365  struct GNUNET_MQ_Envelope *env);
366 
367 
377 void
378 GCP_send_ooo(struct CadetPeer *cp,
379  struct GNUNET_MQ_Envelope *env);
380 
381 
390 void
392  struct GNUNET_MQ_Envelope *last_env);
393 
394 
401 void
402 GCP_set_mq(struct CadetPeer *cp,
403  struct GNUNET_MQ_Handle *mq);
404 
405 
406 #endif
Peer description.
A HELLO message is used to exchange information about transports with other peers.
void(* GCP_MessageQueueNotificationCallback)(void *cls, int available)
Function to call with updated message queue object.
Low-level connection to a destination.
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)...
unsigned int GCP_iterate_paths(struct CadetPeer *cp, GCP_PathIterator callback, void *callback_cls)
Iterate over the paths to a peer.
Data structure used to track whom we have to notify about changes to our message queue.
Entry in a peer path.
void GCP_destroy_all_peers(void)
Clean up all entries about all peers.
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.
struct GCP_MessageQueueManager * GCP_request_mq(struct CadetPeer *cp, GCP_MessageQueueNotificationCallback cb, void *cb_cls)
Start message queue change notifications.
int(* GNUNET_CONTAINER_PeerMapIterator)(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Iterator over hash map entries.
static char * peer_id
Option –peer.
Definition: gnunet-cadet.c:42
const char * GCP_2s(const struct CadetPeer *peer)
Get the static string for a peer ID.
static struct GNUNET_SCHEDULER_Task * t
Main task.
void * cb_cls
Closure for cb.
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.
int(* GCP_PathIterator)(void *cls, struct CadetPeerPath *path, unsigned int off)
Peer path iterator.
void GCP_send(struct GCP_MessageQueueManager *mqm, struct GNUNET_MQ_Envelope *env)
Send the message in env via a mqm.
struct CadetPeer * GCP_get(const struct GNUNET_PeerIdentity *peer_id, int create)
Retrieve the CadetPeer stucture associated with the peer.
GCP_MessageQueueNotificationCallback cb
Function to call with updated message queue object.
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.
struct CadetTunnel * GCP_get_tunnel(struct CadetPeer *cp, int create)
Get the tunnel towards a peer.
void GCP_send_ooo(struct CadetPeer *cp, struct GNUNET_MQ_Envelope *env)
Send the message in env to cp, overriding queueing logic.
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...
int GCP_has_core_connection(struct CadetPeer *cp)
Test if cp has a core-level connection.
Node in the heap.
Struct containing all information regarding a tunnel to a peer.
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, and possibly clean up the peer itself.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
void GCP_set_mq(struct CadetPeer *cp, struct GNUNET_MQ_Handle *mq)
Set the message queue to mq for peer cp and notify watchers.
void GCP_remove_connection(struct CadetPeer *cp, struct CadetConnection *cc)
Remove a connection that went via this cp.
void GCP_add_connection(struct CadetPeer *cp, struct CadetConnection *cc)
Add a connection to this cp.
Handle to a message queue.
Definition: mq.c:84
The identity of the host (wraps the signing key of the peer).
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.
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.
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
void GCP_iterate_all(GNUNET_CONTAINER_PeerMapIterator iter, void *cls)
Iterate over all known peers.
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 * cp
The peer this is for.
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.
Information regarding a possible path to reach a peer.
const struct GNUNET_PeerIdentity * GCP_get_id(struct CadetPeer *cp)
Obtain the peer identity for a struct CadetPeer.
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.
unsigned int GCP_count_paths(const struct CadetPeer *cp)
Count the number of known paths toward the peer.
Information we track per peer.