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

📄 dot11miblib.c

📁 PNE 3.3 wlan source code, running at more than vxworks6.x version
💻 C
📖 第 1 页 / 共 5 页
字号:
    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 dot11WEPDefaultKeysEntry_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] > MAX_dot11WEPDefaultKeyIndex)            {            next_inst[1] = MIN_dot11WEPDefaultKeyIndex;            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 = dot11WEPDefaultKeysEntry_get_value             (vbp->vb_ml.ml_last_match, pktp, vbp, next_inst[1], pEnd))             == NO_ERROR)            {            nextproc_next_instance(pktp, vbp,                                    dot11WEPDefaultKeysEntry_INSTANCE_LEN,                                    next_inst);            }        else            {            nextproc_error(pktp, vbp, error);            }        }    }/***************************************************************************** dot11WEPDefaultKeysEntryTest - SNMP "test" function for WEPDefaultKeyEntry** 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** NOMANUAL*/VOID dot11WEPDefaultKeysEntryTest    (    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)         {          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 != DOT11_WEP40_KEY_SIZE) &&                    (length != DOT11_WEP104_KEY_SIZE))                     {                    testproc_error(pktp, group_vbp, WRONG_LENGTH);                    break;                    }                }                testproc_good(pktp, group_vbp);                break;            default:                testproc_error(pktp, group_vbp, GEN_ERR);                return;            }        }    }/***************************************************************************** dot11WEPDefaultKeyssEntrySet - 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** NOMANUAL*/VOID dot11WEPDefaultKeysEntrySet    (    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 */    )    {    /* Retrieve the value of pEnd we saved in the test routine */    END_OBJ *pEnd = vbp->vb_priv;      /* 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)            {            setproc_error(pktp, vbp, NO_SUCH_NAME);            return;            }        /* Get the pointer to device data for this instance */        if ((pEnd = dot11EndObjGet(tlist[0])) == NULL)             {              setproc_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))        {        setproc_error(pktp, vbp, NO_SUCH_NAME);        return;        }    for ( ; vbp != NULL; vbp = vbp->vb_link)         {        switch (vbp->vb_ml.ml_last_match)             {            case LEAF_dot11WEPDefaultKeyValue:                {                DOT11_KEY key;                INT32 keyLength, keyEntry;                                /* Get the key length */                keyLength = EBufferUsed(VB_GET_STRING(vbp));                /* Figure out the key type from the length of the                data */                switch (keyLength)                    {                    case DOT11_WEP40_KEY_SIZE:                        key.keyType = DOT11_KEY_TYPE_WEP40;                        break;                    case DOT11_WEP104_KEY_SIZE:                        key.keyType = DOT11_KEY_TYPE_WEP104;                        break;                    default:                        setproc_error(pktp, vbp, COMMIT_FAILED);                        return;                    }                /* Move the data from the SNMP buffer into the                key object */                bcopy((char*)EBufferStart(VB_GET_STRING(vbp)),                       (char*)&key.type,                      keyLength);                /* Apply the change */                keyEntry = (WIOCSWEPKEY0 + tlist[1]) - 1;                if (END_IOCTL(pEnd, keyEntry, &key) != OK)                    {                    setproc_error(pktp, vbp, COMMIT_FAILED);                    return;                    }                                /* Commit succeeded */                setproc_good(pktp, vbp);                }                break;            default:                setproc_error(pktp, vbp, GEN_ERR);                return;            }        }    }/***************************************************************************** dot11WEPKeyMappingsEntry_get_value - Returns the value of the WEP key*       * RETURNS: GEN_ERR, or NO_ERROR** ERRNO: N/A** NOMANUAL*/static int dot11WEPKeyMappingsEntry_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 keyNum, /* Key number requested */    END_OBJ *pEnd /* Instance-specific device data */    )         {    switch(lastmatch)         {        default:            /* Not supported by the driver */            dot11RequestNotSupported(pktp, vbp);            break;        }    return(NO_ERROR);    }/***************************************************************************** dot11WEPKeyMappingsEntryGet - 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** NOMANUAL*/VOID dot11WEPKeyMappingsEntryGet    (    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 */    )    {    INT32 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 = dot11WEPKeyMappingsEntry_get_value(            vbp->vb_ml.ml_last_match, pktp, vbp, tlist[1], pEnd))             != NO_ERROR)            getproc_error(pktp, vbp, error);        }    }/***************************************************************************** dot11WEPKeyMappingsEntryNext - 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** NOMANUAL*/VOID dot11WEPKeyMappingsEntryNext    (    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 */    )    

⌨️ 快捷键说明

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