⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dot11mib.c

📁 vworks 下wlan的实现代码
💻 C
📖 第 1 页 / 共 5 页
字号:
/*  dot11Mib.c - Mib leaf support methods for the ieee802dot11.mib *//* Copyright 2003 Wind River Systems, Inc. *//*modification history--------------------01h,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 "taskLib.h"#include "wrn/wlan/wlanEnd.h"#include "wrn/wlan/snmp802dot11.h"#include "mDot11Mib.h"/* 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 16LOCAL const char * dot11Devices[] = {"intPr", "cisAir"};#define DOT11_NUM_DEV NELEMENTS(dot11Devices)/* An internal function to return an END_OBJ given a "interface" number. */LOCAL END_OBJ * dot11EndObjGet(int ifNum);/* Objects imported from mDot11Mib.c */IMPORT MIBNODE_T	n_ieee802dot11;IMPORT OBJ_ID_T objid_ieee802dot11;/***************************************************************************** NOMANUAL* dot11BcopySwap - performs a bcopy that swaps the bytes in BE targets** This routine performs a bcopy that swaps the bytes in BE targets.  This is* used to correct for problems when dealing with data from a PCI device (LE)* on a BE target.** RETURNS: VOID** ERRNO: N/A*/LOCAL void dot11BcopySwap(const UINT8 * pSrc, UINT8 * pDst, UINT16 nbytes)    {    int i;    for (i=0; i<(nbytes); i+=2)        {#if (_BYTE_ORDER == _BIG_ENDIAN)        pDst[i+1] = pSrc[i];        pDst[i]   = pSrc[i+1];#else        pDst[i+1] = pSrc[i+1];        pDst[i]   = pSrc[i];#endif        }    }/***************************************************************************** NOMANUAL* 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*/LOCAL 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 */    )     {    DOT11_IOCTL_PARAM_T cmdObj;         /* Object to pass data from driver */    DOT11_MIB2_T data;                  /* Data buffer for cmdObj */    int status = GEN_ERR;               /* Generic status */    int i;                              /* Generic counter */    OCTET_T * pTemp;                    /* Pointer for dynamic storage alloc */        /* Set up the command object */    cmdObj.pData = &data;    cmdObj.cmdCall = (STATION_CONFIG_ENTRY << 16) | lastmatch;    status = END_IOCTL(pEnd, EIOCGMIB2STA, (caddr_t)&cmdObj);    if (status != OK)        {        getproc_got_empty(pktp, vbp);        return NO_ERROR;        }    switch(lastmatch)         {        case LEAF_dot11StationID:            if((pTemp = SNMP_memory_alloc(SIZE_dot11StationID))               == NULL)                {                return GEN_ERR;                }            bcopy((char *)data.dot11Smt.cnfgEntry.dot11StationID, (char *)pTemp,                      SIZE_dot11StationID);                        getproc_got_string(pktp, vbp, SIZE_dot11StationID,                               pTemp, SNMP_DYNAMIC_RELEASE,                                VT_STRING);               break;        case LEAF_dot11MediumOccupancyLimit:            getproc_got_int32(pktp, vbp,                            data.dot11Smt.cnfgEntry.dot11MediumOccupancyLimit);            break;        case LEAF_dot11CFPollable:            getproc_got_int32(pktp, vbp,                               data.dot11Smt.cnfgEntry.dot11CFPollable);            break;        case LEAF_dot11CFPPeriod:            getproc_got_int32(pktp, vbp, data.dot11Smt.cnfgEntry.dot11CFPPeriod);            break;        case LEAF_dot11CFPMaxDuration:            getproc_got_int32(pktp, vbp,                               data.dot11Smt.cnfgEntry.dot11CFPMaxDuration);            break;        case LEAF_dot11AuthenticationResponseTimeOut:            getproc_got_uint32(pktp, vbp,                    data.dot11Smt.cnfgEntry.dot11AuthenticationResponseTimeOut,                    VT_GAUGE);            break;        case LEAF_dot11PrivacyOptionImplemented:            getproc_got_int32(pktp, vbp,                      data.dot11Smt.cnfgEntry.dot11PrivacyOptionImplemented);            break;        case LEAF_dot11PowerManagementMode:            getproc_got_int32(pktp, vbp,                               data.dot11Smt.cnfgEntry.dot11PowerManagementMode);            break;        case LEAF_dot11DesiredSSID:            if((pTemp = SNMP_memory_alloc(MAXSIZE_dot11DesiredSSID))               == NULL)                {                return GEN_ERR;                }            bcopy((char*)data.dot11Smt.cnfgEntry.dot11DesiredSSID, (char*)pTemp,                  MAXSIZE_dot11DesiredSSID);             getproc_got_string(pktp, vbp,                min(strlen((char *)data.dot11Smt.cnfgEntry.dot11DesiredSSID),                   MAXSIZE_dot11DesiredSSID),               pTemp, SNMP_DYNAMIC_RELEASE, VT_STRING);             break;        case LEAF_dot11DesiredBSSType:            status = END_IOCTL(pEnd, EIOCGMIB2STA, (caddr_t)&cmdObj);            getproc_got_int32(pktp, vbp,                               data.dot11Smt.cnfgEntry.dot11DesiredBSSType);            break;        case LEAF_dot11OperationalRateSet:            if((pTemp = SNMP_memory_alloc(MAXSIZE_dot11OperationalRateSet))               == NULL)                {                return GEN_ERR;                }                        /* To find the length of the operational rate set, step through             until we find an entry of 0x00*/            i = 0;                        while (data.dot11Smt.cnfgEntry.dot11OperationalRateSet[i] != 0x00)                {                i++;                }            bcopy((char *)data.dot11Smt.cnfgEntry.dot11OperationalRateSet,                   (char *) pTemp, i);            getproc_got_string(pktp, vbp, i /*Size we calculated earlier */,                                pTemp, SNMP_DYNAMIC_RELEASE, VT_STRING);            break;        case LEAF_dot11BeaconPeriod:            getproc_got_int32(pktp, vbp,                               data.dot11Smt.cnfgEntry.dot11BeaconPeriod);              break;        case LEAF_dot11DTIMPeriod:            getproc_got_int32(pktp, vbp,                               data.dot11Smt.cnfgEntry.dot11DTIMPeriod);            break;        case LEAF_dot11AssociationResponseTimeOut:            getproc_got_uint32(pktp, vbp,                       data.dot11Smt.cnfgEntry.dot11AssociationResponseTimeOut,                                VT_GAUGE);            break;        case LEAF_dot11DisassociateReason:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -