client_list.c File Reference

Client List Functions. More...

Go to the source code of this file.

Defines

#define _GNU_SOURCE

Functions

t_clientclient_get_first_client (void)
 Get the first element of the list of connected clients.
void client_list_init (void)
 Initializes the client list.
t_clientclient_list_append (char *ip, char *mac, char *token)
 Adds a new client to the connections list.
t_clientclient_list_find (char *ip, char *mac)
 Finds a client by its IP and MAC.
t_clientclient_list_find_by_ip (char *ip)
 Finds a client only by its IP.
t_clientclient_list_find_by_mac (char *mac)
 Finds a client only by its Mac.
t_clientclient_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_clientfirstclient = NULL


Detailed Description

Client List Functions.

Author:
Copyright (C) 2004 Alexandre Carmel-Veillex <acv@acv.ca>

Definition in file client_list.c.


Function Documentation

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.

Parameters:
ip IP address
mac MAC address
token Token
Returns:
Pointer to the client we just created

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.

Parameters:
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

Parameters:
ip IP we are looking for in the linked list
mac MAC we are looking for in the linked list
Returns:
Pointer to the client, or NULL if not found

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

Parameters:
ip IP we are looking for in the linked list
Returns:
Pointer to the client, or NULL if not found

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

Parameters:
mac Mac we are looking for in the linked list
Returns:
Pointer to the client, or NULL if not found

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

Parameters:
token Token we are looking for in the linked list
Returns:
Pointer to the client, or NULL if not found

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.


Variable Documentation

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.


Generated on Sun Apr 13 21:55:00 2008 for WifiDog by  doxygen 1.5.3