GNUnet  0.11.x
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 
35 #ifndef GNUNET_TRANSPORT_COMMUNICATION_SERVICE_H
36 #define GNUNET_TRANSPORT_COMMUNICATION_SERVICE_H
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #if 0 /* keep Emacsens' auto-indent happy */
41 }
42 #endif
43 #endif
44 
45 #include "gnunet_util_lib.h"
46 #include "gnunet_nt_lib.h"
47 
51 #define GNUNET_TRANSPORT_COMMUNICATION_VERSION 0x00000000
52 
56 #define GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED UINT64_MAX
57 
77  void *cls,
78  const struct GNUNET_PeerIdentity *peer,
79  const char *address);
80 
81 
86 
87 
95 {
100 
105 
110 };
111 
112 
129  void *cls,
130  const struct GNUNET_PeerIdentity *sender,
131  const struct GNUNET_MessageHeader *msg);
132 
133 
152  const struct GNUNET_CONFIGURATION_Handle *cfg,
153  const char *config_section_name,
154  const char *addr_prefix,
157  void *mq_init_cls,
159  void *notify_cb_cls);
160 
161 
167 void
170 
171 
172 /* ************************* Receiving *************************** */
173 
183 typedef void
185  int success);
186 
187 
208 int
211  const struct GNUNET_PeerIdentity *sender,
212  const struct GNUNET_MessageHeader *msg,
213  struct GNUNET_TIME_Relative expected_addr_validity,
215  void *cb_cls);
216 
217 
218 /* ************************* Discovery *************************** */
219 
225 
226 
231 {
236 
241 
246 };
247 
248 
270  const struct GNUNET_PeerIdentity *peer,
271  const char *address,
272  uint32_t mtu,
273  uint64_t q_len,
274  uint32_t priority,
275  enum GNUNET_NetworkType nt,
277  struct GNUNET_MQ_Handle *mq);
278 
288 void
291  const struct GNUNET_TRANSPORT_QueueHandle *u_qh,
292  uint64_t q_len,
293  uint32_t priority);
294 
301 void
303 
304 
310 
311 
324  const char *address,
325  enum GNUNET_NetworkType nt,
327 
328 
335 void
338 
339 
358 void
361  const struct GNUNET_PeerIdentity *pid,
362  const char *comm,
363  const struct GNUNET_MessageHeader *header);
364 
365 
366 #if 0 /* keep Emacsens' auto-indent happy */
367 {
368 #endif
369 #ifdef __cplusplus
370 }
371 #endif
372 
373 /* ifndef GNUNET_TRANSPORT_COMMUNICATOR_SERVICE_H */
374 #endif
375  /* end of group */
377 
378 /* end of gnunet_transport_communicator_service.h */
GNUNET_TRANSPORT_CommunicatorCharacteristics
What characteristics does this communicator have?
Transmission is reliabile (with ACKs), i.e.
static struct GNUNET_CADET_Channel * ch
Channel handle.
Definition: gnunet-cadet.c:117
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
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...
GNUNET_TRANSPORT_CommunicatorNotify notify_cb
Function to call when the transport service receives messages for a communicator (i.e.
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 (...
GNUNET_NetworkType
Types of networks (with separate quotas) we support.
Definition: gnunet_nt_lib.h:35
Opaque handle to the transport service for communicators.
void GNUNET_TRANSPORT_communicator_disconnect(struct GNUNET_TRANSPORT_CommunicatorHandle *ch)
Disconnect from the transport service.
enum GNUNET_TRANSPORT_ConnectionStatus cs
Communication status of the queue.
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.
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...
const char * addr_prefix
Address prefix to use.
void(* GNUNET_TRANSPORT_MessageCompletedCallback)(void *cls, int success)
Function called to notify communicator that we have received and processed the message.
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)
Connect to the transport service.
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
this is an inbound connection (communicator initiated)
static char * expiration
Credential TTL.
Definition: gnunet-abd.c:96
static struct GNUNET_NAT_AUTO_Test * nt
Handle to a NAT test operation.
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...
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
static int mq_init(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...
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...
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.
Handle to a message queue.
Definition: mq.c:85
The identity of the host (wraps the signing key of the peer).
configuration data
Definition: configuration.c:84
this is an outbound connection (transport initiated)
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...
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
Header for all communications.
GNUNET_TRANSPORT_ConnectionStatus
Possible states of a connection.
static struct GNUNET_PeerIdentity pid
Identity of the peer we transmit to / connect to.
enum GNUNET_TRANSPORT_CommunicatorCharacteristics cc
Characteristics of the communicator.
static char * address
GNS address for this phone.
uint32_t mtu
Maximum transmission unit for the queue.
Handle returned to identify the internal data structure the transport API has created to manage a mes...
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.
Internal representation of an address a communicator is currently providing for the transport service...
Time for relative time used by GNUnet, in microseconds.