diff options
Diffstat (limited to 'src/mds-server/client.h')
-rw-r--r-- | src/mds-server/client.h | 211 |
1 files changed, 105 insertions, 106 deletions
diff --git a/src/mds-server/client.h b/src/mds-server/client.h index cf0aec6..b8c5533 100644 --- a/src/mds-server/client.h +++ b/src/mds-server/client.h @@ -31,110 +31,110 @@ -#define CLIENT_T_VERSION 0 +#define CLIENT_T_VERSION 0 /** * Client information structure */ typedef struct client { - /** - * The client's entry in the list of clients - */ - ssize_t list_entry; - - /** - * The socket file descriptor for the socket connected to the client - */ - int socket_fd; - - /** - * Whether the socket is open - */ - int open; - - /** - * Message read buffer for the client - */ - struct mds_message message; - - /** - * The read thread for the client - */ - pthread_t thread; - - /** - * The client's ID - */ - uint64_t id; - - /** - * Mutex for sending data and other - * actions that only affacts this client - */ - pthread_mutex_t mutex; - - /** - * Whether `mutex` has been initialised - */ - int mutex_created; - - /** - * The messages interception conditions conditions - * for the client - */ - struct interception_condition* interception_conditions; - - /** - * The number of interception conditions - */ - size_t interception_conditions_count; - - /** - * Pending multicast messages - */ - struct multicast* multicasts; - - /** - * The number of pending multicast messages - */ - size_t multicasts_count; - - /** - * Messages pending to be sent (concatenated) - */ - char* send_pending; - - /** - * The character length of the messages pending to be sent - */ - size_t send_pending_size; - - /** - * Pending reply to the multicast interception - */ - struct mds_message* modify_message; - - /** - * Mutex for `modify_message` - */ - pthread_mutex_t modify_mutex; - - /** - * Condidition for `modify_message` - */ - pthread_cond_t modify_cond; - - /** - * Whether `modify_mutex` has been initialised - */ - int modify_mutex_created; - - /** - * Whether `modify_cond` has been initialised - */ - int modify_cond_created; - + /** + * The client's entry in the list of clients + */ + ssize_t list_entry; + + /** + * The socket file descriptor for the socket connected to the client + */ + int socket_fd; + + /** + * Whether the socket is open + */ + int open; + + /** + * Message read buffer for the client + */ + struct mds_message message; + + /** + * The read thread for the client + */ + pthread_t thread; + + /** + * The client's ID + */ + uint64_t id; + + /** + * Mutex for sending data and other + * actions that only affacts this client + */ + pthread_mutex_t mutex; + + /** + * Whether `mutex` has been initialised + */ + int mutex_created; + + /** + * The messages interception conditions conditions + * for the client + */ + struct interception_condition *interception_conditions; + + /** + * The number of interception conditions + */ + size_t interception_conditions_count; + + /** + * Pending multicast messages + */ + struct multicast *multicasts; + + /** + * The number of pending multicast messages + */ + size_t multicasts_count; + + /** + * Messages pending to be sent (concatenated) + */ + char *send_pending; + + /** + * The character length of the messages pending to be sent + */ + size_t send_pending_size; + + /** + * Pending reply to the multicast interception + */ + struct mds_message *modify_message; + + /** + * Mutex for `modify_message` + */ + pthread_mutex_t modify_mutex; + + /** + * Condidition for `modify_message` + */ + pthread_cond_t modify_cond; + + /** + * Whether `modify_mutex` has been initialised + */ + int modify_mutex_created; + + /** + * Whether `modify_cond` has been initialised + */ + int modify_cond_created; + } client_t; @@ -156,7 +156,7 @@ typedef struct client * @param this Memory slot in which to store the new client information */ __attribute__((nonnull)) -void client_initialise(client_t* restrict this); +void client_initialise(client_t *restrict this); /** * Initialise fields that have to do with threading @@ -171,7 +171,7 @@ void client_initialise(client_t* restrict this); * @return Zero on success, -1 on error */ __attribute__((nonnull)) -int client_initialise_threading(client_t* restrict this); +int client_initialise_threading(client_t *restrict this); /** * Release all resources assoicated with a client @@ -179,7 +179,7 @@ int client_initialise_threading(client_t* restrict this); * @param this The client information */ __attribute__((nonnull)) -void client_destroy(client_t* restrict this); +void client_destroy(client_t *restrict this); /** * Calculate the buffer size need to marshal client information @@ -188,7 +188,7 @@ void client_destroy(client_t* restrict this); * @return The number of bytes to allocate to the output buffer */ __attribute__((pure, nonnull)) -size_t client_marshal_size(const client_t* restrict this); +size_t client_marshal_size(const client_t *restrict this); /** * Marshals client information @@ -198,7 +198,7 @@ size_t client_marshal_size(const client_t* restrict this); * @return The number of bytes that have been written (everything will be written) */ __attribute__((nonnull)) -size_t client_marshal(const client_t* restrict this, char* restrict data); +size_t client_marshal(const client_t *restrict this, char *restrict data); /** * Unmarshals client information @@ -209,7 +209,7 @@ size_t client_marshal(const client_t* restrict this, char* restrict data); * number of read bytes. Destroy the client information on error. */ __attribute__((nonnull)) -size_t client_unmarshal(client_t* restrict this, char* restrict data); +size_t client_unmarshal(client_t *restrict this, char *restrict data); /** * Pretend to unmarshal client information @@ -218,8 +218,7 @@ size_t client_unmarshal(client_t* restrict this, char* restrict data); * @return The number of read bytes */ __attribute__((pure, nonnull)) -size_t client_unmarshal_skip(char* restrict data); +size_t client_unmarshal_skip(char *restrict data); #endif - |