GNUnet 0.21.1
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
31#include "gnunet_util_lib.h"
32
33
41const char *
42GCP_2s (const struct CadetPeer *peer);
43
44
56struct CadetPeer *
58 int create);
59
60
76double
78 unsigned int off);
79
80
87const struct GNUNET_PeerIdentity *
88GCP_get_id (struct CadetPeer *cp);
89
90
97void
99 void *cls);
100
101
108unsigned int
109GCP_count_paths (const struct CadetPeer *cp);
110
111
118void
120
121
131typedef int
132(*GCP_PathIterator) (void *cls,
133 struct CadetPeerPath *path,
134 unsigned int off);
135
136
145unsigned int
146GCP_iterate_paths (struct CadetPeer *cp,
147 GCP_PathIterator callback,
148 void *callback_cls);
149
158unsigned int
160 GCP_PathIterator callback,
161 void *callback_cls);
162
163
174unsigned int
176 unsigned int dist,
177 GCP_PathIterator callback,
178 void *callback_cls);
179
180
188void
190 struct CadetPeerPathEntry *entry,
191 unsigned int off);
192
193
201void
202GCP_path_entry_add (struct CadetPeer *cp,
203 struct CadetPeerPathEntry *entry,
204 unsigned int off);
205
206
214struct CadetTunnel *
215GCP_get_tunnel (struct CadetPeer *cp,
216 int create);
217
218
226void
227GCP_drop_tunnel (struct CadetPeer *cp,
228 struct CadetTunnel *t);
229
230
243GCP_attach_path (struct CadetPeer *cp,
244 struct CadetPeerPath *path,
245 unsigned int off,
246 int force);
247
248
258void
259GCP_detach_path (struct CadetPeer *cp,
260 struct CadetPeerPath *path,
261 struct GNUNET_CONTAINER_HeapNode *hn);
262
263
270void
271GCP_add_connection (struct CadetPeer *cp,
272 struct CadetConnection *cc);
273
274
281void
283 struct CadetConnection *cc);
284
285
293void
294GCP_set_hello (struct CadetPeer *cp,
295 const struct GNUNET_MessageHeader *hello);
296
297
303void
305
306
317
318
328typedef void
330 int available);
331
332
345 void *cb_cls);
346
347
354int
356
357
369void
371 struct GNUNET_MQ_Envelope *env);
372
373
383void
384GCP_send_ooo (struct CadetPeer *cp,
385 struct GNUNET_MQ_Envelope *env);
386
387
396void
398 struct GNUNET_MQ_Envelope *last_env);
399
400
407void
408GCP_set_mq (struct CadetPeer *cp,
409 struct GNUNET_MQ_Handle *mq);
410
418int
419GCP_check_monotime_sig (struct CadetPeer *peer, const struct
421
429int
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:68
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.
const struct GNUNET_PeerIdentity * GCP_get_id(struct CadetPeer *cp)
Obtain the peer identity for a struct CadetPeer.
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.
struct CadetPeer * GCP_get(const struct GNUNET_PeerIdentity *peer_id, int create)
Retrieve the CadetPeer structure associated with the peer.
int GCP_has_core_connection(struct CadetPeer *cp)
Test if cp has a core-level connection.
struct CadetTunnel * GCP_get_tunnel(struct CadetPeer *cp, int create)
Get the tunnel towards a peer.
int(* GCP_PathIterator)(void *cls, struct CadetPeerPath *path, unsigned int off)
Peer path iterator.
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.
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.
void GCP_set_hello(struct CadetPeer *cp, const struct GNUNET_MessageHeader *hello)
We got a HELLO for a cp, remember it, and possibly trigger adequate actions (like trying to connect).
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_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.
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.
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.
const char * GCP_2s(const struct CadetPeer *peer)
Get the static string for a peer ID.
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.
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.
Struct containing all information regarding a given peer.
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.
Handle to a message queue.
Definition: mq.c:87
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.