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 #include <include.h>
00029 #include <src/crt_io.h>
00030
00031 extern UINT8 TypeOfCard;
00032
00033
00034
00035
00036
00037 const char *RateToString(int rate)
00038 {
00039 debug(3, "(Rate = 0x%02X = %d, Rate & 0x7F = 0x%02X)\n", rate, rate,
00040 rate & 0x7F);
00041 switch (rate & 0x7F) {
00042 case 0:
00043 return "0Mb/s";
00044 break;
00045 case 2:
00046 case 10:
00047 return "1Mb/s";
00048 break;
00049 case 4:
00050 case 20:
00051 return "2Mb/s";
00052 break;
00053 case 11:
00054 case 55:
00055 return "5.5Mb/s";
00056 break;
00057 case 12:
00058 return "6Mb/s";
00059 break;
00060 case 18:
00061 return "9Mb/s";
00062 break;
00063 case 22:
00064 case 110:
00065 return "11Mb/s";
00066 break;
00067 case 24:
00068 return "12Mb/s";
00069 break;
00070 case 36:
00071 return "18Mb/s";
00072 break;
00073 case 44:
00074 return "22Mb/s";
00075 break;
00076 case 48:
00077 return "24Mb/s";
00078 break;
00079 case 66:
00080 return "33Mb/s";
00081 break;
00082 case 72:
00083 return "36Mb/s";
00084 break;
00085 case 88:
00086 return "44Mb/s";
00087 break;
00088 case 96:
00089 return "48Mb/s";
00090 break;
00091 case 108:
00092 return "54Mb/s";
00093 break;
00094 default:
00095
00096 return "???";
00097 break;
00098 }
00099 return "???";
00100 }
00101
00102 char *TypeOfClientToString(int TypeOfClient)
00103 {
00104 static const char *TypeOfClientList[16] = {
00105 TYPE_BIT_00, TYPE_BIT_01, TYPE_BIT_02, TYPE_BIT_03,
00106 TYPE_BIT_04, TYPE_BIT_05, TYPE_BIT_06, TYPE_BIT_07,
00107 TYPE_BIT_08, TYPE_BIT_09, TYPE_BIT_0A, TYPE_BIT_0B,
00108 TYPE_BIT_0C, TYPE_BIT_0D, TYPE_BIT_0E, TYPE_BIT_0F
00109 };
00110
00111 return ((char *) TypeOfClientList[(TypeOfClient & 0x0F)]);
00112 }
00113
00114 char *SubTypeOfClientToString(int TypeOfClient)
00115 {
00116 const char *SubTypeOfClientList[16] = {
00117 SUBTYPE_BIT_00, SUBTYPE_BIT_01, SUBTYPE_BIT_02, SUBTYPE_BIT_03,
00118 SUBTYPE_BIT_04, SUBTYPE_BIT_05, SUBTYPE_BIT_06, SUBTYPE_BIT_07,
00119 SUBTYPE_BIT_08, SUBTYPE_BIT_09, SUBTYPE_BIT_0A, SUBTYPE_BIT_0B,
00120 SUBTYPE_BIT_0C, SUBTYPE_BIT_0D, SUBTYPE_BIT_0E, SUBTYPE_BIT_0F
00121 };
00122
00123 return ((char *)
00124 SubTypeOfClientList[((TypeOfClient & 0xF0) >> 4)]);
00125 }
00126
00127 char *BoolToStr(int Boolean)
00128 {
00129 const char *YesNo[2] = { STR_NO, STR_YES };
00130
00131 Boolean = !(!Boolean);
00132 return ((char *) YesNo[Boolean]);
00133 }
00134
00135 char *BoolToWepNoWep(UINT8 WEP, UINT8 WPA)
00136 {
00137 const char *WepNoWep[4] = { STR_NOWEP, STR_WEP, STR_WPA, STR_WPA };
00138
00139 WEP = !(!WEP);
00140 WPA = !(!WPA);
00141 return ((char *) WepNoWep[(WPA << 1) + (WEP)]);
00142 }
00143
00144 char *BoolToStaAp(int STA_AP, int STA_sta)
00145 {
00146 const char *StaAp[] = { STR_STA, STR_AP, STR_sta, STR_AP };
00147
00148 STA_AP = !(!STA_AP);
00149 STA_sta = !(!STA_sta);
00150 return ((char *) StaAp[(STA_AP) + (STA_sta << 1)]);
00151 }
00152
00153 const char *TypeOfPacketToString(UINT16 TypeOfPacket)
00154 {
00155 switch (WLAN_GET_FC_FTYPE(TypeOfPacket)) {
00156
00157 case WLAN_FTYPE_MGMT:
00158
00159 switch (WLAN_GET_FC_FSTYPE(TypeOfPacket)) {
00160 case WLAN_FSTYPE_ASSOCREQ:
00161 return ("ASSREQ");
00162 break;
00163 case WLAN_FSTYPE_ASSOCRESP:
00164 return ("ASSRES");
00165 break;
00166 case WLAN_FSTYPE_REASSOCREQ:
00167 return ("REASSQ");
00168 break;
00169 case WLAN_FSTYPE_REASSOCRESP:
00170 return ("REASSS");
00171 break;
00172 case WLAN_FSTYPE_PROBEREQ:
00173 return ("PRBREQ");
00174 break;
00175 case WLAN_FSTYPE_PROBERESP:
00176 return ("PRBRES");
00177 break;
00178 case WLAN_FSTYPE_BEACON:
00179 return ("BEACON");
00180 break;
00181 case WLAN_FSTYPE_ATIM:
00182 return ("ATIM");
00183 break;
00184 case WLAN_FSTYPE_DISASSOC:
00185 return ("DESASS");
00186 break;
00187 case WLAN_FSTYPE_AUTHEN:
00188 return ("AUTHEN");
00189 break;
00190 case WLAN_FSTYPE_DEAUTHEN:
00191 return ("DEAUTH");
00192 break;
00193 default:
00194 return ("UNKNOW");
00195 }
00196 break;
00197 case WLAN_FTYPE_CTL:
00198 switch (WLAN_GET_FC_FSTYPE(TypeOfPacket)) {
00199
00200 case WLAN_FSTYPE_PSPOLL:
00201 return ("PSPOLL");
00202 break;
00203 case WLAN_FSTYPE_RTS:
00204 return ("RTS");
00205 break;
00206 case WLAN_FSTYPE_CTS:
00207 return ("CTS");
00208 break;
00209 case WLAN_FSTYPE_ACK:
00210 return ("ACK");
00211 break;
00212 case WLAN_FSTYPE_CFEND:
00213 return ("CFEND");
00214 break;
00215 case WLAN_FSTYPE_CFENDCFACK:
00216 return ("CFEACK");
00217 break;
00218 default:
00219 return ("UNKNOW");
00220 }
00221 break;
00222 case WLAN_FTYPE_DATA:
00223 switch (WLAN_GET_FC_FSTYPE(TypeOfPacket)) {
00224
00225 case WLAN_FSTYPE_DATAONLY:
00226 return ("DATA");
00227 break;
00228 case WLAN_FSTYPE_DATA_CFACK:
00229 return ("DATACK");
00230 break;
00231 case WLAN_FSTYPE_DATA_CFPOLL:
00232 return ("DATPOL");
00233 break;
00234 case WLAN_FSTYPE_DATA_CFACK_CFPOLL:
00235 return ("DTPLAK");
00236 break;
00237 case WLAN_FSTYPE_NULL:
00238 return ("NULL");
00239 break;
00240 case WLAN_FSTYPE_CFACK:
00241 return ("CFACK");
00242 break;
00243 case WLAN_FSTYPE_CFPOLL:
00244 return ("CFPOL");
00245 break;
00246 case WLAN_FSTYPE_CFACK_CFPOLL:
00247 return ("CFPLAK");
00248 break;
00249
00250 case WLAN_FSTYPE_QOS_DATAONLY:
00251 return ("DATA+QOS");
00252 break;
00253 case WLAN_FSTYPE_QOS_DATA_CFACK:
00254 return ("DATACK+QOS");
00255 break;
00256 case WLAN_FSTYPE_QOS_DATA_CFPOLL:
00257 return ("DATPOL+QOS");
00258 break;
00259 case WLAN_FSTYPE_QOS_DATA_CFACK_CFPOLL:
00260 return ("DTPLAK+QOS");
00261 break;
00262 case WLAN_FSTYPE_QOS_NULL:
00263 return ("NULL+QOS");
00264 break;
00265 case WLAN_FSTYPE_QOS_CFACK:
00266 return ("CFACK+QOS");
00267 break;
00268 case WLAN_FSTYPE_QOS_CFPOLL:
00269 return ("CFPOL+QOS");
00270 break;
00271 case WLAN_FSTYPE_QOS_CFACK_CFPOLL:
00272 return ("CFPLAK+QOS");
00273 break;
00274 default:
00275 return ("UNKNOW");
00276 }
00277 break;
00278 default:
00279 return ("UNKNOW");
00280 }
00281 }