From ee4f95a93150d050bef0d9b20c7b7a67d037fff2 Mon Sep 17 00:00:00 2001 From: mark Date: Mon, 23 Aug 1999 16:04:42 +0000 Subject: [PATCH] Added first set of validation functions. --- src/include/wlan/p80211msg.h | 306 +++++++++++--------- src/include/wlan/p80211types.h | 249 ++++++++++------ src/shared/p80211metamsg.c | 24 +- src/shared/p80211types.c | 508 +++++++++++++++++++++++---------- 4 files changed, 706 insertions(+), 381 deletions(-) diff --git a/src/include/wlan/p80211msg.h b/src/include/wlan/p80211msg.h index ee97266..1b7692b 100644 --- a/src/include/wlan/p80211msg.h +++ b/src/include/wlan/p80211msg.h @@ -101,213 +101,263 @@ /*====================================================================*/ /*----- Message Structure Types --------------------------------------*/ -/* The following structures are definitions for request/confirm */ -/* messages followed by all the indication definitions. */ +/*--------------------------------------------------------------------*/ +/* Prototype msg type +/*--------------------------------------------------------------------*/ +__WLAN_PRAGMA_PACK1__ +typedef struct p80211msg +{ + UINT32 msgcode __WLAN_ATTRIB_PACK__; +} p80211msg_t; +__WLAN_PRAGMA_PACKDFLT__ + + +__WLAN_PRAGMA_PACK1__ +typedef struct p80211msgd +{ + UINT32 msgcode __WLAN_ATTRIB_PACK__; + UINT8 args[0] __WLAN_ATTRIB_PACK__; +} p80211msgd_t; +__WLAN_PRAGMA_PACKDFLT__ /*--------------------------------------------------------------------*/ /* Request/Confirm structures */ /*--------------------------------------------------------------------*/ +__WLAN_PRAGMA_PACK1__ typedef struct p80211msg_req_mib_get { - UINT32 msgcode; - p80211item_uint32_t mibid; - p80211item_uint32_t resultcode; - p80211item_coll_t mibvalue; - p80211item_uint32_t uint32val; - p80211item_pstr255_t pstrval; + UINT32 msgcode __WLAN_ATTRIB_PACK__; + p80211item_uint32_t mibid __WLAN_ATTRIB_PACK__; + p80211item_uint32_t resultcode __WLAN_ATTRIB_PACK__; + p80211item_coll_t mibvalue __WLAN_ATTRIB_PACK__; + p80211item_uint32_t uint32val __WLAN_ATTRIB_PACK__; + p80211item_pstr255_t pstrval __WLAN_ATTRIB_PACK__; } p80211msg_req_mib_get_t; +__WLAN_PRAGMA_PACKDFLT__ +__WLAN_PRAGMA_PACK1__ typedef struct p80211msg_req_mib_set { - UINT32 msgcode; - p80211item_uint32_t mibid; - p80211item_uint32_t resultcode; - p80211item_coll_t mibvalue; - p80211item_uint32_t uint32val; - p80211item_pstr255_t pstrval; + UINT32 msgcode __WLAN_ATTRIB_PACK__; + p80211item_uint32_t mibid __WLAN_ATTRIB_PACK__; + p80211item_uint32_t resultcode __WLAN_ATTRIB_PACK__; + p80211item_coll_t mibvalue __WLAN_ATTRIB_PACK__; + p80211item_uint32_t uint32val __WLAN_ATTRIB_PACK__; + p80211item_pstr255_t pstrval __WLAN_ATTRIB_PACK__; } p80211msg_req_mib_set_t; +__WLAN_PRAGMA_PACKDFLT__ +__WLAN_PRAGMA_PACK1__ typedef struct p80211msg_req_powermgmt { - UINT32 msgcode; - p80211item_uint32_t mode; - p80211item_uint32_t wakeup; - p80211item_uint32_t rxdtims; - p80211item_uint32_t resultcode; + UINT32 msgcode __WLAN_ATTRIB_PACK__; + p80211item_uint32_t mode __WLAN_ATTRIB_PACK__; + p80211item_uint32_t wakeup __WLAN_ATTRIB_PACK__; + p80211item_uint32_t rxdtims __WLAN_ATTRIB_PACK__; + p80211item_uint32_t resultcode __WLAN_ATTRIB_PACK__; } p80211msg_req_powermgmt_t; +__WLAN_PRAGMA_PACKDFLT__ #define MAX_BSSDESC 10 +__WLAN_PRAGMA_PACK1__ typedef struct p80211msg_req_scan { - UINT32 msgcode; - p80211item_uint32_t bsstype; - p80211item_pstr6_t bssid; - p80211item_pstr32_t ssid; - p80211item_uint32_t scantype; - p80211item_uint32_t probedelay; - p80211item_pstr14_t channellist; - p80211item_uint32_t minchanneltime; - p80211item_uint32_t maxchanneltime; - p80211item_uint32_t resultcode; - p80211item_bssdesc_t bssdesc[MAX_BSSDESC]; + UINT32 msgcode __WLAN_ATTRIB_PACK__; + p80211item_uint32_t bsstype __WLAN_ATTRIB_PACK__; + p80211item_pstr6_t bssid __WLAN_ATTRIB_PACK__; + p80211item_pstr32_t ssid __WLAN_ATTRIB_PACK__; + p80211item_uint32_t scantype __WLAN_ATTRIB_PACK__; + p80211item_uint32_t probedelay __WLAN_ATTRIB_PACK__; + p80211item_pstr14_t channellist __WLAN_ATTRIB_PACK__; + p80211item_uint32_t minchanneltime __WLAN_ATTRIB_PACK__; + p80211item_uint32_t maxchanneltime __WLAN_ATTRIB_PACK__; + p80211item_uint32_t resultcode __WLAN_ATTRIB_PACK__; + p80211item_bssdesc_t bssdesc[MAX_BSSDESC] __WLAN_ATTRIB_PACK__; } p80211msg_req_scan_t; +__WLAN_PRAGMA_PACKDFLT__ +__WLAN_PRAGMA_PACK1__ typedef struct p80211msg_req_join { - UINT32 msgcode; - p80211item_pstr6_t bssid; - p80211item_uint32_t joinfailtimeout; - p80211item_uint32_t basicrate1; - p80211item_uint32_t basicrate2; - p80211item_uint32_t basicrate3; - p80211item_uint32_t basicrate4; - p80211item_uint32_t basicrate5; - p80211item_uint32_t basicrate6; - p80211item_uint32_t basicrate7; - p80211item_uint32_t basicrate8; - p80211item_uint32_t operationalrate1; - p80211item_uint32_t operationalrate2; - p80211item_uint32_t operationalrate3; - p80211item_uint32_t operationalrate4; - p80211item_uint32_t operationalrate5; - p80211item_uint32_t operationalrate6; - p80211item_uint32_t operationalrate7; - p80211item_uint32_t operationalrate8; - p80211item_uint32_t resultcode; + UINT32 msgcode __WLAN_ATTRIB_PACK__; + p80211item_pstr6_t bssid __WLAN_ATTRIB_PACK__; + p80211item_uint32_t joinfailtimeout __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate1 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate2 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate3 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate4 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate5 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate6 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate7 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate8 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t operationalrate1 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t operationalrate2 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t operationalrate3 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t operationalrate4 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t operationalrate5 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t operationalrate6 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t operationalrate7 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t operationalrate8 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t resultcode __WLAN_ATTRIB_PACK__; } p80211msg_req_join_t; +__WLAN_PRAGMA_PACKDFLT__ +__WLAN_PRAGMA_PACK1__ typedef struct p80211msg_req_authenticate { - UINT32 msgcode; - p80211item_pstr6_t peerstaaddr; - p80211item_uint32_t authtype; - p80211item_uint32_t authfailtimeout; - p80211item_uint32_t resultcode; + UINT32 msgcode __WLAN_ATTRIB_PACK__; + p80211item_pstr6_t peerstaaddr __WLAN_ATTRIB_PACK__; + p80211item_uint32_t authtype __WLAN_ATTRIB_PACK__; + p80211item_uint32_t authfailtimeout __WLAN_ATTRIB_PACK__; + p80211item_uint32_t resultcode __WLAN_ATTRIB_PACK__; } p80211msg_req_authenticate_t; +__WLAN_PRAGMA_PACKDFLT__ +__WLAN_PRAGMA_PACK1__ typedef struct p80211msg_req_deauthenticate { - UINT32 msgcode; - p80211item_pstr6_t peerstaaddr; - p80211item_uint32_t reasoncode; - p80211item_uint32_t resultcode; + UINT32 msgcode __WLAN_ATTRIB_PACK__; + p80211item_pstr6_t peerstaaddr __WLAN_ATTRIB_PACK__; + p80211item_uint32_t reasoncode __WLAN_ATTRIB_PACK__; + p80211item_uint32_t resultcode __WLAN_ATTRIB_PACK__; } p80211msg_req_deauthenticate_t; +__WLAN_PRAGMA_PACKDFLT__ +__WLAN_PRAGMA_PACK1__ typedef struct p80211msg_req_associate { - UINT32 msgcode; - p80211item_pstr6_t peerstaaddr; - p80211item_uint32_t assocfailtimeout; - p80211item_uint32_t cfpollable; - p80211item_uint32_t cfpollreq; - p80211item_uint32_t privacy; - p80211item_uint32_t listeninterval; - p80211item_uint32_t resultcode; + UINT32 msgcode __WLAN_ATTRIB_PACK__; + p80211item_pstr6_t peerstaaddr __WLAN_ATTRIB_PACK__; + p80211item_uint32_t assocfailtimeout __WLAN_ATTRIB_PACK__; + p80211item_uint32_t cfpollable __WLAN_ATTRIB_PACK__; + p80211item_uint32_t cfpollreq __WLAN_ATTRIB_PACK__; + p80211item_uint32_t privacy __WLAN_ATTRIB_PACK__; + p80211item_uint32_t listeninterval __WLAN_ATTRIB_PACK__; + p80211item_uint32_t resultcode __WLAN_ATTRIB_PACK__; } p80211msg_req_associate_t; +__WLAN_PRAGMA_PACKDFLT__ +__WLAN_PRAGMA_PACK1__ typedef struct p80211msg_req_reassociate { - UINT32 msgcode; - p80211item_pstr6_t newapaddr; - p80211item_uint32_t reassocfailtimeout; - p80211item_uint32_t cfpollable; - p80211item_uint32_t cfpollreq; - p80211item_uint32_t privacy; - p80211item_uint32_t listeninterval; - p80211item_uint32_t resultcode; + UINT32 msgcode __WLAN_ATTRIB_PACK__; + p80211item_pstr6_t newapaddr __WLAN_ATTRIB_PACK__; + p80211item_uint32_t reassocfailtimeout __WLAN_ATTRIB_PACK__; + p80211item_uint32_t cfpollable __WLAN_ATTRIB_PACK__; + p80211item_uint32_t cfpollreq __WLAN_ATTRIB_PACK__; + p80211item_uint32_t privacy __WLAN_ATTRIB_PACK__; + p80211item_uint32_t listeninterval __WLAN_ATTRIB_PACK__; + p80211item_uint32_t resultcode __WLAN_ATTRIB_PACK__; } p80211msg_req_reassociate_t; +__WLAN_PRAGMA_PACKDFLT__ +__WLAN_PRAGMA_PACK1__ typedef struct p80211msg_req_disassociate { - UINT32 msgcode; - p80211item_pstr6_t peerstaaddr; - p80211item_uint32_t reasoncode; - p80211item_uint32_t resultcode; + UINT32 msgcode __WLAN_ATTRIB_PACK__; + p80211item_pstr6_t peerstaaddr __WLAN_ATTRIB_PACK__; + p80211item_uint32_t reasoncode __WLAN_ATTRIB_PACK__; + p80211item_uint32_t resultcode __WLAN_ATTRIB_PACK__; } p80211msg_req_disassociate_t; +__WLAN_PRAGMA_PACKDFLT__ +__WLAN_PRAGMA_PACK1__ typedef struct p80211msg_req_reset { - UINT32 msgcode; - p80211item_pstr6_t peerstaaddr; - p80211item_uint32_t setdefaultmib; - p80211item_uint32_t resultcode; + UINT32 msgcode __WLAN_ATTRIB_PACK__; + p80211item_pstr6_t peerstaaddr __WLAN_ATTRIB_PACK__; + p80211item_uint32_t setdefaultmib __WLAN_ATTRIB_PACK__; + p80211item_uint32_t resultcode __WLAN_ATTRIB_PACK__; } p80211msg_req_reset_t; +__WLAN_PRAGMA_PACKDFLT__ +__WLAN_PRAGMA_PACK1__ typedef struct p80211msg_req_start { - UINT32 msgcode; - p80211item_pstr32_t ssid; - p80211item_uint32_t bsstype; - p80211item_uint32_t beaconperiod; - p80211item_uint32_t dtimperiod; - p80211item_uint32_t cfpperiod; - p80211item_uint32_t cfpmaxdur; - p80211item_uint32_t fhdwelltime; - p80211item_uint32_t fhhopset; - p80211item_uint32_t fhhoppattern; - p80211item_uint32_t dschannel; - p80211item_uint32_t ibssatimwin; - p80211item_uint32_t probedelay; - p80211item_uint32_t cfpollable; - p80211item_uint32_t cfpollreq; - p80211item_uint32_t basicrate1; - p80211item_uint32_t basicrate2; - p80211item_uint32_t basicrate3; - p80211item_uint32_t basicrate4; - p80211item_uint32_t basicrate5; - p80211item_uint32_t basicrate6; - p80211item_uint32_t basicrate7; - p80211item_uint32_t basicrate8; - p80211item_uint32_t operationalrate1; - p80211item_uint32_t operationalrate2; - p80211item_uint32_t operationalrate3; - p80211item_uint32_t operationalrate4; - p80211item_uint32_t operationalrate5; - p80211item_uint32_t operationalrate6; - p80211item_uint32_t operationalrate7; - p80211item_uint32_t operationalrate8; - p80211item_uint32_t resultcode; + UINT32 msgcode __WLAN_ATTRIB_PACK__; + p80211item_pstr32_t ssid __WLAN_ATTRIB_PACK__; + p80211item_uint32_t bsstype __WLAN_ATTRIB_PACK__; + p80211item_uint32_t beaconperiod __WLAN_ATTRIB_PACK__; + p80211item_uint32_t dtimperiod __WLAN_ATTRIB_PACK__; + p80211item_uint32_t cfpperiod __WLAN_ATTRIB_PACK__; + p80211item_uint32_t cfpmaxdur __WLAN_ATTRIB_PACK__; + p80211item_uint32_t fhdwelltime __WLAN_ATTRIB_PACK__; + p80211item_uint32_t fhhopset __WLAN_ATTRIB_PACK__; + p80211item_uint32_t fhhoppattern __WLAN_ATTRIB_PACK__; + p80211item_uint32_t dschannel __WLAN_ATTRIB_PACK__; + p80211item_uint32_t ibssatimwin __WLAN_ATTRIB_PACK__; + p80211item_uint32_t probedelay __WLAN_ATTRIB_PACK__; + p80211item_uint32_t cfpollable __WLAN_ATTRIB_PACK__; + p80211item_uint32_t cfpollreq __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate1 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate2 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate3 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate4 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate5 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate6 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate7 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate8 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t operationalrate1 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t operationalrate2 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t operationalrate3 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t operationalrate4 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t operationalrate5 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t operationalrate6 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t operationalrate7 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t operationalrate8 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t resultcode __WLAN_ATTRIB_PACK__; } p80211msg_req_start_t; +__WLAN_PRAGMA_PACKDFLT__ /*--------------------------------------------------------------------*/ /* Indication structures */ /*--------------------------------------------------------------------*/ +__WLAN_PRAGMA_PACK1__ typedef struct p80211msg_ind_authenticate { - UINT32 msgcode; - p80211item_pstr6_t peerstaaddr; - p80211item_uint32_t authtype; + UINT32 msgcode __WLAN_ATTRIB_PACK__; + p80211item_pstr6_t peerstaaddr __WLAN_ATTRIB_PACK__; + p80211item_uint32_t authtype __WLAN_ATTRIB_PACK__; } p80211msg_ind_authenticate_t; +__WLAN_PRAGMA_PACKDFLT__ +__WLAN_PRAGMA_PACK1__ typedef struct p80211msg_ind_deauthenticate { - UINT32 msgcode; - p80211item_pstr6_t peerstaaddr; - p80211item_uint32_t reasoncode; + UINT32 msgcode __WLAN_ATTRIB_PACK__; + p80211item_pstr6_t peerstaaddr __WLAN_ATTRIB_PACK__; + p80211item_uint32_t reasoncode __WLAN_ATTRIB_PACK__; } p80211msg_ind_deauthenticate_t; +__WLAN_PRAGMA_PACKDFLT__ +__WLAN_PRAGMA_PACK1__ typedef struct p80211msg_ind_associate { - UINT32 msgcode; - p80211item_pstr6_t peerstaaddr; + UINT32 msgcode __WLAN_ATTRIB_PACK__; + p80211item_pstr6_t peerstaaddr __WLAN_ATTRIB_PACK__; } p80211msg_ind_associate_t; +__WLAN_PRAGMA_PACKDFLT__ +__WLAN_PRAGMA_PACK1__ typedef struct p80211msg_ind_reassociate { - UINT32 msgcode; - p80211item_pstr6_t peerstaaddr; + UINT32 msgcode __WLAN_ATTRIB_PACK__; + p80211item_pstr6_t peerstaaddr __WLAN_ATTRIB_PACK__; } p80211msg_ind_reassociate_t; +__WLAN_PRAGMA_PACKDFLT__ +__WLAN_PRAGMA_PACK1__ typedef struct p80211msg_ind_disassociate { - UINT32 msgcode; - p80211item_pstr6_t peerstaaddr; - p80211item_uint32_t reasoncode; + UINT32 msgcode __WLAN_ATTRIB_PACK__; + p80211item_pstr6_t peerstaaddr __WLAN_ATTRIB_PACK__; + p80211item_uint32_t reasoncode __WLAN_ATTRIB_PACK__; } p80211msg_ind_disassociate_t; +__WLAN_PRAGMA_PACKDFLT__ /*====================================================================*/ /*----- External Declarations ----------------------------------------*/ diff --git a/src/include/wlan/p80211types.h b/src/include/wlan/p80211types.h index 3fd5a50..6398040 100644 --- a/src/include/wlan/p80211types.h +++ b/src/include/wlan/p80211types.h @@ -65,6 +65,7 @@ /* these is in p80211types.c. These defines were generated from the */ /* mappings. */ /*--------------------------------------------------------------------*/ +#define P80211ENUM_BAD 0xffffffffUL /* error code for lookups */ #define P80211ENUM_truth_false 0 #define P80211ENUM_truth_true 1 #define P80211ENUM_powermgmt_active 1 @@ -274,131 +275,183 @@ typedef struct p80211enum /* messages. */ /*--------------------------------------------------------------------*/ +/* Template pascal string */ +__WLAN_PRAGMA_PACK1__ +typedef struct p80211pstr +{ + UINT8 len __WLAN_ATTRIB_PACK__; +} p80211pstr_t; +__WLAN_PRAGMA_PACKDFLT__ + +__WLAN_PRAGMA_PACK1__ +typedef struct p80211pstrd +{ + UINT8 len __WLAN_ATTRIB_PACK__; + UINT8 data[0] __WLAN_ATTRIB_PACK__; +} p80211pstrd_t; +__WLAN_PRAGMA_PACKDFLT__ + /* Maximum pascal string */ +__WLAN_PRAGMA_PACK1__ typedef struct p80211pstr255 { - UINT8 len; - UINT8 data[MAXLEN_PSTR255]; + UINT8 len __WLAN_ATTRIB_PACK__; + UINT8 data[MAXLEN_PSTR255+1] __WLAN_ATTRIB_PACK__; } p80211pstr255_t; +__WLAN_PRAGMA_PACKDFLT__ /* pascal string for macaddress and bssid */ +__WLAN_PRAGMA_PACK1__ typedef struct p80211pstr6 { - UINT8 len; - UINT8 data[MAXLEN_PSTR6]; + UINT8 len __WLAN_ATTRIB_PACK__; + UINT8 data[MAXLEN_PSTR6+1] __WLAN_ATTRIB_PACK__; } p80211pstr6_t; +__WLAN_PRAGMA_PACKDFLT__ /* pascal string for channel list */ +__WLAN_PRAGMA_PACK1__ typedef struct p80211pstr14 { - UINT8 len; - UINT8 data[MAXLEN_PSTR14]; + UINT8 len __WLAN_ATTRIB_PACK__; + UINT8 data[MAXLEN_PSTR14+1] __WLAN_ATTRIB_PACK__; } p80211pstr14_t; +__WLAN_PRAGMA_PACKDFLT__ /* pascal string for ssid */ +__WLAN_PRAGMA_PACK1__ typedef struct p80211pstr32 { - UINT8 len; - UINT8 data[MAXLEN_PSTR32]; + UINT8 len __WLAN_ATTRIB_PACK__; + UINT8 data[MAXLEN_PSTR32+1] __WLAN_ATTRIB_PACK__; } p80211pstr32_t; +__WLAN_PRAGMA_PACKDFLT__ /* prototype template */ +__WLAN_PRAGMA_PACK1__ typedef struct p80211item { - UINT32 did; - UINT32 len; + UINT32 did __WLAN_ATTRIB_PACK__; + UINT32 len __WLAN_ATTRIB_PACK__; } p80211item_t; +__WLAN_PRAGMA_PACKDFLT__ + +/* prototype template w/ data item */ +__WLAN_PRAGMA_PACK1__ +typedef struct p80211itemd +{ + UINT32 did __WLAN_ATTRIB_PACK__; + UINT32 len __WLAN_ATTRIB_PACK__; + UINT8 data[0] __WLAN_ATTRIB_PACK__; +} p80211itemd_t; +__WLAN_PRAGMA_PACKDFLT__ /* message data iteem for COLLECTION */ +__WLAN_PRAGMA_PACK1__ typedef struct p80211item_coll { - UINT32 did; - UINT32 len; + UINT32 did __WLAN_ATTRIB_PACK__; + UINT32 len __WLAN_ATTRIB_PACK__; } p80211item_coll_t; +__WLAN_PRAGMA_PACKDFLT__ /* message data item for INT, BOUNDEDINT, ENUMINT */ +__WLAN_PRAGMA_PACK1__ typedef struct p80211item_uint32 { - UINT32 did; - UINT32 len; - UINT32 data; + UINT32 did __WLAN_ATTRIB_PACK__; + UINT32 len __WLAN_ATTRIB_PACK__; + UINT32 data __WLAN_ATTRIB_PACK__; } p80211item_uint32_t; +__WLAN_PRAGMA_PACKDFLT__ /* message data item for OCTETSTR, DISPLAYSTR */ +__WLAN_PRAGMA_PACK1__ typedef struct p80211item_pstr6 { - UINT32 did; - UINT32 len; - p80211pstr6_t data; + UINT32 did __WLAN_ATTRIB_PACK__; + UINT32 len __WLAN_ATTRIB_PACK__; + p80211pstr6_t data __WLAN_ATTRIB_PACK__; }p80211item_pstr6_t; +__WLAN_PRAGMA_PACKDFLT__ /* message data item for OCTETSTR, DISPLAYSTR */ +__WLAN_PRAGMA_PACK1__ typedef struct p80211item_pstr14 { - UINT32 did; - UINT32 len; - p80211pstr14_t data; + UINT32 did __WLAN_ATTRIB_PACK__; + UINT32 len __WLAN_ATTRIB_PACK__; + p80211pstr14_t data __WLAN_ATTRIB_PACK__; }p80211item_pstr14_t; +__WLAN_PRAGMA_PACKDFLT__ /* message data item for OCTETSTR, DISPLAYSTR */ +__WLAN_PRAGMA_PACK1__ typedef struct p80211item_pstr32 { - UINT32 did; - UINT32 len; - p80211pstr32_t data; + UINT32 did __WLAN_ATTRIB_PACK__; + UINT32 len __WLAN_ATTRIB_PACK__; + p80211pstr32_t data __WLAN_ATTRIB_PACK__; }p80211item_pstr32_t; +__WLAN_PRAGMA_PACKDFLT__ /* message data item for OCTETSTR, DISPLAYSTR */ +__WLAN_PRAGMA_PACK1__ typedef struct p80211item_pstr255 { - UINT32 did; - UINT32 len; - p80211pstr255_t data; + UINT32 did __WLAN_ATTRIB_PACK__; + UINT32 len __WLAN_ATTRIB_PACK__; + p80211pstr255_t data __WLAN_ATTRIB_PACK__; }p80211item_pstr255_t; +__WLAN_PRAGMA_PACKDFLT__ /* message data item for the collection in the BSSDescription argument */ /* in the SCAN msg */ +__WLAN_PRAGMA_PACK1__ typedef struct p80211item_coll_bssdesc { - p80211item_pstr6_t bssid; - p80211item_pstr32_t ssid; - p80211item_uint32_t bsstype; - p80211item_uint32_t beaconperiod; - p80211item_uint32_t dtimperiod; - p80211item_uint32_t timestamp; - p80211item_uint32_t localtime; - p80211item_uint32_t fhdwelltime; - p80211item_uint32_t fhhopset; - p80211item_uint32_t fhhoppattern; - p80211item_uint32_t fhhopindex; - p80211item_uint32_t dschannel; - p80211item_uint32_t cfpcount; - p80211item_uint32_t cfpperiod; - p80211item_uint32_t cfpmaxdur; - p80211item_uint32_t cfpdurremain; - p80211item_uint32_t ibssatimwin; - p80211item_uint32_t cfpollable; - p80211item_uint32_t cfpollreq; - p80211item_uint32_t privacy; - p80211item_uint32_t basicrate1; - p80211item_uint32_t basicrate2; - p80211item_uint32_t basicrate3; - p80211item_uint32_t basicrate4; - p80211item_uint32_t basicrate5; - p80211item_uint32_t basicrate6; - p80211item_uint32_t basicrate7; - p80211item_uint32_t basicrate8; + p80211item_pstr6_t bssid __WLAN_ATTRIB_PACK__; + p80211item_pstr32_t ssid __WLAN_ATTRIB_PACK__; + p80211item_uint32_t bsstype __WLAN_ATTRIB_PACK__; + p80211item_uint32_t beaconperiod __WLAN_ATTRIB_PACK__; + p80211item_uint32_t dtimperiod __WLAN_ATTRIB_PACK__; + p80211item_uint32_t timestamp __WLAN_ATTRIB_PACK__; + p80211item_uint32_t localtime __WLAN_ATTRIB_PACK__; + p80211item_uint32_t fhdwelltime __WLAN_ATTRIB_PACK__; + p80211item_uint32_t fhhopset __WLAN_ATTRIB_PACK__; + p80211item_uint32_t fhhoppattern __WLAN_ATTRIB_PACK__; + p80211item_uint32_t fhhopindex __WLAN_ATTRIB_PACK__; + p80211item_uint32_t dschannel __WLAN_ATTRIB_PACK__; + p80211item_uint32_t cfpcount __WLAN_ATTRIB_PACK__; + p80211item_uint32_t cfpperiod __WLAN_ATTRIB_PACK__; + p80211item_uint32_t cfpmaxdur __WLAN_ATTRIB_PACK__; + p80211item_uint32_t cfpdurremain __WLAN_ATTRIB_PACK__; + p80211item_uint32_t ibssatimwin __WLAN_ATTRIB_PACK__; + p80211item_uint32_t cfpollable __WLAN_ATTRIB_PACK__; + p80211item_uint32_t cfpollreq __WLAN_ATTRIB_PACK__; + p80211item_uint32_t privacy __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate1 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate2 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate3 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate4 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate5 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate6 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate7 __WLAN_ATTRIB_PACK__; + p80211item_uint32_t basicrate8 __WLAN_ATTRIB_PACK__; }p80211item_coll_bssdesc_t; +__WLAN_PRAGMA_PACKDFLT__ /* message data item for the BSSDescription argument in the SCAN msg */ +__WLAN_PRAGMA_PACK1__ typedef struct p80211item_bssdesc { - UINT32 did; - UINT32 len; - p80211item_coll_bssdesc_t data; + UINT32 did __WLAN_ATTRIB_PACK__; + UINT32 len __WLAN_ATTRIB_PACK__; + p80211item_coll_bssdesc_t data __WLAN_ATTRIB_PACK__; } p80211item_bssdesc_t; +__WLAN_PRAGMA_PACKDFLT__ /*--------------------------------------------------------------------*/ /* The following structure type is used to represent all of the */ @@ -406,6 +459,10 @@ typedef struct p80211item_bssdesc /* different metadata items. */ /*--------------------------------------------------------------------*/ +typedef void (*p80211_totext_t)(UINT32 did, UINT8* itembuf, char *textbuf); +typedef void (*p80211_fromtext_t)(UINT32 did, UINT8* itembuf, char *textbuf); +typedef UINT32 (*p80211_valid_t)(UINT32 did, UINT8* itembuf); + typedef struct p80211meta { char *name; /* data item name */ @@ -416,9 +473,9 @@ typedef struct p80211meta UINT32 maxlen; /* maxlen of a OCTETSTR or DISPLAYSTR */ p80211enum_t *enumptr; /* ptr to the enum type for ENUMINT */ struct p80211meta *collptr; /* ptr to array of COLLECTION subitems */ - void (*totextptr)(void); /* ptr to totext conversion function */ - void (*fromtextptr)(void); /* ptr to totext conversion function */ - void (*validfunptr)(void); /* ptr to totext conversion function */ + p80211_totext_t totextptr; /* ptr to totext conversion function */ + p80211_fromtext_t fromtextptr; /* ptr to totext conversion function */ + p80211_valid_t validfunptr; /* ptr to totext conversion function */ } p80211meta_t; @@ -444,6 +501,7 @@ extern p80211enum_t MKENUMNAME(scantype); extern p80211enum_t MKENUMNAME(resultcode); extern p80211enum_t MKENUMNAME(reason); extern p80211enum_t MKENUMNAME(status); +extern p80211enum_t MKENUMNAME(msgcode); /*--------------------------------------------------------------------*/ /* Metadata Lists */ @@ -514,6 +572,21 @@ extern UINT32 MKINDMETASIZE(disassociate); /*====================================================================*/ /*----- Function Prototypes ------------------------------------------*/ +/*--------------------------------------------------------------------*/ +/* The following declare some utility functions for use with the */ +/* p80211enum_t type. */ +/*--------------------------------------------------------------------*/ + +UINT32 p80211enum_text2int(p80211enum_t *ep, char *text); +void p80211enum_int2text(p80211enum_t *ep, UINT32 val, char *text); + +/*--------------------------------------------------------------------*/ +/* The following declare some utility functions for use with the */ +/* p80211item_t and p80211meta_t types. */ +/*--------------------------------------------------------------------*/ + +UINT32 p80211item_maxdatalen( UINT32 did ); + /*--------------------------------------------------------------------*/ /* The following declare functions that perform validation and text */ /* to binary conversions based on the metadata for interface and */ @@ -522,92 +595,92 @@ extern UINT32 MKINDMETASIZE(disassociate); /*-- DISPLAYSTR ------------------------------------------------------*/ /* pstr ==> cstr */ -void p80211_totext_displaystr( void ); +void p80211_totext_displaystr( UINT32 did, UINT8 *itembuf, char *textbuf ); /* cstr ==> pstr */ -void p80211_fromtext_displaystr( void ); +void p80211_fromtext_displaystr( UINT32 did, UINT8 *itembuf, char *textbuf ); /* function that checks validity of a displaystr binary value */ -void p80211_isvalid_displaystr( void ); +UINT32 p80211_isvalid_displaystr( UINT32 did, UINT8 *itembuf ); /*-- OCTETSTR --------------------------------------------------------*/ /* pstr ==> "xx:xx:...." */ -void p80211_totext_octetstr( void ); +void p80211_totext_octetstr( UINT32 did, UINT8 *itembuf, char *textbuf ); /* "xx:xx:...." ==> pstr */ -void p80211_fromtext_octetstr( void ); +void p80211_fromtext_octetstr( UINT32 did, UINT8 *itembuf, char *textbuf ); /* function that checks validity of an octetstr binary value */ -void p80211_isvalid_octetstr( void ); +UINT32 p80211_isvalid_octetstr( UINT32 did, UINT8 *itembuf ); /*-- BOUNDEDINT ------------------------------------------------------*/ /* UINT32 ==> %d */ -void p80211_totext_boundedint( void ); +void p80211_totext_boundedint( UINT32 did, UINT8 *itembuf, char *textbuf ); /* %d ==> UINT32 */ -void p80211_fromtext_boundedint( void ); +void p80211_fromtext_boundedint( UINT32 did, UINT8 *itembuf, char *textbuf ); /* function that checks validity of a boundedint's binary value */ -void p80211_isvalid_boundedint( void ); +UINT32 p80211_isvalid_boundedint( UINT32 did, UINT8 *itembuf ); /*-- INT -------------------------------------------------------------*/ /* UINT32 ==> %d */ -void p80211_totext_int( void ); +void p80211_totext_int( UINT32 did, UINT8 *itembuf, char *textbuf ); /* %d ==> UINT32 */ -void p80211_fromtext_int( void ); +void p80211_fromtext_int( UINT32 did, UINT8 *itembuf, char *textbuf ); /* function that checks validity of an int's binary value (always successful) */ -void p80211_isvalid_int( void ); +UINT32 p80211_isvalid_int( UINT32 did, UINT8 *itembuf ); /*-- ENUMINT ---------------------------------------------------------*/ /* UINT32 ==> */ -void p80211_totext_enumint( void ); +void p80211_totext_enumint( UINT32 did, UINT8 *itembuf, char *textbuf ); /* ==> UINT32 */ -void p80211_fromtext_enumint( void ); +void p80211_fromtext_enumint( UINT32 did, UINT8 *itembuf, char *textbuf ); /* function that checks validity of an enum's binary value */ -void p80211_isvalid_enumint( void ); +UINT32 p80211_isvalid_enumint( UINT32 did, UINT8 *itembuf ); /*-- COLLECTION ------------------------------------------------------*/ /* ==> */ -void p80211_totext_collection( void ); +void p80211_totext_collection( UINT32 did, UINT8 *itembuf, char *textbuf ); /* ==> */ -void p80211_fromtext_collection( void ); +void p80211_fromtext_collection( UINT32 did, UINT8 *itembuf, char *textbuf ); /* function that checks validity of a collection's binary value */ -void p80211_isvalid_collection( void ); +UINT32 p80211_isvalid_collection( UINT32 did, UINT8 *itembuf ); /*-- MIBITEM ---------------------------------------------------------*/ /* ==> */ -void p80211_totext_mibitem( void ); +void p80211_totext_mibitem( UINT32 did, UINT8 *itembuf, char *textbuf ); /* ==> */ -void p80211_fromtext_mibitem( void ); +void p80211_fromtext_mibitem( UINT32 did, UINT8 *itembuf, char *textbuf ); /* function that checks validity of a mibitem's binary value */ -void p80211_isvalid_mibitem( void ); +UINT32 p80211_isvalid_mibitem( UINT32 did, UINT8 *itembuf ); /*-- MIBDID ----------------------------------------------------------*/ /* ==> */ -void p80211_totext_mibdid( void ); +void p80211_totext_mibdid( UINT32 did, UINT8 *itembuf, char *textbuf ); /* ==> */ -void p80211_fromtext_mibdid( void ); +void p80211_fromtext_mibdid( UINT32 did, UINT8 *itembuf, char *textbuf ); /* function that checks validity of a mibdid's binary value */ -void p80211_isvalid_mibdid( void ); +UINT32 p80211_isvalid_mibdid( UINT32 did, UINT8 *itembuf ); /*-- MIBCOLLECTION ---------------------------------------------------*/ /* ==> */ -void p80211_totext_mibcollection( void ); +void p80211_totext_mibcollection( UINT32 did, UINT8 *itembuf, char *textbuf ); /* ==> */ -void p80211_fromtext_mibcollection( void ); +void p80211_fromtext_mibcollection( UINT32 did, UINT8 *itembuf, char *textbuf ); /* function that checks validity of a mibcollection binary value */ -void p80211_isvalid_mibcollection( void ); +UINT32 p80211_isvalid_mibcollection( UINT32 did, UINT8 *itembuf ); #endif /* _P80211TYPES_H */ diff --git a/src/shared/p80211metamsg.c b/src/shared/p80211metamsg.c index b864082..385345f 100644 --- a/src/shared/p80211metamsg.c +++ b/src/shared/p80211metamsg.c @@ -584,7 +584,7 @@ p80211meta_t MKREQMETANAME(mibget)[] = /* offset */ P80211ITEM_MKOFFSET(ISREQUIRED, 0UL, ISCONFIRM, 24UL ), /* min */ 0, /* max */ 0, -/* maxlen */ 0, +/* maxlen */ 276, /* enumptr */ NULL, /* collptr */ MKCOLLMETANAME(getmibvalue), /* totextptr */ p80211_totext_mibcollection, @@ -648,7 +648,7 @@ p80211meta_t MKREQMETANAME(mibset)[] = /* offset */ P80211ITEM_MKOFFSET(ISREQUIRED, ISREQUEST, ISCONFIRM, 24UL ), /* min */ 0, /* max */ 0, -/* maxlen */ 0, +/* maxlen */ 276, /* enumptr */ NULL, /* collptr */ MKCOLLMETANAME(getmibvalue), /* totextptr */ p80211_totext_mibcollection, @@ -880,7 +880,7 @@ p80211meta_t MKREQMETANAME(scan)[] = /* offset */ P80211ITEM_MKOFFSET(ISREQUIRED, 0UL, ISCONFIRM, 156UL ), /* min */ 0, /* max */ 0, -/* maxlen */ 0, +/* maxlen */ 372, /* enumptr */ NULL, /* collptr */ MKCOLLMETANAME(bssdesc), /* totextptr */ p80211_totext_collection, @@ -893,7 +893,7 @@ p80211meta_t MKREQMETANAME(scan)[] = /* offset */ P80211ITEM_MKOFFSET(ISREQUIRED, 0UL, ISCONFIRM, 536UL ), /* min */ 0, /* max */ 0, -/* maxlen */ 0, +/* maxlen */ 372, /* enumptr */ NULL, /* collptr */ MKCOLLMETANAME(bssdesc), /* totextptr */ p80211_totext_collection, @@ -906,7 +906,7 @@ p80211meta_t MKREQMETANAME(scan)[] = /* offset */ P80211ITEM_MKOFFSET(ISREQUIRED, 0UL, ISCONFIRM, 916UL ), /* min */ 0, /* max */ 0, -/* maxlen */ 0, +/* maxlen */ 372, /* enumptr */ NULL, /* collptr */ MKCOLLMETANAME(bssdesc), /* totextptr */ p80211_totext_collection, @@ -919,7 +919,7 @@ p80211meta_t MKREQMETANAME(scan)[] = /* offset */ P80211ITEM_MKOFFSET(ISREQUIRED, 0UL, ISCONFIRM, 1296UL ), /* min */ 0, /* max */ 0, -/* maxlen */ 0, +/* maxlen */ 372, /* enumptr */ NULL, /* collptr */ MKCOLLMETANAME(bssdesc), /* totextptr */ p80211_totext_collection, @@ -932,7 +932,7 @@ p80211meta_t MKREQMETANAME(scan)[] = /* offset */ P80211ITEM_MKOFFSET(ISREQUIRED, 0UL, ISCONFIRM, 1676UL ), /* min */ 0, /* max */ 0, -/* maxlen */ 0, +/* maxlen */ 372, /* enumptr */ NULL, /* collptr */ MKCOLLMETANAME(bssdesc), /* totextptr */ p80211_totext_collection, @@ -945,7 +945,7 @@ p80211meta_t MKREQMETANAME(scan)[] = /* offset */ P80211ITEM_MKOFFSET(ISREQUIRED, 0UL, ISCONFIRM, 2056UL ), /* min */ 0, /* max */ 0, -/* maxlen */ 0, +/* maxlen */ 372, /* enumptr */ NULL, /* collptr */ MKCOLLMETANAME(bssdesc), /* totextptr */ p80211_totext_collection, @@ -958,7 +958,7 @@ p80211meta_t MKREQMETANAME(scan)[] = /* offset */ P80211ITEM_MKOFFSET(ISREQUIRED, 0UL, ISCONFIRM, 2436UL ), /* min */ 0, /* max */ 0, -/* maxlen */ 0, +/* maxlen */ 372, /* enumptr */ NULL, /* collptr */ MKCOLLMETANAME(bssdesc), /* totextptr */ p80211_totext_collection, @@ -971,7 +971,7 @@ p80211meta_t MKREQMETANAME(scan)[] = /* offset */ P80211ITEM_MKOFFSET(ISREQUIRED, 0UL, ISCONFIRM, 2816UL ), /* min */ 0, /* max */ 0, -/* maxlen */ 0, +/* maxlen */ 372, /* enumptr */ NULL, /* collptr */ MKCOLLMETANAME(bssdesc), /* totextptr */ p80211_totext_collection, @@ -984,7 +984,7 @@ p80211meta_t MKREQMETANAME(scan)[] = /* offset */ P80211ITEM_MKOFFSET(ISREQUIRED, 0UL, ISCONFIRM, 3196UL ), /* min */ 0, /* max */ 0, -/* maxlen */ 0, +/* maxlen */ 372, /* enumptr */ NULL, /* collptr */ MKCOLLMETANAME(bssdesc), /* totextptr */ p80211_totext_collection, @@ -997,7 +997,7 @@ p80211meta_t MKREQMETANAME(scan)[] = /* offset */ P80211ITEM_MKOFFSET(ISREQUIRED, 0UL, ISCONFIRM, 3576UL ), /* min */ 0, /* max */ 0, -/* maxlen */ 0, +/* maxlen */ 372, /* enumptr */ NULL, /* collptr */ MKCOLLMETANAME(bssdesc), /* totextptr */ p80211_totext_collection, diff --git a/src/shared/p80211types.c b/src/shared/p80211types.c index a83cef8..aceac63 100644 --- a/src/shared/p80211types.c +++ b/src/shared/p80211types.c @@ -20,18 +20,370 @@ */ #include +#include #include #include #include +/*====================================================================*/ +/* Local Types */ +/*====================================================================*/ + /*====================================================================*/ +/* Static data defined in this file */ +/*====================================================================*/ + +/* too much data in this file, we moved to the bottom */ + +/*====================================================================*/ +/* Local Function Declarations */ +/*====================================================================*/ + + +/*====================================================================*/ +/* Function Definitions */ +/*====================================================================*/ + +/*---------------------------------------------------------------- +* p80211enum_text2int +* +* Returns the numeric value of an enum item name and a ptr to +* the enum struct. +* +* returns: +* 0xffffffff no match on the name +* anything else success +----------------------------------------------------------------*/ +UINT32 p80211enum_text2int(p80211enum_t *ep, char *text) +{ + UINT32 result = 0xffffffffUL; + int i; + + for ( i = 0; i < ep->nitems; i++ ) + { + if ( strcmp(text, ep->list[i].name ) == 0 ) + { + result = ep->list[i].val; + break; + } + } + return result; +} + + +/*---------------------------------------------------------------- +* p80211enum_int2text +* +* Fills a buffer with the name string for a given integer +* quantity and a ptr to the enum struct. +* +* returns: +* "" no match on the numeric value +* anything else success +----------------------------------------------------------------*/ +void p80211enum_int2text(p80211enum_t *ep, UINT32 val, char *text) +{ + int i; + + text[0] = '\0'; + + for ( i = 0; i < ep->nitems; i++) + { + if ( ep->list[i].val == val ) + { + strcpy( text, ep->list[i].name ); + break; + } + } + return; +} + + +/*---------------------------------------------------------------- +* p80211item_maxlen +* +* Returns the total maximum data size of an item identified +* by a given DID. This is the length of the data part of the +* item triple. +* +* returns: +* 0xffffffff if the type from the did doesn't match a +* known type +* itemlen on success +----------------------------------------------------------------*/ +UINT32 p80211item_maxdatalen( UINT32 did ) +{ + UINT32 maxlen = 0; + p80211meta_t *meta; + + + meta = &(p80211meta_slist + [P80211DID_SECTION(did)] + [P80211DID_GROUP(did)] + [P80211DID_ITEM(did)]); + + switch( P80211DID_TYPE(did) ) + { + case P80211_TYPE_OCTETSTR: + case P80211_TYPE_DISPLAYSTR: + maxlen = meta->maxlen + 1; /* add one for the pstr length byte */ + break; + + case P80211_TYPE_INT: + case P80211_TYPE_BOUNDEDINT: + case P80211_TYPE_ENUMINT: + maxlen = 4; /* all int types are 4 bytes */ + break; + + case P80211_TYPE_COLLECTION: + maxlen = meta->maxlen; + break; + + default: + maxlen = 0xffffffffUL; + } + return maxlen; +} + + +/*--------------------------------------------------------------------*/ +/* The following function definitions are for functions that */ +/* functions that convert MIB items binary represenations to/from */ +/* their textual representations. */ +/* Note: all of these functions assume a valid DID and pointers */ +/* All textual representations are "=" */ +/* All itembufs are p80211item_t */ +/* isvalid functions return: */ +/* 0 if item is invalid */ +/* non-zero if item is value */ +/*--------------------------------------------------------------------*/ + +/*-- DISPLAYSTR ------------------------------------------------------*/ +/* pstr ==> cstr */ +void p80211_totext_displaystr( UINT32 did, UINT8 *itembuf, char *textbuf ) +{ + p80211meta_t *meta = NULL; + p80211itemd_t *item = (p80211itemd_t*)itembuf; + p80211pstrd_t *pstr; + UINT8 *cstr; + + /* collect the C string stored in the data item */ + pstr = (p80211pstrd_t*)item->data; + cstr = pstr->data; + + /* collect the metadata item */ + meta = &(p80211meta_slist + [P80211DID_SECTION(did)] + [P80211DID_GROUP(did)] + [P80211DID_ITEM(did)]); + + /* now, print to the textbuf */ + sprintf( textbuf, "%s=%s", meta->name, cstr); + + return; +} + +/* cstr ==> pstr */ +void p80211_fromtext_displaystr( UINT32 did, UINT8 *itembuf, char *textbuf ) +{ + p80211meta_t *meta = NULL; + p80211itemd_t *item = (p80211itemd_t*)itembuf; + p80211pstrd_t *pstr; + + /* collect the metadata item */ + meta = &(p80211meta_slist + [P80211DID_SECTION(did)] + [P80211DID_GROUP(did)] + [P80211DID_ITEM(did)]); + + /* set up the pointers */ + pstr = (p80211pstrd_t*)item->data; + + /* set the DID and length */ + item->did = did | meta->did; /* OR in the partial DID for safety */ + item->len = meta->maxlen; + + /* set the data */ + /* first the, skip past the item name */ + textbuf = strchr(textbuf, '='); + if ( textbuf != NULL ) + { + textbuf++; /* OK, got the '=', bump to the next */ + pstr->len = strlen(textbuf) + 1; /* INCLUDE the '\0' in the pstr */ + memcpy( pstr->data, textbuf, pstr->len); + } + else /* bogus text string, set the item to an empty string */ + { + pstr->len = 1; + pstr->data[0] = '\0'; + } + return; +} + +/* function that checks validity of data item's value */ +UINT32 p80211_isvalid_displaystr( UINT32 did, UINT8 *itembuf ) +{ + UINT32 result = 0; + p80211meta_t *meta = NULL; + p80211itemd_t *item = (p80211itemd_t*)itembuf; + p80211pstrd_t *pstr; + + /* collect the metadata item */ + meta = &(p80211meta_slist + [P80211DID_SECTION(did)] + [P80211DID_GROUP(did)] + [P80211DID_ITEM(did)]); + + /* set up the pointers */ + pstr = (p80211pstrd_t*)item->data; + + if ( (pstr->len - 1) <= meta->maxlen ) + { + result = 1; + } + return result; +} + + +/*-- OCTETSTR --------------------------------------------------------*/ +/* pstr ==> "xx:xx:...." */ +void p80211_totext_octetstr( UINT32 did, UINT8 *itembuf, char *textbuf ) +{ +} + +/* "xx:xx:...." ==> pstr */ +void p80211_fromtext_octetstr( UINT32 did, UINT8 *itembuf, char *textbuf ) +{ +} + +/* function that checks validity of data item's value */ +UINT32 p80211_isvalid_octetstr( UINT32 did, UINT8 *itembuf ) +{ +} + +/*-- BOUNDEDINT ------------------------------------------------------*/ +/* UINT32 ==> %d */ +void p80211_totext_boundedint( UINT32 did, UINT8 *itembuf, char *textbuf ) +{ +} + +/* %d ==> UINT32 */ +void p80211_fromtext_boundedint( UINT32 did, UINT8 *itembuf, char *textbuf ) +{ +} + +/* function that checks validity of data item's value */ +UINT32 p80211_isvalid_boundedint( UINT32 did, UINT8 *itembuf ) +{ +} + +/*-- INT -------------------------------------------------------------*/ +/* UINT32 ==> %d */ +void p80211_totext_int( UINT32 did, UINT8 *itembuf, char *textbuf ) +{ +} + +/* %d ==> UINT32 */ +void p80211_fromtext_int( UINT32 did, UINT8 *itembuf, char *textbuf ) +{ +} + +/* function that checks validity of data item's value */ +UINT32 p80211_isvalid_int( UINT32 did, UINT8 *itembuf ) +{ +} + +/*-- ENUMINT ---------------------------------------------------------*/ +/* UINT32 ==> */ +void p80211_totext_enumint( UINT32 did, UINT8 *itembuf, char *textbuf ) +{ +} + +/* ==> UINT32 */ +void p80211_fromtext_enumint( UINT32 did, UINT8 *itembuf, char *textbuf ) +{ +} + +/* function that checks validity of data item's value */ +UINT32 p80211_isvalid_enumint( UINT32 did, UINT8 *itembuf ) +{ +} + +/*-- COLLECTION ------------------------------------------------------*/ +/* UINT32 ==> */ +void p80211_totext_collection( UINT32 did, UINT8 *itembuf, char *textbuf ) +{ +} + +/* ==> UINT32 */ +void p80211_fromtext_collection( UINT32 did, UINT8 *itembuf, char *textbuf ) +{ +} + +/* function that checks validity of data item's value */ +UINT32 p80211_isvalid_collection( UINT32 did, UINT8 *itembuf ) +{ +} + +/*-- MIBITEM ---------------------------------------------------------*/ +/* ==> */ +void p80211_totext_mibitem( UINT32 did, UINT8 *itembuf, char *textbuf ) +{ +} + +/* ==> */ +void p80211_fromtext_mibitem( UINT32 did, UINT8 *itembuf, char *textbuf ) +{ +} + +/* function that checks validity of a mibitem's binary value */ +UINT32 p80211_isvalid_mibitem( UINT32 did, UINT8 *itembuf ) +{ +} + +/*-- MIBDID ----------------------------------------------------------*/ +/* ==> */ +void p80211_fromtext_mibdid( UINT32 did, UINT8 *itembuf, char *textbuf ) +{ +} + +/* ==> */ +void p80211_totext_mibdid( UINT32 did, UINT8 *itembuf, char *textbuf ) +{ +} + +/* function that checks validity of a mibdid's binary value */ +UINT32 p80211_isvalid_mibdid( UINT32 did, UINT8 *itembuf ) +{ +} + +/*-- MIBCOLLECTION ---------------------------------------------------*/ +/* ==> */ +void p80211_fromtext_mibcollection( UINT32 did, UINT8 *itembuf, char *textbuf ) +{ +} + +/* ==> */ +void p80211_totext_mibcollection( UINT32 did, UINT8 *itembuf, char *textbuf ) +{ +} + +/* function that checks validity of a mibcollection binary value */ +UINT32 p80211_isvalid_mibcollection( UINT32 did, UINT8 *itembuf ) +{ +} +/*====================================================================*/ +/* Static data defined in this file */ +/*====================================================================*/ + +/*--------------------------------------------------------------------*/ /* Item Metadata */ /* The following array contains pointers to the metadata sections. */ /* Each section is an array of groups, each group is an array of */ /* metadata items. */ -/*====================================================================*/ +/*--------------------------------------------------------------------*/ extern UINT32 p80211meta_slist_size; @@ -53,11 +405,11 @@ p80211meta_t **p80211meta_slist[] = UINT32 p80211meta_slist_size = sizeof(p80211meta_slist)/sizeof(p80211meta_t**); -/*====================================================================*/ +/*--------------------------------------------------------------------*/ /* Item enumerations */ /* The following arrays list the numbers and names for each of the */ /* enumerations present in the 802.11 MIB and MLME. */ -/*====================================================================*/ +/*--------------------------------------------------------------------*/ /* the following depends on the following defines: P80211_NOINCLUDESTRINGS - ifdef, all metadata name fields are empty strings @@ -252,154 +604,4 @@ MKENUMPAIRLIST(msgcode) }; MKENUM(msgcode); -/*--------------------------------------------------------------------*/ -/* The following function definitions are for functions that */ -/* functions that convert MIB items binary represenations to/from */ -/* their textual representations. */ -/*--------------------------------------------------------------------*/ - - -/*-- DISPLAYSTR ------------------------------------------------------*/ -/* pstr ==> cstr */ -void p80211_totext_displaystr( void ) -{ -} - -/* cstr ==> pstr */ -void p80211_fromtext_displaystr( void ) -{ -} - -/* function that checks validity of data item's value */ -void p80211_isvalid_displaystr( void ) -{ -} - -/*-- OCTETSTR --------------------------------------------------------*/ -/* pstr ==> "xx:xx:...." */ -void p80211_totext_octetstr( void ) -{ -} - -/* "xx:xx:...." ==> pstr */ -void p80211_fromtext_octetstr( void ) -{ -} - -/* function that checks validity of data item's value */ -void p80211_isvalid_octetstr( void ) -{ -} - -/*-- BOUNDEDINT ------------------------------------------------------*/ -/* UINT32 ==> %d */ -void p80211_totext_boundedint( void ) -{ -} - -/* %d ==> UINT32 */ -void p80211_fromtext_boundedint( void ) -{ -} - -/* function that checks validity of data item's value */ -void p80211_isvalid_boundedint( void ) -{ -} - -/*-- INT -------------------------------------------------------------*/ -/* UINT32 ==> %d */ -void p80211_totext_int( void ) -{ -} - -/* %d ==> UINT32 */ -void p80211_fromtext_int( void ) -{ -} - -/* function that checks validity of data item's value */ -void p80211_isvalid_int( void ) -{ -} - -/*-- ENUMINT ---------------------------------------------------------*/ -/* UINT32 ==> */ -void p80211_totext_enumint( void ) -{ -} - -/* ==> UINT32 */ -void p80211_fromtext_enumint( void ) -{ -} - -/* function that checks validity of data item's value */ -void p80211_isvalid_enumint( void ) -{ -} - -/*-- COLLECTION ------------------------------------------------------*/ -/* UINT32 ==> */ -void p80211_totext_collection( void ) -{ -} - -/* ==> UINT32 */ -void p80211_fromtext_collection( void ) -{ -} - -/* function that checks validity of data item's value */ -void p80211_isvalid_collection( void ) -{ -} - -/*-- MIBITEM ---------------------------------------------------------*/ -/* function that checks validity of a mibitem's binary value */ -void p80211_isvalid_mibitem( void ) -{ -} - -/* ==> */ -void p80211_totext_mibitem( void ) -{ -} - -/* ==> */ -void p80211_fromtext_mibitem( void ) -{ -} - -/*-- MIBDID ----------------------------------------------------------*/ -/* function that checks validity of a mibdid's binary value */ -void p80211_isvalid_mibdid( void ) -{ -} - -/* ==> */ -void p80211_totext_mibdid( void ) -{ -} - -/* ==> */ -void p80211_fromtext_mibdid( void ) -{ -} - -/*-- MIBCOLLECTION ---------------------------------------------------*/ -/* function that checks validity of a mibcollection binary value */ -void p80211_isvalid_mibcollection( void ) -{ -} - -/* ==> */ -void p80211_totext_mibcollection( void ) -{ -} - -/* ==> */ -void p80211_fromtext_mibcollection( void ) -{ -}