conversion.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

const char * RateToString (int rate)
char * TypeOfClientToString (int TypeOfClient)
char * SubTypeOfClientToString (int TypeOfClient)
char * BoolToStr (int Boolean)
char * BoolToWepNoWep (UINT8 WEP, UINT8 WPA)
char * BoolToStaAp (int STA_AP, int STA_sta)
const char * TypeOfPacketToString (UINT16 TypeOfPacket)


Function Documentation

const char* RateToString ( int  rate  ) 

Definition at line 37 of file conversion.c.

References debug.

Referenced by LogWriteReport(), and main().

00038 {
00039   debug(3, "(Rate = 0x%02X = %d, Rate & 0x7F = 0x%02X)\n", rate, rate,
00040         rate & 0x7F);
00041   switch (rate & 0x7F) {        // Bit 8 is a flag for BASIC rate
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:                    // Wlan-ng
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:                     // ? is it normalized ?
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     //debug (0, "Unknowed rate : %X (%d) ", rate, rate);
00096     return "???";
00097     break;
00098   }
00099   return "???";
00100 }

char* TypeOfClientToString ( int  TypeOfClient  ) 

Definition at line 102 of file conversion.c.

References TYPE_BIT_00, TYPE_BIT_01, TYPE_BIT_02, TYPE_BIT_03, TYPE_BIT_04, TYPE_BIT_05, TYPE_BIT_06, TYPE_BIT_07, TYPE_BIT_08, TYPE_BIT_09, TYPE_BIT_0A, TYPE_BIT_0B, TYPE_BIT_0C, TYPE_BIT_0D, TYPE_BIT_0E, and TYPE_BIT_0F.

Referenced by main().

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 }

char* SubTypeOfClientToString ( int  TypeOfClient  ) 

char* BoolToStr ( int  Boolean  ) 

Definition at line 127 of file conversion.c.

References STR_NO, and STR_YES.

00128 {
00129   const char *YesNo[2] = { STR_NO, STR_YES };
00130 
00131   Boolean = !(!Boolean);
00132   return ((char *) YesNo[Boolean]);
00133 }

char* BoolToWepNoWep ( UINT8  WEP,
UINT8  WPA 
)

Definition at line 135 of file conversion.c.

References STR_NOWEP, STR_WEP, and STR_WPA.

Referenced by main().

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 }

char* BoolToStaAp ( int  STA_AP,
int  STA_sta 
)

Definition at line 144 of file conversion.c.

References STR_AP, STR_sta, and STR_STA.

Referenced by main().

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 }

const char* TypeOfPacketToString ( UINT16  TypeOfPacket  ) 

Definition at line 153 of file conversion.c.

References WLAN_FSTYPE_ACK, WLAN_FSTYPE_ASSOCREQ, WLAN_FSTYPE_ASSOCRESP, WLAN_FSTYPE_ATIM, WLAN_FSTYPE_AUTHEN, WLAN_FSTYPE_BEACON, WLAN_FSTYPE_CFACK, WLAN_FSTYPE_CFACK_CFPOLL, WLAN_FSTYPE_CFEND, WLAN_FSTYPE_CFENDCFACK, WLAN_FSTYPE_CFPOLL, WLAN_FSTYPE_CTS, WLAN_FSTYPE_DATA_CFACK, WLAN_FSTYPE_DATA_CFACK_CFPOLL, WLAN_FSTYPE_DATA_CFPOLL, WLAN_FSTYPE_DATAONLY, WLAN_FSTYPE_DEAUTHEN, WLAN_FSTYPE_DISASSOC, WLAN_FSTYPE_NULL, WLAN_FSTYPE_PROBEREQ, WLAN_FSTYPE_PROBERESP, WLAN_FSTYPE_PSPOLL, WLAN_FSTYPE_QOS_CFACK, WLAN_FSTYPE_QOS_CFACK_CFPOLL, WLAN_FSTYPE_QOS_CFPOLL, WLAN_FSTYPE_QOS_DATA_CFACK, WLAN_FSTYPE_QOS_DATA_CFACK_CFPOLL, WLAN_FSTYPE_QOS_DATA_CFPOLL, WLAN_FSTYPE_QOS_DATAONLY, WLAN_FSTYPE_QOS_NULL, WLAN_FSTYPE_REASSOCREQ, WLAN_FSTYPE_REASSOCRESP, WLAN_FSTYPE_RTS, WLAN_FTYPE_CTL, WLAN_FTYPE_DATA, WLAN_FTYPE_MGMT, WLAN_GET_FC_FSTYPE, and WLAN_GET_FC_FTYPE.

Referenced by processPacket().

00154 {
00155   switch (WLAN_GET_FC_FTYPE(TypeOfPacket)) {
00156     /* Frame subtypes */
00157   case WLAN_FTYPE_MGMT:
00158     /* Management */
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       /* Control */
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       /* Data */
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       /* Data With QOS */
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 }


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