📄 snmp1471.c
字号:
vbp, /* casting from USHORT to INT_32_T */ (INT_32_T) (*((pData->interface)-> pppLinkStatusLocalMRUGet)) (pData->state)); break; case LEAF_pppLinkStatusRemoteMRU: /* expected value: 1..2^(31)-1 */ getproc_got_int32(pktp, vbp, /* casting from USHORT to INT_32_T */ (INT_32_T) (*((pData->interface)-> pppLinkStatusRemoteMRUGet)) (pData->state)); break; case LEAF_pppLinkStatusLocalToPeerACCMap: auxUINT32 = (*((pData->interface)-> pppLinkStatusLocalToPeerACCMapGet)) (pData->state); pOctet = (OCTET_T *) snmpdMemoryAlloc (4); for (i = 0; i<4; i++) { pOctet[i] = (OCTET_T)((auxUINT32 << (i*8)) >> 24); } /* if the data being returned is in dynamic storage and * needs to be free'd, change the 0 argument to a 1. */ getproc_got_string(pktp, vbp, 4, pOctet, 1, VT_STRING); break; case LEAF_pppLinkStatusPeerToLocalACCMap: auxUINT32 = (*((pData->interface)-> pppLinkStatusPeerToLocalACCMapGet)) (pData->state); pOctet = (OCTET_T *) snmpdMemoryAlloc (4); for (i = 0; i<4; i++) { pOctet[i] = (OCTET_T)((auxUINT32 << (i*8)) >> 24); } /* if the data being returned is in dynamic storage and * needs to be free'd, change the 0 argument to a 1. */ getproc_got_string(pktp, vbp, 4, pOctet, 1, VT_STRING); break; case LEAF_pppLinkStatusLocalToRemoteProtocolCompression: /* Values: * enabled(1) = * VAL_pppLinkStatusLocalToRemoteProtocolCompression_enabled * disabled(2) = * VAL_pppLinkStatusLocalToRemoteProtocolCompression_disabled */ getproc_got_int32 ( pktp, vbp, /* casting from UINT32 to INT_32_T */ (INT_32_T) (*((pData->interface)-> pppLinkStatusLocalToRemoteProtocolCompressionGet)) (pData->state) ); break; case LEAF_pppLinkStatusRemoteToLocalProtocolCompression: /* Values: * enabled(1) = * VAL_pppLinkStatusRemoteToLocalProtocolCompression_enabled * disabled(2) = * VAL_pppLinkStatusRemoteToLocalProtocolCompression_disabled */ getproc_got_int32 ( pktp, vbp, /* casting from UINT32 to INT_32_T */ (INT_32_T) (*((pData->interface)-> pppLinkStatusRemoteToLocalProtocolCompressionGet)) (pData->state) ); break; case LEAF_pppLinkStatusLocalToRemoteACCompression: /* Values: * enabled(1) = * VAL_pppLinkStatusLocalToRemoteACCompression_enabled * disabled(2) = * VAL_pppLinkStatusLocalToRemoteACCompression_disabled */ getproc_got_int32 ( pktp, vbp, /* casting from UINT32 to INT_32_T */ (INT_32_T) (*((pData->interface)-> pppLinkStatusLocalToRemoteACCompressionGet)) (pData->state) ); break; case LEAF_pppLinkStatusRemoteToLocalACCompression: /* Values: * enabled(1) = * VAL_pppLinkStatusRemoteToLocalACCompression_enabled * disabled(2) = * VAL_pppLinkStatusRemoteToLocalACCompression_disabled */ getproc_got_int32 ( pktp, vbp, /* casting from UINT32 to INT_32_T */ (INT_32_T) (*((pData->interface)-> pppLinkStatusRemoteToLocalACCompressionGet)) (pData->state) ); break; case LEAF_pppLinkStatusTransmitFcsSize: /* expected value 1..128 */ getproc_got_int32(pktp, vbp, /* casting from UINT32 to INT_32_T */ (INT_32_T) (*((pData->interface)-> pppLinkStatusTransmitFcsSizeGet)) (pData->state)); break; case LEAF_pppLinkStatusReceiveFcsSize: /* expected value 1..128 */ getproc_got_int32(pktp, vbp, /* casting from UINT32 to INT_32_T */ (INT_32_T) (*((pData->interface)-> pppLinkStatusReceiveFcsSizeGet)) (pData->state)); break; default: getproc_error(pktp, vbp, GEN_ERR); return; } return; }/**************************************************************************** pppLinkStatusEntryGet - Get routine for pppLinkStatusEntry columnar objects** A columnar object instance is identified by an instance identifier.* An instance identifier consists of the object identifier and the sequence of* index values. The object identifier consists of the object identifier* of the tabular entry (in this case the OID for pppLinkStatusEntry) and the * leaf subindentifier. In our case the table pppLinkStatusTable is indexed by* only one index, the index being ifIndex which is not a leaf value.* OIDC stands for Object Identifier Component. Compc stands for component* count and it counts the number of components that comprise the index* values part of the instance identifier. Compl stands for components left * and it is the index values array.** RETURNS N/A*/void pppLinkStatusEntryGet ( OIDC_T lastmatch, /* leaf subindentifier */ int compc, /* should be 1 */ OIDC_T * compl, /* pointer to ifIndex */ SNMP_PKT_T * pktp, /* packet pointer */ VB_T * vbp /* varbind list head */ ) { PPP_LINK_STATUS_ENTRY_DATA data; UINT32 ifIndex; /* find all the varbinds that share the same getproc and instance */ snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl); if ((compc != 1) || (NULL == compl)) { for ( ; vbp; vbp = vbp->vb_link) { getproc_nosuchins(pktp, vbp); } return; } ifIndex = *compl; /* so that *compl will be const i.e. unaltered after the call */ if (m2pppLinkStatusEntryLookup(compc, &ifIndex, &data, M2_PPP_ENTRY_EXACT_MATCH) /* use the instance (compc and compl) to look up the entry */ != OK) { for ( ; vbp; vbp = vbp->vb_link) { getproc_nosuchins(pktp, vbp); } } else { /* retrieve all the values from the same data structure */ for ( ; vbp; vbp = vbp->vb_link) { pppLinkStatusEntryInfoGet(vbp->vb_ml.ml_last_match, pktp, vbp, &data); } } return; }/**************************************************************************** pppLinkStatusEntryNext - GetNext for pppLinkStatusEntry columnar objects** A columnar object instance is identified by an instance identifier.* An instance identifier consists of the object identifier and the sequence of* index values. The object identifier consists of the object identifier* of the tabular entry (in this case the OID for pppLinkStatusEntry) and the * leaf subindentifier. In our case the table pppLinkStatusTable is indexed by* only one index, the index being ifIndex which is not a leaf value.* OIDC stands for Object Identifier Component. Compc stands for component* count and it counts the number of components that comprise the index* values part of the instance identifier. Compl stands for components left * and it is the index values array.** RETURNS N/A*/void pppLinkStatusEntryNext ( OIDC_T lastmatch, /* leaf subindentifier */ int compc, /* should be 1 */ OIDC_T * compl, /* pointer to ifIndex */ SNMP_PKT_T * pktp, /* packet pointer */ VB_T * vbp /* varbind list head */ ) { PPP_LINK_STATUS_ENTRY_DATA data; UINT32 ifIndex; OIDC_T nextIfIndex; /* find all the varbinds that share the same getproc and instance */ snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl); ifIndex = (compl != NULL) ? *compl : 0; /* we accept compl == NULL; note that *compl will be const */ if (m2pppLinkStatusEntryLookup(compc, &ifIndex, &data, M2_PPP_ENTRY_NEXT_MATCH) /* use the instance (compc and compl) to look up the entry */ != OK) { for ( ; vbp; vbp = vbp->vb_link) { nextproc_no_next(pktp, vbp); } } else { /* retrieve all the values from the same data structure */ for ( ; vbp; vbp = vbp->vb_link) { pppLinkStatusEntryInfoGet(vbp->vb_ml.ml_last_match, pktp, vbp, &data); nextIfIndex = pppLinkIdGet(data.stackObj); nextproc_next_instance(pktp, vbp, pppLinkStatusEntry_INSTANCE_LEN, &nextIfIndex); nextproc_good(pktp, vbp); } } return; }/**************************************************************************** pppLinkConfigEntryInfoGet - populate packet pppLinkStatusTable varbinds** RETURNS N/A** NOMANUAL*/LOCAL void pppLinkConfigEntryInfoGet ( OIDC_T lastmatch, /* leaf subidentifier */ SNMP_PKT_T * pktp, /* packet pointer */ VB_T * vbp, /* varbind pointer */ PPP_LINK_CONFIG_ENTRY_DATA * pData /* internal structure pointer */ ) { /* compare types specified in RFC, with SNMP agent implementation input * output types, and backend routines input output types. */ OCTET_T * pOctet; /* to be used for dynamic memory management */ ULONG auxULONG; /* we will use this auxiliary ULONG to translate to and * from external and internal ACCMap representations. */ int i; switch(lastmatch) { case LEAF_pppLinkConfigInitialMRU: /* Expected value: 0..2^(31)-1; note that it MAY be zero. * Local and Remote MRU SHOULD be greater than zero. */ getproc_got_int32(pktp, vbp, /* casting from ULONG to INT_32_T */ (INT_32_T) (*((pData->interface)-> pppLinkConfigInitialMRUGet)) (pData->state)); break; case LEAF_pppLinkConfigReceiveACCMap: auxULONG = (*((pData->interface)-> pppLinkConfigReceiveACCMapGet)) (pData->state); pOctet = (OCTET_T *) snmpdMemoryAlloc (4); for (i = 0; i<4; i++) { pOctet[i] = (OCTET_T)((auxULONG << (i*8)) >> 24); } /* if the data being returned is in dynamic storage and * needs to be free'd, change the 0 argument to a 1. */ getproc_got_string(pktp, vbp, 4, pOctet, 1, VT_STRING); break; case LEAF_pppLinkConfigTransmitACCMap: auxULONG = (*((pData->interface)-> pppLinkConfigTransmitACCMapGet)) (pData->state); pOctet = (OCTET_T *) snmpdMemoryAlloc (4); for (i = 0; i<4; i++) { pOctet[i] = (OCTET_T)((auxULONG << (i*8)) >> 24); } /* if the data being returned is in dynamic storage and * needs to be free'd, change the 0 argument to a 1. */ getproc_got_string(pktp, vbp, 4, pOctet, 1, VT_STRING); break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -