Main Page | Data Structures | Directories | File List | Data Fields

src/client_list.h

00001 /********************************************************************\
00002  * This program is free software; you can redistribute it and/or    *
00003  * modify it under the terms of the GNU General Public License as   *
00004  * published by the Free Software Foundation; either version 2 of   *
00005  * the License, or (at your option) any later version.              *
00006  *                                                                  *
00007  * This program is distributed in the hope that it will be useful,  *
00008  * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
00009  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
00010  * GNU General Public License for more details.                     *
00011  *                                                                  *
00012  * You should have received a copy of the GNU General Public License*
00013  * along with this program; if not, contact:                        *
00014  *                                                                  *
00015  * Free Software Foundation           Voice:  +1-617-542-5942       *
00016  * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652       *
00017  * Boston, MA  02111-1307,  USA       gnu@gnu.org                   *
00018  *                                                                  *
00019 \********************************************************************/
00020 
00021 /* $Header: /cvsroot/wifidog/wifidog/src/client_list.h,v 1.9 2005/02/21 00:00:47 minaguib Exp $ */
00027 #ifndef _CLIENT_LIST_H_
00028 #define _CLIENT_LIST_H_
00029 
00032 typedef struct _t_counters {
00033     unsigned long long  incoming;       
00034     unsigned long long  outgoing;       
00035     time_t      last_updated;   
00036 } t_counters;
00037 
00040 typedef struct  _t_client {
00041   struct        _t_client *next;        
00042         char    *ip;                    
00043         char    *mac;                   
00044         char    *token;                 
00045         unsigned int fw_connection_state; 
00047         int     fd;                     
00050         t_counters      counters;       
00052 } t_client;
00053 
00056 t_client *client_get_first_client(void);
00057 
00059 void client_list_init(void);
00060 
00062 t_client *client_list_append(char *ip, char *mac, char *token);
00063 
00065 t_client *client_list_find(char *ip, char *mac);
00066 
00068 t_client *client_list_find_by_ip(char *ip); /* needed by fw_iptables.c, auth.c 
00069                                              * and wdctl_thread.c */
00070 
00072 t_client *client_list_find_by_mac(char *mac); /* needed by wdctl_thread.c */
00073 
00075 t_client *client_list_find_by_token(char *token);
00076 
00078 void client_list_delete(t_client *client);
00079 
00080 #define LOCK_CLIENT_LIST() do { \
00081         debug(LOG_DEBUG, "Locking client list"); \
00082         pthread_mutex_lock(&client_list_mutex); \
00083         debug(LOG_DEBUG, "Client list locked"); \
00084 } while (0)
00085 
00086 #define UNLOCK_CLIENT_LIST() do { \
00087         debug(LOG_DEBUG, "Unlocking client list"); \
00088         pthread_mutex_unlock(&client_list_mutex); \
00089         debug(LOG_DEBUG, "Client list unlocked"); \
00090 } while (0)
00091 
00092 #endif /* _CLIENT_LIST_H_ */

Generated on Sun Apr 3 20:04:45 2005 for WifiDog by  doxygen 1.4.1