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

wifidog-1.1.3_beta2/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 /* $Id: util.h 901 2006-01-17 18:58:13Z mina $ */
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 Get MAC address of an interface */
00041 char *get_iface_mac(char *ifname);
00042 
00043 
00044 /* @brief Sets hint that an online action (dns/connect/etc using WAN) succeeded */
00045 void mark_online();
00046 /* @brief Sets hint that an online action (dns/connect/etc using WAN) failed */
00047 void mark_offline();
00048 /* @brief Returns a guess (true or false) on whether we're online or not based on previous calls to mark_online and mark_offline */
00049 int is_online();
00050 
00051 /* @brief Sets hint that an auth server online action succeeded */
00052 void mark_auth_online();
00053 /* @brief Sets hint that an auth server online action failed */
00054 void mark_auth_offline();
00055 /* @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 */
00056 int is_auth_online();
00057 
00058 /*
00059  * @brief Creates a human-readable paragraph of the status of wifidog
00060  */
00061 char * get_status_text();
00062 
00063 #define LOCK_GHBN() do { \
00064         debug(LOG_DEBUG, "Locking wd_gethostbyname()"); \
00065         pthread_mutex_lock(&ghbn_mutex); \
00066         debug(LOG_DEBUG, "wd_gethostbyname() locked"); \
00067 } while (0)
00068 
00069 #define UNLOCK_GHBN() do { \
00070         debug(LOG_DEBUG, "Unlocking wd_gethostbyname()"); \
00071         pthread_mutex_unlock(&ghbn_mutex); \
00072         debug(LOG_DEBUG, "wd_gethostbyname() unlocked"); \
00073 } while (0)
00074 
00075 #endif /* _UTIL_H_ */
00076 

Generated on Tue Jan 31 23:13:16 2006 for WifiDog by  doxygen 1.4.4