00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00027 #ifndef _CLIENT_LIST_H_
00028 #define _CLIENT_LIST_H_
00029
00032 typedef struct _t_counters {
00033 unsigned long long incoming;
00034 unsigned long long outgoing;
00035 time_t last_updated;
00036 } t_counters;
00037
00040 typedef struct _t_client {
00041 struct _t_client *next;
00042 char *ip;
00043 char *mac;
00044 char *token;
00045 unsigned int fw_connection_state;
00047 int fd;
00050 t_counters counters;
00052 } t_client;
00053
00056 t_client *client_get_first_client(void);
00057
00059 void client_list_init(void);
00060
00062 t_client *client_list_append(char *ip, char *mac, char *token);
00063
00065 t_client *client_list_find(char *ip, char *mac);
00066
00068 t_client *client_list_find_by_ip(char *ip);
00069
00070
00072 t_client *client_list_find_by_mac(char *mac);
00073
00075 t_client *client_list_find_by_token(char *token);
00076
00078 void client_list_delete(t_client *client);
00079
00080 #define LOCK_CLIENT_LIST() do { \
00081 debug(LOG_DEBUG, "Locking client list"); \
00082 pthread_mutex_lock(&client_list_mutex); \
00083 debug(LOG_DEBUG, "Client list locked"); \
00084 } while (0)
00085
00086 #define UNLOCK_CLIENT_LIST() do { \
00087 debug(LOG_DEBUG, "Unlocking client list"); \
00088 pthread_mutex_unlock(&client_list_mutex); \
00089 debug(LOG_DEBUG, "Client list unlocked"); \
00090 } while (0)
00091
00092 #endif