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

📄 dot11mib.c

📁 vworks 下wlan的实现代码
💻 C
📖 第 1 页 / 共 5 页
字号:
    DOT11_IOCTL_PARAM_T cmdObj;    DOT11_MIB2_T data;    int status = ERROR;            if (pEnd == NULL)        {        if (tcount != 1)            {            testproc_error(pktp, vbp, NO_SUCH_NAME);            return;            }        /* Get the pointer to device data for this instance */        if ((pEnd = dot11EndObjGet(tlist[0])) == NULL)             {              testproc_error(pktp, vbp, NO_SUCH_NAME);            return;            }        }       for ( ; vbp != NULL; vbp = vbp->vb_link)         {        switch (vbp->vb_ml.ml_last_match)             {            case LEAF_dot11StationID:                bcopy((char *)EBufferStart(VB_GET_STRING(vbp)),                       (char *)data.dot11Smt.cnfgEntry.dot11StationID,                      EBufferUsed(VB_GET_STRING(vbp)));                data.dot11Smt.cnfgEntry.dot11StationID[                   EBufferUsed(VB_GET_STRING(vbp))] = 0x00;                break;            case LEAF_dot11MediumOccupancyLimit:                data.dot11Smt.cnfgEntry.dot11MediumOccupancyLimit =                     VB_GET_INT32(vbp);                break;            case LEAF_dot11CFPPeriod:                data.dot11Smt.cnfgEntry.dot11CFPPeriod = VB_GET_INT32(vbp);                break;            case LEAF_dot11CFPMaxDuration:                data.dot11Smt.cnfgEntry.dot11CFPMaxDuration =                     VB_GET_INT32(vbp);                break;            case LEAF_dot11AuthenticationResponseTimeOut:                data.dot11Smt.cnfgEntry.dot11AuthenticationResponseTimeOut =                     VB_GET_UINT32(vbp);                break;            case LEAF_dot11PowerManagementMode:                data.dot11Smt.cnfgEntry.dot11PowerManagementMode =                     VB_GET_INT32(vbp);                   break;            case LEAF_dot11DesiredSSID:                bcopy((char *)EBufferStart(VB_GET_STRING(vbp)),                       (char *)data.dot11Smt.cnfgEntry.dot11DesiredSSID,                      EBufferUsed(VB_GET_STRING(vbp)));                data.dot11Smt.cnfgEntry.dot11DesiredSSID[                   EBufferUsed(VB_GET_STRING(vbp))] = 0x00;                break;            case LEAF_dot11DesiredBSSType:                data.dot11Smt.cnfgEntry.dot11DesiredBSSType =                     VB_GET_INT32(vbp);                 break;            case LEAF_dot11OperationalRateSet:                bcopy((char *)EBufferStart(VB_GET_STRING(vbp)),                       (char *)data.dot11Smt.cnfgEntry.dot11OperationalRateSet,                      EBufferUsed(VB_GET_STRING(vbp)));                data.dot11Smt.cnfgEntry.dot11OperationalRateSet[                   EBufferUsed(VB_GET_STRING(vbp))] = 0x00;                break;            case LEAF_dot11BeaconPeriod:                data.dot11Smt.cnfgEntry.dot11BeaconPeriod = VB_GET_INT32(vbp);                break;            case LEAF_dot11DTIMPeriod:                data.dot11Smt.cnfgEntry.dot11DTIMPeriod = VB_GET_INT32(vbp);                   break;            case LEAF_dot11AssociationResponseTimeOut:                data.dot11Smt.cnfgEntry.dot11AssociationResponseTimeOut =                     VB_GET_UINT32(vbp);                break;            default:                setproc_error(pktp, vbp, COMMIT_FAILED);                return;            }        cmdObj.pData = &data;        cmdObj.cmdCall = (STATION_CONFIG_ENTRY << 16) |             vbp->vb_ml.ml_last_match;        status = END_IOCTL(pEnd, EIOCSMIB2STA, (caddr_t)&cmdObj);        if (status == OK)            {            setproc_good(pktp, vbp);            }        else            {            setproc_error(pktp, vbp, COMMIT_FAILED);            }        }    }/***************************************************************************** NOMANUAL* dot11AuthenticationAlgorithmsEntry_get_value - Internal function to get the *     currently used Authentication Algorithms** Returns the value of the indicated leaf:**   dot11AuthenticationAlgorithm -- read-only* This attribute shall be a set of all the authentication* algorithms supported by the STAs. The following are the* default values and the associated algorithm.  * Value = 1: Open System * Value = 2: Shared Key**   dot11AuthenticationAlgorithmsEnable -- read-write* This attribute, when true at a station, shall enable the acceptance * of the authentication algorithm described in the corresponding table * entry in authentication frames received by the station that have odd * authentication sequence numbers.  The default value of this attribute * shall be 1 for the Open System table entry and 2 for all other table * entries.* * RETURNS: NO_ERROR, GEN_ERR** ERRNO: N/A*/LOCAL int dot11AuthenticationAlgorithmsEntry_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 */    int      algorithm, /* Which algorithm to report on */    END_OBJ *pEnd       /* Instance specific device data */    )     {    UINT16 temp;    switch(lastmatch)         {        case LEAF_dot11AuthenticationAlgorithmsIndex:        case LEAF_dot11AuthenticationAlgorithm:            /* Values:        *  openSystem(1) = VAL_dot11AuthenticationAlgorithm_openSystem        *  sharedKey(2)  = VAL_dot11AuthenticationAlgorithm_sharedKey        */        getproc_got_int32(pktp, vbp, algorithm);            break;    case LEAF_dot11AuthenticationAlgorithmsEnable:        /* Values:        *  true(1)  = VAL_dot11AuthenticationAlgorithmsEnable_true        *  false(2) = VAL_dot11AuthenticationAlgorithmsEnable_false        */        END_IOCTL(pEnd, EIOCGAUTHTYPE, &temp);        if ((temp & algorithm) == algorithm)             {            getproc_got_int32(pktp, vbp, DOT11_TRUE);             }        else            {            getproc_got_int32(pktp, vbp, DOT11_FALSE);             }        break;    default:        return GEN_ERR;    }    return NO_ERROR;    }/***************************************************************************** NOMANUAL* dot11AuthenticationAlgorithmsEntry_get - SNMP "get" function for *        Authenticatio Algorithms ** This is the standard WM SNMP get method for the StationConfigEntry.  It is* called when a "get" query is received by the SNMP agent for this branch.* The leaf number (last part of OID) is contained in <lastmatch> and the * requested instance is specified in <tcount> and <tlist>* * RETURNS: NO_ERROR, GEN_ERR** ERRNO: N/A*/void dot11AuthenticationAlgorithmsEntry_get    (    OIDC_T lastmatch,   /* Last matching part of OID - the LEAF name */    int         tcount, /* Number of elements in interface (table) list */    OIDC_T *    tlist,  /* List of interface (table) elements */    SNMP_PKT_T *pktp,   /* Pointer to raw SNMP packet */    VB_T *     vbp     /* Pointer to varbind structure */    )    {    int error;    END_OBJ * pEnd;    /* This entry has two indices */    if (tcount != 2)        {        getproc_nosuchins(pktp, vbp);        return;        }    /* find all the varbinds that share the same getproc and instance */    group_by_getproc_and_instance(pktp, vbp, tcount, tlist);    /* use the instance (tcount and tlist) to look up the entry in the    * table.  This lookup routine will probably have to be changed to    * suit your system. */    if ((pEnd = dot11EndObjGet((int)tlist[0])) == NULL)        {        for ( ; vbp != NULL; vbp = vbp->vb_link)            {            getproc_nosuchins(pktp, vbp);            }        return;        }        /* retrieve all the values from the same instance */    for ( ; vbp != NULL; vbp = vbp->vb_link)         {        if ((error = dot11AuthenticationAlgorithmsEntry_get_value(            vbp->vb_ml.ml_last_match, pktp, vbp, tlist[1], pEnd)) != NO_ERROR)            getproc_error(pktp, vbp, error);        }    }/***************************************************************************** NOMANUAL* dot11AuthenticationAlgorithmsEntry_next - SNMP "next" function for *        AuthenticationAlgorithmsEntry** This is the standard "next" function for AuthenticationAlgorithmsEntry.  This* is called when a MIB client issues a "next" command, typically when walking * a tree or when doing index discovery.  This will return the instance number * of the next instance, if there is one, or call next_proc_no_next if not.  The* MIB agent is responsible for determining the "next" leaf if there is no* more instances of the current one.* * RETURNS: VOID** ERRNO: N/A*/void dot11AuthenticationAlgorithmsEntry_next    (    OIDC_T lastmatch,   /* Last matching part of OID - the LEAF name */    int         tcount, /* Number of elements in interface (table) list */    OIDC_T *    tlist,  /* List of interface (table) elements */    SNMP_PKT_T *pktp,   /* Pointer to raw SNMP packet */    VB_T *     vbp     /* Pointer to varbind structure */    )    {#define dot11AuthenticationAlgorithmsEntry_INSTANCE_LEN 2      END_OBJ * pEnd;    OIDC_T next_inst[dot11AuthenticationAlgorithmsEntry_INSTANCE_LEN];    int error;    /* find all the varbinds that share the same getproc and instance */    group_by_getproc_and_instance(pktp, vbp, tcount, tlist);    /* This entry has two indices */    if (tcount == 0)        {        /* If there's no indices specified, then we need the first element */        next_inst[0] = 1;        next_inst[1] = 1;        }    else if ((tcount == 1) || (tcount == 2))        {        next_inst[0] = tlist[0];        if (tcount == 1)            {            /* If only one index was specified, set the second to zero */            next_inst[1] = 0;            }        else            {            next_inst[1] = tlist[1];            }                /* Increment the algorithm.  If it's too big, then take it back to         OS, and increment the ifnumber */        next_inst[1] ++;        if (next_inst[1] > VAL_dot11AuthenticationAlgorithm_sharedKey)            {            next_inst[1] = VAL_dot11AuthenticationAlgorithm_openSystem;            next_inst[0] ++;            }                /* In case the ifindex was zero */         if (next_inst[0] == 0)            {            next_inst[0] = 1;            }        }    else        {        /* If the instance count is greater than 1 then somebody's trying to           add extra dimensions to this table */        for ( ; vbp ; vbp = vbp->vb_link )            {            nextproc_error(pktp, vbp, NO_SUCH_NAME);            }        return;        }    /* Determine if the specified instance exists. */    if ((pEnd = dot11EndObjGet((int)next_inst[0])) == NULL)        {        for ( ; vbp ; vbp = vbp->vb_link )            nextproc_no_next(pktp, vbp);        return;        }        /* Now that we've verified the instance exists, get the value of that     instance, and tell the agent what the next OID is */    for ( ; vbp ; vbp = vbp->vb_link)         {        if ((error = dot11AuthenticationAlgorithmsEntry_get_value             (vbp->vb_ml.ml_last_match, pktp, vbp, next_inst[1], pEnd))             == NO_ERROR)            {            nextproc_next_instance(pktp, vbp,                    dot11AuthenticationAlgorithmsEntry_INSTANCE_LEN,                    next_inst);            }        else            {            nextproc_error(pktp, vbp, error);            }        }    }/***************************************************************************** NOMANUAL* dot11AuthenticationAlgorithmsEntry_test - SNMP "test" function for *        AuthenticationAlgorithmsEntry** The "test" routine is executed before the "set" routine when acting on* a SNMP set request.  Its purpose is to evaluate whether the SNMP "set" is* valid - checking the leaf, the instance  and the value for that leaf.  If it* returns successfully then the "set" routine is called.  If not, a failure is* sent back to the SNMP client.* * RETURNS: VOID** ERRNO: N/A*/void dot11AuthenticationAlgorithmsEntry_test    (    OIDC_T lastmatch,   /* Last matching part of OID - the LEAF name */    int         tcount, /* Number of elements in interface (table) list */    OIDC_T *    tlist,  /* List of interface (table) elements */    SNMP_PKT_T *pktp,   /* Pointer to raw SNMP packet */    VB_T *     vbp     /* Pointer to varbind structure */    )    {    END_OBJ * pEnd;    VB_T *group_vbp;    /* This is a two-dimensional table */    if (tcount != 2)        {        testproc_error(pktp, vbp, NO_SUCH_NAME);        return;        }    /* Get the pointer to device data for this instance */    if ((pEnd = dot11EndObjGet(tlist[0])) == NULL) 

⌨️ 快捷键说明

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