GNUnet  0.11.x
gnunet-service-transport_neighbours.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2010-2015 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 
26 #ifndef GNUNET_SERVICE_TRANSPORT_NEIGHBOURS_H
27 #define GNUNET_SERVICE_TRANSPORT_NEIGHBOURS_H
28 
33 #include "transport.h"
34 #include "gnunet_util_lib.h"
35 
36 
42 void
43 GST_neighbours_start (unsigned int max_fds);
44 
45 
49 void
50 GST_neighbours_stop (void);
51 
52 
59 int
61 
62 
71 typedef void
72 (*GST_NeighbourSendContinuation) (void *cls,
73  int success,
74  size_t bytes_payload,
75  size_t bytes_on_wire);
76 
77 
88 void
89 GST_neighbours_send (const struct GNUNET_PeerIdentity *target,
90  const void *msg,
91  size_t msg_size,
93  GST_NeighbourSendContinuation cont, void *cont_cls);
94 
95 
109  GNUNET_PeerIdentity *sender,
110  ssize_t size,
111  int *do_forward);
112 
113 
121 void
122 GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour,
123  const struct GNUNET_MessageHeader *m);
124 
125 
134 void
136  const struct GNUNET_MessageHeader *m);
137 
138 
144 void
146 
147 
159 typedef void
160 (*GST_NeighbourIterator) (void *cls,
161  const struct GNUNET_PeerIdentity *peer,
162  const struct GNUNET_HELLO_Address *address,
164  struct GNUNET_TIME_Absolute state_timeout,
165  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
166  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out);
167 
168 
175 void
177 
178 
187 int
189  struct GNUNET_ATS_Session *session);
190 
191 
200 void
202  const struct GNUNET_MessageHeader *message);
203 
204 
214 void
216  struct GNUNET_ATS_Session *session,
217  size_t size);
218 
219 
229 void
231  struct GNUNET_ATS_Session *session,
233  bandwidth_in,
235  bandwidth_out);
236 
237 
246 int
248  const struct GNUNET_PeerIdentity *peer);
249 
250 
260 int
262  GNUNET_MessageHeader *message,
263  const struct
265  struct GNUNET_ATS_Session *session);
266 
267 
278 int
280  const struct GNUNET_HELLO_Address *address,
281  struct GNUNET_ATS_Session *session);
282 
283 
290 const struct GNUNET_HELLO_Address *
292 
293 
301 void
303  const struct GNUNET_MessageHeader *msg);
304 
305 
313 void
316  const struct
318 
319 
320 #endif
321 /* end of file gnunet-service-transport_neighbours.h */
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
static struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
Definition: gnunet-abd.c:61
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
Definition: gnunet-arm.c:104
static char * address
GNS address for this phone.
enum State state
current state of profiling
void GST_neighbours_switch_to_address(const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
For an existing neighbour record, set the active connection to use the given address.
void GST_neighbours_notify_data_recv(const struct GNUNET_HELLO_Address *address, const struct GNUNET_MessageHeader *message)
Track information about data we received from the given address (used to notify ATS about our utiliza...
void GST_neighbours_keepalive_response(const struct GNUNET_PeerIdentity *neighbour, const struct GNUNET_MessageHeader *m)
We received a KEEP_ALIVE_RESPONSE message and use this to calculate latency to this peer.
const struct GNUNET_HELLO_Address * GST_neighbour_get_current_address(const struct GNUNET_PeerIdentity *peer)
Obtain current address information for the given neighbour.
void GST_neighbours_handle_disconnect_message(const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *msg)
We received a disconnect message from the given peer, validate and process.
int GST_neighbours_handle_session_syn(const struct GNUNET_MessageHeader *message, const struct GNUNET_PeerIdentity *peer)
We received a 'SESSION_CONNECT' message from the other peer.
void(* GST_NeighbourSendContinuation)(void *cls, int success, size_t bytes_payload, size_t bytes_on_wire)
Function called after the transmission is done.
void GST_neighbours_stop(void)
Cleanup the neighbours subsystem.
struct GNUNET_TIME_Relative GST_neighbours_calculate_receive_delay(const struct GNUNET_PeerIdentity *sender, ssize_t size, int *do_forward)
We have received a message from the given sender.
int GST_neighbours_handle_session_ack(const struct GNUNET_MessageHeader *message, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session)
We received a 'SESSION_ACK' message from the other peer.
void(* GST_NeighbourIterator)(void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Address *address, enum GNUNET_TRANSPORT_PeerState state, struct GNUNET_TIME_Absolute state_timeout, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
Function called for each neighbour.
int GST_neighbours_handle_session_syn_ack(const struct GNUNET_MessageHeader *message, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session)
We received a 'SESSION_CONNECT_ACK' message from the other peer.
int GST_neighbours_session_terminated(const struct GNUNET_PeerIdentity *peer, struct GNUNET_ATS_Session *session)
A session was terminated.
void GST_neighbours_keepalive(const struct GNUNET_PeerIdentity *neighbour, const struct GNUNET_MessageHeader *m)
Keep the connection to the given neighbour alive longer, we received a KEEPALIVE (or equivalent); sen...
void GST_neighbours_force_disconnect(const struct GNUNET_PeerIdentity *target)
If we have an active connection to the given target, it must be shutdown.
void GST_neighbours_send(const struct GNUNET_PeerIdentity *target, const void *msg, size_t msg_size, struct GNUNET_TIME_Relative timeout, GST_NeighbourSendContinuation cont, void *cont_cls)
Transmit a message to the given target using the active connection.
int GST_neighbours_test_connected(const struct GNUNET_PeerIdentity *target)
Test if we're connected to the given peer.
void GST_neighbours_iterate(GST_NeighbourIterator cb, void *cb_cls)
Iterate over all connected neighbours.
void GST_neighbours_start(unsigned int max_fds)
Initialize the neighbours subsystem.
void GST_neighbours_notify_data_sent(const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, size_t size)
Track information about data we transmitted using the given address and session (used to notify ATS a...
void GST_neighbours_handle_quota_message(const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *msg)
We received a quoat message from the given peer, validate and process.
GNUNET_TRANSPORT_PeerState
Possible state of a neighbour.
static unsigned int size
Size of the "table".
Definition: peer.c:67
Session handle for connections.
32-bit bandwidth used for network exchange by GNUnet, in bytes per second.
An address for communicating with a peer.
Header for all communications.
The identity of the host (wraps the signing key of the peer).
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
common internal definitions for transport service