client_list.h File Reference

Client List functions. More...

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_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 (const char *ip, const char *mac, const char *token)
 Adds a new client to the connections list.
t_clientclient_list_find (const char *ip, const char *mac)
 Finds a client by its IP and MAC.
t_clientclient_list_find_by_ip (const char *ip)
 Finds a client only by its IP.
t_clientclient_list_find_by_mac (const char *mac)
 Finds a client only by its Mac.
t_clientclient_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.


Detailed Description

Client List functions.

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

Definition in file client_list.h.


Define Documentation

 
#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.


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(), 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.

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.

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.

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

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.

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

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.

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

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.

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

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.

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.


Generated on Fri Sep 25 15:28:43 2009 for WifiDog by  doxygen 1.5.5