functions.h

Go to the documentation of this file.
00001 /* Linux Prism II Stumbler - Utility Scan for 802_11 networks under Linux
00002  * 
00003  * File : functions.h
00004  * Project : WifiScanner (c) 2002 Hervé Schauer Consultants
00005  * Usage : This utility is written for use with IEEE 802.11 adapters based
00006  * on Intersil's PRISM II chipset (PCMCIA).
00007  * 
00008  * Base code was from prismstumbler Jan Fernquist <Jan.B.Fernquist@telia.com>
00009  * and wlanctl from www.linux-wlan.com
00010  *
00011  * This program is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU General Public License
00013  * as published by the Free Software Foundation; either version 2
00014  * of the License, or (at your option) any later version.
00015  * 
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  * 
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00024  *
00025  * $Id: functions.h 174 2007-07-25 13:20:29Z poggij $
00026  */
00027 
00028 #ifndef __functions_h__
00029 #define __functions_h__
00030 
00031 #include <wlan/p80211types.h>
00032 #include <wlan/p80211msg.h>
00033 #include <wlan/p80211meta.h>
00034 #include <wlan/p80211metamsg.h>
00035 #include <wlan/p80211metastruct.h>
00036 #include <wlan/p80211mgmt.h>
00037 #include <math.h>
00038 
00039 #define CHANNEL_MIN 1
00040 #define CHANNEL_MAX 14
00041 
00042 #define HOP_MIN 1
00043 #define HOP_MAX 13
00044 
00045 #define IFACE_WLAN_MIN 0
00046 #define IFACE_WLAN_MAX 4
00047 
00048 #ifdef RADIOTAP_H_EXIST
00049 /*
00050  *  * Useful combinations of channel characteristics.
00051  *   */
00052 #define IEEE80211_CHAN_FHSS \
00053           (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)
00054 #define IEEE80211_CHAN_A \
00055           (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
00056 #define IEEE80211_CHAN_B \
00057           (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK)
00058 #define IEEE80211_CHAN_PUREG \
00059           (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM)
00060 #define IEEE80211_CHAN_G \
00061           (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN)
00062 #define IEEE80211_CHAN_T \
00063           (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
00064 
00065 #define IEEE80211_IS_CHAN_FHSS(_flags) \
00066           ((_flags & IEEE80211_CHAN_FHSS) == IEEE80211_CHAN_FHSS)
00067 #define IEEE80211_IS_CHAN_A(_flags) \
00068           ((_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A)
00069 #define IEEE80211_IS_CHAN_B(_flags) \
00070           ((_flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B)
00071 #define IEEE80211_IS_CHAN_PUREG(_flags) \
00072           ((_flags & IEEE80211_CHAN_PUREG) == IEEE80211_CHAN_PUREG)
00073 #define IEEE80211_IS_CHAN_G(_flags) \
00074           ((_flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G)
00075 #define IEEE80211_IS_CHAN_T(_flags) \
00076           ((_flags & IEEE80211_CHAN_T) == IEEE80211_CHAN_T)
00077 
00078 #define IEEE80211_RADIOTAP_TSFT 0
00079 #define IEEE80211_RADIOTAP_FLAGS 1
00080 #define IEEE80211_RADIOTAP_RATE 2
00081 #define IEEE80211_RADIOTAP_CHANNEL 3
00082 #define IEEE80211_RADIOTAP_FHSS 4
00083 #define IEEE80211_RADIOTAP_DBM_ANTSIGNAL 5
00084 #define IEEE80211_RADIOTAP_DBM_ANTNOISE 6
00085 #define IEEE80211_RADIOTAP_LOCK_QUALITY 7
00086 #define IEEE80211_RADIOTAP_TX_ATTENUATION 8
00087 #define IEEE80211_RADIOTAP_DB_TX_ATTENUATION 9
00088 #define IEEE80211_RADIOTAP_DBM_TX_POWER 10
00089 #define IEEE80211_RADIOTAP_ANTENNA 11
00090 #define IEEE80211_RADIOTAP_DB_ANTSIGNAL 12
00091 #define IEEE80211_RADIOTAP_DB_ANTNOISE 13
00092 #define IEEE80211_RADIOTAP_EXT 31
00093 
00094 #endif
00095 
00096 int processPacket(p80211_caphdr_t * wlan_header, UINT8 * packet, int len);
00097 void ParseCommandLine(int argc, char **argv, ConfigStruct * config);
00098 void ChannelToStr(char *strChannel, UINT8 Channel, UINT8 SChannel);
00099 char *safe_strncpy(char *dst, const char *src, int size);
00100 int safe_snprintf(char *s, int size, char *fmt, ...);
00101 void *memcpy_buff(void *dest, const void *src, size_t n);
00102 void InitConfiguration(ConfigStruct * config);
00103 int FillRadioData(p80211_caphdr_t * wlan_header, int DataLink,
00104                    UINT8 * Packet, int len);
00105 int CalculateOffset(int DataLink);
00106 
00107 int InterfaceIsExistant(char *devname);
00108 int IfconfigSetFlags(char *devname, short flags);
00109 int IwconfigSetChannel(char *devname, int channel);
00110 int IwconfigSetMode(char *devname, __u32 mode);
00111 int IwconfigClearSSID(char *devname);
00112 int Iwconfig_Set_IntPriv(const char *devname, const char *privcmd, int val1, int val2);
00113 
00114 #endif

Generated on Fri Jul 25 17:10:33 2008 for WifiScanner by  doxygen 1.5.5