X-Git-Url: https://git.cworth.org/git?p=ttt;a=blobdiff_plain;f=src%2Fttt-client.h;h=ef74b87760d893acfaaf671dd6470a3b4c9baf2d;hp=b067674fdbc7b2fb7e1696d28462747b38e1fbe5;hb=907321c065fb1383e800f0794981df91d4327f57;hpb=5d56d3cd8b4685e905ed604277ac9cb32c876127 diff --git a/src/ttt-client.h b/src/ttt-client.h index b067674..ef74b87 100644 --- a/src/ttt-client.h +++ b/src/ttt-client.h @@ -21,30 +21,28 @@ #include "ttt.h" -#include "ttt-server.h" - #ifndef _TTT_CLIENT_H_ #define _TTT_CLIENT_H_ -typedef struct _ttt_client ttt_client_t; +#define TTT_CLIENT_BUF_SIZE 1024 + +/* Create a new client and start a new thread to handle all requests + * from the client. */ +void +ttt_client_new (void *closure, int client_socket); -/* Create a new ttt_client_t for the given server and given a - * connected socket. +/* Send a message to a client. * - * Returns: A new ttt_client_t. Call ttt_client_destroy when finished - * with it. + * Locking: The client mutex will be acquired and held throughout the + * execution of this function. * - * Errors: If any error occurs, (such as out-of-memory), this function - * will not return. + * Errors: If an IO error occurs, 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); +ttt_client_send (ttt_client_t *client, const char *message); -/* Loop forever handling client requests. Never returns. */ -void -ttt_client_handle_requests (ttt_client_t *client); +/* Get a client's unique ID. */ +int +ttt_client_get_id (ttt_client_t *client); #endif /* _TTT_CLIENT_H_ */