/*
This file is part of GNUnet.
- (C) 2009-2013 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2009-2013 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
/**
- * @file include/gnunet_server_lib.h
- * @brief library for building GNUnet network servers
* @author Christian Grothoff
- * @defgroup server functions for a server that communicates with clients
+ *
+ * @file
+ * Library for building GNUnet network servers
+
+ * @defgroup server Server library
+ * Library for building GNUnet network servers
+ *
+ * Provides functions for a server that communicates with clients.
+ *
+ * @see [Documentation](https://gnunet.org/ipc)
+ *
* @{
*/
* @param client identification of the client
* @param message the actual message
*/
-typedef void (*GNUNET_SERVER_MessageCallback) (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader
- *message);
+typedef void
+(*GNUNET_SERVER_MessageCallback) (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message);
/**
/**
* Create a new server.
*
- * @param access function for access control
- * @param access_cls closure for @a access
+ * @param access_cb function for access control
+ * @param access_cb_cls closure for @a access_cb
* @param lsocks NULL-terminated array of listen sockets
* @param idle_timeout after how long should we timeout idle connections?
* @param require_found if #GNUNET_YES, connections sending messages of unknown type
* (typically, "port" already in use)
*/
struct GNUNET_SERVER_Handle *
-GNUNET_SERVER_create_with_sockets (GNUNET_CONNECTION_AccessCheck access,
- void *access_cls,
+GNUNET_SERVER_create_with_sockets (GNUNET_CONNECTION_AccessCheck access_cb,
+ void *access_cb_cls,
struct GNUNET_NETWORK_Handle **lsocks,
struct GNUNET_TIME_Relative idle_timeout,
int require_found);
/**
* Create a new server.
*
- * @param access function for access control
- * @param access_cls closure for @a access
+ * @param access_cb function for access control
+ * @param access_cb_cls closure for @a access_cb
* @param server_addr address toes listen on (including port), NULL terminated array
* @param socklen lengths of respective @a server_addr
* @param idle_timeout after how long should we timeout idle connections?
* (typically, "port" already in use)
*/
struct GNUNET_SERVER_Handle *
-GNUNET_SERVER_create (GNUNET_CONNECTION_AccessCheck access, void *access_cls,
+GNUNET_SERVER_create (GNUNET_CONNECTION_AccessCheck access_cb,
+ void *access_cb_cls,
struct sockaddr *const *server_addr,
const socklen_t * socklen,
struct GNUNET_TIME_Relative idle_timeout,
* @param server the server to use
* @param connection the connection to manage (client must
* stop using this connection from now on)
- * @return the client handle (client should call
- * #GNUNET_SERVER_client_drop on the return value eventually)
+ * @return the client handle
*/
struct GNUNET_SERVER_Client *
GNUNET_SERVER_connect_socket (struct GNUNET_SERVER_Handle *server,
* @param client identification of the client; NULL
* for the last call when the server is destroyed
*/
-typedef void (*GNUNET_SERVER_DisconnectCallback) (void *cls,
- struct GNUNET_SERVER_Client *client);
+typedef void
+(*GNUNET_SERVER_DisconnectCallback) (void *cls,
+ struct GNUNET_SERVER_Client *client);
/**
* @param cls closure
* @param client identification of the client
*/
-typedef void (*GNUNET_SERVER_ConnectCallback) (void *cls,
- struct GNUNET_SERVER_Client *client);
+typedef void
+(*GNUNET_SERVER_ConnectCallback) (void *cls,
+ struct GNUNET_SERVER_Client *client);
/**
GNUNET_SERVER_notification_context_get_size (struct GNUNET_SERVER_NotificationContext *nc);
+/**
+ * Create a message queue for a server's client.
+ *
+ * @param client the client
+ * @return the message queue
+ */
+struct GNUNET_MQ_Handle *
+GNUNET_MQ_queue_for_server_client (struct GNUNET_SERVER_Client *client);
+
+
/**
* Handle to a message stream tokenizer.
*/
* @param client handle to client the tokenzier will be used for
* @return handle to custom tokenizer ('mst')
*/
-typedef void* (*GNUNET_SERVER_MstCreateCallback) (void *cls,
- struct GNUNET_SERVER_Client *client);
+typedef void*
+(*GNUNET_SERVER_MstCreateCallback) (void *cls,
+ struct GNUNET_SERVER_Client *client);
/**
* @param cls closure from #GNUNET_SERVER_set_callbacks
* @param mst custom tokenizer handle
*/
-typedef void (*GNUNET_SERVER_MstDestroyCallback) (void *cls, void *mst);
+typedef void
+(*GNUNET_SERVER_MstDestroyCallback) (void *cls,
+ void *mst);
/**
* #GNUNET_NO if one_shot was set and we have another message ready
* #GNUNET_SYSERR if the data stream is corrupt
*/
-typedef int (*GNUNET_SERVER_MstReceiveCallback) (void *cls, void *mst,
- struct GNUNET_SERVER_Client *client,
- const char *buf, size_t size,
- int purge, int one_shot);
+typedef int
+(*GNUNET_SERVER_MstReceiveCallback) (void *cls, void *mst,
+ struct GNUNET_SERVER_Client *client,
+ const char *buf,
+ size_t size,
+ int purge,
+ int one_shot);
/**
}
#endif
-/** @} */ /* end of group server */
-
/* ifndef GNUNET_SERVER_LIB_H */
#endif
+
+/** @} */ /* end of group server */
+
/* end of gnunet_server_lib.h */