aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-01-18 09:00:05 +0000
committerChristian Grothoff <christian@grothoff.org>2010-01-18 09:00:05 +0000
commit53840e9a81994acd8dc4c0cb1c54a0d4764667c3 (patch)
tree317eb98e7e6ab6472d5700c0db2de84913489bce /src/include
parente67ade17fc2bf555af625863dab525f909b310f2 (diff)
downloadgnunet-53840e9a81994acd8dc4c0cb1c54a0d4764667c3.tar.gz
gnunet-53840e9a81994acd8dc4c0cb1c54a0d4764667c3.zip
making peer_configure API cancellable
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_core_service.h58
-rw-r--r--src/include/gnunet_protocols.h13
2 files changed, 30 insertions, 41 deletions
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h
index dbe39d0d7..c520b5b7d 100644
--- a/src/include/gnunet_core_service.h
+++ b/src/include/gnunet_core_service.h
@@ -63,25 +63,6 @@ typedef void (*GNUNET_CORE_ClientEventHandler) (void *cls,
63 63
64 64
65/** 65/**
66 * Type of a send callback to fill up buffers.
67 *
68 * @param receiver the receiver of the message
69 * @param position is the reference to the
70 * first unused position in the buffer where GNUnet is building
71 * the message
72 * @param padding is the number of bytes left in that buffer.
73 * @return the number of bytes written to
74 * that buffer (must be a positive number).
75 */
76typedef unsigned int
77 (*GNUNET_CORE_BufferFillCallback) (void *cls,
78 const struct GNUNET_PeerIdentity *
79 receiver,
80 void *position,
81 size_t padding);
82
83
84/**
85 * Functions with this signature are called whenever a message is 66 * Functions with this signature are called whenever a message is
86 * received or transmitted. 67 * received or transmitted.
87 * 68 *
@@ -159,7 +140,6 @@ typedef void
159 * connected to the core service; note that timeout is only meaningful if init is not NULL 140 * connected to the core service; note that timeout is only meaningful if init is not NULL
160 * @param connects function to call on peer connect, can be NULL 141 * @param connects function to call on peer connect, can be NULL
161 * @param disconnects function to call on peer disconnect / timeout, can be NULL 142 * @param disconnects function to call on peer disconnect / timeout, can be NULL
162 * @param bfc function to call to fill up spare bandwidth, can be NULL
163 * @param inbound_notify function to call for all inbound messages, can be NULL 143 * @param inbound_notify function to call for all inbound messages, can be NULL
164 * @param inbound_hdr_only set to GNUNET_YES if inbound_notify will only read the 144 * @param inbound_hdr_only set to GNUNET_YES if inbound_notify will only read the
165 * GNUNET_MessageHeader and hence we do not need to give it the full message; 145 * GNUNET_MessageHeader and hence we do not need to give it the full message;
@@ -180,7 +160,6 @@ GNUNET_CORE_connect (struct GNUNET_SCHEDULER_Handle *sched,
180 GNUNET_CORE_StartupCallback init, 160 GNUNET_CORE_StartupCallback init,
181 GNUNET_CORE_ClientEventHandler connects, 161 GNUNET_CORE_ClientEventHandler connects,
182 GNUNET_CORE_ClientEventHandler disconnects, 162 GNUNET_CORE_ClientEventHandler disconnects,
183 GNUNET_CORE_BufferFillCallback bfc,
184 GNUNET_CORE_MessageCallback inbound_notify, 163 GNUNET_CORE_MessageCallback inbound_notify,
185 int inbound_hdr_only, 164 int inbound_hdr_only,
186 GNUNET_CORE_MessageCallback outbound_notify, 165 GNUNET_CORE_MessageCallback outbound_notify,
@@ -219,10 +198,17 @@ typedef void
219 unsigned long long preference); 198 unsigned long long preference);
220 199
221 200
201
202/**
203 * Context that can be used to cancel a peer information request.
204 */
205struct GNUNET_CORE_InformationRequestContext;
206
222/** 207/**
223 * Obtain statistics and/or change preferences for the given peer. 208 * Obtain statistics and/or change preferences for the given peer.
224 * 209 *
225 * @param handle connection to core to use 210 * @param sched scheduler to use
211 * @param cfg configuration to use
226 * @param peer identifies the peer 212 * @param peer identifies the peer
227 * @param timeout after how long should we give up (and call "info" with NULL 213 * @param timeout after how long should we give up (and call "info" with NULL
228 * for "peer" to signal an error)? 214 * for "peer" to signal an error)?
@@ -241,17 +227,27 @@ typedef void
241 * to all connected peers 227 * to all connected peers
242 * @param info function to call with the resulting configuration information 228 * @param info function to call with the resulting configuration information
243 * @param info_cls closure for info 229 * @param info_cls closure for info
230 * @return NULL on error
231 */
232struct GNUNET_CORE_InformationRequestContext *
233GNUNET_CORE_peer_get_info (struct GNUNET_SCHEDULER_Handle *sched,
234 const struct GNUNET_CONFIGURATION_Handle *cfg,
235 const struct GNUNET_PeerIdentity *peer,
236 struct GNUNET_TIME_Relative timeout,
237 uint32_t bpm_out,
238 int32_t amount,
239 uint64_t preference,
240 GNUNET_CORE_PeerConfigurationInfoCallback info,
241 void *info_cls);
242
243
244/**
245 * Cancel request for getting information about a peer.
246 *
247 * @param irc context returned by the original GNUNET_CORE_peer_get_info call
244 */ 248 */
245// FIXME: should return handle for cancellation!
246void 249void
247GNUNET_CORE_peer_configure (struct GNUNET_CORE_Handle *handle, 250GNUNET_CORE_peer_get_info_cancel (struct GNUNET_CORE_InformationRequestContext *irc);
248 const struct GNUNET_PeerIdentity *peer,
249 struct GNUNET_TIME_Relative timeout,
250 unsigned int bpm_out,
251 int amount,
252 unsigned long long preference,
253 GNUNET_CORE_PeerConfigurationInfoCallback info,
254 void *info_cls);
255 251
256 252
257/** 253/**
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 8f966c737..51442958c 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -276,7 +276,7 @@ extern "C"
276/** 276/**
277 * Request from client to "configure" P2P connection. 277 * Request from client to "configure" P2P connection.
278 */ 278 */
279#define GNUNET_MESSAGE_TYPE_CORE_REQUEST_CONFIGURE 70 279#define GNUNET_MESSAGE_TYPE_CORE_REQUEST_INFO 70
280 280
281/** 281/**
282 * Response from server about (possibly updated) P2P 282 * Response from server about (possibly updated) P2P
@@ -285,16 +285,9 @@ extern "C"
285#define GNUNET_MESSAGE_TYPE_CORE_CONFIGURATION_INFO 71 285#define GNUNET_MESSAGE_TYPE_CORE_CONFIGURATION_INFO 71
286 286
287/** 287/**
288 * Solicitation from server for transmission (may have 288 * Request from client with message to transmit.
289 * been requested or also be transmitted without
290 * client's request).
291 */ 289 */
292#define GNUNET_MESSAGE_TYPE_CORE_SOLICIT_TRAFFIC 72 290#define GNUNET_MESSAGE_TYPE_CORE_SEND 72
293
294/**
295 * Response from client with message to transmit.
296 */
297#define GNUNET_MESSAGE_TYPE_CORE_SEND 73
298 291
299 292
300/** 293/**