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

📄 dot11mib.c

📁 vworks 下wlan的实现代码
💻 C
📖 第 1 页 / 共 5 页
字号:
    /* 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)         {          testproc_error(pktp, vbp, NO_SUCH_NAME);        return;        }    /* stash the looked up information here for the setproc */    vbp->vb_priv = (void *)pEnd;    /* find all the varbinds that share the same getproc and instance and    * group them together. */    group_by_getproc_and_instance(pktp, vbp, tcount, tlist);    /* now check each varbind */    for (group_vbp = vbp; group_vbp != NULL; group_vbp = group_vbp->vb_link)         {        switch (group_vbp->vb_ml.ml_last_match)             {            case LEAF_dot11WEPDefaultKeyValue:                {                 ALENGTH_T length = EBufferUsed(VB_GET_STRING(group_vbp));                if (length != SIZE_dot11WEPDefaultKeyValue)                     {                    testproc_error(pktp, group_vbp, WRONG_LENGTH);                    break;                    }                }                testproc_good(pktp, group_vbp);                break;            default:                testproc_error(pktp, group_vbp, GEN_ERR);                return;            }        }    }/***************************************************************************** NOMANUAL* dot11WEPDefaultKeyssEntry_set - SNMP "set" function for WEPDefaultKeysEntry** After the "test" routine has been called as a result of a SNMP "set" command,* the SNMP agent calls this routine.  The actual changes to the device occur* here.* * RETURNS: VOID** ERRNO: N/A*/void dot11WEPDefaultKeysEntry_set    (    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 = vbp->vb_priv;  /* Retrieve the value of pEnd we saved in                                       the test routine */    UINT8 * keyBuffer[SIZE_dot11WEPDefaultKeyValue];    int status = ERROR;    /* If we got a valid pEnd, then we don't need to do validation and lookup,    since the testproc had to be called first */    if (pEnd == NULL)        {        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)             {              testproc_error(pktp, vbp, NO_SUCH_NAME);            return;            }        }       /* Check that we have a valid key number before we go adjusting the IOCTL    call to some arbitrary value */    if ((tlist[1] < MIN_dot11WEPDefaultKeyIndex) ||         (tlist[1] > MAX_dot11WEPDefaultKeyIndex))        {        testproc_error(pktp, vbp, NO_SUCH_NAME);        return;        }    for ( ; vbp != NULL; vbp = vbp->vb_link)         {        switch (vbp->vb_ml.ml_last_match)             {            case LEAF_dot11WEPDefaultKeyValue:                bcopy((char *)EBufferStart(VB_GET_STRING(vbp)),                       (char *)keyBuffer,                      EBufferUsed(VB_GET_STRING(vbp)));                                /* Apply the change */                status = END_IOCTL(pEnd, EIOCSWEPKEY0 - 1 + tlist[1],                                    keyBuffer);                                if (status != OK)                    {                    setproc_error(pktp, vbp, COMMIT_FAILED);                    return;                    }                setproc_good(pktp, vbp);                break;            default:                setproc_error(pktp, vbp, COMMIT_FAILED);                return;            }        }    }/***************************************************************************** NOMANUAL* dot11WEPKeyMappingsEntry_get - SNMP "get" function for WEPKeyMappingsEntry** WEPKeyMappingsEntry is not implemented at this time.  If you are adding* this functionality, re-generate the stubs using mibcomp.** RETURNS: VOID** ERRNO: N/A*/void dot11WEPKeyMappingsEntry_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 */    )    {    for ( ; vbp != NULL; vbp = vbp->vb_link)        getproc_nosuchins(pktp, vbp);    }/***************************************************************************** NOMANUAL* dot11WEPKeyMappingsEntry_next - SNMP "next" function for WEPKeyMappingsEntry** WEPKeyMappingsEntry is not implemented at this time.  If you are adding* this functionality, re-generate the stubs using mibcomp.* * RETURNS: VOID** ERRNO: N/A*/void dot11WEPKeyMappingsEntry_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 */    )    {    nextproc_no_next(pktp, vbp);    }/***************************************************************************** NOMANUAL* dot11WEPKeyMappingsEntry_test - SNMP "test" function for WEPKeyMappingsEntry** WEPKeyMappingsEntry is not implemented at this time.  If you are adding* this functionality, re-generate the stubs using mibcomp.* * RETURNS: VOID** ERRNO: N/A*/void dot11WEPKeyMappingsEntry_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 */    )    {    testproc_error(pktp, vbp, NO_SUCH_NAME);    }/***************************************************************************** NOMANUAL* dot11WEPKeyMappingsEntry_set - SNMP "set" function for WEPKeyMappingsEntry** WEPKeyMappingsEntry is not implemented at this time.  If you are adding* this functionality, re-generate the stubs using mibcomp.* * RETURNS: VOID** ERRNO: N/A*/void dot11WEPKeyMappingsEntry_set    (    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 */    )    {    setproc_error(pktp, vbp, NO_SUCH_NAME);    }/***************************************************************************** NOMANUAL* dot11PrivacyEntry_get_value - Local function that retrieves PrivacyEntry*                               values* This function reads the value for the following leaves from the card:* *   dot11PrivacyInvoked -- read-write* When this attribute is true, it shall indicate that the IEEE* 802.11 WEP mechanism is used for transmitting frames of type* Data. The default value of this attribute shall be false.**   dot11WEPDefaultKeyID -- read-write* This attribute shall indicate the use of the first,* second, third, or fourth element of the WEPDefaultKeys* array when set to values of zero, one, two, or three.  The* default value of this attribute shall be 0.**   dot11WEPKeyMappingLength -- read-write* The maximum number of tuples that dot11WEPKeyMappings can hold.**   dot11ExcludeUnencrypted -- read-write* When this attribute is true, the STA shall not indicate at* the MAC service interface received MSDUs that have the WEP* subfield of the Frame Control field equal to zero. When this* attribute is false, the STA may accept MSDUs that have the WEP* subfield of the Frame Control field equal to zero. The default* value of this attribute shall be false.**   dot11WEPICVErrorCount -- read-only* This counter shall increment when a frame is received with the* WEP subfield of the Frame Control field set to one and the value* of the ICV as received in the frame does not match the ICV value* that is calculated for the contents of the received frame.**   dot11WEPExcludedCount -- read-only* This counter shall increment when a frame is received with the* WEP subfield of the Frame Control field set to zero and the value* of dot11ExcludeUnencrypted causes that frame to be discarded.** RETURNS: GEN_ERROR, NO_ERROR** ERRNO: N/A*/LOCAL int dot11PrivacyEntry_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       /* Instance-specific device data */    )    {    DOT11_IOCTL_PARAM_T cmdObj;    DOT11_MIB2_T data;    int status = ERROR;    cmdObj.pData = &data;    cmdObj.cmdCall = (PRIVACY_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_dot11PrivacyInvoked:            getproc_got_int32(pktp, vbp,                               data.dot11Smt.privEntry.dot11PrivacyInvoked);            break;        case LEAF_dot11WEPDefaultKeyID:            getproc_got_int32(pktp, vbp,                               data.dot11Smt.privEntry.dot11WEPDefaultKeyID);            break;        case LEAF_dot11WEPKeyMappingLength:            getproc_got_uint32(pktp, vbp,                                data.dot11Smt.privEntry.dot11WEPKeyMappingLength,                               VT_GAUGE);            break;        case LEAF_dot11ExcludeUnencrypted:            getproc_got_int32(pktp, vbp,                               data.dot11Smt.privEntry.dot11ExcludeUnencrypted);            break;        case LEAF_dot11WEPICVErrorCount:            getproc_got_uint32(pktp, vbp,                                data.dot11Smt.privEntry.dot11WEPICVErrorCount,                                VT_COUNTER);            break;        case LEAF_dot11WEPExcludedCount:            getproc_got_uint32(pktp, vbp,                                data.dot11Smt.privEntry.dot11WEPExcludedCount,                                VT_COUNTER);            break;        default:            return GEN_ERR;        }    return NO_ERROR;    }/***************************************************************************** NOMANUAL* dot11PrivacyEntry_get - SNMP "get" function for PrivacyEntry** This is the standard WM SNMP get method for PrivacyEntry.  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: VOID** ERRNO: N/A*/void dot11PrivacyEntry_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;    /* We're only expecting one index variable */    if (tcount != 1)        {        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);            }        }    else         {        /* r

⌨️ 快捷键说明

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