Go to the source code of this file.
Defines | |
| #define | _GNU_SOURCE |
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_free_node (t_client *client) |
| void | client_list_delete (t_client *client) |
| Deletes a client from the connections list. | |
Variables | |
| pthread_mutex_t | client_list_mutex = PTHREAD_MUTEX_INITIALIZER |
| t_client * | firstclient = NULL |
Definition in file client_list.c.
| 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(), fw_sync_with_authserver(), get_status_text(), and wdctl_restart().
| 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.
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.
Referenced by fw_sync_with_authserver(), http_callback_auth(), and wdctl_reset().
| 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.
Referenced by authenticate_client(), fw_sync_with_authserver(), and http_callback_auth().
| 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.
Referenced by authenticate_client(), iptables_fw_counters_update(), and wdctl_reset().
| 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.
Referenced by wdctl_reset().
| 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.
| 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.
| pthread_mutex_t client_list_mutex = PTHREAD_MUTEX_INITIALIZER |
Global mutex to protect access to the client list
Definition at line 48 of file client_list.c.
1.5.3