]> git.cworth.org Git - ttt/blobdiff - src/ttt-client.h
2005-11-11 Carl Worth <cworth@cworth.org>
[ttt] / src / ttt-client.h
diff --git a/src/ttt-client.h b/src/ttt-client.h
new file mode 100644 (file)
index 0000000..b067674
--- /dev/null
@@ -0,0 +1,50 @@
+/* ttt-client.c - client handling code for tic-tac-toe game server
+ *
+ * Copyright © 2005 Carl Worth
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Author: Carl Worth <cworth@cworth.org>
+ */
+
+#include "ttt.h"
+
+#include "ttt-server.h"
+
+#ifndef _TTT_CLIENT_H_
+#define _TTT_CLIENT_H_
+
+typedef struct _ttt_client ttt_client_t;
+
+/* Create a new ttt_client_t for the given server and given a
+ * connected socket.
+ *
+ * Returns: A new ttt_client_t. Call ttt_client_destroy when finished
+ * with it.
+ *
+ * Errors: If any error occurs, (such as out-of-memory), this function
+ * will not return.
+ */
+ttt_client_t *
+ttt_client_create (ttt_server_t *server, int socket);
+
+void
+ttt_client_destroy (ttt_client_t *client);
+
+/* Loop forever handling client requests. Never returns. */
+void
+ttt_client_handle_requests (ttt_client_t *client);
+
+#endif /* _TTT_CLIENT_H_ */