GNUnet  0.10.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
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  ssize_t size,
110  int *do_forward);
111 
112 
120 void
121 GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour,
122  const struct GNUNET_MessageHeader *m);
123 
124 
133 void
135  const struct GNUNET_MessageHeader *m);
136 
137 
143 void
145 
146 
158 typedef void
159 (*GST_NeighbourIterator) (void *cls,
160  const struct GNUNET_PeerIdentity *peer,
161  const struct GNUNET_HELLO_Address *address,
163  struct GNUNET_TIME_Absolute state_timeout,
164  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
165  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out);
166 
167 
174 void
176 
177 
186 int
188  struct GNUNET_ATS_Session *session);
189 
190 
199 void
201  const struct GNUNET_MessageHeader *message);
202 
203 
213 void
215  struct GNUNET_ATS_Session *session,
216  size_t size);
217 
218 
228 void
230  struct GNUNET_ATS_Session *session,
231  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
232  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out);
233 
234 
243 int
245  const struct GNUNET_PeerIdentity *peer);
246 
247 
257 int
259  const struct GNUNET_HELLO_Address *address,
260  struct GNUNET_ATS_Session *session);
261 
262 
273 int
275  const struct GNUNET_HELLO_Address *address,
276  struct GNUNET_ATS_Session *session);
277 
278 
285 const struct GNUNET_HELLO_Address *
287 
288 
296 void
298  const struct GNUNET_MessageHeader *msg);
299 
300 
308 void
310  const struct GNUNET_MessageHeader *msg);
311 
312 
313 #endif
314 /* end of file gnunet-service-transport_neighbours.h */
int GST_neighbours_handle_session_syn(const struct GNUNET_MessageHeader *message, const struct GNUNET_PeerIdentity *peer)
We received a &#39;SESSION_CONNECT&#39; message from the other peer.
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
GNUNET_TRANSPORT_PeerState
Possible state of a neighbour.
common internal definitions for transport service
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_stop(void)
Cleanup the neighbours subsystem.
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.
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.
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...
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
Definition: gnunet-arm.c:99
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...
int GST_neighbours_test_connected(const struct GNUNET_PeerIdentity *target)
Test if we&#39;re connected to the given peer.
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 &#39;SESSION_CONNECT_ACK&#39; message from the other peer.
enum State state
current state of profiling
static struct GNUNET_TIME_Relative timeout
User defined timestamp for completing operations.
Definition: gnunet-arm.c:114
int GST_neighbours_session_terminated(const struct GNUNET_PeerIdentity *peer, struct GNUNET_ATS_Session *session)
A session was terminated.
Information about ongoing sessions of the transport client.
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 &#39;SESSION_ACK&#39; message from the other peer.
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.
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.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
static unsigned int size
Size of the "table".
Definition: peer.c:67
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.
32-bit bandwidth used for network exchange by GNUnet, in bytes per second.
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.
The identity of the host (wraps the signing key of the 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.
An address for communicating with a peer.
const struct GNUNET_HELLO_Address * GST_neighbour_get_current_address(const struct GNUNET_PeerIdentity *peer)
Obtain current address information for the given neighbour.
Header for all communications.
Time for absolute times used by GNUnet, in microseconds.
void(* GST_NeighbourSendContinuation)(void *cls, int success, size_t bytes_payload, size_t bytes_on_wire)
Function called after the transmission is done.
static char * address
GNS address for this phone.
Time for relative time used by GNUnet, in microseconds.