📄 dot11miblib.c
字号:
/* dot11MibLib.c - Mib leaf support methods for the ieee802dot11.mib *//* Copyright 2003 Wind River Systems, Inc. *//*modification history--------------------01t,17mar06,rb Fix warning01s,16mar06,rb Fix Coverity issues (SPR 119148)01r,04may05,rb Fix for bug B0298 - compile errors under vxWorks 6.101q,31aug04,eja Fix mips group address values always being read as 0.01p,30aug04,eja Add support to get the device beacon interval.01o,30aug04,eja Fix issue 103 which states that walking the MIB on an x86 based target causes a page fault01n,25aug04,eja Fix issues 98 and 99 pertaining to adding multicast address when device is not attached to the network stack and support for desired BSS type.01m,23aug04,eja Fix compiler warnings01l,23aug04,eja Add MibLib extension to base OID to resolve mutual dependencies between wls MIB and wlan MIB when using project facility01k,20aug04,eja Resolve issue 8701j,17aug04,eja Get Mcast Creation and Deletion added01i,16aug04,eja Change file name to add Lib extension and partial multicast support01h,12sep03,rb Fix for SPR 90707: Unable to create new groupAddressEntry01g,12sep03,rb Fix for SPR 90446: Mem leak in groupAddressesTable01f,08sep03,ggg Adjust product name and version bcopy lengths01e,02jul03,rb Removed dependency on PRISM driver - bcopyswsap01d,09may03,rb Removed warnings caused by IPv6 integration01c,05may03,rb Removed warning due to previous checkin01b,02may03,rb Added delay to mDot11TreeAdd() to solve sync w/ SNMP agent01a,10apr03,rb Created new file to rewrite MIB support*//*DESCRIPTIONThis file provides the methods that implement the leaves in the ieee802dot11 MIB, which is the MIB formally specified by the 802.11 task group to be used for managing 802.11 interfaces.The interface numbers used are not related to the ifIndex entries in the<interfaces> group, for technical reasons. Instead, numbers are assigned todevices of the "intPr" family first, and the "cisAir" family second, sortedby increasing usint numbers. To add a chipset to the list to be managed,modify the structure <dot11Devices> at the top of this file.This file was created from the stubs generated by the WindManage 9.3 MIBCompiler. The settings on the last run were : **** Last build date: Mon Mar 17 11:30:36 2003 **** from files: **** target\src\wrn\wm\snmp\std-mibs\rfc1213.mib, **** target\src\wrn\wlan\mib\ieee802dot11MIB.mib **** starting from node: ieee802dot11SEE ALSOIEEE 802.11 Standard MIB ($WIND_BASE/target/src/wrn/wlan/management/ieee802dot11.mib)WindNet 802.11b Station User's Guide 1.1WindNet 802.11b Access Point User's Guide 1.1WindManage 9.4 Programmer's Guide<SNMP, SNMPv2, SNMPv3, RMON 1 and 2> 1999, William Stallings, Addison-Wesley*/#include <vxWorks.h>#include <string.h>#include <wrn/wm/snmp/engine/asn1conf.h>#include <wrn/wm/snmp/engine/asn1.h>#include <wrn/wm/snmp/engine/buffer.h>#include <wrn/wm/snmp/engine/mib.h>#include <wrn/wm/snmp/engine/localio.h>#include <wrn/wm/snmp/engine/snmpdefs.h>#include <wrn/wm/snmp/engine/snmp.h>#include <wrn/wm/snmp/engine/view.h>#include <wrn/wm/snmp/engine/auxfuncs.h>#include "end.h"#include "mDot11MibLib.h"#include "drv/wlan/dot11Lib.h"#include "lstLib.h"#define MDOT11_TRUE (1)#define MDOT11_FALSE (2)#define VXWORKS_TO_MDOT11_BOOL(value) \{ \if(value == (BOOL)FALSE) \{ \value = MDOT11_FALSE; \} \else \{ \value = MDOT11_TRUE; \} \}/* Private forward declarations */static VOID dot11RequestNotSupported(SNMP_PKT_T *pktp, VB_T *vbp);static STATUS dot11McastAddrFind ( END_OBJ *pEnd, /* Pointer to end object */ INT32 addrNum, /* Index of address in list */ char *addrBuf, /* Buffer to save address */ INT32 addrSize /* Size of the address buffer */ );/* Used in getproc_got_string if the SNMP agent is supposed to deallocate the string*/#define SNMP_DYNAMIC_RELEASE 1/* Macro to get to an END driver's IOCTL call given the pEnd */#define END_IOCTL(pEnd, cmd, data) \ (((END_OBJ *)(pEnd))->pFuncTable->ioctl) ((END_OBJ *)(pEnd), \ (int)(cmd), (caddr_t)(data))/* Add addition wireless interfaces that support the EIOCGMIB2STA ioctl call */#define DOT11_MAX_UNIT 16static const char * dot11Devices[] = {"wls"};#define DOT11_NUM_DEV NELEMENTS(dot11Devices)/* An internal function to return an END_OBJ given a "interface" number. */static END_OBJ * dot11EndObjGet(int ifNum);/* Objects imported from mDot11Mib.c */IMPORT MIBNODE_T n_ieee802dot11MibLib;IMPORT OBJ_ID_T objid_ieee802dot11MibLib;/***************************************************************************** dot11StationConfigEntry_get_value - Internal function to get leaf value** This function returns the value of the indicated leaf. Leaves serviced in* this routine are as follows:** dot11StationID -- read-write* The purpose of dot11StationID is to allow a manager to identify a station * for its own purposes. This attribute provides for that eventuality while * keeping the true MAC address independent. Its syntax is MAC address and * default value is the station's assigned, unique MAC address.** dot11MediumOccupancyLimit -- read-write* This attribute shall indicate the maximum amount of time, in TU, that a * point coordinator may control the usage of the wireless medium without * relinquishing control for long enough to allow at least one instance of DCF * access to the medium. The default value of this attribute shall be 100,* and the maximum value shall be 1000.** dot11CFPollable -- read-only* When this attribute is true, it shall indicate that the STA is able to * respond to a CF-Poll with a data frame within a SIFS time. This attribute * shall be false if the STA is not able to respond to a CF-Poll with a data * frame within a SIFS time.** dot11CFPPeriod -- read-write* The attribute shall describe the number of DTIM intervals between the start * of CFPs. It is modified by MLME-START.request primitive.** dot11CFPMaxDuration -- read-write* The attribute shall describe the maximum duration of the CFP in TU that may * be generated by the PCF. It is modified by MLME-START.request primitive.** dot11AuthenticationResponseTimeOut -- read-write* This attribute shall specify the number of TU that a responding STA should * wait for the next frame in the authentication sequence.** dot11PrivacyOptionImplemented -- read-only* This attribute, when true, shall indicate that the IEEE 802.11 WEP option is * implemented. The default value of this attribute shall be false.** dot11PowerManagementMode -- read-write* This attribute shall specify the power management mode of the STA. When set * to active, it shall indicate that the station is not in power-save mode. When * set to powersave, it shall indicate that the station is in power-save mode. * The power management mode is transmitted in all frames according to the rules* in 7.1.3.1.7.** dot11DesiredSSID -- read-write* This attribute reflects the Service Set ID used in the DesiredSSID parameter * of the most recent MLME_Scan.request. This value may be modified by an * external management entity and used by the local SME to make decisions about* the Scanning process.** dot11DesiredBSSType -- read-write* This attribute shall specify the type of BSS the station shall use when * scanning for a BSS with which to synchronize. This value is used to filter * Probe Response frames and Beacons. When set to infrastructure, the station * shall only synchronize with a BSS whose Capability Information field has the* ESS subfield set to 1. When set to independent, the station shall only* synchronize with a BSS whose Capability Information field has the IBSS * subfield set to 1. When set to any, the station may synchronize to either type* of BSS.** dot11OperationalRateSet -- read-write* This attribute shall specify the set of data ratesat which the station may * transmit data. Each octet contains a value representing a rate. Each rate* shall be within the range from 2 to 127, corresponding to data rates in * increments of 500 kb/s from 1 Mb/s to 63.5 Mb/s, and shall be supported (as * indicated in the supported rates table) for receiving data. This value is * reported in transmitted Beacon, Probe Request, Probe Response, Association * Request, Association Response, Reassociation Request, and Reassociation * Response frames, and is used to determine whether a BSS with which the * station desires to synchronize is suitable. It is also used when starting a * BSS, as specified in 10.3.** dot11BeaconPeriod -- read-write* This attribute shall specify the number of TU that a station shall use for * scheduling Beacon transmissions. This value is transmitted in Beacon and * Probe Response frames.** dot11DTIMPeriod -- read-write* This attribute shall specify the number of beacon intervals that shall elapse* between transmission of Beacons frames containing a TIM element whose DTIM* Count field is 0. This value is transmitted in the DTIM Period field of* Beacon frames.** dot11AssociationResponseTimeOut -- read-write* This attribute shall specify the number of TU that a requesting STA should * wait for a response to a transmitted association-request MMPDU. ** dot11DisassociateReason -- read-only (NOT IMPLEMENTED)* This attribute is not implemented since there is no mechanism for a callback* to disassociate a station in the driver/MIB interface.** dot11DisassociateStation -- read-only (NOT IMPLEMENTED)* This attribute is not implemented since there is no mechanism for a callback* to disassociate a station in the driver/MIB interface.** dot11DeauthenticateReason -- read-only (NOT IMPLEMENTED)* This attribute is not implemented since there is no mechanism for a callback* to deauthenticate a station in the driver/MIB interface.** dot11DeauthenticateStation -- read-only (NOT IMPLEMENTED)* This attribute is not implemented since there is no mechanism for a callback* to deauthenticate a station in the driver/MIB interface.** dot11AuthenticateFailStatus -- read-only (NOT IMPLEMENTED)* This attribute is not implemented since there is no mechanism for a callback* to deauthenticate a station in the driver/MIB interface.** dot11AuthenticateFailStation -- read-only (NOT IMPLEMENTED)* This attribute is not implemented since there is no mechanism for a callback* to deauthenticate a station in the driver/MIB interface.* * RETURNS: NO_ERROR, GEN_ERR** ERRNO: N/A** NOMANUAL*/static int dot11StationConfigEntry_get_value ( OIDC_T lastmatch, /* Last matching part of OID - the LEAF name */ SNMP_PKT_T *pktp, /* Pointer to raw SNMP packet */ VB_T *vbp, /* Pointer to varbind structure */ END_OBJ *pEnd /* Pointer to device data for this instance */ ) { INT32 ioctlStatus; /* Driver ioctl status */ INT32 dot11Data; /* Driver generic ioctl data */ INT32 status = NO_ERROR; /* Generic status */ /* Query the driver for the data */ switch(lastmatch) { case LEAF_dot11StationID: { char ssid[SIZE_dot11StationID]; /* Temporary storage */ /* Get the MAC address from the driver */ ioctlStatus = END_IOCTL(pEnd, EIOCGADDR, ssid); /* Make sure the previous call succeeded */ if (ioctlStatus == OK) { OCTET_T *pMem; /* Pointer for dynamic storage alloc */ /* Allocate block of memory from the SNMP engine. Note that this memory will be freed by the consumer (i.e. SNMP engine once the data has been processed */ pMem = SNMP_memory_alloc(SIZE_dot11StationID); /* Make sure that we allocated the block successfully */ if (pMem == NULL) { status = GEN_ERR; break; } /* Now copy the SSID data to the dynamic SNMP storage block */ bcopy(ssid, (char*)pMem, SIZE_dot11StationID); /* Send a signal to the SNMP engine that the data has been received from the driver successfully */ getproc_got_string(pktp, /* Packet pointer */ vbp, /* Var binding */ SIZE_dot11StationID, /* Size */ pMem, /* Data */ SNMP_DYNAMIC_RELEASE, /* Release later */ VT_STRING); /* String type data */ } else { /* Driver ioctl call failed */ getproc_got_empty(pktp, vbp); } } break; case LEAF_dot11PrivacyOptionImplemented: { /* Get the Authentication protocol from the driver */ ioctlStatus = END_IOCTL(pEnd, WIOCGAUTHTYPE, &dot11Data); /* Make sure call previous call succeeded */ if (ioctlStatus == OK) { /* Convert boolean data to the MIB standard */ VXWORKS_TO_MDOT11_BOOL(dot11Data); getproc_got_int32(pktp, /* Packet pointer */ vbp, /* Var binding */ (INT_32_T)dot11Data); /* Data */ } else { /* Driver Ioctl call failed */ getproc_got_empty(pktp, vbp); } } break; case LEAF_dot11PowerManagementMode: { /* Get the Current Power Management mode from the driver */ ioctlStatus = END_IOCTL(pEnd, WIOCGPWRMAN, &dot11Data); /* Make sure previous call succeeded */ if (ioctlStatus == OK) { /* Convert the data to conform to the MIB decription which are as follows 1 == active and 2 == powersave. To convert simply add one since 0 == active mode and 1 == powersave mode on the driver */ dot11Data++; /* Now send the data to the SNMP engine */ getproc_got_int32(pktp, /* Packet pointer */ vbp, /* Var binding */ (INT_32_T)dot11Data); /* Data */ } else { /* Driver Ioctl call failed */ getproc_got_empty(pktp, vbp); } } break; case LEAF_dot11DesiredSSID: /* OK */ { char dssid[MAXSIZE_dot11DesiredSSID]; /* Temporary storage */ /* Get the Desired SSID from the driver */ ioctlStatus = END_IOCTL(pEnd, WIOCGDESIREDSSID, dssid); /* Make sure the call succeeded */ if (ioctlStatus == OK) { OCTET_T *pMem; /* Pointer for dynamic storage alloc */ /* Allocate block of memory from the SNMP engine. Note
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -