📄 axmth.c
字号:
object identifier OIDC_T * Unused part of the object identifier SNMP_PKT_T * SNMP packet currently being processed. VB_T * Variable being processed.RETURNS: void****************************************************************************/void agentxSession_get (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp){ /* * Find all the varbinds that share the same getproc and instance */ group_by_getproc_and_instance (pktp, vbp, tcount, tlist); /* Scalar: check that the instance is exactly .0 */ if ((tcount != 1) || (*tlist != 0)) { for (; vbp; vbp = vbp -> vb_link) getproc_nosuchins (pktp, vbp); } else { for (; vbp; vbp = vbp -> vb_link) { bits32_t lastChangeTimeStamp; if (!AxGetScalar (AX_SESS_LASTCHG, &lastChangeTimeStamp)) getproc_error (pktp, vbp, GEN_ERR); else getproc_got_uint32 (pktp, vbp, lastChangeTimeStamp, VT_TIMETICKS); } }}/****************************************************************************NAME: agentxSession_nextPURPOSE: Routine to get information about the next element in the session list. This routine is called from the scalar representing the last time the session table was changed.PARAMETERS: OIDC_T Last component of the object id leading to the leaf node in the MIB. This is usually the identifier for the particular attribute in the table. int Number of components in the unused part of the object identifier OIDC_T * Unused part of the object identifier SNMP_PKT_T * SNMP packet currently being processed. VB_T * Variable being processed.RETURNS: void****************************************************************************/void agentxSession_next (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp){ OIDC_T instance = 0; /* * The only time there's a next for a scalar is if we're * given no instance at all. */ if (tcount != 0) nextproc_no_next (pktp, vbp); else { /* * Find all the varbinds in this group and retrieve * their values from the same data structure */ for (group_by_getproc_and_instance (pktp, vbp, tcount, tlist); vbp; vbp = vbp -> vb_link) { bits32_t lastChangeTimeStamp; nextproc_next_instance (pktp, vbp, 1, &instance); if (!AxGetScalar (AX_SESS_LASTCHG, &lastChangeTimeStamp)) getproc_error (pktp, vbp, GEN_ERR); else getproc_got_uint32 (pktp, vbp, lastChangeTimeStamp, VT_TIMETICKS); } }}/*** Method routines for the REGISTRATION group*//****************************************************************************NAME: agentxRegistrationEntry_get_valuePURPOSE: Routine to extract information about a registrationPARAMETERS: OIDC_T Last component of the object id leading to the leaf node in the MIB. This is usually the identifier for the particular attribute in the table. SNMP_PKT_T * SNMP packet currently being processed. VB_T * Variable being processed. AX_SESSENT_T * session structureRETURNS: error code or NO_ERROR****************************************************************************/static int agentxRegistrationEntry_get_value (OIDC_T lastmatch, SNMP_PKT_T *pktp, VB_T *vbp, AX_REGENT_T *regData){ switch (lastmatch) { case LEAF_agentxRegContext: getproc_got_string (pktp, vbp, EBufferUsed (®Data -> agentxRegContext), EBufferStart (®Data -> agentxRegContext), 0, VT_STRING); break; case LEAF_agentxRegStart: getproc_got_object_id (pktp, vbp, regData -> agentxRegStart.num_components, regData -> agentxRegStart.component_list, 0); break; case LEAF_agentxRegRangeSubId: getproc_got_uint32 (pktp, vbp, regData -> agentxRegRangeSubId, VT_GAUGE); break; case LEAF_agentxRegUpperBound: getproc_got_uint32 (pktp, vbp, regData -> agentxRegUpperBound, VT_GAUGE); break; case LEAF_agentxRegPriority: getproc_got_uint32 (pktp, vbp, regData -> agentxRegPriority, VT_GAUGE); break; case LEAF_agentxRegTimeout: getproc_got_int32 (pktp, vbp, regData -> agentxRegTimeout); break; case LEAF_agentxRegInstance: getproc_got_int32 (pktp, vbp, regData -> agentxRegInstance); break; default: return GEN_ERR; } return NO_ERROR;}/****************************************************************************NAME: agentxRegistrationEntry_getPURPOSE: Routine to get information about an element in the agentx registration listPARAMETERS: OIDC_T Last component of the object id leading to the leaf node in the MIB. This is usually the identifier for the particular attribute in the table. int Number of components in the unused part of the object identifier OIDC_T * Unused part of the object identifier SNMP_PKT_T * SNMP packet currently being processed. VB_T * Variable being processed.RETURNS: void****************************************************************************/void agentxRegistrationEntry_get (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp){ AX_REGENT_T *regEntry; int error; group_by_getproc_and_instance (pktp, vbp, tcount, tlist); if (tcount != agentxRegistrationEntry_INSTANCE_LEN) { for (; vbp; vbp = vbp -> vb_link) getproc_nosuchins (pktp, vbp); return; } if ((regEntry = AxRegGetEntry (tcount, tlist))) { /* Retrieve all the values from the same data structure */ for (; vbp; vbp = vbp -> vb_link) { if ((error = agentxRegistrationEntry_get_value (vbp -> vb_ml.ml_last_match, pktp, vbp, regEntry)) != NO_ERROR) getproc_error (pktp, vbp, error); } EBufferClean (®Entry->agentxRegContext); if (regEntry->agentxRegStart.num_components) SNMP_memory_free (regEntry->agentxRegStart.component_list); SNMP_memory_free (regEntry); } else for (; vbp; vbp = vbp -> vb_link) getproc_nosuchins (pktp, vbp);}/****************************************************************************NAME: agentxRegistrationEntry_nextPURPOSE: Routine to get information about the next element in the registration listPARAMETERS: OIDC_T Last component of the object id leading to the leaf node in the MIB. This is usually the identifier for the particular attribute in the table. int Number of components in the unused part of the object identifier OIDC_T * Unused part of the object identifier SNMP_PKT_T * SNMP packet currently being processed. VB_T * Variable being processed.RETURNS: void****************************************************************************/void agentxRegistrationEntry_next (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp){ AX_REGENT_T *nextEntry = 0; bits32_t error; OIDC_T best_instance[agentxRegistrationEntry_INSTANCE_LEN]; /* * Find all the varbinds that share the same getproc and instance, * then get the next instance, if any. */ group_by_getproc_and_instance (pktp, vbp, tcount, tlist); if ((nextEntry = AxRegGetNext (tcount, tlist))) { /* * We found the next instance. * Get the values and set the instance for all the * varbinds for this row of this table. */ best_instance[0] = nextEntry->agentxConnIndex; best_instance[1] = nextEntry->agentxSessIndex; best_instance[2] = nextEntry->agentxRegIndex; for (; vbp ; vbp = vbp -> vb_link) { if ((error = agentxRegistrationEntry_get_value (vbp -> vb_ml.ml_last_match, pktp, vbp, nextEntry)) == NO_ERROR) nextproc_next_instance (pktp, vbp, agentxRegistrationEntry_INSTANCE_LEN, best_instance); else nextproc_error (pktp, vbp, error); } EBufferClean (&nextEntry->agentxRegContext); if (nextEntry->agentxRegStart.num_components) SNMP_memory_free (nextEntry->agentxRegStart.component_list); SNMP_memory_free (nextEntry); } else { /* * There's no more in this table */ for (; vbp ; vbp = vbp -> vb_link) nextproc_no_next (pktp, vbp); }}/****************************************************************************NAME: agentxRegistration_getPURPOSE: Routine to get information about an element in the agentx registration. This getproc is called to retrieve the scalar representing the time the registration table was last changed.PARAMETERS: OIDC_T Last component of the object id leading to the leaf node in the MIB. This is usually the identifier for the particular attribute in the table. int Number of components in the unused part of the object identifier OIDC_T * Unused part of the object identifier SNMP_PKT_T * SNMP packet currently being processed. VB_T * Variable being processed.RETURNS: void****************************************************************************/void agentxRegistration_get (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp){ /* * Find all the varbinds in this group and retrieve * their values from the same data structure */ group_by_getproc_and_instance (pktp, vbp, tcount, tlist); /* * Scalar: check that the instance is exactly ".0" */ if ((tcount != 1) || (*tlist != 0)) { for (; vbp; vbp = vbp -> vb_link) getproc_nosuchins (pktp, vbp); } else { for (; vbp; vbp = vbp -> vb_link) { bits32_t lastChangeTimeStamp; if (!AxGetScalar (AX_REG_LASTCHG, &lastChangeTimeStamp)) getproc_error (pktp, vbp, GEN_ERR); else getproc_got_uint32 (pktp, vbp, lastChangeTimeStamp, VT_TIMETICKS); } }}/****************************************************************************NAME: agentxRegistration_nextPURPOSE: Routine to get information about the next element in the registration list. This routine is called from the scalar representing the last time the registration table was changed.PARAMETERS: OIDC_T Last component of the object id leading to the leaf node in the MIB. This is usually the identifier for the particular attribute in the table. int Number of components in the unused part of the object identifier OIDC_T * Unused part of the object identifier SNMP_PKT_T * SNMP packet currently being processed. VB_T * Variable being processed.RETURNS: void****************************************************************************/void agentxRegistration_next (OIDC_T lastmatch, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp){ OIDC_T instance = 0; /* * The only time there's a next for a scalar is if we're * given no instance at all. */ if (tcount != 0) nextproc_no_next (pktp, vbp); else { /* * Find all the varbinds in this group and retrieve * their values from the same data structure */ for (group_by_getproc_and_instance (pktp, vbp, tcount, tlist); vbp; vbp = vbp -> vb_link) { bits32_t lastChangeTimeStamp; nextproc_next_instance (pktp, vbp, 1, &instance); if (!AxGetScalar (AX_REG_LASTCHG, &lastChangeTimeStamp)) getproc_error (pktp, vbp, GEN_ERR); else getproc_got_uint32 (pktp, vbp, lastChangeTimeStamp, VT_TIMETICKS); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -