GNUnet  0.11.x
transport-testing2.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 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 
27 #include "platform.h"
28 #include "gnunet_util_lib.h"
30 #include "transport.h"
31 
36 
37 
42 
52 (*GNUNET_TRANSPORT_TESTING_BackchannelCallback)(void *cls,
53  struct GNUNET_MessageHeader *msg,
54  struct GNUNET_PeerIdentity *pid);
55 
56 
66 typedef void
68  struct
70  *tc_h,
71  enum
73  cc,
74  char *address_prefix);
75 
76 
87 typedef void
89  struct
91  *tc_h,
92  const char *address,
94  expiration,
95  uint32_t aid,
96  enum GNUNET_NetworkType nt);
97 
98 
106 typedef void
108  struct
110  *tc_h,
111  int will_try);
112 
113 
121 typedef void
123  struct
125  *tc_h,
126  struct
128  *tc_queue,
129  size_t mtu);
130 
131 
139 typedef void
141  struct
143  *tc_h,
144  const char*payload,
145  size_t payload_len);
146 
151 {
157 
162 
167 
172 
174 
179 
185 
186 
191 
196 
201 
206 
211 
216 
221 
225  char *c_address;
226 
231 
236 
237  /* Callbacks + Closures */
243 
248 
253 
258 
263 
268 
273 
277  void *cb_cls;
278 
283 };
284 
302  const char *service_name,
303  const char *binary_name,
304  const char *cfg_filename,
305  const struct GNUNET_PeerIdentity *peer_id,
313  void *cb_cls);
314 
315 
316 void
319 
320 
328 void
331  *tc_h,
332  const struct
334  *peer_id,
335  const char *address);
336 
337 
347 void
350  *tc_h,
352  cont,
353  void *cont_cls,
354  const void *payload,
355  size_t payload_size);
GNUNET_TRANSPORT_CommunicatorCharacteristics
What characteristics does this communicator have?
void(* GNUNET_TRANSPORT_TESTING_IncomingMessageCallback)(void *cls, struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h, const char *payload, size_t payload_len)
Handle an incoming message.
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
void(* GNUNET_TRANSPORT_TESTING_QueueCreateReplyCallback)(void *cls, struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h, int will_try)
Get informed about the success of a queue request.
common internal definitions for transport service
Handle to a service.
Definition: service.c:116
char * cfg_filename
File name of configuration file.
struct GNUNET_SCHEDULER_Task * ts_shutdown_task
Task that will be run on shutdown to stop and clean transport service.
struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle * GNUNET_TRANSPORT_TESTING_transport_communicator_service_start(const char *service_name, const char *binary_name, const char *cfg_filename, const struct GNUNET_PeerIdentity *peer_id, GNUNET_TRANSPORT_TESTING_CommunicatorAvailableCallback communicator_available_cb, GNUNET_TRANSPORT_TESTING_AddAddressCallback add_address_cb, GNUNET_TRANSPORT_TESTING_QueueCreateReplyCallback queue_create_reply_cb, GNUNET_TRANSPORT_TESTING_AddQueueCallback add_queue_cb, GNUNET_TRANSPORT_TESTING_IncomingMessageCallback incoming_message_cb, GNUNET_TRANSPORT_TESTING_BackchannelCallback bc_cb, void *cb_cls)
Start communicator part of transport service and communicator.
struct GNUNET_MQ_Handle * c_mq
Handle to the client.
enum GNUNET_TRANSPORT_CommunicatorCharacteristics c_characteristics
Characteristics of the communicator.
struct GNUNET_SERVICE_Handle * sh
Our service handle.
GNUNET_NetworkType
Types of networks (with separate quotas) we support.
Definition: gnunet_nt_lib.h:35
void(* GNUNET_SCHEDULER_TaskCallback)(void *cls)
Signature of the main function of a task.
GNUNET_TRANSPORT_TESTING_CommunicatorAvailableCallback communicator_available_cb
Callback called when a new communicator connects.
struct GNUNET_OS_Process * nat_proc
NAT process.
char * c_addr_prefix
Specifies supported addresses.
void(* GNUNET_TRANSPORT_TESTING_AddQueueCallback)(void *cls, struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h, struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue, size_t mtu)
Handle opening of queue.
struct GNUNET_OS_Process * ps_proc
peerstore service process
void GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop(struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h)
struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *(* GNUNET_TRANSPORT_TESTING_BackchannelCallback)(void *cls, struct GNUNET_MessageHeader *msg, struct GNUNET_PeerIdentity *pid)
Function signature for callbacks that are called when new backchannel message arrived.
struct GNUNET_OS_Process * resolver_proc
resolver service process
static char * service_name
Option -s: service name (hash to get service descriptor)
Definition: gnunet-vpn.c:51
GNUNET_TRANSPORT_TESTING_AddAddressCallback add_address_cb
Callback called when a new communicator connects.
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_TESTING_CommunicatorAvailableCallback)(void *cls, struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h, enum GNUNET_TRANSPORT_CommunicatorCharacteristics cc, char *address_prefix)
Function signature for callbacks that are called when new communicators become available.
struct GNUNET_CONFIGURATION_Handle * cfg
Handle to the configuration.
GNUNET_TRANSPORT_TESTING_IncomingMessageCallback incoming_msg_cb
Callback called when a new communicator connects.
static unsigned long long payload
How much data are we currently storing in the database?
struct GNUNET_SERVICE_Handle * tsh
Handle to the transport service.
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
struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue * queue_tail
Tail of the DLL of queues associated with this communicator.
Entry in list of pending tasks.
Definition: scheduler.c:134
struct GNUNET_OS_Process * c_proc
Process of the communicator.
Header for all communications.
void(* GNUNET_TRANSPORT_TESTING_AddAddressCallback)(void *cls, struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h, const char *address, struct GNUNET_TIME_Relative expiration, uint32_t aid, enum GNUNET_NetworkType nt)
Receive information about the address of a communicator.
GNUNET_TRANSPORT_TESTING_AddQueueCallback add_queue_cb
Callback called when a new communicator connects.
void GNUNET_TRANSPORT_TESTING_transport_communicator_send(struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h, GNUNET_SCHEDULER_TaskCallback cont, void *cont_cls, const void *payload, size_t payload_size)
Instruct communicator to send data.
GNUNET_TRANSPORT_TESTING_QueueCreateReplyCallback queue_create_reply_cb
Callback called when a new communicator connects.
struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue * queue_head
Head of the DLL of queues associated with this communicator.
struct GNUNET_SCHEDULER_Task * c_shutdown_task
Task that will be run on shutdown to stop and clean communicator.
GNUNET_TRANSPORT_TESTING_BackchannelCallback bc_cb
Backchannel callback.
static struct GNUNET_PeerIdentity pid
Identity of the peer we transmit to / connect to.
static char * address
GNS address for this phone.
void GNUNET_TRANSPORT_TESTING_transport_communicator_open_queue(struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h, const struct GNUNET_PeerIdentity *peer_id, const char *address)
Instruct communicator to open a queue.
char * c_address
Specifies supported addresses.
Time for relative time used by GNUnet, in microseconds.
Queue of a communicator and some context.
Bandwidth allocation API for the transport service.