/* * Note: this file originally auto-generated by mib2c using * version : 1.16 $ of : mfd-data-get.m2c,v $ * * $Id$ */ /* * standard Net-SNMP includes */ #include #include #include /* * include our parent header */ #include "ifTable.h" #include "ifTable_enums.h" #include /** @defgroup data_get data_get: Routines to get data * * These routine are used to get the value for individual objects. The * row context is passed, along with a pointer to the memory where the * value should be copied. * * @{ */ /********************************************************************** ********************************************************************** *** *** Table ifTable *** ********************************************************************** **********************************************************************/ /* * ifTable is subid 2 of interfaces. * It's status is Current. * OID: .1.3.6.1.2.1.2.2, length: 8 */ /** * set mib index(es) * * @param tbl_idx mib index structure * * @retval MFD_SUCCESS : success. * @retval MFD_ERROR : other error. * * @remark * This convenience function is useful for setting all the MIB index * components with a single function call. It is assume that the C values * have already been mapped from their native/rawformat to the MIB format. */ int ifTable_indexes_set_tbl_idx(ifTable_mib_index * tbl_idx, long ifIndex_val) { DEBUGMSGTL(("verbose:ifTable_indexes_set_tbl_idx", "called\n")); /* * ifIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H */ /* * TODO: * update, replace or delete, if needed. */ tbl_idx->ifIndex = ifIndex_val; /** xxx-rks: call validation routines? assume caller knows what they * are doing? */ return MFD_SUCCESS; } /** * @internal * set row context indexes * * @param reqreq_ctx the row context that needs updated indexes * * @retval MFD_SUCCESS : success. * @retval MFD_ERROR : other error. * * @remark * This function sets the mib indexs, then updates the oid indexs * from the mib index. */ int ifTable_indexes_set(ifTable_rowreq_ctx * rowreq_ctx, long ifIndex_val) { if (MFD_SUCCESS != ifTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx, ifIndex_val)) return MFD_ERROR; /* * convert mib index to oid index */ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid); if (0 != ifTable_index_to_oid(&rowreq_ctx->oid_idx, &rowreq_ctx->tbl_idx)) { return MFD_ERROR; } return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifDescr * ifDescr is subid 2 of ifEntry. * It's status is Current, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.2 * Description: A textual string containing information about the interface. This string should include the name of the manufacturer, the product name and the version of the interface hardware/software. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 1 hashint 1 * settable 0 * hint: 255a * * Ranges: 0 - 255; * * It's syntax is DisplayString (based on perltype OCTETSTR) * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char) * This data type requires a length. (Max 255) */ /** * Extract the current value of the ifDescr data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifDescr_val_ptr_ptr * Pointer to storage for a char variable * @param ifDescr_val_ptr_len_ptr * Pointer to a size_t. On entry, it will contain the size (in bytes) * pointed to by ifDescr. * On exit, this value should contain the data size (in bytes). * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error * * @note If you need more than (*ifDescr_val_ptr_len_ptr) bytes of memory, * allocate it using malloc() and update ifDescr_val_ptr_ptr. * DO NOT free the previous pointer. * The MFD helper will release the memory you allocate. * * @remark If you call this function yourself, you are responsible * for checking if the pointer changed, and freeing any * previously allocated memory. (Not necessary if you pass * in a pointer to static memory, obviously.) */ int ifDescr_get(ifTable_rowreq_ctx * rowreq_ctx, char **ifDescr_val_ptr_ptr, size_t *ifDescr_val_ptr_len_ptr) { /** we should have a non-NULL pointer and enough storage */ netsnmp_assert((NULL != ifDescr_val_ptr_ptr) && (NULL != *ifDescr_val_ptr_ptr)); netsnmp_assert(NULL != ifDescr_val_ptr_len_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifDescr_val_ptr_ptr ) and (* ifDescr_val_ptr_len_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ /* * make sure there is enough space for data */ if ((NULL == (*ifDescr_val_ptr_ptr)) || ((*ifDescr_val_ptr_len_ptr) < rowreq_ctx->data.ifDescr_len)) { /* * allocate space for data */ (*ifDescr_val_ptr_ptr) = malloc(rowreq_ctx->data.ifDescr_len * sizeof((*ifDescr_val_ptr_ptr)[0])); if (NULL == (*ifDescr_val_ptr_ptr)) { snmp_log(LOG_ERR, "could not allocate memory\n"); return MFD_ERROR; } } (*ifDescr_val_ptr_len_ptr) = rowreq_ctx->data.ifDescr_len; memcpy((*ifDescr_val_ptr_ptr), rowreq_ctx->data.ifDescr, (*ifDescr_val_ptr_len_ptr) * sizeof((*ifDescr_val_ptr_ptr)[0])); return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifType * ifType is subid 3 of ifEntry. * It's status is Current, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.3 * Description: The type of interface. Additional values for ifType are assigned by the Internet Assigned Numbers Authority (IANA), through updating the syntax of the IANAifType textual convention. * * Attributes: * accessible 1 isscalar 0 enums 1 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * Enum range: 146/256. Values: other(1), regular1822(2), hdh1822(3), ddnX25(4), rfc877x25(5), ethernetCsmacd(6), iso88023Csmacd(7), iso88024TokenBus(8), iso88025TokenRing(9), iso88026Man(10), starLan(11), proteon10Mbit(12), proteon80Mbit(13), hyperchannel(14), fddi(15), lapb(16), sdlc(17), ds1(18), e1(19), basicISDN(20), primaryISDN(21), propPointToPointSerial(22), ppp(23), softwareLoopback(24), eon(25), ethernet3Mbit(26), nsip(27), slip(28), ultra(29), ds3(30), sip(31), frameRelay(32), rs232(33), para(34), arcnet(35), arcnetPlus(36), atm(37), miox25(38), sonet(39), x25ple(40), iso88022llc(41), localTalk(42), smdsDxi(43), frameRelayService(44), v35(45), hssi(46), hippi(47), modem(48), aal5(49), sonetPath(50), sonetVT(51), smdsIcip(52), propVirtual(53), propMultiplexor(54), ieee80212(55), fibreChannel(56), hippiInterface(57), frameRelayInterconnect(58), aflane8023(59), aflane8025(60), cctEmul(61), fastEther(62), isdn(63), v11(64), v36(65), g703at64k(66), g703at2mb(67), qllc(68), fastEtherFX(69), channel(70), ieee80211(71), ibm370parChan(72), escon(73), dlsw(74), isdns(75), isdnu(76), lapd(77), ipSwitch(78), rsrb(79), atmLogical(80), ds0(81), ds0Bundle(82), bsc(83), async(84), cnr(85), iso88025Dtr(86), eplrs(87), arap(88), propCnls(89), hostPad(90), termPad(91), frameRelayMPI(92), x213(93), adsl(94), radsl(95), sdsl(96), vdsl(97), iso88025CRFPInt(98), myrinet(99), voiceEM(100), voiceFXO(101), voiceFXS(102), voiceEncap(103), voiceOverIp(104), atmDxi(105), atmFuni(106), atmIma(107), pppMultilinkBundle(108), ipOverCdlc(109), ipOverClaw(110), stackToStack(111), virtualIpAddress(112), mpc(113), ipOverAtm(114), iso88025Fiber(115), tdlc(116), gigabitEthernet(117), hdlc(118), lapf(119), v37(120), x25mlp(121), x25huntGroup(122), trasnpHdlc(123), interleave(124), fast(125), ip(126), docsCableMaclayer(127), docsCableDownstream(128), docsCableUpstream(129), a12MppSwitch(130), tunnel(131), coffee(132), ces(133), atmSubInterface(134), l2vlan(135), l3ipvlan(136), l3ipxvlan(137), digitalPowerline(138), mediaMailOverIp(139), dtm(140), dcn(141), ipForward(142), msdsl(143), ieee1394(144), if_gsn(145), dvbRccMacLayer(146), dvbRccDownstream(147), dvbRccUpstream(148), atmVirtual(149), mplsTunnel(150), srp(151), voiceOverAtm(152), voiceOverFrameRelay(153), idsl(154), compositeLink(155), ss7SigLink(156), propWirelessP2P(157), frForward(158), rfc1483(159), usb(160), ieee8023adLag(161), bgppolicyaccounting(162), frf16MfrBundle(163), h323Gatekeeper(164), h323Proxy(165), mpls(166), mfSigLink(167), hdsl2(168), shdsl(169), ds1FDL(170), pos(171), dvbAsiIn(172), dvbAsiOut(173), plc(174), nfas(175), tr008(176), gr303RDT(177), gr303IDT(178), isup(179), propDocsWirelessMaclayer(180), propDocsWirelessDownstream(181), propDocsWirelessUpstream(182), hiperlan2(183), propBWAp2Mp(184), sonetOverheadChannel(185), digitalWrapperOverheadChannel(186), aal2(187), radioMAC(188), atmRadio(189), imt(190), mvl(191), reachDSL(192), frDlciEndPt(193), atmVciEndPt(194), opticalChannel(195), opticalTransport(196), propAtm(197), voiceOverCable(198), infiniband(199), teLink(200), q2931(201), virtualTg(202), sipTg(203), sipSig(204), docsCableUpstreamChannel(205), econet(206), pon155(207), pon622(208), bridge(209), linegroup(210), voiceEMFGD(211), voiceFGDEANA(212), voiceDID(213), mpegTransport(214), sixToFour(215), gtp(216), pdnEtherLoop1(217), pdnEtherLoop2(218), opticalChannelGroup(219), homepna(220), gfp(221) * * It's syntax is IANAifType (based on perltype INTEGER) * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) */ /** * map a value from it's original native format the the MIB format. * * @retval MFD_SUCCESS : success * @retval MFD_ERROR : Any other error * * @note parameters follow the memset convention (dest, src). * * @note generation and use of this function can be turned off by re-running * mib2c after adding the following line to the file * default-node-ifType.m2d : * @eval $m2c_node_skip_mapping = 1@ * * @remark * If the values for your data type don't exactly match the * possible values defined by the mib, you should map them here. * Otherwise, just do a direct copy. */ int ifType_map(u_long * mib_ifType_val_ptr, u_long raw_ifType_val) { netsnmp_assert(NULL != mib_ifType_val_ptr); DEBUGMSGTL(("verbose:ifType_map", "called\n")); /* * TODO: * value mapping */ /** TODO: update INTERNAL_* macros defined in the header */ switch (raw_ifType_val) { case INTERNAL_IANAIFTYPE_ETHERNETCSMACD: (*mib_ifType_val_ptr) = IANAIFTYPE_ETHERNETCSMACD; break; case INTERNAL_IANAIFTYPE_TUNNEL: case ARPHRD_TUNNEL6: #ifdef ARPHRD_IPGRE case ARPHRD_IPGRE: #endif case ARPHRD_SIT: (*mib_ifType_val_ptr) = IANAIFTYPE_TUNNEL; break; /* tunnel */ case ARPHRD_CSLIP: case ARPHRD_SLIP6: case ARPHRD_CSLIP6: case INTERNAL_IANAIFTYPE_SLIP: (*mib_ifType_val_ptr) = IANAIFTYPE_SLIP; break; /* slip */ case INTERNAL_IANAIFTYPE_PPP: (*mib_ifType_val_ptr) = IANAIFTYPE_PPP; break; /* ppp */ case INTERNAL_IANAIFTYPE_SOFTWARELOOPBACK: (*mib_ifType_val_ptr) = IANAIFTYPE_SOFTWARELOOPBACK; break; /* softwareLoopback */ case INTERNAL_IANAIFTYPE_FDDI: (*mib_ifType_val_ptr) = IANAIFTYPE_FDDI; break; case INTERNAL_IANAIFTYPE_ARCNET: (*mib_ifType_val_ptr) = IANAIFTYPE_ARCNET; break; case INTERNAL_IANAIFTYPE_LOCALTALK: (*mib_ifType_val_ptr) = IANAIFTYPE_LOCALTALK; break; #ifdef INTERNAL_IANAIFTYPE_HIPPI case INTERNAL_IANAIFTYPE_HIPPI: (*mib_ifType_val_ptr) = IANAIFTYPE_HIPPI; break; #endif #ifdef INTERNAL_IANAIFTYPE_ATM case INTERNAL_IANAIFTYPE_ATM: (*mib_ifType_val_ptr) = IANAIFTYPE_ATM; break; #endif /* * XXX: more if_arp.h:ARPHDR_xxx to IANAifType mappings... */ default: snmp_log(LOG_ERR, "couldn't map value %d for ifType\n", raw_ifType_val); (*mib_ifType_val_ptr) = IANAIFTYPE_OTHER; } return MFD_SUCCESS; } /** * Extract the current value of the ifType data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifType_val_ptr * Pointer to storage for a long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */ int ifType_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifType_val_ptr) { /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifType_val_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifType_val_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ (*ifType_val_ptr) = rowreq_ctx->data.ifType; return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifMtu * ifMtu is subid 4 of ifEntry. * It's status is Current, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.4 * Description: The size of the largest packet which can be sent/received on the interface, specified in octets. For interfaces that are used for transmitting network datagrams, this is the size of the largest network datagram that can be sent on the interface. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * It's syntax is INTEGER32 (based on perltype INTEGER32) * The net-snmp type is ASN_INTEGER. The C type decl is long (long) */ /** * Extract the current value of the ifMtu data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifMtu_val_ptr * Pointer to storage for a long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */ int ifMtu_get(ifTable_rowreq_ctx * rowreq_ctx, long *ifMtu_val_ptr) { /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifMtu_val_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifMtu_val_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ if (rowreq_ctx->data.ifMtu == 0) return MFD_SKIP; (*ifMtu_val_ptr) = rowreq_ctx->data.ifMtu; return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifSpeed * ifSpeed is subid 5 of ifEntry. * It's status is Current, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.5 * Description: An estimate of the interface's current bandwidth in bits per second. For interfaces which do not vary in bandwidth or for those where no accurate estimation can be made, this object should contain the nominal bandwidth. If the bandwidth of the interface is greater than the maximum value reportable by this object then this object should report its maximum value (4,294,967,295) and ifHighSpeed must be used to report the interace's speed. For a sub-layer which has no concept of bandwidth, this object should be zero. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * It's syntax is GAUGE (based on perltype GAUGE) * The net-snmp type is ASN_GAUGE. The C type decl is u_long (u_long) */ /** * Extract the current value of the ifSpeed data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifSpeed_val_ptr * Pointer to storage for a u_long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */ int ifSpeed_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifSpeed_val_ptr) { /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifSpeed_val_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifSpeed_val_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ (*ifSpeed_val_ptr) = rowreq_ctx->data.ifSpeed; return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifPhysAddress * ifPhysAddress is subid 6 of ifEntry. * It's status is Current, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.6 * Description: The interface's address at its protocol sub-layer. For example, for an 802.x interface, this object normally contains a MAC address. The interface's media-specific MIB must define the bit and byte ordering and the format of the value of this object. For interfaces which do not have such an address (e.g., a serial line), this object should contain an octet string of zero length. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 1 * settable 0 * hint: 1x: * * * It's syntax is PhysAddress (based on perltype OCTETSTR) * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char) * This data type requires a length. (Max 255) */ /** * Extract the current value of the ifPhysAddress data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifPhysAddress_val_ptr_ptr * Pointer to storage for a char variable * @param ifPhysAddress_val_ptr_len_ptr * Pointer to a size_t. On entry, it will contain the size (in bytes) * pointed to by ifPhysAddress. * On exit, this value should contain the data size (in bytes). * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error * * @note If you need more than (*ifPhysAddress_val_ptr_len_ptr) bytes of memory, * allocate it using malloc() and update ifPhysAddress_val_ptr_ptr. * DO NOT free the previous pointer. * The MFD helper will release the memory you allocate. * * @remark If you call this function yourself, you are responsible * for checking if the pointer changed, and freeing any * previously allocated memory. (Not necessary if you pass * in a pointer to static memory, obviously.) */ int ifPhysAddress_get(ifTable_rowreq_ctx * rowreq_ctx, char **ifPhysAddress_val_ptr_ptr, size_t *ifPhysAddress_val_ptr_len_ptr) { /** we should have a non-NULL pointer and enough storage */ netsnmp_assert((NULL != ifPhysAddress_val_ptr_ptr) && (NULL != *ifPhysAddress_val_ptr_ptr)); netsnmp_assert(NULL != ifPhysAddress_val_ptr_len_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifPhysAddress_val_ptr_ptr ) and (* ifPhysAddress_val_ptr_len_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ /* * make sure there is enough space for data */ if ((NULL == (*ifPhysAddress_val_ptr_ptr)) || ((*ifPhysAddress_val_ptr_len_ptr) < rowreq_ctx->data.ifPhysAddress_len)) { /* * allocate space for data */ (*ifPhysAddress_val_ptr_ptr) = malloc(rowreq_ctx->data.ifPhysAddress_len * sizeof((*ifPhysAddress_val_ptr_ptr)[0])); if (NULL == (*ifPhysAddress_val_ptr_ptr)) { snmp_log(LOG_ERR, "could not allocate memory\n"); return MFD_ERROR; } } (*ifPhysAddress_val_ptr_len_ptr) = rowreq_ctx->data.ifPhysAddress_len; memcpy((*ifPhysAddress_val_ptr_ptr), rowreq_ctx->data.ifPhysAddress, (*ifPhysAddress_val_ptr_len_ptr) * sizeof((*ifPhysAddress_val_ptr_ptr)[0])); return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifAdminStatus * ifAdminStatus is subid 7 of ifEntry. * It's status is Current, and it's access level is ReadWrite. * OID: .1.3.6.1.2.1.2.2.1.7 * Description: The desired state of the interface. The testing(3) state indicates that no operational packets can be passed. When a managed system initializes, all interfaces start with ifAdminStatus in the down(2) state. As a result of either explicit management action or per configuration information retained by the managed system, ifAdminStatus is then changed to either the up(1) or testing(3) states (or remains in the down(2) state). * * Attributes: * accessible 1 isscalar 0 enums 1 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 1 * * Enum range: 2/8. Values: up(1), down(2), testing(3) * * It's syntax is INTEGER (based on perltype INTEGER) * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) */ /** * map a value from it's original native format the the MIB format. * * @retval MFD_SUCCESS : success * @retval MFD_ERROR : Any other error * * @note parameters follow the memset convention (dest, src). * * @note generation and use of this function can be turned off by re-running * mib2c after adding the following line to the file * default-node-ifAdminStatus.m2d : * @eval $m2c_node_skip_mapping = 1@ * * @remark * If the values for your data type don't exactly match the * possible values defined by the mib, you should map them here. * Otherwise, just do a direct copy. */ int ifAdminStatus_map(u_long * mib_ifAdminStatus_val_ptr, u_long raw_ifAdminStatus_val) { netsnmp_assert(NULL != mib_ifAdminStatus_val_ptr); DEBUGMSGTL(("verbose:ifAdminStatus_map", "called\n")); /* * TODO: * value mapping */ /** TODO: update INTERNAL_* macros defined in the header */ switch (raw_ifAdminStatus_val) { case INTERNAL_IFADMINSTATUS_UP: *mib_ifAdminStatus_val_ptr = IFADMINSTATUS_UP; break; case INTERNAL_IFADMINSTATUS_DOWN: *mib_ifAdminStatus_val_ptr = IFADMINSTATUS_DOWN; break; case INTERNAL_IFADMINSTATUS_TESTING: *mib_ifAdminStatus_val_ptr = IFADMINSTATUS_TESTING; break; default: snmp_log(LOG_ERR, "couldn't map value %d for ifAdminStatus\n", raw_ifAdminStatus_val); return MFD_ERROR; } return MFD_SUCCESS; } /** * Extract the current value of the ifAdminStatus data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifAdminStatus_val_ptr * Pointer to storage for a long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */ int ifAdminStatus_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifAdminStatus_val_ptr) { /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifAdminStatus_val_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifAdminStatus_val_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ (*ifAdminStatus_val_ptr) = rowreq_ctx->data.ifAdminStatus; return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifOperStatus * ifOperStatus is subid 8 of ifEntry. * It's status is Current, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.8 * Description: The current operational state of the interface. The testing(3) state indicates that no operational packets can be passed. If ifAdminStatus is down(2) then ifOperStatus should be down(2). If ifAdminStatus is changed to up(1) then ifOperStatus should change to up(1) if the interface is ready to transmit and receive network traffic; it should change to dormant(5) if the interface is waiting for external actions (such as a serial line waiting for an incoming connection); it should remain in the down(2) state if and only if there is a fault that prevents it from going to the up(1) state; it should remain in the notPresent(6) state if the interface has missing (typically, hardware) components. * * Attributes: * accessible 1 isscalar 0 enums 1 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * Enum range: 5/8. Values: up(1), down(2), testing(3), unknown(4), dormant(5), notPresent(6), lowerLayerDown(7) * * It's syntax is INTEGER (based on perltype INTEGER) * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) */ /** * map a value from it's original native format the the MIB format. * * @retval MFD_SUCCESS : success * @retval MFD_ERROR : Any other error * * @note parameters follow the memset convention (dest, src). * * @note generation and use of this function can be turned off by re-running * mib2c after adding the following line to the file * default-node-ifOperStatus.m2d : * @eval $m2c_node_skip_mapping = 1@ * * @remark * If the values for your data type don't exactly match the * possible values defined by the mib, you should map them here. * Otherwise, just do a direct copy. */ int ifOperStatus_map(u_long * mib_ifOperStatus_val_ptr, u_long raw_ifOperStatus_val) { netsnmp_assert(NULL != mib_ifOperStatus_val_ptr); DEBUGMSGTL(("verbose:ifOperStatus_map", "called\n")); /* * TODO: * value mapping */ /** TODO: update INTERNAL_* macros defined in the header */ switch (raw_ifOperStatus_val) { case INTERNAL_IFOPERSTATUS_UP: *mib_ifOperStatus_val_ptr = IFOPERSTATUS_UP; break; case INTERNAL_IFOPERSTATUS_DOWN: *mib_ifOperStatus_val_ptr = IFOPERSTATUS_DOWN; break; case INTERNAL_IFOPERSTATUS_TESTING: *mib_ifOperStatus_val_ptr = IFOPERSTATUS_TESTING; break; case INTERNAL_IFOPERSTATUS_UNKNOWN: *mib_ifOperStatus_val_ptr = IFOPERSTATUS_UNKNOWN; break; case INTERNAL_IFOPERSTATUS_DORMANT: *mib_ifOperStatus_val_ptr = IFOPERSTATUS_DORMANT; break; case INTERNAL_IFOPERSTATUS_NOTPRESENT: *mib_ifOperStatus_val_ptr = IFOPERSTATUS_NOTPRESENT; break; case INTERNAL_IFOPERSTATUS_LOWERLAYERDOWN: *mib_ifOperStatus_val_ptr = IFOPERSTATUS_LOWERLAYERDOWN; break; default: snmp_log(LOG_ERR, "couldn't map value %d for ifOperStatus\n", raw_ifOperStatus_val); return MFD_ERROR; } return MFD_SUCCESS; } /** * Extract the current value of the ifOperStatus data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifOperStatus_val_ptr * Pointer to storage for a long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */ int ifOperStatus_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifOperStatus_val_ptr) { /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifOperStatus_val_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifOperStatus_val_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ (*ifOperStatus_val_ptr) = rowreq_ctx->data.ifOperStatus; return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifLastChange * ifLastChange is subid 9 of ifEntry. * It's status is Current, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.9 * Description: The value of sysUpTime at the time the interface entered its current operational state. If the current state was entered prior to the last re-initialization of the local network management subsystem, then this object contains a zero value. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * It's syntax is TICKS (based on perltype TICKS) * The net-snmp type is ASN_TIMETICKS. The C type decl is u_long (u_long) */ /** * Extract the current value of the ifLastChange data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifLastChange_val_ptr * Pointer to storage for a u_long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */ int ifLastChange_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifLastChange_val_ptr) { /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifLastChange_val_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifLastChange_val_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ (*ifLastChange_val_ptr) = rowreq_ctx->data.ifLastChange; return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifInOctets * ifInOctets is subid 10 of ifEntry. * It's status is Current, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.10 * Description: The total number of octets received on the interface, including framing characters. Discontinuities in the value of this counter can occur at re-initialization of the management system, and at other times as indicated by the value of ifCounterDiscontinuityTime. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * It's syntax is COUNTER (based on perltype COUNTER) * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) */ /** * Extract the current value of the ifInOctets data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifInOctets_val_ptr * Pointer to storage for a u_long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */ int ifInOctets_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifInOctets_val_ptr) { /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifInOctets_val_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifInOctets_val_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ (*ifInOctets_val_ptr) = rowreq_ctx->data.ifInOctets; return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifInUcastPkts * ifInUcastPkts is subid 11 of ifEntry. * It's status is Current, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.11 * Description: The number of packets, delivered by this sub-layer to a higher (sub-)layer, which were not addressed to a multicast or broadcast address at this sub-layer. Discontinuities in the value of this counter can occur at re-initialization of the management system, and at other times as indicated by the value of ifCounterDiscontinuityTime. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * It's syntax is COUNTER (based on perltype COUNTER) * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) */ /** * Extract the current value of the ifInUcastPkts data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifInUcastPkts_val_ptr * Pointer to storage for a u_long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */ int ifInUcastPkts_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifInUcastPkts_val_ptr) { /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifInUcastPkts_val_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifInUcastPkts_val_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ (*ifInUcastPkts_val_ptr) = rowreq_ctx->data.ifInUcastPkts; return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifInNUcastPkts * ifInNUcastPkts is subid 12 of ifEntry. * It's status is Deprecated, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.12 * Description: The number of packets, delivered by this sub-layer to a higher (sub-)layer, which were addressed to a multicast or broadcast address at this sub-layer. Discontinuities in the value of this counter can occur at re-initialization of the management system, and at other times as indicated by the value of ifCounterDiscontinuityTime. This object is deprecated in favour of ifInMulticastPkts and ifInBroadcastPkts. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * It's syntax is COUNTER (based on perltype COUNTER) * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) */ /** * Extract the current value of the ifInNUcastPkts data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifInNUcastPkts_val_ptr * Pointer to storage for a u_long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */ int ifInNUcastPkts_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifInNUcastPkts_val_ptr) { /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifInNUcastPkts_val_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifInNUcastPkts_val_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ (*ifInNUcastPkts_val_ptr) = rowreq_ctx->data.ifInNUcastPkts; return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifInDiscards * ifInDiscards is subid 13 of ifEntry. * It's status is Current, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.13 * Description: The number of inbound packets which were chosen to be discarded even though no errors had been detected to prevent their being deliverable to a higher-layer protocol. One possible reason for discarding such a packet could be to free up buffer space. Discontinuities in the value of this counter can occur at re-initialization of the management system, and at other times as indicated by the value of ifCounterDiscontinuityTime. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * It's syntax is COUNTER (based on perltype COUNTER) * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) */ /** * Extract the current value of the ifInDiscards data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifInDiscards_val_ptr * Pointer to storage for a u_long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */ int ifInDiscards_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifInDiscards_val_ptr) { /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifInDiscards_val_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifInDiscards_val_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ (*ifInDiscards_val_ptr) = rowreq_ctx->data.ifInDiscards; return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifInErrors * ifInErrors is subid 14 of ifEntry. * It's status is Current, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.14 * Description: For packet-oriented interfaces, the number of inbound packets that contained errors preventing them from being deliverable to a higher-layer protocol. For character- oriented or fixed-length interfaces, the number of inbound transmission units that contained errors preventing them from being deliverable to a higher-layer protocol. Discontinuities in the value of this counter can occur at re-initialization of the management system, and at other times as indicated by the value of ifCounterDiscontinuityTime. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * It's syntax is COUNTER (based on perltype COUNTER) * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) */ /** * Extract the current value of the ifInErrors data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifInErrors_val_ptr * Pointer to storage for a u_long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */ int ifInErrors_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifInErrors_val_ptr) { /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifInErrors_val_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifInErrors_val_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ (*ifInErrors_val_ptr) = rowreq_ctx->data.ifInErrors; return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifInUnknownProtos * ifInUnknownProtos is subid 15 of ifEntry. * It's status is Current, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.15 * Description: For packet-oriented interfaces, the number of packets received via the interface which were discarded because of an unknown or unsupported protocol. For character-oriented or fixed-length interfaces that support protocol multiplexing the number of transmission units received via the interface which were discarded because of an unknown or unsupported protocol. For any interface that does not support protocol multiplexing, this counter will always be 0. Discontinuities in the value of this counter can occur at re-initialization of the management system, and at other times as indicated by the value of ifCounterDiscontinuityTime. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * It's syntax is COUNTER (based on perltype COUNTER) * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) */ /** * Extract the current value of the ifInUnknownProtos data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifInUnknownProtos_val_ptr * Pointer to storage for a u_long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */ int ifInUnknownProtos_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifInUnknownProtos_val_ptr) { /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifInUnknownProtos_val_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifInUnknownProtos_val_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ (*ifInUnknownProtos_val_ptr) = rowreq_ctx->data.ifInUnknownProtos; return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifOutOctets * ifOutOctets is subid 16 of ifEntry. * It's status is Current, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.16 * Description: The total number of octets transmitted out of the interface, including framing characters. Discontinuities in the value of this counter can occur at re-initialization of the management system, and at other times as indicated by the value of ifCounterDiscontinuityTime. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * It's syntax is COUNTER (based on perltype COUNTER) * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) */ /** * Extract the current value of the ifOutOctets data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifOutOctets_val_ptr * Pointer to storage for a u_long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */ int ifOutOctets_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifOutOctets_val_ptr) { /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifOutOctets_val_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifOutOctets_val_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ (*ifOutOctets_val_ptr) = rowreq_ctx->data.ifOutOctets; return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifOutUcastPkts * ifOutUcastPkts is subid 17 of ifEntry. * It's status is Current, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.17 * Description: The total number of packets that higher-level protocols requested be transmitted, and which were not addressed to a multicast or broadcast address at this sub-layer, including those that were discarded or not sent. Discontinuities in the value of this counter can occur at re-initialization of the management system, and at other times as indicated by the value of ifCounterDiscontinuityTime. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * It's syntax is COUNTER (based on perltype COUNTER) * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) */ /** * Extract the current value of the ifOutUcastPkts data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifOutUcastPkts_val_ptr * Pointer to storage for a u_long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */ int ifOutUcastPkts_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifOutUcastPkts_val_ptr) { /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifOutUcastPkts_val_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifOutUcastPkts_val_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ (*ifOutUcastPkts_val_ptr) = rowreq_ctx->data.ifOutUcastPkts; return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifOutNUcastPkts * ifOutNUcastPkts is subid 18 of ifEntry. * It's status is Deprecated, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.18 * Description: The total number of packets that higher-level protocols requested be transmitted, and which were addressed to a multicast or broadcast address at this sub-layer, including those that were discarded or not sent. Discontinuities in the value of this counter can occur at re-initialization of the management system, and at other times as indicated by the value of ifCounterDiscontinuityTime. This object is deprecated in favour of ifOutMulticastPkts and ifOutBroadcastPkts. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * It's syntax is COUNTER (based on perltype COUNTER) * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) */ /** * Extract the current value of the ifOutNUcastPkts data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifOutNUcastPkts_val_ptr * Pointer to storage for a u_long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */ int ifOutNUcastPkts_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifOutNUcastPkts_val_ptr) { /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifOutNUcastPkts_val_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifOutNUcastPkts_val_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ (*ifOutNUcastPkts_val_ptr) = rowreq_ctx->data.ifOutNUcastPkts; return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifOutDiscards * ifOutDiscards is subid 19 of ifEntry. * It's status is Current, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.19 * Description: The number of outbound packets which were chosen to be discarded even though no errors had been detected to prevent their being transmitted. One possible reason for discarding such a packet could be to free up buffer space. Discontinuities in the value of this counter can occur at re-initialization of the management system, and at other times as indicated by the value of ifCounterDiscontinuityTime. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * It's syntax is COUNTER (based on perltype COUNTER) * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) */ /** * Extract the current value of the ifOutDiscards data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifOutDiscards_val_ptr * Pointer to storage for a u_long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */ int ifOutDiscards_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifOutDiscards_val_ptr) { /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifOutDiscards_val_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifOutDiscards_val_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ (*ifOutDiscards_val_ptr) = rowreq_ctx->data.ifOutDiscards; return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifOutErrors * ifOutErrors is subid 20 of ifEntry. * It's status is Current, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.20 * Description: For packet-oriented interfaces, the number of outbound packets that could not be transmitted because of errors. For character-oriented or fixed-length interfaces, the number of outbound transmission units that could not be transmitted because of errors. Discontinuities in the value of this counter can occur at re-initialization of the management system, and at other times as indicated by the value of ifCounterDiscontinuityTime. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * It's syntax is COUNTER (based on perltype COUNTER) * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) */ /** * Extract the current value of the ifOutErrors data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifOutErrors_val_ptr * Pointer to storage for a u_long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */ int ifOutErrors_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifOutErrors_val_ptr) { /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifOutErrors_val_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifOutErrors_val_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ (*ifOutErrors_val_ptr) = rowreq_ctx->data.ifOutErrors; return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifOutQLen * ifOutQLen is subid 21 of ifEntry. * It's status is Deprecated, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.21 * Description: The length of the output packet queue (in packets). * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * It's syntax is GAUGE (based on perltype GAUGE) * The net-snmp type is ASN_GAUGE. The C type decl is u_long (u_long) */ /** * Extract the current value of the ifOutQLen data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifOutQLen_val_ptr * Pointer to storage for a u_long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */ int ifOutQLen_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifOutQLen_val_ptr) { /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ifOutQLen_val_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifOutQLen_val_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ (*ifOutQLen_val_ptr) = rowreq_ctx->data.ifOutQLen; return MFD_SUCCESS; } /*--------------------------------------------------------------------- * IF-MIB::ifEntry.ifSpecific * ifSpecific is subid 22 of ifEntry. * It's status is Deprecated, and it's access level is ReadOnly. * OID: .1.3.6.1.2.1.2.2.1.22 * Description: A reference to MIB definitions specific to the particular media being used to realize the interface. It is recommended that this value point to an instance of a MIB object in the media-specific MIB, i.e., that this object have the semantics associated with the InstancePointer textual convention defined in RFC 2579. In fact, it is recommended that the media-specific MIB specify what value ifSpecific should/can take for values of ifType. If no MIB definitions specific to the particular media are available, the value should be set to the OBJECT IDENTIFIER { 0 0 }. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * It's syntax is OBJECTID (based on perltype OBJECTID) * The net-snmp type is ASN_OBJECT_ID. The C type decl is oid (oid) * This data type requires a length. (Max 255) */ /** * Extract the current value of the ifSpecific data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ifSpecific_val_ptr_ptr * Pointer to storage for a oid variable * @param ifSpecific_val_ptr_len_ptr * Pointer to a size_t. On entry, it will contain the size (in bytes) * pointed to by ifSpecific. * On exit, this value should contain the data size (in bytes). * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error * * @note If you need more than (*ifSpecific_val_ptr_len_ptr) bytes of memory, * allocate it using malloc() and update ifSpecific_val_ptr_ptr. * DO NOT free the previous pointer. * The MFD helper will release the memory you allocate. * * @remark If you call this function yourself, you are responsible * for checking if the pointer changed, and freeing any * previously allocated memory. (Not necessary if you pass * in a pointer to static memory, obviously.) */ int ifSpecific_get(ifTable_rowreq_ctx * rowreq_ctx, oid ** ifSpecific_val_ptr_ptr, size_t *ifSpecific_val_ptr_len_ptr) { /** we should have a non-NULL pointer and enough storage */ netsnmp_assert((NULL != ifSpecific_val_ptr_ptr) && (NULL != *ifSpecific_val_ptr_ptr)); netsnmp_assert(NULL != ifSpecific_val_ptr_len_ptr); netsnmp_assert(NULL != rowreq_ctx); /* * TODO: * set (* ifSpecific_val_ptr_ptr ) and (* ifSpecific_val_ptr_len_ptr ) from rowreq_ctx->data. */ /* * TODO: * update, replace or delete, if needed. */ /* * make sure there is enough space for data */ if ((NULL == (*ifSpecific_val_ptr_ptr)) || ((*ifSpecific_val_ptr_len_ptr) < rowreq_ctx->data.ifSpecific_len)) { /* * allocate space for data */ (*ifSpecific_val_ptr_ptr) = malloc(rowreq_ctx->data.ifSpecific_len * sizeof((*ifSpecific_val_ptr_ptr)[0])); if (NULL == (*ifSpecific_val_ptr_ptr)) { snmp_log(LOG_ERR, "could not allocate memory\n"); return MFD_ERROR; } } (*ifSpecific_val_ptr_len_ptr) = rowreq_ctx->data.ifSpecific_len; memcpy((*ifSpecific_val_ptr_ptr), rowreq_ctx->data.ifSpecific, (*ifSpecific_val_ptr_len_ptr) * sizeof((*ifSpecific_val_ptr_ptr)[0])); return MFD_SUCCESS; } /** @} */