User`s guide
Aironet Wireless Communications, Inc. 7-42 Confidential and Proprietary
Receiving an 802.11 Packet
The following is sample code for receiving a packet, assuming that the 802.3 header reception has been
disabled:
typedef struct { /* receive control header */
unsigned long RxTime; /* time at start of 802.11 MAC */
unsigned short Status; /* receive packet status */
#define RXS_CRCERR (1<<1) /* CRC32 error -- monitor mode only */
unsigned short PayloadLen; /* length of payload */
unsigned char Reserved1;
unsigned char Signal; /* rssi signal strength */
unsigned char Rate; /* rate at which received 0x02=1Mbps */
unsigned char Frequency; /* frequency received on 0=2400 MHz */
unsigned char RxAssocCnt; /* AP ONLY */
unsigned char Reserved2[3];
unsigned char PlcpHeader[4]; /* Plcp Header */
} tdsRxCtlHdr;
typedef struct { /* 802.11 mac header (802.11 packet format) */
unsigned short FrameControl; /* PC4500 sets Retry, MoreFrag, Power, Order */
/* Note, host sets FrameControl Retry for resubmit */
unsigned short Duration; /* set by PC4500 */
unsigned char Addr1[6];
unsigned char Addr2[6]; /* ignored by PC4500 */
unsigned char Addr3[6];
unsigned short Sequence; /* set by PC4500 if FrameControl.Retry is clear */
unsigned char Addr4[6];
} tdsMacHdr;
struct {
tdsRxCtlHdr CtlHeader; // receive control header
tdsMacHdr MacHeader; // 802.11 mac header
char payload[2312]; // payload
}
unsigned short Fid;
unsigned short GapLen;
unsigned short Gap[8];
unsigned short receive_802_11_packet(void)
{
if ( (IN4500(EVSTAT) & EV_RX) == 0) return NO_PACKET;
Fid = IN4500(RXFID);
// read the receive control header and 802.11 header
if (bap0_setup(Fid, 0) != SUCCESS) return ERROR;
bap0_read(&rxpkt.CtlHeader, sizeof(rxpkt.CtlHeader)+sizeof(rxPkt.MacHeader));
// skip past the gap
bap0_read(&GapLen, sizeof(GapLen));
if (GapLen > 8) return ERROR; // excessive gap
bap0_read(&Gap, GapLen);
// read the packet payload