functions and structures related to testing-tng More...
#include "platform.h"#include "gnunet_util_lib.h"#include "gnunet_pils_service.h"#include "gnunet_transport_communication_service.h"#include "transport.h"Go to the source code of this file.
Data Structures | |
| struct | GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle |
| Handle to a transport communicator. More... | |
Typedefs | |
| typedef 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. | |
| typedef void(* | GNUNET_TRANSPORT_TESTING_PeerIdCallback) (void *cls, struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h, const struct GNUNET_PeerIdentity *peer_id) |
| Function signature for callbacks that are called once the peer identity of the peer this communicator belongs to is known. | |
| typedef 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. | |
| typedef 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. | |
| typedef 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. | |
| typedef 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. | |
| typedef 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. | |
functions and structures related to testing-tng
Definition in file transport-testing-communicator.h.
| typedef 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.
| cls | Closure |
| msg | Backchannel message |
| pid | Target peer |
Definition at line 1 of file transport-testing-communicator.h.
| typedef void(* GNUNET_TRANSPORT_TESTING_PeerIdCallback) (void *cls, struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h, const struct GNUNET_PeerIdentity *peer_id) |
Function signature for callbacks that are called once the peer identity of the peer this communicator belongs to is known.
The peer identity is derived at runtime by PILS, so it is not known when the communicator is started. It may also change later on, in which case this callback is invoked again.
| cls | Closure |
| tc_h | Communicator handle |
| peer_id | the (new) peer identity of this peer |
Definition at line 72 of file transport-testing-communicator.h.
| typedef 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.
| cls | Closure |
| tc_h | Communicator handle |
| cc | Characteristics of communicator |
| address_prefix | Prefix of the address |
Definition at line 90 of file transport-testing-communicator.h.
| typedef 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.
| cls | Closure |
| tc_h | Communicator handle |
| address | Address represented as string |
| expiration | Expiration |
| aid | Aid |
| nt | Network Type |
Definition at line 111 of file transport-testing-communicator.h.
| typedef 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.
| cls | Closure |
| tc_h | Communicator handle |
| will_try | GNUNET_YES if communicator will try to create queue |
Definition at line 130 of file transport-testing-communicator.h.
| typedef 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.
| cls | Closure |
| tc_h | Communicator handle |
| tc_queue | Handle to newly opened queue |
Definition at line 145 of file transport-testing-communicator.h.
| typedef 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.
| cls | Closure |
| tc_h | Handle to the receiving communicator |
| msg | Received message |
Definition at line 163 of file transport-testing-communicator.h.
| struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle * GNUNET_TRANSPORT_TESTING_transport_communicator_service_start | ( | const char * | service_name, |
| const char * | binary_name, | ||
| const char * | cfg_filename, | ||
| GNUNET_TRANSPORT_TESTING_PeerIdCallback | peer_id_cb, | ||
| 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.
Also starts the PILS service of that peer. The peer identity is not known when this function returns; it is reported via peer_id_cb.
| service_name | Name of the service |
| cfg | Configuration handle |
| peer_id_cb | Callback handling the peer identity assigned by PILS |
| communicator_available | Callback that is called when a new communicator becomes available |
| add_address_cb | Callback handling new addresses |
| queue_create_reply_cb | Callback handling success of queue requests |
| add_queue_cb | Callback handling freshly created queues |
| incoming_message_cb | Callback handling incoming messages |
| cb_cls | Closure to communicator_available |
| service_name | Name of the service |
| cfg | Configuration handle |
| peer_id_cb | Callback that is called once PILS assigned a peer identity |
| communicator_available_cb | Callback that is called when a new |
| add_address_cb | Callback that is called when a new communicator becomes available |
| cb_cls | Closure to communicator_available_cb and |
Definition at line 1034 of file transport-testing-communicator.c.
References _, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::add_address_cb, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::add_queue_cb, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::bc_cb, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::bc_enabled, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::cb_cls, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::cfg, cfg_filename, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::cfg_filename, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::communicator_available_cb, communicator_start(), GNUNET_break, GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_destroy(), GNUNET_CONFIGURATION_get_value_yesno(), GNUNET_CONFIGURATION_load(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_new, GNUNET_NO, GNUNET_OS_project_data_gnunet(), GNUNET_PILS_connect(), GNUNET_strdup, GNUNET_SYSERR, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::have_peer_id, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::incoming_msg_cb, LOG, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::nat_proc, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::peer_id_cb, pid_change_cb(), GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::pils, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::pils_proc, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::ps_proc, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::queue_create_reply_cb, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::resolver_proc, service_start(), GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::stat_proc, and transport_communicator_start().
| void GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop | ( | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle * | tc_h | ) |
Definition at line 1114 of file transport-testing-communicator.c.
References GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::c_addr_prefix, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::c_address, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::c_proc, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::cfg, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::cfg_filename, GNUNET_CONFIGURATION_destroy(), GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_PILS_disconnect(), GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::nat_proc, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::pils, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::pils_proc, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::ps_proc, queue(), GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::queue_head, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::queue_tail, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::resolver_proc, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::sh, shutdown_communicator(), shutdown_nat(), shutdown_peerstore(), shutdown_pils(), shutdown_resolver(), shutdown_service(), shutdown_statistics(), GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::stat_proc, and GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue::tc_h.
| 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.
| tc_h | Handle to communicator which shall open queue |
| peer_id | Towards which peer |
| address | For which address |
Definition at line 1151 of file transport-testing-communicator.c.
References address, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::c_mq, env, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_HELLO_address_to_prefix(), GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, LOG, msg, GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue::open_queue_env, peer_id, GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue::peer_id, prefix, GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue::qid, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::queue_head, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::queue_tail, and GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue::tc_h.
| 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.
| tc_queue | The queue to use for sending |
| cont | function to call when done sending |
| cont_cls | closure for cont |
| payload | Data to send |
| payload_size | Size of the payload |
Definition at line 1197 of file transport-testing-communicator.c.
References GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::c_mq, env, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSAGE_TYPE_DUMMY, GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG, GNUNET_MQ_msg_extra, GNUNET_MQ_notify_sent(), GNUNET_MQ_send(), GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED, LOG, mh, GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue::mid, msg, GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue::mtu, GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue::next, payload, GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue::peer_id, GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue::priority, GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue::q_len, GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue::qid, GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle::queue_head, and GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue::tc_h.