1 /* ttt-server.c - tic-tac-toe game server
3 * Copyright © 2005 Carl Worth
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 * Author: Carl Worth <cworth@cworth.org>
24 #ifndef _TTT_SERVER_H_
25 #define _TTT_SERVER_H_
27 /* Register a new client with the server.
29 * Returns: the unique id of the client.
31 * Locking: The server mutex will be acquired and held throughout the
32 * execution of this function.
34 * Errors: If an error (such as out-of-memory) occurs, this function
38 ttt_server_register_client (ttt_server_t *server, ttt_client_t *client);
40 /* Un-register a client from the server.
42 * Locking: The server mutex will be acquired and held throughout the
43 * execution of this function.
46 ttt_server_unregister_client (ttt_server_t *server, ttt_client_t *client);
48 /* Send a message to all connected clients.
50 * Locking: The server mutex will be acquired and held throughout the
51 * execution of this function. Each client mutex may also be acquired
52 * and held by functions called during the execution of this function.
54 * Errors: If an error such as an IO error occurs, this function will
58 ttt_server_broadcast (ttt_server_t *server, const char *message);
60 #endif /* _TTT_SERVER_H_ */