aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-01-20 16:49:25 +0000
committerChristian Grothoff <christian@grothoff.org>2010-01-20 16:49:25 +0000
commitc18b4fced53673e250c587935c6ff692d3936aa6 (patch)
treead872e6eb3f898a78a002f7399dcc8ccd9552375 /src/include
parent7d9f187d106394b2451660294df9428eb50e82d7 (diff)
downloadgnunet-c18b4fced53673e250c587935c6ff692d3936aa6.tar.gz
gnunet-c18b4fced53673e250c587935c6ff692d3936aa6.zip
breaking stuff
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_transport_service.h78
1 files changed, 56 insertions, 22 deletions
diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h
index 344de582f..1c32f10f1 100644
--- a/src/include/gnunet_transport_service.h
+++ b/src/include/gnunet_transport_service.h
@@ -22,6 +22,10 @@
22 * @file include/gnunet_transport_service.h 22 * @file include/gnunet_transport_service.h
23 * @brief low-level P2P IO 23 * @brief low-level P2P IO
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 *
26 * TODO:
27 * - define API for blacklisting, un-blacklisting and notifications
28 * about blacklisted peers
25 */ 29 */
26 30
27#ifndef GNUNET_TRANSPORT_SERVICE_H 31#ifndef GNUNET_TRANSPORT_SERVICE_H
@@ -50,19 +54,21 @@ extern "C"
50 * Function called by the transport for each received message. 54 * Function called by the transport for each received message.
51 * 55 *
52 * @param cls closure 56 * @param cls closure
53 * @param latency estimated latency for communicating with the
54 * given peer
55 * @param peer (claimed) identity of the other peer 57 * @param peer (claimed) identity of the other peer
56 * @param message the message 58 * @param message the message
59 * @param latency estimated latency for communicating with the
60 * given peer (round-trip)
61 * @param distance in overlay hops, as given by transport plugin
57 */ 62 */
58typedef void (*GNUNET_TRANSPORT_ReceiveCallback) (void *cls, 63typedef void (*GNUNET_TRANSPORT_ReceiveCallback) (void *cls,
59 struct GNUNET_TIME_Relative
60 latency,
61 const struct 64 const struct
62 GNUNET_PeerIdentity * peer, 65 GNUNET_PeerIdentity * peer,
63 const struct 66 const struct
64 GNUNET_MessageHeader * 67 GNUNET_MessageHeader *
65 message); 68 message,
69 struct GNUNET_TIME_Relative
70 latency,
71 unsigned int distance);
66 72
67 73
68/** 74/**
@@ -77,12 +83,15 @@ struct GNUNET_TRANSPORT_Handle;
77 * 83 *
78 * @param cls closure 84 * @param cls closure
79 * @param peer the peer that connected 85 * @param peer the peer that connected
80 * @param latency current latency of the connection 86 * @param latency estimated latency for communicating with the
87 * given peer (round-trip)
88 * @param distance in overlay hops, as given by transport plugin
81 */ 89 */
82typedef void 90typedef void
83 (*GNUNET_TRANSPORT_NotifyConnect) (void *cls, 91 (*GNUNET_TRANSPORT_NotifyConnect) (void *cls,
84 const struct GNUNET_PeerIdentity * peer, 92 const struct GNUNET_PeerIdentity * peer,
85 struct GNUNET_TIME_Relative latency); 93 struct GNUNET_TIME_Relative latency,
94 unsigned int distance);
86 95
87/** 96/**
88 * Function called to notify transport users that another 97 * Function called to notify transport users that another
@@ -97,9 +106,16 @@ typedef void
97 peer); 106 peer);
98 107
99 108
109/**
110 * Function to call with a human-readable format of an address
111 *
112 * @param cls closure
113 * @param address NULL on error, otherwise 0-terminated printable UTF-8 string
114 */
100typedef void 115typedef void
101(*GNUNET_TRANSPORT_AddressLookUpCallback) (void *cls, 116(*GNUNET_TRANSPORT_AddressLookUpCallback) (void *cls,
102 const char *address); 117 const char *address);
118
103 119
104/** 120/**
105 * Connect to the transport service. Note that the connection may 121 * Connect to the transport service. Note that the connection may
@@ -111,6 +127,7 @@ typedef void
111 * @param rec receive function to call 127 * @param rec receive function to call
112 * @param nc function to call on connect events 128 * @param nc function to call on connect events
113 * @param nd function to call on disconnect events 129 * @param nd function to call on disconnect events
130 * @return NULL on error
114 */ 131 */
115struct GNUNET_TRANSPORT_Handle *GNUNET_TRANSPORT_connect (struct 132struct GNUNET_TRANSPORT_Handle *GNUNET_TRANSPORT_connect (struct
116 GNUNET_SCHEDULER_Handle 133 GNUNET_SCHEDULER_Handle
@@ -128,6 +145,8 @@ struct GNUNET_TRANSPORT_Handle *GNUNET_TRANSPORT_connect (struct
128 145
129/** 146/**
130 * Disconnect from the transport service. 147 * Disconnect from the transport service.
148 *
149 * @param handle handle returned from connect
131 */ 150 */
132void GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle); 151void GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle);
133 152
@@ -185,7 +204,7 @@ struct GNUNET_TRANSPORT_TransmitHandle
185 *handle, 204 *handle,
186 const struct GNUNET_PeerIdentity 205 const struct GNUNET_PeerIdentity
187 *target, size_t size, 206 *target, size_t size,
188 unsigned int priority, 207 unsigned int priority,
189 struct GNUNET_TIME_Relative 208 struct GNUNET_TIME_Relative
190 timeout, 209 timeout,
191 GNUNET_CONNECTION_TransmitReadyNotify 210 GNUNET_CONNECTION_TransmitReadyNotify
@@ -203,28 +222,42 @@ GNUNET_TRANSPORT_notify_transmit_ready_cancel (struct
203 *h); 222 *h);
204 223
205 224
225
226typedef void (*GNUNET_TRANSPORT_HelloUpdateCallback)(void *cls,
227 const struct GNUNET_MessageHeader *hello);
228
229
206/** 230/**
207 * Obtain the HELLO message for this peer. 231 * Obtain updates on changes to the HELLO message for this peer.
208 * 232 *
209 * @param handle connection to transport service 233 * @param handle connection to transport service
210 * @param timeout how long to wait for the HELLO 234 * @param rec function to call with the HELLO
211 * @param rec function to call with the HELLO, sender will be our peer
212 * identity; message and sender will be NULL on timeout
213 * (handshake with transport service pending/failed).
214 * cost estimate will be 0.
215 * @param rec_cls closure for rec 235 * @param rec_cls closure for rec
216 */ 236 */
217void 237void
218GNUNET_TRANSPORT_get_hello (struct GNUNET_TRANSPORT_Handle *handle, 238GNUNET_TRANSPORT_get_hello (struct GNUNET_TRANSPORT_Handle *handle,
219 struct GNUNET_TIME_Relative timeout, 239 GNUNET_TRANSPORT_HelloUpdateCallback rec,
220 GNUNET_TRANSPORT_ReceiveCallback rec,
221 void *rec_cls); 240 void *rec_cls);
222 241
223 242
224/** 243/**
244 * Stop receiving updates about changes to our HELLO message.
245 *
246 * @param handle connection to transport service
247 * @param rec function previously registered to be called with the HELLOs
248 * @param rec_cls closure for rec
249 */
250void
251GNUNET_TRANSPORT_get_hello_cancel (struct GNUNET_TRANSPORT_Handle *handle,
252 GNUNET_TRANSPORT_HelloUpdateCallback rec,
253 void *rec_cls);
254
255
256/**
225 * Offer the transport service the HELLO of another peer. Note that 257 * Offer the transport service the HELLO of another peer. Note that
226 * the transport service may just ignore this message if the HELLO is 258 * the transport service may just ignore this message if the HELLO is
227 * malformed or useless due to our local configuration. 259 * malformed or useless due to our local configuration. If the HELLO
260 * is working, we should add it to PEERINFO.
228 * 261 *
229 * @param handle connection to transport service 262 * @param handle connection to transport service
230 * @param hello the hello message 263 * @param hello the hello message
@@ -233,14 +266,16 @@ void
233GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle, 266GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle,
234 const struct GNUNET_MessageHeader *hello); 267 const struct GNUNET_MessageHeader *hello);
235 268
269
236/** 270/**
237 * Convert a binary address into a human 271 * Convert a binary address into a human readable address.
238 * readable address.
239 * 272 *
240 * @param sched scheduler to use 273 * @param sched scheduler to use
241 * @param cfg configuration to use 274 * @param cfg configuration to use
242 * @param address address to convert (binary format) 275 * @param address address to convert (binary format)
243 * @param addressLen number of bytes in address 276 * @param addressLen number of bytes in address
277 * @param numeric should (IP) addresses be displayed in numeric form
278 * (otherwise do reverse DNS lookup)
244 * @param nameTrans name of the transport to which the address belongs 279 * @param nameTrans name of the transport to which the address belongs
245 * @param timeout how long is the lookup allowed to take at most 280 * @param timeout how long is the lookup allowed to take at most
246 * @param aluc function to call with the results 281 * @param aluc function to call with the results
@@ -251,6 +286,7 @@ GNUNET_TRANSPORT_address_lookup (struct GNUNET_SCHEDULER_Handle *sched,
251 const struct GNUNET_CONFIGURATION_Handle *cfg, 286 const struct GNUNET_CONFIGURATION_Handle *cfg,
252 const char * address, 287 const char * address,
253 size_t addressLen, 288 size_t addressLen,
289 int numeric,
254 const char * nameTrans, 290 const char * nameTrans,
255 struct GNUNET_TIME_Relative timeout, 291 struct GNUNET_TIME_Relative timeout,
256 GNUNET_TRANSPORT_AddressLookUpCallback aluc, 292 GNUNET_TRANSPORT_AddressLookUpCallback aluc,
@@ -268,5 +304,3 @@ GNUNET_TRANSPORT_address_lookup (struct GNUNET_SCHEDULER_Handle *sched,
268/* ifndef GNUNET_TRANSPORT_SERVICE_H */ 304/* ifndef GNUNET_TRANSPORT_SERVICE_H */
269#endif 305#endif
270/* end of gnunet_transport_service.h */ 306/* end of gnunet_transport_service.h */
271
272