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

wifidog-1.1.1/src/util.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/util.h,v 1.11 2005/03/12 02:02:02 minaguib Exp $ */
00027 #ifndef _UTIL_H_
00028 #define _UTIL_H_
00029 
00030 #define STATUS_BUF_SIZ  16384
00031 
00034 int execute(char *cmd_line, int quiet);
00035 struct in_addr *wd_gethostbyname(const char *name);
00036 
00037 /* @brief Get IP address of an interface */
00038 char *get_iface_ip(char *ifname);
00039 
00040 /* @brief Sets hint that an online action (dns/connect/etc using WAN) succeeded */
00041 void mark_online();
00042 /* @brief Sets hint that an online action (dns/connect/etc using WAN) failed */
00043 void mark_offline();
00044 /* @brief Returns a guess (true or false) on whether we're online or not based on previous calls to mark_online and mark_offline */
00045 int is_online();
00046 
00047 /* @brief Sets hint that an auth server online action succeeded */
00048 void mark_auth_online();
00049 /* @brief Sets hint that an auth server online action failed */
00050 void mark_auth_offline();
00051 /* @brief Returns a guess (true or false) on whether we're an auth server is online or not based on previous calls to mark_auth_online and mark_auth_offline */
00052 int is_auth_online();
00053 
00054 /*
00055  * @brief Creates a human-readable paragraph of the status of wifidog
00056  */
00057 char * get_status_text();
00058 
00059 #define LOCK_GHBN() do { \
00060         debug(LOG_DEBUG, "Locking wd_gethostbyname()"); \
00061         pthread_mutex_lock(&ghbn_mutex); \
00062         debug(LOG_DEBUG, "wd_gethostbyname() locked"); \
00063 } while (0)
00064 
00065 #define UNLOCK_GHBN() do { \
00066         debug(LOG_DEBUG, "Unlocking wd_gethostbyname()"); \
00067         pthread_mutex_unlock(&ghbn_mutex); \
00068         debug(LOG_DEBUG, "wd_gethostbyname() unlocked"); \
00069 } while (0)
00070 
00071 #endif /* _UTIL_H_ */
00072 

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