Go to the source code of this file.
Data Structures | |
struct | _t_counters |
struct | _t_client |
Defines | |
#define | LOCK_CLIENT_LIST() |
#define | UNLOCK_CLIENT_LIST() |
Typedefs | |
typedef struct _t_counters | t_counters |
typedef struct _t_client | t_client |
Functions | |
t_client * | client_get_first_client (void) |
Get the first element of the list of connected clients. | |
void | client_list_init (void) |
Initializes the client list. | |
t_client * | client_list_append (const char *ip, const char *mac, const char *token) |
Adds a new client to the connections list. | |
t_client * | client_list_find (const char *ip, const char *mac) |
Finds a client by its IP and MAC. | |
t_client * | client_list_find_by_ip (const char *ip) |
Finds a client only by its IP. | |
t_client * | client_list_find_by_mac (const char *mac) |
Finds a client only by its Mac. | |
t_client * | client_list_find_by_token (const char *token) |
Finds a client by its token. | |
void | client_list_delete (t_client *client) |
Deletes a client from the connections list. |
Definition in file client_list.h.
#define LOCK_CLIENT_LIST | ( | ) |
Value:
do { \ debug(LOG_DEBUG, "Locking client list"); \ pthread_mutex_lock(&client_list_mutex); \ debug(LOG_DEBUG, "Client list locked"); \ } while (0)
Definition at line 82 of file client_list.h.
#define UNLOCK_CLIENT_LIST | ( | ) |
Value:
do { \ debug(LOG_DEBUG, "Unlocking client list"); \ pthread_mutex_unlock(&client_list_mutex); \ debug(LOG_DEBUG, "Client list unlocked"); \ } while (0)
Definition at line 88 of file client_list.h.
t_client* client_get_first_client | ( | void | ) |
Get the first element of the list of connected clients.
Get the first element of the list of connected clients
Definition at line 58 of file client_list.c.
Referenced by fw_init(), and fw_sync_with_authserver().
t_client* client_list_append | ( | const char * | ip, | |
const char * | mac, | |||
const char * | token | |||
) |
Adds a new client to the connections list.
Based on the parameters it receives, this function creates a new entry in the connections list. All the memory allocation is done here.
ip | IP address | |
mac | MAC address | |
token | Token |
Definition at line 80 of file client_list.c.
References _t_client::counters, debug, _t_counters::incoming, _t_counters::incoming_history, _t_client::ip, _t_counters::last_updated, _t_client::mac, _t_client::next, _t_counters::outgoing, _t_counters::outgoing_history, safe_malloc(), and _t_client::token.
Referenced by http_callback_auth().
void client_list_delete | ( | t_client * | client | ) |
Deletes a client from the connections list.
Removes the specified client from the connections list and then calls the function to free the memory used by the client.
client | Points to the client to be deleted |
Definition at line 225 of file client_list.c.
References debug, and _t_client::next.
Referenced by fw_sync_with_authserver(), and http_callback_auth().
t_client* client_list_find | ( | const char * | ip, | |
const char * | mac | |||
) |
Finds a client by its IP and MAC.
Finds a client by its IP and MAC, returns NULL if the client could not be found
ip | IP we are looking for in the linked list | |
mac | MAC we are looking for in the linked list |
Definition at line 120 of file client_list.c.
References _t_client::ip, _t_client::mac, and _t_client::next.
Referenced by authenticate_client(), fw_sync_with_authserver(), and http_callback_auth().
t_client* client_list_find_by_ip | ( | const char * | ip | ) |
Finds a client only by its IP.
Finds a client by its IP, returns NULL if the client could not be found
ip | IP we are looking for in the linked list |
Definition at line 141 of file client_list.c.
References _t_client::ip, and _t_client::next.
Referenced by authenticate_client(), and iptables_fw_counters_update().
t_client* client_list_find_by_mac | ( | const char * | mac | ) |
Finds a client only by its Mac.
Finds a client by its Mac, returns NULL if the client could not be found
mac | Mac we are looking for in the linked list |
Definition at line 162 of file client_list.c.
References _t_client::mac, and _t_client::next.
t_client* client_list_find_by_token | ( | const char * | token | ) |
Finds a client by its token.
Finds a client by its token
token | Token we are looking for in the linked list |
Definition at line 181 of file client_list.c.
References _t_client::next, and _t_client::token.
void client_list_init | ( | void | ) |
Initializes the client list.
Initializes the list of connected clients (client)
Definition at line 67 of file client_list.c.