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() |
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 (char *ip, char *mac, char *token) |
Adds a new client to the connections list. | |
t_client * | client_list_find (char *ip, char *mac) |
Finds a client by its IP and MAC. | |
t_client * | client_list_find_by_ip (char *ip) |
Finds a client only by its IP. | |
t_client * | client_list_find_by_mac (char *mac) |
Finds a client only by its Mac. | |
t_client * | client_list_find_by_token (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.
Referenced by authenticate_client(), fw_init(), fw_sync_with_authserver(), get_status_text(), http_callback_auth(), iptables_fw_counters_update(), wdctl_reset(), and wdctl_restart().
#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.
Referenced by authenticate_client(), fw_init(), fw_sync_with_authserver(), get_status_text(), http_callback_auth(), iptables_fw_counters_update(), wdctl_reset(), and wdctl_restart().
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.
t_client* client_list_append | ( | char * | ip, | |
char * | mac, | |||
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(), safe_strdup(), and t_client::token.
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 _client_list_free_node(), debug, and t_client::next.
t_client* client_list_find | ( | char * | ip, | |
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.
t_client* client_list_find_by_ip | ( | 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.
t_client* client_list_find_by_mac | ( | 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 | ( | 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.