]> git.cworth.org Git - ttt/blobdiff - src/ttt-server.h
2005-11-15 Carl Worth <cworth@cworth.org>
[ttt] / src / ttt-server.h
index b8d2496e2149d44285b302a14d6fb28da13714a7..77fb4bf79df7c023a2f971b27015131b8e7e09e9 100644 (file)
 #ifndef _TTT_SERVER_H_
 #define _TTT_SERVER_H_
 
-typedef struct _ttt_server ttt_server_t;
+/* Register a new client with the server.
+ *
+ * Returns: the unique id of the client.
+ *
+ * Locking: The server mutex will be acquired and held throughout the
+ * execution of this function.
+ *
+ * Errors: If an error (such as out-of-memory) occurs, this function
+ * will not return.
+ */
+int
+ttt_server_register_client (ttt_server_t *server, ttt_client_t *client);
 
-/* Send a message to all connected clients. */
+/* Un-register a client from the server.
+ *
+ * Locking: The server mutex will be acquired and held throughout the
+ * execution of this function.
+ */
+void
+ttt_server_unregister_client (ttt_server_t *server, ttt_client_t *client);
+
+/* Send a message to all connected clients.
+ *
+ * Locking: The server mutex will be acquired and held throughout the
+ * execution of this function. Each client mutex may also be acquired
+ * and held by functions called during the execution of this function.
+ *
+ * Errors: If an error such as an IO error occurs, this function will
+ * not return.
+ */
 void
 ttt_server_broadcast (ttt_server_t *server, const char *message);