Some code cleanup

This commit is contained in:
Igor Socec 2016-11-19 13:46:26 +01:00
parent c17e696566
commit b934bb120c
11 changed files with 122 additions and 112 deletions

View file

@ -1,7 +1,7 @@
#pragma once
/* Handles communication with a client. */
#pragma once
#include <common.h>
#include <netinet/in.h>
@ -9,12 +9,12 @@
typedef struct
{
int socket; /* client socket */
struct sockaddr_in address; /* client address information */
char ip_string[INET_ADDRSTRLEN]; /* client IP address as a string */
time_t last_active; /* time of client's last activity in seconds from Epoch */
char username[USERNAME_LEN]; /* username for human identification */
char data[DATABUF_LEN]; /* buffer for data received from client */
int socket; /* client socket */
struct sockaddr_in address; /* client address information */
char ip_string[INET_ADDRSTRLEN]; /* client IP address as a string */
time_t last_active; /* time of client's last activity */
char username[USERNAME_LEN]; /* username for human identification */
char data[BUFFER_LEN]; /* buffer for received data */
} client_t;
/**
@ -48,7 +48,7 @@ int client_write(client_t *client, char *databuf, int datalen);
*
* Returns:
* - 0 on success
* - negative value if error occurred
* - negative value if an error occurred
*/
int client_wait_line(client_t *client);
@ -58,6 +58,6 @@ int client_wait_line(client_t *client);
*
* Returns:
* - 0 on success
* - negative value if error occurred
* - negative value if an error occurred
*/
int client_ask_username(client_t *client);