00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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
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