📄 asy_back.c
字号:
break; case VT_IPADDRESS: cp = (*((OCTET_T * (*) __((OIDC_T, int, OIDC_T *, char *, SNMP_PKT_T *, UINT_32_T *))) (crts->getproc)))(last_match, tcount, tlist, crts->cookie, pktp, &uint_value); if (cp != 0) MEMCPY(&uint_value, cp, 4); getproc_got_ip_address(pktp, vbp, uint_value); break;/* We only include the following case if v2 types is installed */#if (ENVOY_USE_V2_TYPES) case VT_COUNTER64: DYNCFG_IFCFGVBL_BEGIN(envoy_use_v2_types) { UINT_64_T *uint64_value; uint64_value = (*((UINT_64_T * (*) __((OIDC_T, int, OIDC_T *, char *, SNMP_PKT_T *, int *))) (crts->getproc))) (last_match, tcount, tlist, crts->cookie, pktp, &dynamic); if (uint64_value == 0) /* no counter was returned */ getproc_got_uint64_high_low(pktp, vbp, 0, 0); else { getproc_got_uint64(pktp, vbp, uint64_value); if (dynamic) SNMP_memory_free(uint64_value); } break; } DYNCFG_IFCFGVBL_END(envoy_use_v2_types)#endif /* (ENVOY_USE_V2_TYPES) */ default: getproc_error(pktp, vbp, GEN_ERR); break; }return;}/****************************************************************************NAME: async_compat_nextPURPOSE: This is a glue routine to translate from the async method routine api to the older sync method routine api. This will allow older method routines to be used with the async engine code. For nexts we call the old next followed by an old get and then insert the information into the packet.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 processsed. VB_T * Variable being processed.RETURNS: void****************************************************************************//*ARGSUSED*/void async_compat_next(OIDC_T last_match, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp){COMPAT_ROUTINES_T *crts;int rcount;#if INSTALL_ENVOY_HEAP_LARGE_VARSOIDC_T *rlist;#elseOIDC_T rlist[MAX_OID_COUNT];#endif /* INSTALL_ENVOY_HEAP_LARGE_VARS */#if INSTALL_ENVOY_HEAP_LARGE_VARSrlist = (OIDC_T *)SNMP_memory_alloc(MAX_OID_COUNT * sizeof(OIDC_T));if (rlist == 0) { nextproc_error(pktp, vbp, GEN_ERR); BUG(BUG_ENVOY_INSUFFICIENT_MEMORY, BUG_CONTINUABLE, 0, (BUG_OUT, "async_compat_next(): insufficient memory", 0)); return; }#endif /* INSTALL_ENVOY_HEAP_LARGE_VARS */crts = (COMPAT_ROUTINES_T *)vbp->vb_ml.ml_leaf->user_cookie;rcount = crts->nextproc(last_match, tcount, tlist, rlist, crts->cookie, pktp);if (rcount == 0) { nextproc_no_next(pktp, vbp); }else { nextproc_next_instance(pktp, vbp, rcount, rlist); async_get_routines(last_match, rcount, rlist, pktp, vbp); }#if INSTALL_ENVOY_HEAP_LARGE_VARSSNMP_memory_free(rlist);#endifreturn;}/****************************************************************************NAME: async_compat_getPURPOSE: This is a glue routine to translate from the async method routine api to the older sync method routine api. This will allow older method routines to be used with the async engine code. For gets we do a test with the correct arguments followed by a get and then insert the information into the packet.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 processsed. VB_T * Variable being processed.RETURNS: void****************************************************************************//*ARGSUSED*/void async_compat_get(OIDC_T last_match, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp){COMPAT_ROUTINES_T *crts;int rcode;crts = (COMPAT_ROUTINES_T *)vbp->vb_ml.ml_leaf->user_cookie;rcode = (crts->testproc)(0, last_match, tcount, tlist, crts->cookie, pktp, vbp_to_index(pktp, vbp));if (rcode) { getproc_nosuchins(pktp, vbp); return; }async_get_routines(last_match, tcount, tlist, pktp, vbp);return;}/****************************************************************************NAME: async_compat_setPURPOSE: This is a glue routine to translate from the async method routine api to the older sync method routine api. This will allow older method routines to be used with the async engine code. For sets all we can do is call the set routine, we would like to be able to use undos but they didn't exist so we can't.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 processsed. VB_T * Variable being processed.RETURNS: void****************************************************************************//*ARGSUSED*/void async_compat_set(OIDC_T last_match, int tcount, OIDC_T *tlist, SNMP_PKT_T *pktp, VB_T *vbp){COMPAT_ROUTINES_T *crts;crts = (COMPAT_ROUTINES_T *)vbp->vb_ml.ml_leaf->user_cookie;switch (vbp->vb_ml.ml_leaf->expected_tag) { case VT_NUMBER: case VT_COUNTER: case VT_GAUGE: case VT_TIMETICKS: (*((void (*) __((OIDC_T, int, OIDC_T *, char *, INT_32_T, SNMP_PKT_T *, int))) (crts->setproc)))(last_match, tcount, tlist, crts->cookie, vbp->value_u.v_number, pktp, vbp_to_index(pktp, vbp)); break; case VT_STRING: case VT_OPAQUE: (*((void (*) __((OIDC_T, int, OIDC_T *, char *, char *, int, SNMP_PKT_T *, int))) (crts->setproc)))(last_match, tcount, tlist, crts->cookie, (char *)vbp->value_u.v_string.start_bp, (int)EBufferUsed(&vbp->value_u.v_string), pktp, vbp_to_index(pktp, vbp)); break; case VT_OBJECT: (*((void (*) __((OIDC_T, int, OIDC_T *, char *, int, OIDC_T *, SNMP_PKT_T *, int))) (crts->setproc)))(last_match, tcount, tlist, crts->cookie, vbp->value_u.v_object.num_components, vbp->value_u.v_object.component_list, pktp, vbp_to_index(pktp, vbp)); break; case VT_EMPTY: break; case VT_IPADDRESS: /* Calling sequence to set IP address is same as for strings */ (*((void (*) __((OIDC_T, int, OIDC_T *, char *, char *, int, SNMP_PKT_T *, int))) (crts->setproc)))(last_match, tcount, tlist, crts->cookie, (char *)vbp->value_u.v_network_address, 4, pktp, vbp_to_index(pktp, vbp)); break;/* We only include the following cases if v2 types are installed */#if (ENVOY_USE_V2_TYPES) case VT_COUNTER64: DYNCFG_IFCFGVBL_BEGIN(envoy_use_v2_types) (*((void (*) __((OIDC_T, int, OIDC_T *, char *, UINT_32_T, UINT_32_T, SNMP_PKT_T *, int))) (crts->setproc)))(last_match, tcount, tlist, crts->cookie, UI64_High(&vbp->value_u.v_counter64), UI64_Low(&vbp->value_u.v_counter64), pktp, vbp_to_index(pktp, vbp)); DYNCFG_IFCFGVBL_END(envoy_use_v2_types) break;#endif /* (ENVOY_USE_V2_TYPES) */ default: setproc_error(pktp, vbp, GEN_ERR); return; }setproc_good(pktp, vbp);return;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -