📄 dot11miblib.c
字号:
break; case LEAF_dot11DesiredSSID: { ALENGTH_T length = EBufferUsed(VB_GET_STRING(group_vbp)); if (!(length <= MAXSIZE_dot11DesiredSSID)) { testproc_error(pktp, group_vbp, WRONG_LENGTH); break; } } testproc_good(pktp, group_vbp); break; case LEAF_dot11OperationalRateSet: { ALENGTH_T length = EBufferUsed(VB_GET_STRING(group_vbp)); if (!((length >= MINSIZE_dot11OperationalRateSet) && (length <= MAXSIZE_dot11OperationalRateSet))) { testproc_error(pktp, group_vbp, WRONG_LENGTH); break; } } testproc_good(pktp, group_vbp); break; case LEAF_dot11DesiredBSSType: { switch (VB_GET_INT32(group_vbp)) { case VAL_dot11DesiredBSSType_infrastructure: case VAL_dot11DesiredBSSType_independent: break; default: testproc_error(pktp, group_vbp, WRONG_VALUE); continue; } testproc_good(pktp, group_vbp); } break; case LEAF_dot11AssociationResponseTimeOut: case LEAF_dot11MediumOccupancyLimit: case LEAF_dot11DisassociateReason: case LEAF_dot11DisassociateStation: case LEAF_dot11DeauthenticateReason: case LEAF_dot11DeauthenticateStation: case LEAF_dot11AuthenticateFailStatus: case LEAF_dot11AuthenticateFailStation: case LEAF_dot11StationID: case LEAF_dot11CFPPeriod: case LEAF_dot11CFPMaxDuration: case LEAF_dot11AuthenticationResponseTimeOut: case LEAF_dot11DTIMPeriod: case LEAF_dot11BeaconPeriod: testproc_error(pktp, group_vbp, GEN_ERR); return; default: /* SNMP error */ testproc_error(pktp, group_vbp, GEN_ERR); return; } } }/***************************************************************************** dot11StationConfigEntrySet - SNMP "set" function for StationConfigEntry** 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 dot11StationConfigEntrySet ( 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; INT32 ioctlStatus = ERROR; /* Driver ioctl status */ INT32 dot11Data; /* Driver generic ioctl data */ /* Sanity check */ 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; } } /* Now issue the command to the desired instance of the driver */ for ( ; vbp != NULL; vbp = vbp->vb_link) { switch (vbp->vb_ml.ml_last_match) { case LEAF_dot11PowerManagementMode: { /* Get data from the var bind */ dot11Data = VB_GET_INT32(vbp); /* Now make the request to the driver */ ioctlStatus = END_IOCTL(pEnd, WIOCSPWRMAN, &dot11Data); } break; case LEAF_dot11DesiredSSID: { char dssid[MAXSIZE_dot11DesiredSSID]; /* Temporary storage */ /* Copy the desired SSID from the var bind to the temporary storage buffer */ bcopy((char*)EBufferStart(VB_GET_STRING(vbp)), (char*)dssid, EBufferUsed(VB_GET_STRING(vbp))); /* Add the null terminating character */ dssid[EBufferUsed(VB_GET_STRING(vbp))] = '\0'; /* Set the Desired SSID on the driver */ ioctlStatus = END_IOCTL(pEnd, WIOCSSSID, dssid); } break; case LEAF_dot11OperationalRateSet: { DOT11_RATES rateSet; /* Get the size of the rates table */ rateSet.length = EBufferUsed(VB_GET_STRING(vbp)); /* Copy the desired rate from the var bind to the temporary storage buffer */ bcopy((char*)EBufferStart(VB_GET_STRING(vbp)), (char*)&rateSet.rates[0], rateSet.length); /* Now make the request to the driver */ ioctlStatus = END_IOCTL(pEnd, WIOCSTXRATE, &rateSet); } break; case LEAF_dot11DesiredBSSType: { /* Get data from the var bind */ dot11Data = VB_GET_INT32(vbp); /* Convert the data to one of the supported modes of operation */ switch(dot11Data) { case VAL_dot11DesiredBSSType_infrastructure: dot11Data = DOT11_MODE_ESS; break; case VAL_dot11DesiredBSSType_independent: dot11Data = DOT11_MODE_IBSS; break; default: setproc_error(pktp, vbp, GEN_ERR); return; } /* Get the Current Power Management mode from the driver */ ioctlStatus = END_IOCTL(pEnd, WIOCSDOT11MODE, dot11Data); } break; case LEAF_dot11AssociationResponseTimeOut: case LEAF_dot11CFPPeriod: case LEAF_dot11MediumOccupancyLimit: case LEAF_dot11StationID: case LEAF_dot11CFPMaxDuration: case LEAF_dot11AuthenticationResponseTimeOut: case LEAF_dot11DTIMPeriod: case LEAF_dot11BeaconPeriod: default: setproc_error(pktp, vbp, GEN_ERR); return; } /* Check the status of the command */ if (ioctlStatus == OK) { setproc_good(pktp, vbp); } else { setproc_error(pktp, vbp, GEN_ERR); } } }/***************************************************************************** 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** NOMANUAL*/static 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 */ ) { 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: { INT32 temp; /* Values: * true(1) = VAL_dot11AuthenticationAlgorithmsEnable_true * false(2) = VAL_dot11AuthenticationAlgorithmsEnable_false */ if (END_IOCTL(pEnd, WIOCGAUTHTYPE, &temp) == OK) { if ((temp & algorithm) == algorithm) { getproc_got_int32(pktp, vbp, MDOT11_TRUE); } else { getproc_got_int32(pktp, vbp, MDOT11_FALSE); } } else { /* Driver error */ getproc_got_empty(pktp, vbp); } } break; default: return(GEN_ERR); } return(NO_ERROR); }/***************************************************************************** dot11AuthenticationAlgorithmsEntryGet - 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** NOMANUAL*/VOID dot11AuthenticationAlgorithmsEntryGet ( 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 = dot11AuthenticationAlgorithmsEntry_get_value( vbp->vb_ml.ml_last_match, pktp, vbp, tlist[1], pEnd)) != NO_ERROR) getproc_error(pktp, vbp, error); } }/***************************************************************************** dot11AuthenticationAlgorithmsEntryNext - 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** NOMANUAL*/VOID dot11AuthenticationAlgorithmsEntryNext ( 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]; INT32 error;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -