📄 dot11mib.c
字号:
getproc_got_empty(pktp, vbp); break; case LEAF_dot11DisassociateStation: getproc_got_empty(pktp, vbp); break; case LEAF_dot11DeauthenticateReason: getproc_got_empty(pktp, vbp); break; case LEAF_dot11DeauthenticateStation: getproc_got_empty(pktp, vbp); break; case LEAF_dot11AuthenticateFailStatus: getproc_got_empty(pktp, vbp); break; case LEAF_dot11AuthenticateFailStation: getproc_got_empty(pktp, vbp); break; default: return GEN_ERR; } return NO_ERROR; }/***************************************************************************** NOMANUAL* dot11StationConfigEntry_get - SNMP "get" function for StationConfigEntry** 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: VOID** ERRNO: N/A*/void dot11StationConfigEntry_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 { /* retrieve all the values from the same data structure */ for ( ; vbp != NULL; vbp = vbp->vb_link) { if ((error = dot11StationConfigEntry_get_value( vbp->vb_ml.ml_last_match, pktp, vbp, pEnd)) != NO_ERROR) { getproc_error(pktp, vbp, error); } } } }/***************************************************************************** NOMANUAL* dot11StationConfigEntry_next - SNMP "next" function for StationConfigEntry** This is the standard "next" function for StationConfigEntry. 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 dot11StationConfigEntry_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 */ ) { END_OBJ * pEnd; int error; OIDC_T next; group_by_getproc_and_instance(pktp, vbp, tcount, tlist); if (tcount == 0) { /* If the instance count is zero, then we're trying to find the first instance. */ next = 1; } else if (tcount == 1) { /* If the instance length is one, then we're doing a simple next */ next = tlist[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)) == 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 = dot11StationConfigEntry_get_value (vbp->vb_ml.ml_last_match, pktp, vbp, pEnd)) == NO_ERROR) { nextproc_next_instance(pktp, vbp, 1, &next); } else { nextproc_error(pktp, vbp, error); } } }/***************************************************************************** NOMANUAL* dot11StationConfigEntry_test - SNMP "test" function for StationConfigEntry** 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 dot11StationConfigEntry_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 one-dimensional table */ 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; } /* 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_dot11StationID: { ALENGTH_T length = EBufferUsed(VB_GET_STRING(group_vbp)); if (length != SIZE_dot11StationID) { testproc_error(pktp, group_vbp, WRONG_LENGTH); break; } } testproc_good(pktp, group_vbp); break; case LEAF_dot11MediumOccupancyLimit: { bits32_t value = VB_GET_INT32(group_vbp); if (!(value <= MAX_dot11MediumOccupancyLimit)) { testproc_error(pktp, group_vbp, WRONG_VALUE); break; } } testproc_good(pktp, group_vbp); break; case LEAF_dot11CFPPeriod: { bits32_t value = VB_GET_INT32(group_vbp); if (!(value <= MAX_dot11CFPPeriod)) { testproc_error(pktp, group_vbp, WRONG_VALUE); break; } } testproc_good(pktp, group_vbp); break; case LEAF_dot11CFPMaxDuration: { bits32_t value = VB_GET_INT32(group_vbp); if (!(value <= MAX_dot11CFPMaxDuration)) { testproc_error(pktp, group_vbp, WRONG_VALUE); break; } } testproc_good(pktp, group_vbp); break; case LEAF_dot11AuthenticationResponseTimeOut: testproc_good(pktp, group_vbp); break; case LEAF_dot11PowerManagementMode: switch (VB_GET_INT32(group_vbp)) { case VAL_dot11PowerManagementMode_active: case VAL_dot11PowerManagementMode_powersave: break; default: testproc_error(pktp, group_vbp, WRONG_VALUE); continue; } testproc_good(pktp, group_vbp); 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_dot11DesiredBSSType: switch (VB_GET_INT32(group_vbp)) { case VAL_dot11DesiredBSSType_infrastructure: case VAL_dot11DesiredBSSType_independent: case VAL_dot11DesiredBSSType_any: break; default: testproc_error(pktp, group_vbp, WRONG_VALUE); continue; } 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_dot11BeaconPeriod: { bits32_t value = VB_GET_INT32(group_vbp); if (!((value >= MIN_dot11BeaconPeriod) && (value <= MAX_dot11BeaconPeriod))) { testproc_error(pktp, group_vbp, WRONG_VALUE); break; } } testproc_good(pktp, group_vbp); break; case LEAF_dot11DTIMPeriod: { bits32_t value = VB_GET_INT32(group_vbp); if (!((value >= MIN_dot11DTIMPeriod) && (value <= MAX_dot11DTIMPeriod))) { testproc_error(pktp, group_vbp, WRONG_VALUE); break; } } testproc_good(pktp, group_vbp); break; case LEAF_dot11AssociationResponseTimeOut: testproc_good(pktp, group_vbp); break; default: testproc_error(pktp, group_vbp, GEN_ERR); return; } } }/***************************************************************************** NOMANUAL* dot11StationConfigEntry_set - 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*/void dot11StationConfigEntry_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 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -