GNUnet 0.22.0
gnunet_transport_communication_service.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2009-2019 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
38#ifndef GNUNET_TRANSPORT_COMMUNICATION_SERVICE_H
39#define GNUNET_TRANSPORT_COMMUNICATION_SERVICE_H
40
41#ifdef __cplusplus
42extern "C" {
43#if 0 /* keep Emacsens' auto-indent happy */
44}
45#endif
46#endif
47
48
49#include "gnunet_util_lib.h"
50
54#define GNUNET_TRANSPORT_COMMUNICATION_VERSION 0x00000000
55
59#define GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED UINT64_MAX
60
80 void *cls,
81 const struct GNUNET_PeerIdentity *peer,
82 const char *address);
83
84
89
90
98{
103
108
114
115
132 void *cls,
133 const struct GNUNET_PeerIdentity *sender,
134 const struct GNUNET_MessageHeader *msg);
135
136
142typedef void (*GNUNET_TRANSPORT_StartBurstNotify) (const char *address,
143 struct GNUNET_TIME_Relative rtt,
144 struct GNUNET_PeerIdentity *peer);
145
166 const struct GNUNET_CONFIGURATION_Handle *cfg,
167 const char *config_section_name,
168 const char *addr_prefix,
171 void *mq_init_cls,
173 void *notify_cb_cls,
175
176
182void
185
186
187/* ************************* Receiving *************************** */
188
198typedef void
200 int success);
201
202
223int
226 const struct GNUNET_PeerIdentity *sender,
227 const struct GNUNET_MessageHeader *msg,
228 struct GNUNET_TIME_Relative expected_addr_validity,
230 void *cb_cls);
231
232
237void
239
240/* ************************* Discovery *************************** */
241
247
248
253{
258
263
269
270
292 const struct GNUNET_PeerIdentity *peer,
293 const char *address,
294 uint32_t mtu,
295 uint64_t q_len,
296 uint32_t priority,
299 struct GNUNET_MQ_Handle *mq);
300
310void
313 const struct GNUNET_TRANSPORT_QueueHandle *u_qh,
314 uint64_t q_len,
315 uint32_t priority);
316
323void
325
326
332
333
346 const char *address,
349
350
357void
360
366void
369
388void
391 const struct GNUNET_PeerIdentity *pid,
392 const char *comm,
393 const struct GNUNET_MessageHeader *header);
394
395
396#if 0 /* keep Emacsens' auto-indent happy */
397{
398#endif
399#ifdef __cplusplus
400}
401#endif
402
403/* ifndef GNUNET_TRANSPORT_COMMUNICATOR_SERVICE_H */
404#endif
405 /* end of group */
407 /* end of group addition */
409
410/* end of gnunet_transport_communicator_service.h */
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:108
static struct GNUNET_CADET_Channel * ch
Channel handle.
Definition: gnunet-cadet.c:117
static void notify_cb(void *cls, const struct GNUNET_PeerIdentity *sender, const struct GNUNET_MessageHeader *msg)
Function called when the transport service has received a backchannel message for this communicator (...
static int mq_init(void *cls, const struct GNUNET_PeerIdentity *peer_id, const char *address)
Function called by the transport service to initialize a message queue given address information abou...
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
static char * address
GNS address for this phone.
static struct GNUNET_TIME_Relative expiration
User supplied expiration value.
static struct GNUNET_NAT_AUTO_Test * nt
Handle to a NAT test operation.
static struct GNUNET_PeerIdentity pid
Identity of the peer we transmit to / connect to.
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Definition: gnunet-vpn.c:35
void GNUNET_TRANSPORT_communicator_address_remove(struct GNUNET_TRANSPORT_AddressIdentifier *ai)
Notify transport service about an address that this communicator no longer provides for this peer.
void(* GNUNET_TRANSPORT_StartBurstNotify)(const char *address, struct GNUNET_TIME_Relative rtt, struct GNUNET_PeerIdentity *peer)
Function to start burst, if request by transport service.
int GNUNET_TRANSPORT_communicator_receive(struct GNUNET_TRANSPORT_CommunicatorHandle *handle, const struct GNUNET_PeerIdentity *sender, const struct GNUNET_MessageHeader *msg, struct GNUNET_TIME_Relative expected_addr_validity, GNUNET_TRANSPORT_MessageCompletedCallback cb, void *cb_cls)
Notify transport service that the communicator has received a message.
void GNUNET_TRANSPORT_communicator_burst_finished(struct GNUNET_TRANSPORT_CommunicatorHandle *ch)
The communicator tells the transport service that it finished the burst.
void GNUNET_TRANSPORT_communicator_mq_del(struct GNUNET_TRANSPORT_QueueHandle *qh)
Notify transport service that an MQ became unavailable due to a disconnect or timeout.
struct GNUNET_TRANSPORT_QueueHandle * GNUNET_TRANSPORT_communicator_mq_add(struct GNUNET_TRANSPORT_CommunicatorHandle *ch, const struct GNUNET_PeerIdentity *peer, const char *address, uint32_t mtu, uint64_t q_len, uint32_t priority, enum GNUNET_NetworkType nt, enum GNUNET_TRANSPORT_ConnectionStatus cs, struct GNUNET_MQ_Handle *mq)
Notify transport service that a MQ became available due to an "inbound" connection or because the com...
GNUNET_TRANSPORT_CommunicatorCharacteristics
What characteristics does this communicator have?
void GNUNET_TRANSPORT_communicator_mq_update(struct GNUNET_TRANSPORT_CommunicatorHandle *ch, const struct GNUNET_TRANSPORT_QueueHandle *u_qh, uint64_t q_len, uint32_t priority)
Notify transport service that an MQ was updated.
void GNUNET_TRANSPORT_communicator_notify(struct GNUNET_TRANSPORT_CommunicatorHandle *ch, const struct GNUNET_PeerIdentity *pid, const char *comm, const struct GNUNET_MessageHeader *header)
The communicator asks the transport service to route a message via a different path to another commun...
void GNUNET_TRANSPORT_communicator_disconnect(struct GNUNET_TRANSPORT_CommunicatorHandle *ch)
Disconnect from the transport service.
void(* GNUNET_TRANSPORT_CommunicatorNotify)(void *cls, const struct GNUNET_PeerIdentity *sender, const struct GNUNET_MessageHeader *msg)
Function called when the transport service has received a backchannel message for this communicator (...
int(* GNUNET_TRANSPORT_CommunicatorMqInit)(void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
Function called by the transport service to initialize a message queue given address information abou...
GNUNET_TRANSPORT_ConnectionStatus
Possible states of a connection.
struct GNUNET_TRANSPORT_CommunicatorHandle * GNUNET_TRANSPORT_communicator_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *config_section_name, const char *addr_prefix, enum GNUNET_TRANSPORT_CommunicatorCharacteristics cc, GNUNET_TRANSPORT_CommunicatorMqInit mq_init, void *mq_init_cls, GNUNET_TRANSPORT_CommunicatorNotify notify_cb, void *notify_cb_cls, GNUNET_TRANSPORT_StartBurstNotify sb)
Connect to the transport service.
struct GNUNET_TRANSPORT_AddressIdentifier * GNUNET_TRANSPORT_communicator_address_add(struct GNUNET_TRANSPORT_CommunicatorHandle *ch, const char *address, enum GNUNET_NetworkType nt, struct GNUNET_TIME_Relative expiration)
Notify transport service about an address that this communicator provides for this peer.
void GNUNET_TRANSPORT_communicator_address_remove_all(struct GNUNET_TRANSPORT_CommunicatorHandle *ch)
Notify transport service that this communicator no longer provides all its addresses for this peer.
void(* GNUNET_TRANSPORT_MessageCompletedCallback)(void *cls, int success)
Function called to notify communicator that we have received and processed the message.
@ GNUNET_TRANSPORT_CC_RELIABLE
Transmission is reliabile (with ACKs), e.g.
@ GNUNET_TRANSPORT_CC_UNRELIABLE
Transmission is unreliable (e.g.
@ GNUNET_TRANSPORT_CC_UNKNOWN
Characteristics are unknown (e.g.
@ GNUNET_TRANSPORT_CS_INBOUND
this is an inbound connection (communicator initiated)
@ GNUNET_TRANSPORT_CS_DOWN
Connection is down.
@ GNUNET_TRANSPORT_CS_OUTBOUND
this is an outbound connection (transport initiated)
GNUNET_NetworkType
Types of networks (with separate quotas) we support.
Definition: gnunet_nt_lib.h:44
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 relative time used by GNUnet, in microseconds.
Internal representation of an address a communicator is currently providing for the transport service...
Opaque handle to the transport service for communicators.
enum GNUNET_TRANSPORT_CommunicatorCharacteristics cc
Characteristics of the communicator.
GNUNET_TRANSPORT_StartBurstNotify sb
Function to start a burst, requested by the transport service.
const char * addr_prefix
Address prefix to use.
Handle returned to identify the internal data structure the transport API has created to manage a mes...
enum GNUNET_TRANSPORT_ConnectionStatus cs
Communication status of the queue.
uint32_t mtu
Maximum transmission unit for the queue.
struct GNUNET_PeerIdentity peer
Which peer we can communciate with.