aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport-testing2.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/transport-testing2.h')
-rw-r--r--src/transport/transport-testing2.h87
1 files changed, 81 insertions, 6 deletions
diff --git a/src/transport/transport-testing2.h b/src/transport/transport-testing2.h
index 83d98baab..fbc1927d9 100644
--- a/src/transport/transport-testing2.h
+++ b/src/transport/transport-testing2.h
@@ -20,7 +20,7 @@
20 20
21/** 21/**
22 * @file transport/transport-testing2.h 22 * @file transport/transport-testing2.h
23 * @brief functions related to testing-tng 23 * @brief functions and structures related to testing-tng
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 * @author Julius Bünger 25 * @author Julius Bünger
26 */ 26 */
@@ -30,17 +30,32 @@
30#include "transport.h" 30#include "transport.h"
31 31
32 32
33/**
34 * @brief Handle to a transport communicator
35 */
33struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle; 36struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle;
34 37
38
39/**
40 * @brief Queue of a communicator and some context
41 */
35struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue; 42struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue;
36 43
44
45/**
46 * @brief Handle/Context to a single transmission
47 */
37struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorTransmission; 48struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorTransmission;
38 49
50
39/** 51/**
40 * @brief Function signature for callbacks that are called when new communicators become available 52 * @brief Function signature for callbacks that are called when new
53 * communicators become available
41 * 54 *
42 * @param Closure 55 * @param cls Closure
43 * @param msg Message 56 * @param tc_h Communicator handle
57 * @param cc Characteristics of communicator
58 * @param address_prefix Prefix of the address
44 */ 59 */
45typedef void 60typedef void
46(*GNUNET_TRANSPORT_TESTING_CommunicatorAvailableCallback)(void *cls, 61(*GNUNET_TRANSPORT_TESTING_CommunicatorAvailableCallback)(void *cls,
@@ -49,6 +64,16 @@ typedef void
49 char *address_prefix); 64 char *address_prefix);
50 65
51 66
67/**
68 * @brief Receive information about the address of a communicator.
69 *
70 * @param cls Closure
71 * @param tc_h Communicator handle
72 * @param address Address represented as string
73 * @param expiration Expiration
74 * @param aid Aid
75 * @param nt Network Type
76 */
52typedef void 77typedef void
53(*GNUNET_TRANSPORT_TESTING_AddAddressCallback)(void *cls, 78(*GNUNET_TRANSPORT_TESTING_AddAddressCallback)(void *cls,
54 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h, 79 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h,
@@ -58,12 +83,26 @@ typedef void
58 enum GNUNET_NetworkType nt); 83 enum GNUNET_NetworkType nt);
59 84
60 85
86/**
87 * @brief Get informed about the success of a queue request.
88 *
89 * @param cls Closure
90 * @param tc_h Communicator handle
91 * @param will_try #GNUNET_YES if communicator will try to create queue
92 */
61typedef void 93typedef void
62(*GNUNET_TRANSPORT_TESTING_QueueCreateReplyCallback)(void *cls, 94(*GNUNET_TRANSPORT_TESTING_QueueCreateReplyCallback)(void *cls,
63 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h, 95 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h,
64 int will_try); 96 int will_try);
65 97
66 98
99/**
100 * @brief Handle opening of queue
101 *
102 * @param cls Closure
103 * @param tc_h Communicator handle
104 * @param tc_queue Handle to newly opened queue
105 */
67typedef void 106typedef void
68(*GNUNET_TRANSPORT_TESTING_AddQueueCallback)(void *cls, 107(*GNUNET_TRANSPORT_TESTING_AddQueueCallback)(void *cls,
69 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h, 108 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h,
@@ -71,33 +110,69 @@ typedef void
71 110
72 111
73/** 112/**
113 * @brief Handle an incoming message
114 *
115 * @param cls Closure
116 * @param tc_h Handle to the receiving communicator
117 * @param msg Received message
118 */
119typedef void
120(*GNUNET_TRANSPORT_TESTING_IncomingMessageCallback)(void *cls,
121 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h,
122 const struct GNUNET_MessageHeader *msg);
123
124
125/**
74 * @brief Start communicator part of transport service and communicator 126 * @brief Start communicator part of transport service and communicator
75 * 127 *
76 * @param service_name Name of the service 128 * @param service_name Name of the service
77 * @param cfg Configuration handle 129 * @param cfg Configuration handle
78 * @param communicator_available Callback that is called when a new 130 * @param communicator_available Callback that is called when a new
79 * communicator becomes available 131 * communicator becomes available
132 * @param add_address_cb Callback handling new addresses
133 * @param queue_create_reply_cb Callback handling success of queue requests
134 * @param add_queue_cb Callback handling freshly created queues
135 * @param incoming_message_cb Callback handling incoming messages
80 * @param cb_cls Closure to @p communicator_available 136 * @param cb_cls Closure to @p communicator_available
81 * 137 *
82 * @return Handle to the communicator duo 138 * @return Handle to the communicator duo
83 */ 139 */
84struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle * 140struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *
85GNUNET_TRANSPORT_TESTING_transport_communicator_service_start 141GNUNET_TRANSPORT_TESTING_transport_communicator_service_start (
86 (const char *service_name, 142 const char *service_name,
87 const char *binary_name, 143 const char *binary_name,
88 const char *cfg_filename, 144 const char *cfg_filename,
89 GNUNET_TRANSPORT_TESTING_CommunicatorAvailableCallback communicator_available_cb, 145 GNUNET_TRANSPORT_TESTING_CommunicatorAvailableCallback communicator_available_cb,
90 GNUNET_TRANSPORT_TESTING_AddAddressCallback add_address_cb, 146 GNUNET_TRANSPORT_TESTING_AddAddressCallback add_address_cb,
91 GNUNET_TRANSPORT_TESTING_QueueCreateReplyCallback queue_create_reply_cb, 147 GNUNET_TRANSPORT_TESTING_QueueCreateReplyCallback queue_create_reply_cb,
92 GNUNET_TRANSPORT_TESTING_AddQueueCallback add_queue_cb, 148 GNUNET_TRANSPORT_TESTING_AddQueueCallback add_queue_cb,
149 GNUNET_TRANSPORT_TESTING_IncomingMessageCallback incoming_message_cb,
93 void *cb_cls); 150 void *cb_cls);
94 151
152
153/**
154 * @brief Instruct communicator to open a queue
155 *
156 * @param tc_h Handle to communicator which shall open queue
157 * @param peer_id Towards which peer
158 * @param address For which address
159 */
95void 160void
96GNUNET_TRANSPORT_TESTING_transport_communicator_open_queue 161GNUNET_TRANSPORT_TESTING_transport_communicator_open_queue
97 (struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h, 162 (struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h,
98 const struct GNUNET_PeerIdentity *peer_id, 163 const struct GNUNET_PeerIdentity *peer_id,
99 const char *address); 164 const char *address);
100 165
166
167/**
168 * @brief Instruct communicator to send data
169 *
170 * @param tc_queue The queue to use for sending
171 * @param payload Data to send
172 * @param payload_size Size of the payload
173 *
174 * @return Handle to the transmission
175 */
101struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorTransmission * 176struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorTransmission *
102GNUNET_TRANSPORT_TESTING_transport_communicator_send 177GNUNET_TRANSPORT_TESTING_transport_communicator_send
103 (struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue, 178 (struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue,