aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_server_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-07-11 22:18:17 +0000
committerChristian Grothoff <christian@grothoff.org>2013-07-11 22:18:17 +0000
commit57be99113715a6023164633556ea1de50ceae6e1 (patch)
treebe1c6003207ec50b17483267f21ad10cbc85d976 /src/include/gnunet_server_lib.h
parent4f0cfaff0e3e5cc0c59801279714cb0467fc0385 (diff)
downloadgnunet-57be99113715a6023164633556ea1de50ceae6e1.tar.gz
gnunet-57be99113715a6023164633556ea1de50ceae6e1.zip
-adding API to associated user context with a server's client to avoid ugly hacks, such as linked list searches and casting pointers to integers (thanks to Peter-Vogginger for forcing me to fix this)
Diffstat (limited to 'src/include/gnunet_server_lib.h')
-rw-r--r--src/include/gnunet_server_lib.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/include/gnunet_server_lib.h b/src/include/gnunet_server_lib.h
index f7b526416..e9137154b 100644
--- a/src/include/gnunet_server_lib.h
+++ b/src/include/gnunet_server_lib.h
@@ -297,6 +297,52 @@ GNUNET_SERVER_client_set_timeout (struct GNUNET_SERVER_Client *client,
297 struct GNUNET_TIME_Relative timeout); 297 struct GNUNET_TIME_Relative timeout);
298 298
299 299
300
301/**
302 * Return user context associated with the given client.
303 * Note: you should probably use the macro (call without the underscore).
304 *
305 * @param client client to query
306 * @param size number of bytes in user context struct (for verification only)
307 * @return pointer to user context
308 */
309void *
310GNUNET_SERVER_client_get_user_context_ (struct GNUNET_SERVER_Client *client,
311 size_t size);
312
313
314/**
315 * Set user context to be associated with the given client.
316 * Note: you should probably use the macro (call without the underscore).
317 *
318 * @param client client to query
319 * @param ptr pointer to user context
320 * @param size number of bytes in user context struct (for verification only)
321 */
322void
323GNUNET_SERVER_client_set_user_context_ (struct GNUNET_SERVER_Client *client,
324 void *ptr,
325 size_t size);
326
327
328/**
329 * Return user context associated with the given client.
330 *
331 * @param client client to query
332 * @param type expected return type (i.e. 'struct Foo')
333 * @return pointer to user context of type 'type *'.
334 */
335#define GNUNET_SERVER_client_get_user_context(client,type) (type *) GNUNET_SERVER_client_get_user_context_ (client, sizeof (type))
336
337/**
338 * Set user context to be associated with the given client.
339 *
340 * @param client client to query
341 * @param ptr pointer to user context
342 */
343#define GNUNET_SERVER_client_set_user_context(client,value) GNUNET_SERVER_client_set_user_context_ (client, value, sizeof (*value))
344
345
300/** 346/**
301 * Disable the warning the server issues if a message is not acknowledged 347 * Disable the warning the server issues if a message is not acknowledged
302 * in a timely fashion. Use this call if a client is intentionally delayed 348 * in a timely fashion. Use this call if a client is intentionally delayed