| 1 |
/* |
| 2 |
* Note: this file originally auto-generated by mib2c using |
| 3 |
* version : 1.48 $ of : mfd-top.m2c,v $ |
| 4 |
* |
| 5 |
* $Id$ |
| 6 |
*/ |
| 7 |
/** \page MFD helper for ifTable |
| 8 |
* |
| 9 |
* \section intro Introduction |
| 10 |
* Introductory text. |
| 11 |
* |
| 12 |
*/ |
| 13 |
/* |
| 14 |
* standard Net-SNMP includes |
| 15 |
*/ |
| 16 |
#include <net-snmp/net-snmp-config.h> |
| 17 |
#include <net-snmp/net-snmp-features.h> |
| 18 |
#include <net-snmp/net-snmp-includes.h> |
| 19 |
#include <net-snmp/agent/net-snmp-agent-includes.h> |
| 20 |
|
| 21 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 22 |
netsnmp_feature_require(interface_access_entry_set_admin_status); |
| 23 |
#endif /* NETSNMP_NO_WRITE_SUPPORT */ |
| 24 |
|
| 25 |
/* |
| 26 |
* include our parent header |
| 27 |
*/ |
| 28 |
#include "ifTable.h" |
| 29 |
#include "ifTable_defs.h" |
| 30 |
|
| 31 |
#include <net-snmp/agent/mib_modules.h> |
| 32 |
|
| 33 |
#include "ifTable_interface.h" |
| 34 |
|
| 35 |
#ifdef USING_IP_MIB_IPV4INTERFACETABLE_IPV4INTERFACETABLE_MODULE |
| 36 |
# include "ip-mib/ipv4InterfaceTable/ipv4InterfaceTable.h" |
| 37 |
#endif |
| 38 |
#ifdef USING_IP_MIB_IPV6INTERFACETABLE_IPV6INTERFACETABLE_MODULE |
| 39 |
# include "ip-mib/ipv6InterfaceTable/ipv6InterfaceTable.h" |
| 40 |
#endif |
| 41 |
#ifdef USING_IF_MIB_IFXTABLE_IFXTABLE_MODULE |
| 42 |
# include "if-mib/ifXTable/ifXTable.h" |
| 43 |
#endif |
| 44 |
|
| 45 |
const oid ifTable_oid[] = { IFTABLE_OID }; |
| 46 |
const int ifTable_oid_size = OID_LENGTH(ifTable_oid); |
| 47 |
|
| 48 |
ifTable_registration ifTable_user_context; |
| 49 |
static ifTable_registration *ifTable_user_context_p; |
| 50 |
|
| 51 |
void initialize_table_ifTable(void); |
| 52 |
void shutdown_table_ifTable(void); |
| 53 |
|
| 54 |
static int |
| 55 |
_if_number_handler(netsnmp_mib_handler *handler, |
| 56 |
netsnmp_handler_registration *reginfo, |
| 57 |
netsnmp_agent_request_info *reqinfo, |
| 58 |
netsnmp_request_info *requests); |
| 59 |
|
| 60 |
|
| 61 |
/** |
| 62 |
* Initializes the ifTable module. Called before the snmpd configuration has |
| 63 |
* been read. |
| 64 |
*/ |
| 65 |
static int |
| 66 |
_init_ifTable(int majorID, int minorID, void *serverargs, void *clientarg) |
| 67 |
{ |
| 68 |
static int ifTable_did_init = 0; |
| 69 |
|
| 70 |
DEBUGMSGTL(("verbose:ifTable:init_ifTable", "called\n")); |
| 71 |
|
| 72 |
netsnmp_access_interface_init(); |
| 73 |
|
| 74 |
/* |
| 75 |
* TODO:300:o: Perform ifTable one-time module initialization. |
| 76 |
*/ |
| 77 |
if (++ifTable_did_init != 1) { |
| 78 |
DEBUGMSGTL(("ifTable:init_ifTable", "ignoring duplicate call\n")); |
| 79 |
return 0; |
| 80 |
} |
| 81 |
|
| 82 |
/* |
| 83 |
* here we initialize all the tables we're planning on supporting |
| 84 |
*/ |
| 85 |
if (should_init("ifTable")) { |
| 86 |
|
| 87 |
#ifdef USING_IP_MIB_IPV4INTERFACETABLE_IPV4INTERFACETABLE_MODULE |
| 88 |
if (should_init("ipv4InterfaceTable")) |
| 89 |
initialize_table_ipv4InterfaceTable(); |
| 90 |
#endif |
| 91 |
|
| 92 |
#ifdef USING_IP_MIB_IPV6INTERFACETABLE_IPV6INTERFACETABLE_MODULE |
| 93 |
if (should_init("ipv6InterfaceTable")) |
| 94 |
initialize_table_ipv6InterfaceTable(); |
| 95 |
#endif |
| 96 |
|
| 97 |
initialize_table_ifTable(); |
| 98 |
|
| 99 |
#ifdef USING_IF_MIB_IFXTABLE_IFXTABLE_MODULE |
| 100 |
if (should_init("ifXTable")) |
| 101 |
initialize_table_ifXTable(); |
| 102 |
#endif |
| 103 |
} |
| 104 |
|
| 105 |
return 0; |
| 106 |
} /* init_ifTable */ |
| 107 |
|
| 108 |
void |
| 109 |
init_ifTable(void) |
| 110 |
{ |
| 111 |
snmp_register_callback(SNMP_CALLBACK_LIBRARY, |
| 112 |
SNMP_CALLBACK_PRE_READ_CONFIG, |
| 113 |
_init_ifTable, NULL); |
| 114 |
} |
| 115 |
|
| 116 |
/** |
| 117 |
* Shut-down the ifTable module (agent is exiting) |
| 118 |
*/ |
| 119 |
void |
| 120 |
shutdown_ifTable(void) |
| 121 |
{ |
| 122 |
if (should_init("ifTable")) |
| 123 |
shutdown_table_ifTable(); |
| 124 |
|
| 125 |
} |
| 126 |
|
| 127 |
/** |
| 128 |
* Initialize the table ifTable |
| 129 |
* (Define its contents and how it's structured) |
| 130 |
*/ |
| 131 |
void |
| 132 |
initialize_table_ifTable(void) |
| 133 |
{ |
| 134 |
u_long flags; |
| 135 |
|
| 136 |
DEBUGMSGTL(("verbose:ifTable:initialize_table_ifTable", "called\n")); |
| 137 |
|
| 138 |
/* |
| 139 |
* TODO:301:o: Perform ifTable one-time table initialization. |
| 140 |
*/ |
| 141 |
|
| 142 |
/* |
| 143 |
* TODO:302:o: |->Initialize ifTable user context |
| 144 |
* if you'd like to pass in a pointer to some data for this |
| 145 |
* table, allocate or set it up here. |
| 146 |
*/ |
| 147 |
/* |
| 148 |
* a netsnmp_data_list is a simple way to store void pointers. A simple |
| 149 |
* string token is used to add, find or remove pointers. |
| 150 |
*/ |
| 151 |
ifTable_user_context_p = netsnmp_create_data_list("ifTable", NULL, NULL); |
| 152 |
|
| 153 |
/* |
| 154 |
* No support for any flags yet, but in the future you would |
| 155 |
* set any flags here. |
| 156 |
*/ |
| 157 |
flags = 0; |
| 158 |
|
| 159 |
/* |
| 160 |
* call interface initialization code |
| 161 |
*/ |
| 162 |
_ifTable_initialize_interface(ifTable_user_context_p, flags); |
| 163 |
|
| 164 |
/* |
| 165 |
* register scalar for ifNumber |
| 166 |
*/ |
| 167 |
{ |
| 168 |
const oid reg_oid[] = { IFTABLE_NUMBER }; |
| 169 |
netsnmp_handler_registration *myreg; |
| 170 |
|
| 171 |
myreg = |
| 172 |
netsnmp_create_handler_registration("if number", |
| 173 |
_if_number_handler, |
| 174 |
reg_oid, |
| 175 |
OID_LENGTH(reg_oid), |
| 176 |
HANDLER_CAN_RONLY); |
| 177 |
netsnmp_register_scalar(myreg); |
| 178 |
} |
| 179 |
|
| 180 |
} /* initialize_table_ifTable */ |
| 181 |
|
| 182 |
/** |
| 183 |
* Shutdown the table ifTable |
| 184 |
*/ |
| 185 |
void |
| 186 |
shutdown_table_ifTable(void) |
| 187 |
{ |
| 188 |
/* |
| 189 |
* call interface shutdown code |
| 190 |
*/ |
| 191 |
_ifTable_shutdown_interface(ifTable_user_context_p); |
| 192 |
netsnmp_free_all_list_data(ifTable_user_context_p); |
| 193 |
ifTable_user_context_p = NULL; |
| 194 |
} |
| 195 |
|
| 196 |
/** |
| 197 |
* pre-request callback |
| 198 |
* @param user_context |
| 199 |
* |
| 200 |
* |
| 201 |
* @retval MFD_SUCCESS : success. |
| 202 |
* @retval MFD_ERROR : other error |
| 203 |
*/ |
| 204 |
int |
| 205 |
ifTable_pre_request(ifTable_registration * user_context) |
| 206 |
{ |
| 207 |
DEBUGMSGTL(("verbose:ifTable:ifTable_pre_request", "called\n")); |
| 208 |
|
| 209 |
/* |
| 210 |
* TODO:510:o: Perform ifTable pre-request actions. |
| 211 |
*/ |
| 212 |
|
| 213 |
return MFD_SUCCESS; |
| 214 |
} /* ifTable_pre_request */ |
| 215 |
|
| 216 |
/** |
| 217 |
* post-request callback |
| 218 |
* |
| 219 |
* Note: |
| 220 |
* New rows have been inserted into the container, and |
| 221 |
* deleted rows have been removed from the container and |
| 222 |
* released. |
| 223 |
* |
| 224 |
* @param user_context |
| 225 |
* @param rc : MFD_SUCCESS if all requests succeeded |
| 226 |
* |
| 227 |
* @retval MFD_SUCCESS : success. |
| 228 |
* @retval MFD_ERROR : other error (ignored) |
| 229 |
*/ |
| 230 |
int |
| 231 |
ifTable_post_request(ifTable_registration * user_context, int rc) |
| 232 |
{ |
| 233 |
DEBUGMSGTL(("verbose:ifTable:ifTable_post_request", "called\n")); |
| 234 |
|
| 235 |
/* |
| 236 |
* TODO:511:o: Perform ifTable post-request actions. |
| 237 |
*/ |
| 238 |
|
| 239 |
/* |
| 240 |
* check to set if any rows were changed. |
| 241 |
*/ |
| 242 |
if (ifTable_dirty_get()) { |
| 243 |
/* |
| 244 |
* check if request was successful. If so, this would be |
| 245 |
* a good place to save data to its persistent store. |
| 246 |
*/ |
| 247 |
if (MFD_SUCCESS == rc) { |
| 248 |
/* |
| 249 |
* notify library to save changed rows |
| 250 |
*/ |
| 251 |
snmp_store_needed(netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, |
| 252 |
NETSNMP_DS_LIB_APPTYPE)); |
| 253 |
} |
| 254 |
|
| 255 |
ifTable_dirty_set(0); /* clear table dirty flag */ |
| 256 |
} |
| 257 |
|
| 258 |
return MFD_SUCCESS; |
| 259 |
} /* ifTable_post_request */ |
| 260 |
|
| 261 |
|
| 262 |
/********************************************************************** |
| 263 |
********************************************************************** |
| 264 |
*** |
| 265 |
*** Table ifTable |
| 266 |
*** |
| 267 |
********************************************************************** |
| 268 |
**********************************************************************/ |
| 269 |
/* |
| 270 |
* IF-MIB::ifTable is subid 2 of interfaces. |
| 271 |
* Its status is Current. |
| 272 |
* OID: .1.3.6.1.2.1.2.2, length: 8 |
| 273 |
*/ |
| 274 |
|
| 275 |
/* |
| 276 |
* --------------------------------------------------------------------- |
| 277 |
* * TODO:200:r: Implement ifTable data context functions. |
| 278 |
*/ |
| 279 |
|
| 280 |
/** |
| 281 |
* @internal |
| 282 |
* set row context indexes |
| 283 |
* |
| 284 |
* @param reqreq_ctx the row context that needs updated indexes |
| 285 |
* @param ifIndex_val |
| 286 |
* |
| 287 |
* @retval MFD_SUCCESS : success. |
| 288 |
* @retval MFD_ERROR : other error. |
| 289 |
* |
| 290 |
* @remark |
| 291 |
* This function sets the mib indexs, then updates the oid indexs |
| 292 |
* from the mib index. |
| 293 |
*/ |
| 294 |
int |
| 295 |
ifTable_indexes_set(ifTable_rowreq_ctx * rowreq_ctx, long ifIndex_val) |
| 296 |
{ |
| 297 |
DEBUGMSGTL(("verbose:ifTable:ifTable_indexes_set", "called\n")); |
| 298 |
|
| 299 |
rowreq_ctx->tbl_idx.ifIndex = ifIndex_val; |
| 300 |
|
| 301 |
/* |
| 302 |
* convert mib index to oid index |
| 303 |
*/ |
| 304 |
rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid); |
| 305 |
if (0 != ifTable_index_to_oid(&rowreq_ctx->oid_idx, |
| 306 |
&rowreq_ctx->tbl_idx)) { |
| 307 |
return MFD_ERROR; |
| 308 |
} |
| 309 |
|
| 310 |
return MFD_SUCCESS; |
| 311 |
} /* ifTable_indexes_set */ |
| 312 |
|
| 313 |
|
| 314 |
/*--------------------------------------------------------------------- |
| 315 |
* IF-MIB::ifEntry.ifDescr |
| 316 |
* ifDescr is subid 2 of ifEntry. |
| 317 |
* Its status is Current, and its access level is ReadOnly. |
| 318 |
* OID: .1.3.6.1.2.1.2.2.1.2 |
| 319 |
* Description: |
| 320 |
A textual string containing information about the |
| 321 |
interface. This string should include the name of the |
| 322 |
manufacturer, the product name and the version of the |
| 323 |
interface hardware/software. |
| 324 |
* |
| 325 |
* Attributes: |
| 326 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 327 |
* readable 1 iscolumn 1 ranges 1 hashint 1 |
| 328 |
* settable 0 |
| 329 |
* hint: 255a |
| 330 |
* |
| 331 |
* Ranges: 0 - 255; |
| 332 |
* |
| 333 |
* Its syntax is DisplayString (based on perltype OCTETSTR) |
| 334 |
* The net-snmp type is ASN_OCTET_STR. The C type decl is char (char) |
| 335 |
* This data type requires a length. (Max 255) |
| 336 |
*/ |
| 337 |
/** |
| 338 |
* Extract the current value of the ifDescr data. |
| 339 |
* |
| 340 |
* Set a value using the data context for the row. |
| 341 |
* |
| 342 |
* @param rowreq_ctx |
| 343 |
* Pointer to the row request context. |
| 344 |
* @param ifDescr_val_ptr_ptr |
| 345 |
* Pointer to storage for a char variable |
| 346 |
* @param ifDescr_val_ptr_len_ptr |
| 347 |
* Pointer to a size_t. On entry, it will contain the size (in bytes) |
| 348 |
* pointed to by ifDescr. |
| 349 |
* On exit, this value should contain the data size (in bytes). |
| 350 |
* |
| 351 |
* @retval MFD_SUCCESS : success |
| 352 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 353 |
* @retval MFD_ERROR : Any other error |
| 354 |
* |
| 355 |
* @note If you need more than (*ifDescr_val_ptr_len_ptr) bytes of memory, |
| 356 |
* allocate it using malloc() and update ifDescr_val_ptr_ptr. |
| 357 |
* <b>DO NOT</b> free the previous pointer. |
| 358 |
* The MFD helper will release the memory you allocate. |
| 359 |
* |
| 360 |
* @remark If you call this function yourself, you are responsible |
| 361 |
* for checking if the pointer changed, and freeing any |
| 362 |
* previously allocated memory. (Not necessary if you pass |
| 363 |
* in a pointer to static memory, obviously.) |
| 364 |
*/ |
| 365 |
int |
| 366 |
ifDescr_get(ifTable_rowreq_ctx * rowreq_ctx, char **ifDescr_val_ptr_ptr, |
| 367 |
size_t * ifDescr_val_ptr_len_ptr) |
| 368 |
{ |
| 369 |
char *tmp_descr = NULL; |
| 370 |
u_char tmp_len = 0; |
| 371 |
|
| 372 |
/** we should have a non-NULL pointer and enough storage */ |
| 373 |
netsnmp_assert((NULL != ifDescr_val_ptr_ptr) |
| 374 |
&& (NULL != *ifDescr_val_ptr_ptr)); |
| 375 |
netsnmp_assert(NULL != ifDescr_val_ptr_len_ptr); |
| 376 |
|
| 377 |
|
| 378 |
DEBUGMSGTL(("verbose:ifTable:ifDescr_get", "called\n")); |
| 379 |
|
| 380 |
netsnmp_assert(NULL != rowreq_ctx); |
| 381 |
|
| 382 |
/* |
| 383 |
* if ifDescr is NULL, use the ifName |
| 384 |
*/ |
| 385 |
if (NULL == rowreq_ctx->data.ifDescr) { |
| 386 |
#ifdef USING_IF_MIB_IFXTABLE_IFXTABLE_MODULE |
| 387 |
tmp_descr = rowreq_ctx->data.ifName; |
| 388 |
#else |
| 389 |
tmp_descr = NULL; |
| 390 |
#endif |
| 391 |
} else |
| 392 |
tmp_descr = rowreq_ctx->data.ifDescr; |
| 393 |
|
| 394 |
if (NULL != tmp_descr) |
| 395 |
tmp_len = strlen(tmp_descr); |
| 396 |
else |
| 397 |
tmp_len = 0; |
| 398 |
|
| 399 |
/* |
| 400 |
* TODO:231:o: |-> Extract the current value of the ifDescr data. |
| 401 |
* copy (* ifDescr_val_ptr_ptr ) data and (* ifDescr_val_ptr_len_ptr ) from rowreq_ctx->data |
| 402 |
*/ |
| 403 |
/* |
| 404 |
* make sure there is enough space for ifDescr data |
| 405 |
*/ |
| 406 |
if ((NULL == (*ifDescr_val_ptr_ptr)) || |
| 407 |
((*ifDescr_val_ptr_len_ptr) < tmp_len)) { |
| 408 |
/* |
| 409 |
* allocate space for ifDescr data |
| 410 |
*/ |
| 411 |
(*ifDescr_val_ptr_ptr) = |
| 412 |
(char*)malloc(tmp_len * sizeof(rowreq_ctx->data.ifDescr[0])); |
| 413 |
if (NULL == (*ifDescr_val_ptr_ptr)) { |
| 414 |
snmp_log(LOG_ERR, "could not allocate memory\n"); |
| 415 |
return MFD_ERROR; |
| 416 |
} |
| 417 |
} |
| 418 |
(*ifDescr_val_ptr_len_ptr) = |
| 419 |
tmp_len * sizeof(rowreq_ctx->data.ifDescr[0]); |
| 420 |
memcpy((*ifDescr_val_ptr_ptr), tmp_descr, (*ifDescr_val_ptr_len_ptr)); |
| 421 |
|
| 422 |
return MFD_SUCCESS; |
| 423 |
} /* ifDescr_get */ |
| 424 |
|
| 425 |
/*--------------------------------------------------------------------- |
| 426 |
* IF-MIB::ifEntry.ifType |
| 427 |
* ifType is subid 3 of ifEntry. |
| 428 |
* Its status is Current, and its access level is ReadOnly. |
| 429 |
* OID: .1.3.6.1.2.1.2.2.1.3 |
| 430 |
* Description: |
| 431 |
The type of interface. Additional values for ifType are |
| 432 |
assigned by the Internet Assigned Numbers Authority (IANA), |
| 433 |
through updating the syntax of the IANAifType textual |
| 434 |
convention. |
| 435 |
* |
| 436 |
* Attributes: |
| 437 |
* accessible 1 isscalar 0 enums 1 hasdefval 0 |
| 438 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 439 |
* settable 0 |
| 440 |
* |
| 441 |
* Enum range: 149/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), ciscoISLvlan(222), actelisMetaLOOP(223), fcipLink(224) |
| 442 |
* |
| 443 |
* Its syntax is IANAifType (based on perltype INTEGER) |
| 444 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 445 |
*/ |
| 446 |
/** |
| 447 |
* Extract the current value of the ifType data. |
| 448 |
* |
| 449 |
* Set a value using the data context for the row. |
| 450 |
* |
| 451 |
* @param rowreq_ctx |
| 452 |
* Pointer to the row request context. |
| 453 |
* @param ifType_val_ptr |
| 454 |
* Pointer to storage for a long variable |
| 455 |
* |
| 456 |
* @retval MFD_SUCCESS : success |
| 457 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 458 |
* @retval MFD_ERROR : Any other error |
| 459 |
*/ |
| 460 |
int |
| 461 |
ifType_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifType_val_ptr) |
| 462 |
{ |
| 463 |
/** we should have a non-NULL pointer */ |
| 464 |
netsnmp_assert(NULL != ifType_val_ptr); |
| 465 |
|
| 466 |
|
| 467 |
DEBUGMSGTL(("verbose:ifTable:ifType_get", "called\n")); |
| 468 |
|
| 469 |
netsnmp_assert(NULL != rowreq_ctx); |
| 470 |
|
| 471 |
/* |
| 472 |
* TODO:231:o: |-> Extract the current value of the ifType data. |
| 473 |
* copy (* ifType_val_ptr ) from rowreq_ctx->data |
| 474 |
*/ |
| 475 |
(*ifType_val_ptr) = rowreq_ctx->data.ifType; |
| 476 |
|
| 477 |
return MFD_SUCCESS; |
| 478 |
} /* ifType_get */ |
| 479 |
|
| 480 |
/*--------------------------------------------------------------------- |
| 481 |
* IF-MIB::ifEntry.ifMtu |
| 482 |
* ifMtu is subid 4 of ifEntry. |
| 483 |
* Its status is Current, and its access level is ReadOnly. |
| 484 |
* OID: .1.3.6.1.2.1.2.2.1.4 |
| 485 |
* Description: |
| 486 |
The size of the largest packet which can be sent/received |
| 487 |
on the interface, specified in octets. For interfaces that |
| 488 |
are used for transmitting network datagrams, this is the |
| 489 |
size of the largest network datagram that can be sent on the |
| 490 |
interface. |
| 491 |
* |
| 492 |
* Attributes: |
| 493 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 494 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 495 |
* settable 0 |
| 496 |
* |
| 497 |
* |
| 498 |
* Its syntax is INTEGER32 (based on perltype INTEGER32) |
| 499 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (long) |
| 500 |
*/ |
| 501 |
/** |
| 502 |
* Extract the current value of the ifMtu data. |
| 503 |
* |
| 504 |
* Set a value using the data context for the row. |
| 505 |
* |
| 506 |
* @param rowreq_ctx |
| 507 |
* Pointer to the row request context. |
| 508 |
* @param ifMtu_val_ptr |
| 509 |
* Pointer to storage for a long variable |
| 510 |
* |
| 511 |
* @retval MFD_SUCCESS : success |
| 512 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 513 |
* @retval MFD_ERROR : Any other error |
| 514 |
*/ |
| 515 |
int |
| 516 |
ifMtu_get(ifTable_rowreq_ctx * rowreq_ctx, long *ifMtu_val_ptr) |
| 517 |
{ |
| 518 |
/** we should have a non-NULL pointer */ |
| 519 |
netsnmp_assert(NULL != ifMtu_val_ptr); |
| 520 |
|
| 521 |
|
| 522 |
DEBUGMSGTL(("verbose:ifTable:ifMtu_get", "called\n")); |
| 523 |
|
| 524 |
netsnmp_assert(NULL != rowreq_ctx); |
| 525 |
|
| 526 |
/* |
| 527 |
* TODO:231:o: |-> Extract the current value of the ifMtu data. |
| 528 |
* copy (* ifMtu_val_ptr ) from rowreq_ctx->data |
| 529 |
*/ |
| 530 |
(*ifMtu_val_ptr) = rowreq_ctx->data.ifMtu; |
| 531 |
|
| 532 |
return MFD_SUCCESS; |
| 533 |
} /* ifMtu_get */ |
| 534 |
|
| 535 |
/*--------------------------------------------------------------------- |
| 536 |
* IF-MIB::ifEntry.ifSpeed |
| 537 |
* ifSpeed is subid 5 of ifEntry. |
| 538 |
* Its status is Current, and its access level is ReadOnly. |
| 539 |
* OID: .1.3.6.1.2.1.2.2.1.5 |
| 540 |
* Description: |
| 541 |
An estimate of the interface's current bandwidth in bits |
| 542 |
per second. For interfaces which do not vary in bandwidth |
| 543 |
or for those where no accurate estimation can be made, this |
| 544 |
object should contain the nominal bandwidth. If the |
| 545 |
bandwidth of the interface is greater than the maximum value |
| 546 |
reportable by this object then this object should report its |
| 547 |
maximum value (4,294,967,295) and ifHighSpeed must be used |
| 548 |
to report the interace's speed. For a sub-layer which has |
| 549 |
no concept of bandwidth, this object should be zero. |
| 550 |
* |
| 551 |
* Attributes: |
| 552 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 553 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 554 |
* settable 0 |
| 555 |
* |
| 556 |
* |
| 557 |
* Its syntax is GAUGE (based on perltype GAUGE) |
| 558 |
* The net-snmp type is ASN_GAUGE. The C type decl is u_long (u_long) |
| 559 |
*/ |
| 560 |
/** |
| 561 |
* Extract the current value of the ifSpeed data. |
| 562 |
* |
| 563 |
* Set a value using the data context for the row. |
| 564 |
* |
| 565 |
* @param rowreq_ctx |
| 566 |
* Pointer to the row request context. |
| 567 |
* @param ifSpeed_val_ptr |
| 568 |
* Pointer to storage for a u_long variable |
| 569 |
* |
| 570 |
* @retval MFD_SUCCESS : success |
| 571 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 572 |
* @retval MFD_ERROR : Any other error |
| 573 |
*/ |
| 574 |
int |
| 575 |
ifSpeed_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifSpeed_val_ptr) |
| 576 |
{ |
| 577 |
/** we should have a non-NULL pointer */ |
| 578 |
netsnmp_assert(NULL != ifSpeed_val_ptr); |
| 579 |
|
| 580 |
|
| 581 |
DEBUGMSGTL(("verbose:ifTable:ifSpeed_get", "called\n")); |
| 582 |
|
| 583 |
netsnmp_assert(NULL != rowreq_ctx); |
| 584 |
|
| 585 |
/* |
| 586 |
* TODO:231:o: |-> Extract the current value of the ifSpeed data. |
| 587 |
* copy (* ifSpeed_val_ptr ) from rowreq_ctx->data |
| 588 |
*/ |
| 589 |
(*ifSpeed_val_ptr) = rowreq_ctx->data.ifSpeed; |
| 590 |
|
| 591 |
return MFD_SUCCESS; |
| 592 |
} /* ifSpeed_get */ |
| 593 |
|
| 594 |
/*--------------------------------------------------------------------- |
| 595 |
* IF-MIB::ifEntry.ifPhysAddress |
| 596 |
* ifPhysAddress is subid 6 of ifEntry. |
| 597 |
* Its status is Current, and its access level is ReadOnly. |
| 598 |
* OID: .1.3.6.1.2.1.2.2.1.6 |
| 599 |
* Description: |
| 600 |
The interface's address at its protocol sub-layer. For |
| 601 |
example, for an 802.x interface, this object normally |
| 602 |
contains a MAC address. The interface's media-specific MIB |
| 603 |
must define the bit and byte ordering and the format of the |
| 604 |
value of this object. For interfaces which do not have such |
| 605 |
an address (e.g., a serial line), this object should contain |
| 606 |
an octet string of zero length. |
| 607 |
* |
| 608 |
* Attributes: |
| 609 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 610 |
* readable 1 iscolumn 1 ranges 0 hashint 1 |
| 611 |
* settable 0 |
| 612 |
* hint: 1x: |
| 613 |
* |
| 614 |
* |
| 615 |
* Its syntax is PhysAddress (based on perltype OCTETSTR) |
| 616 |
* The net-snmp type is ASN_OCTET_STR. The C type decl is char (char) |
| 617 |
* This data type requires a length. (Max 255) |
| 618 |
*/ |
| 619 |
/** |
| 620 |
* Extract the current value of the ifPhysAddress data. |
| 621 |
* |
| 622 |
* Set a value using the data context for the row. |
| 623 |
* |
| 624 |
* @param rowreq_ctx |
| 625 |
* Pointer to the row request context. |
| 626 |
* @param ifPhysAddress_val_ptr_ptr |
| 627 |
* Pointer to storage for a char variable |
| 628 |
* @param ifPhysAddress_val_ptr_len_ptr |
| 629 |
* Pointer to a size_t. On entry, it will contain the size (in bytes) |
| 630 |
* pointed to by ifPhysAddress. |
| 631 |
* On exit, this value should contain the data size (in bytes). |
| 632 |
* |
| 633 |
* @retval MFD_SUCCESS : success |
| 634 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 635 |
* @retval MFD_ERROR : Any other error |
| 636 |
* |
| 637 |
* @note If you need more than (*ifPhysAddress_val_ptr_len_ptr) bytes of memory, |
| 638 |
* allocate it using malloc() and update ifPhysAddress_val_ptr_ptr. |
| 639 |
* <b>DO NOT</b> free the previous pointer. |
| 640 |
* The MFD helper will release the memory you allocate. |
| 641 |
* |
| 642 |
* @remark If you call this function yourself, you are responsible |
| 643 |
* for checking if the pointer changed, and freeing any |
| 644 |
* previously allocated memory. (Not necessary if you pass |
| 645 |
* in a pointer to static memory, obviously.) |
| 646 |
*/ |
| 647 |
int |
| 648 |
ifPhysAddress_get(ifTable_rowreq_ctx * rowreq_ctx, |
| 649 |
char **ifPhysAddress_val_ptr_ptr, |
| 650 |
size_t * ifPhysAddress_val_ptr_len_ptr) |
| 651 |
{ |
| 652 |
/** we should have a non-NULL pointer and enough storage */ |
| 653 |
netsnmp_assert((NULL != ifPhysAddress_val_ptr_ptr) |
| 654 |
&& (NULL != *ifPhysAddress_val_ptr_ptr)); |
| 655 |
netsnmp_assert(NULL != ifPhysAddress_val_ptr_len_ptr); |
| 656 |
|
| 657 |
|
| 658 |
DEBUGMSGTL(("verbose:ifTable:ifPhysAddress_get", "called\n")); |
| 659 |
|
| 660 |
netsnmp_assert(NULL != rowreq_ctx); |
| 661 |
|
| 662 |
if ((rowreq_ctx->data.ifPhysAddress[0] == 0) && |
| 663 |
(rowreq_ctx->data.ifPhysAddress[1] == 0) && |
| 664 |
(rowreq_ctx->data.ifPhysAddress[2] == 0) && |
| 665 |
(rowreq_ctx->data.ifPhysAddress[3] == 0) && |
| 666 |
(rowreq_ctx->data.ifPhysAddress[4] == 0) && |
| 667 |
(rowreq_ctx->data.ifPhysAddress[5] == 0)) { |
| 668 |
/* |
| 669 |
* all 0s = empty string |
| 670 |
*/ |
| 671 |
(*ifPhysAddress_val_ptr_len_ptr) = 0; |
| 672 |
return MFD_SUCCESS; |
| 673 |
} |
| 674 |
|
| 675 |
/* |
| 676 |
* TODO:231:o: |-> Extract the current value of the ifPhysAddress data. |
| 677 |
* copy (* ifPhysAddress_val_ptr_ptr ) data and (* ifPhysAddress_val_ptr_len_ptr ) from rowreq_ctx->data |
| 678 |
*/ |
| 679 |
/* |
| 680 |
* make sure there is enough space for ifPhysAddress data |
| 681 |
*/ |
| 682 |
if ((NULL == (*ifPhysAddress_val_ptr_ptr)) || |
| 683 |
((*ifPhysAddress_val_ptr_len_ptr) < |
| 684 |
(rowreq_ctx->data.ifPhysAddress_len * |
| 685 |
sizeof(rowreq_ctx->data.ifPhysAddress[0])))) { |
| 686 |
/* |
| 687 |
* allocate space for ifPhysAddress data |
| 688 |
*/ |
| 689 |
(*ifPhysAddress_val_ptr_ptr) = |
| 690 |
(char*)malloc(rowreq_ctx->data.ifPhysAddress_len * |
| 691 |
sizeof(rowreq_ctx->data.ifPhysAddress[0])); |
| 692 |
if (NULL == (*ifPhysAddress_val_ptr_ptr)) { |
| 693 |
snmp_log(LOG_ERR, "could not allocate memory\n"); |
| 694 |
return MFD_ERROR; |
| 695 |
} |
| 696 |
} |
| 697 |
(*ifPhysAddress_val_ptr_len_ptr) = |
| 698 |
rowreq_ctx->data.ifPhysAddress_len * |
| 699 |
sizeof(rowreq_ctx->data.ifPhysAddress[0]); |
| 700 |
memcpy((*ifPhysAddress_val_ptr_ptr), rowreq_ctx->data.ifPhysAddress, |
| 701 |
(*ifPhysAddress_val_ptr_len_ptr)); |
| 702 |
|
| 703 |
return MFD_SUCCESS; |
| 704 |
} /* ifPhysAddress_get */ |
| 705 |
|
| 706 |
/*--------------------------------------------------------------------- |
| 707 |
* IF-MIB::ifEntry.ifAdminStatus |
| 708 |
* ifAdminStatus is subid 7 of ifEntry. |
| 709 |
* Its status is Current, and its access level is ReadWrite. |
| 710 |
* OID: .1.3.6.1.2.1.2.2.1.7 |
| 711 |
* Description: |
| 712 |
The desired state of the interface. The testing(3) state |
| 713 |
indicates that no operational packets can be passed. When a |
| 714 |
managed system initializes, all interfaces start with |
| 715 |
ifAdminStatus in the down(2) state. As a result of either |
| 716 |
explicit management action or per configuration information |
| 717 |
retained by the managed system, ifAdminStatus is then |
| 718 |
changed to either the up(1) or testing(3) states (or remains |
| 719 |
in the down(2) state). |
| 720 |
* |
| 721 |
* Attributes: |
| 722 |
* accessible 1 isscalar 0 enums 1 hasdefval 0 |
| 723 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 724 |
* settable 1 |
| 725 |
* |
| 726 |
* Enum range: 2/8. Values: up(1), down(2), testing(3) |
| 727 |
* |
| 728 |
* Its syntax is INTEGER (based on perltype INTEGER) |
| 729 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 730 |
*/ |
| 731 |
/** |
| 732 |
* Extract the current value of the ifAdminStatus data. |
| 733 |
* |
| 734 |
* Set a value using the data context for the row. |
| 735 |
* |
| 736 |
* @param rowreq_ctx |
| 737 |
* Pointer to the row request context. |
| 738 |
* @param ifAdminStatus_val_ptr |
| 739 |
* Pointer to storage for a long variable |
| 740 |
* |
| 741 |
* @retval MFD_SUCCESS : success |
| 742 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 743 |
* @retval MFD_ERROR : Any other error |
| 744 |
*/ |
| 745 |
int |
| 746 |
ifAdminStatus_get(ifTable_rowreq_ctx * rowreq_ctx, |
| 747 |
u_long * ifAdminStatus_val_ptr) |
| 748 |
{ |
| 749 |
/** we should have a non-NULL pointer */ |
| 750 |
netsnmp_assert(NULL != ifAdminStatus_val_ptr); |
| 751 |
|
| 752 |
|
| 753 |
DEBUGMSGTL(("verbose:ifTable:ifAdminStatus_get", "called\n")); |
| 754 |
|
| 755 |
netsnmp_assert(NULL != rowreq_ctx); |
| 756 |
|
| 757 |
/* |
| 758 |
* TODO:231:o: |-> Extract the current value of the ifAdminStatus data. |
| 759 |
* copy (* ifAdminStatus_val_ptr ) from rowreq_ctx->data |
| 760 |
*/ |
| 761 |
(*ifAdminStatus_val_ptr) = rowreq_ctx->data.ifAdminStatus; |
| 762 |
|
| 763 |
return MFD_SUCCESS; |
| 764 |
} /* ifAdminStatus_get */ |
| 765 |
|
| 766 |
/*--------------------------------------------------------------------- |
| 767 |
* IF-MIB::ifEntry.ifOperStatus |
| 768 |
* ifOperStatus is subid 8 of ifEntry. |
| 769 |
* Its status is Current, and its access level is ReadOnly. |
| 770 |
* OID: .1.3.6.1.2.1.2.2.1.8 |
| 771 |
* Description: |
| 772 |
The current operational state of the interface. The |
| 773 |
testing(3) state indicates that no operational packets can |
| 774 |
be passed. If ifAdminStatus is down(2) then ifOperStatus |
| 775 |
should be down(2). If ifAdminStatus is changed to up(1) |
| 776 |
then ifOperStatus should change to up(1) if the interface is |
| 777 |
ready to transmit and receive network traffic; it should |
| 778 |
change to dormant(5) if the interface is waiting for |
| 779 |
external actions (such as a serial line waiting for an |
| 780 |
incoming connection); it should remain in the down(2) state |
| 781 |
if and only if there is a fault that prevents it from going |
| 782 |
to the up(1) state; it should remain in the notPresent(6) |
| 783 |
state if the interface has missing (typically, hardware) |
| 784 |
components. |
| 785 |
* |
| 786 |
* Attributes: |
| 787 |
* accessible 1 isscalar 0 enums 1 hasdefval 0 |
| 788 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 789 |
* settable 0 |
| 790 |
* |
| 791 |
* Enum range: 5/8. Values: up(1), down(2), testing(3), unknown(4), dormant(5), notPresent(6), lowerLayerDown(7) |
| 792 |
* |
| 793 |
* Its syntax is INTEGER (based on perltype INTEGER) |
| 794 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 795 |
*/ |
| 796 |
/** |
| 797 |
* Extract the current value of the ifOperStatus data. |
| 798 |
* |
| 799 |
* Set a value using the data context for the row. |
| 800 |
* |
| 801 |
* @param rowreq_ctx |
| 802 |
* Pointer to the row request context. |
| 803 |
* @param ifOperStatus_val_ptr |
| 804 |
* Pointer to storage for a long variable |
| 805 |
* |
| 806 |
* @retval MFD_SUCCESS : success |
| 807 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 808 |
* @retval MFD_ERROR : Any other error |
| 809 |
*/ |
| 810 |
int |
| 811 |
ifOperStatus_get(ifTable_rowreq_ctx * rowreq_ctx, |
| 812 |
u_long * ifOperStatus_val_ptr) |
| 813 |
{ |
| 814 |
/** we should have a non-NULL pointer */ |
| 815 |
netsnmp_assert(NULL != ifOperStatus_val_ptr); |
| 816 |
|
| 817 |
|
| 818 |
DEBUGMSGTL(("verbose:ifTable:ifOperStatus_get", "called\n")); |
| 819 |
|
| 820 |
netsnmp_assert(NULL != rowreq_ctx); |
| 821 |
|
| 822 |
/* |
| 823 |
* TODO:231:o: |-> Extract the current value of the ifOperStatus data. |
| 824 |
* copy (* ifOperStatus_val_ptr ) from rowreq_ctx->data |
| 825 |
*/ |
| 826 |
(*ifOperStatus_val_ptr) = rowreq_ctx->data.ifOperStatus; |
| 827 |
|
| 828 |
return MFD_SUCCESS; |
| 829 |
} /* ifOperStatus_get */ |
| 830 |
|
| 831 |
/*--------------------------------------------------------------------- |
| 832 |
* IF-MIB::ifEntry.ifLastChange |
| 833 |
* ifLastChange is subid 9 of ifEntry. |
| 834 |
* Its status is Current, and its access level is ReadOnly. |
| 835 |
* OID: .1.3.6.1.2.1.2.2.1.9 |
| 836 |
* Description: |
| 837 |
The value of sysUpTime at the time the interface entered |
| 838 |
its current operational state. If the current state was |
| 839 |
entered prior to the last re-initialization of the local |
| 840 |
network management subsystem, then this object contains a |
| 841 |
zero value. |
| 842 |
* |
| 843 |
* Attributes: |
| 844 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 845 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 846 |
* settable 0 |
| 847 |
* |
| 848 |
* |
| 849 |
* Its syntax is TICKS (based on perltype TICKS) |
| 850 |
* The net-snmp type is ASN_TIMETICKS. The C type decl is u_long (u_long) |
| 851 |
*/ |
| 852 |
/** |
| 853 |
* Extract the current value of the ifLastChange data. |
| 854 |
* |
| 855 |
* Set a value using the data context for the row. |
| 856 |
* |
| 857 |
* @param rowreq_ctx |
| 858 |
* Pointer to the row request context. |
| 859 |
* @param ifLastChange_val_ptr |
| 860 |
* Pointer to storage for a u_long variable |
| 861 |
* |
| 862 |
* @retval MFD_SUCCESS : success |
| 863 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 864 |
* @retval MFD_ERROR : Any other error |
| 865 |
*/ |
| 866 |
int |
| 867 |
ifLastChange_get(ifTable_rowreq_ctx * rowreq_ctx, |
| 868 |
u_long * ifLastChange_val_ptr) |
| 869 |
{ |
| 870 |
/** we should have a non-NULL pointer */ |
| 871 |
netsnmp_assert(NULL != ifLastChange_val_ptr); |
| 872 |
|
| 873 |
|
| 874 |
DEBUGMSGTL(("verbose:ifTable:ifLastChange_get", "called\n")); |
| 875 |
|
| 876 |
netsnmp_assert(NULL != rowreq_ctx); |
| 877 |
|
| 878 |
/* |
| 879 |
* TODO:231:o: |-> Extract the current value of the ifLastChange data. |
| 880 |
* copy (* ifLastChange_val_ptr ) from rowreq_ctx->data |
| 881 |
*/ |
| 882 |
(*ifLastChange_val_ptr) = rowreq_ctx->data.ifLastChange; |
| 883 |
|
| 884 |
return MFD_SUCCESS; |
| 885 |
} /* ifLastChange_get */ |
| 886 |
|
| 887 |
/*--------------------------------------------------------------------- |
| 888 |
* IF-MIB::ifEntry.ifInOctets |
| 889 |
* ifInOctets is subid 10 of ifEntry. |
| 890 |
* Its status is Current, and its access level is ReadOnly. |
| 891 |
* OID: .1.3.6.1.2.1.2.2.1.10 |
| 892 |
* Description: |
| 893 |
The total number of octets received on the interface, |
| 894 |
including framing characters. |
| 895 |
|
| 896 |
Discontinuities in the value of this counter can occur at |
| 897 |
re-initialization of the management system, and at other |
| 898 |
times as indicated by the value of |
| 899 |
ifCounterDiscontinuityTime. |
| 900 |
* |
| 901 |
* Attributes: |
| 902 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 903 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 904 |
* settable 0 |
| 905 |
* |
| 906 |
* |
| 907 |
* Its syntax is COUNTER (based on perltype COUNTER) |
| 908 |
* The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) |
| 909 |
*/ |
| 910 |
/** |
| 911 |
* Extract the current value of the ifInOctets data. |
| 912 |
* |
| 913 |
* Set a value using the data context for the row. |
| 914 |
* |
| 915 |
* @param rowreq_ctx |
| 916 |
* Pointer to the row request context. |
| 917 |
* @param ifInOctets_val_ptr |
| 918 |
* Pointer to storage for a u_long variable |
| 919 |
* |
| 920 |
* @retval MFD_SUCCESS : success |
| 921 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 922 |
* @retval MFD_ERROR : Any other error |
| 923 |
*/ |
| 924 |
int |
| 925 |
ifInOctets_get(ifTable_rowreq_ctx * rowreq_ctx, |
| 926 |
u_long * ifInOctets_val_ptr) |
| 927 |
{ |
| 928 |
/** we should have a non-NULL pointer */ |
| 929 |
netsnmp_assert(NULL != ifInOctets_val_ptr); |
| 930 |
|
| 931 |
|
| 932 |
DEBUGMSGTL(("verbose:ifTable:ifInOctets_get", "called\n")); |
| 933 |
|
| 934 |
netsnmp_assert(NULL != rowreq_ctx); |
| 935 |
|
| 936 |
/* |
| 937 |
* TODO:231:o: |-> Extract the current value of the ifInOctets data. |
| 938 |
* copy (* ifInOctets_val_ptr ) from rowreq_ctx->data |
| 939 |
*/ |
| 940 |
(*ifInOctets_val_ptr) = rowreq_ctx->data.ifInOctets; |
| 941 |
|
| 942 |
return MFD_SUCCESS; |
| 943 |
} /* ifInOctets_get */ |
| 944 |
|
| 945 |
/*--------------------------------------------------------------------- |
| 946 |
* IF-MIB::ifEntry.ifInUcastPkts |
| 947 |
* ifInUcastPkts is subid 11 of ifEntry. |
| 948 |
* Its status is Current, and its access level is ReadOnly. |
| 949 |
* OID: .1.3.6.1.2.1.2.2.1.11 |
| 950 |
* Description: |
| 951 |
The number of packets, delivered by this sub-layer to a |
| 952 |
higher (sub-)layer, which were not addressed to a multicast |
| 953 |
or broadcast address at this sub-layer. |
| 954 |
|
| 955 |
Discontinuities in the value of this counter can occur at |
| 956 |
re-initialization of the management system, and at other |
| 957 |
times as indicated by the value of |
| 958 |
ifCounterDiscontinuityTime. |
| 959 |
* |
| 960 |
* Attributes: |
| 961 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 962 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 963 |
* settable 0 |
| 964 |
* |
| 965 |
* |
| 966 |
* Its syntax is COUNTER (based on perltype COUNTER) |
| 967 |
* The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) |
| 968 |
*/ |
| 969 |
/** |
| 970 |
* Extract the current value of the ifInUcastPkts data. |
| 971 |
* |
| 972 |
* Set a value using the data context for the row. |
| 973 |
* |
| 974 |
* @param rowreq_ctx |
| 975 |
* Pointer to the row request context. |
| 976 |
* @param ifInUcastPkts_val_ptr |
| 977 |
* Pointer to storage for a u_long variable |
| 978 |
* |
| 979 |
* @retval MFD_SUCCESS : success |
| 980 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 981 |
* @retval MFD_ERROR : Any other error |
| 982 |
*/ |
| 983 |
int |
| 984 |
ifInUcastPkts_get(ifTable_rowreq_ctx * rowreq_ctx, |
| 985 |
u_long * ifInUcastPkts_val_ptr) |
| 986 |
{ |
| 987 |
/** we should have a non-NULL pointer */ |
| 988 |
netsnmp_assert(NULL != ifInUcastPkts_val_ptr); |
| 989 |
|
| 990 |
|
| 991 |
DEBUGMSGTL(("verbose:ifTable:ifInUcastPkts_get", "called\n")); |
| 992 |
|
| 993 |
netsnmp_assert(NULL != rowreq_ctx); |
| 994 |
|
| 995 |
/* |
| 996 |
* TODO:231:o: |-> Extract the current value of the ifInUcastPkts data. |
| 997 |
* copy (* ifInUcastPkts_val_ptr ) from rowreq_ctx->data |
| 998 |
*/ |
| 999 |
(*ifInUcastPkts_val_ptr) = rowreq_ctx->data.ifInUcastPkts; |
| 1000 |
|
| 1001 |
return MFD_SUCCESS; |
| 1002 |
} /* ifInUcastPkts_get */ |
| 1003 |
|
| 1004 |
/*--------------------------------------------------------------------- |
| 1005 |
* IF-MIB::ifEntry.ifInNUcastPkts |
| 1006 |
* ifInNUcastPkts is subid 12 of ifEntry. |
| 1007 |
* Its status is Deprecated, and its access level is ReadOnly. |
| 1008 |
* OID: .1.3.6.1.2.1.2.2.1.12 |
| 1009 |
* Description: |
| 1010 |
The number of packets, delivered by this sub-layer to a |
| 1011 |
higher (sub-)layer, which were addressed to a multicast or |
| 1012 |
broadcast address at this sub-layer. |
| 1013 |
|
| 1014 |
Discontinuities in the value of this counter can occur at |
| 1015 |
re-initialization of the management system, and at other |
| 1016 |
times as indicated by the value of |
| 1017 |
ifCounterDiscontinuityTime. |
| 1018 |
|
| 1019 |
This object is deprecated in favour of ifInMulticastPkts and |
| 1020 |
ifInBroadcastPkts. |
| 1021 |
* |
| 1022 |
* Attributes: |
| 1023 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 1024 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1025 |
* settable 0 |
| 1026 |
* |
| 1027 |
* |
| 1028 |
* Its syntax is COUNTER (based on perltype COUNTER) |
| 1029 |
* The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) |
| 1030 |
*/ |
| 1031 |
/** |
| 1032 |
* Extract the current value of the ifInNUcastPkts data. |
| 1033 |
* |
| 1034 |
* Set a value using the data context for the row. |
| 1035 |
* |
| 1036 |
* @param rowreq_ctx |
| 1037 |
* Pointer to the row request context. |
| 1038 |
* @param ifInNUcastPkts_val_ptr |
| 1039 |
* Pointer to storage for a u_long variable |
| 1040 |
* |
| 1041 |
* @retval MFD_SUCCESS : success |
| 1042 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1043 |
* @retval MFD_ERROR : Any other error |
| 1044 |
*/ |
| 1045 |
int |
| 1046 |
ifInNUcastPkts_get(ifTable_rowreq_ctx * rowreq_ctx, |
| 1047 |
u_long * ifInNUcastPkts_val_ptr) |
| 1048 |
{ |
| 1049 |
/** we should have a non-NULL pointer */ |
| 1050 |
netsnmp_assert(NULL != ifInNUcastPkts_val_ptr); |
| 1051 |
|
| 1052 |
|
| 1053 |
DEBUGMSGTL(("verbose:ifTable:ifInNUcastPkts_get", "called\n")); |
| 1054 |
|
| 1055 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1056 |
|
| 1057 |
/* |
| 1058 |
* TODO:231:o: |-> Extract the current value of the ifInNUcastPkts data. |
| 1059 |
* copy (* ifInNUcastPkts_val_ptr ) from rowreq_ctx->data |
| 1060 |
*/ |
| 1061 |
(*ifInNUcastPkts_val_ptr) = rowreq_ctx->data.ifInNUcastPkts; |
| 1062 |
|
| 1063 |
return MFD_SUCCESS; |
| 1064 |
} /* ifInNUcastPkts_get */ |
| 1065 |
|
| 1066 |
/*--------------------------------------------------------------------- |
| 1067 |
* IF-MIB::ifEntry.ifInDiscards |
| 1068 |
* ifInDiscards is subid 13 of ifEntry. |
| 1069 |
* Its status is Current, and its access level is ReadOnly. |
| 1070 |
* OID: .1.3.6.1.2.1.2.2.1.13 |
| 1071 |
* Description: |
| 1072 |
The number of inbound packets which were chosen to be |
| 1073 |
discarded even though no errors had been detected to prevent |
| 1074 |
|
| 1075 |
their being deliverable to a higher-layer protocol. One |
| 1076 |
possible reason for discarding such a packet could be to |
| 1077 |
free up buffer space. |
| 1078 |
|
| 1079 |
Discontinuities in the value of this counter can occur at |
| 1080 |
re-initialization of the management system, and at other |
| 1081 |
times as indicated by the value of |
| 1082 |
ifCounterDiscontinuityTime. |
| 1083 |
* |
| 1084 |
* Attributes: |
| 1085 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 1086 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1087 |
* settable 0 |
| 1088 |
* |
| 1089 |
* |
| 1090 |
* Its syntax is COUNTER (based on perltype COUNTER) |
| 1091 |
* The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) |
| 1092 |
*/ |
| 1093 |
/** |
| 1094 |
* Extract the current value of the ifInDiscards data. |
| 1095 |
* |
| 1096 |
* Set a value using the data context for the row. |
| 1097 |
* |
| 1098 |
* @param rowreq_ctx |
| 1099 |
* Pointer to the row request context. |
| 1100 |
* @param ifInDiscards_val_ptr |
| 1101 |
* Pointer to storage for a u_long variable |
| 1102 |
* |
| 1103 |
* @retval MFD_SUCCESS : success |
| 1104 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1105 |
* @retval MFD_ERROR : Any other error |
| 1106 |
*/ |
| 1107 |
int |
| 1108 |
ifInDiscards_get(ifTable_rowreq_ctx * rowreq_ctx, |
| 1109 |
u_long * ifInDiscards_val_ptr) |
| 1110 |
{ |
| 1111 |
/** we should have a non-NULL pointer */ |
| 1112 |
netsnmp_assert(NULL != ifInDiscards_val_ptr); |
| 1113 |
|
| 1114 |
|
| 1115 |
DEBUGMSGTL(("verbose:ifTable:ifInDiscards_get", "called\n")); |
| 1116 |
|
| 1117 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1118 |
|
| 1119 |
/* |
| 1120 |
* TODO:231:o: |-> Extract the current value of the ifInDiscards data. |
| 1121 |
* copy (* ifInDiscards_val_ptr ) from rowreq_ctx->data |
| 1122 |
*/ |
| 1123 |
(*ifInDiscards_val_ptr) = rowreq_ctx->data.ifInDiscards; |
| 1124 |
|
| 1125 |
return MFD_SUCCESS; |
| 1126 |
} /* ifInDiscards_get */ |
| 1127 |
|
| 1128 |
/*--------------------------------------------------------------------- |
| 1129 |
* IF-MIB::ifEntry.ifInErrors |
| 1130 |
* ifInErrors is subid 14 of ifEntry. |
| 1131 |
* Its status is Current, and its access level is ReadOnly. |
| 1132 |
* OID: .1.3.6.1.2.1.2.2.1.14 |
| 1133 |
* Description: |
| 1134 |
For packet-oriented interfaces, the number of inbound |
| 1135 |
packets that contained errors preventing them from being |
| 1136 |
deliverable to a higher-layer protocol. For character- |
| 1137 |
oriented or fixed-length interfaces, the number of inbound |
| 1138 |
transmission units that contained errors preventing them |
| 1139 |
from being deliverable to a higher-layer protocol. |
| 1140 |
|
| 1141 |
Discontinuities in the value of this counter can occur at |
| 1142 |
re-initialization of the management system, and at other |
| 1143 |
times as indicated by the value of |
| 1144 |
ifCounterDiscontinuityTime. |
| 1145 |
* |
| 1146 |
* Attributes: |
| 1147 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 1148 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1149 |
* settable 0 |
| 1150 |
* |
| 1151 |
* |
| 1152 |
* Its syntax is COUNTER (based on perltype COUNTER) |
| 1153 |
* The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) |
| 1154 |
*/ |
| 1155 |
/** |
| 1156 |
* Extract the current value of the ifInErrors data. |
| 1157 |
* |
| 1158 |
* Set a value using the data context for the row. |
| 1159 |
* |
| 1160 |
* @param rowreq_ctx |
| 1161 |
* Pointer to the row request context. |
| 1162 |
* @param ifInErrors_val_ptr |
| 1163 |
* Pointer to storage for a u_long variable |
| 1164 |
* |
| 1165 |
* @retval MFD_SUCCESS : success |
| 1166 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1167 |
* @retval MFD_ERROR : Any other error |
| 1168 |
*/ |
| 1169 |
int |
| 1170 |
ifInErrors_get(ifTable_rowreq_ctx * rowreq_ctx, |
| 1171 |
u_long * ifInErrors_val_ptr) |
| 1172 |
{ |
| 1173 |
/** we should have a non-NULL pointer */ |
| 1174 |
netsnmp_assert(NULL != ifInErrors_val_ptr); |
| 1175 |
|
| 1176 |
|
| 1177 |
DEBUGMSGTL(("verbose:ifTable:ifInErrors_get", "called\n")); |
| 1178 |
|
| 1179 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1180 |
|
| 1181 |
/* |
| 1182 |
* TODO:231:o: |-> Extract the current value of the ifInErrors data. |
| 1183 |
* copy (* ifInErrors_val_ptr ) from rowreq_ctx->data |
| 1184 |
*/ |
| 1185 |
(*ifInErrors_val_ptr) = rowreq_ctx->data.ifInErrors; |
| 1186 |
|
| 1187 |
return MFD_SUCCESS; |
| 1188 |
} /* ifInErrors_get */ |
| 1189 |
|
| 1190 |
/*--------------------------------------------------------------------- |
| 1191 |
* IF-MIB::ifEntry.ifInUnknownProtos |
| 1192 |
* ifInUnknownProtos is subid 15 of ifEntry. |
| 1193 |
* Its status is Current, and its access level is ReadOnly. |
| 1194 |
* OID: .1.3.6.1.2.1.2.2.1.15 |
| 1195 |
* Description: |
| 1196 |
For packet-oriented interfaces, the number of packets |
| 1197 |
received via the interface which were discarded because of |
| 1198 |
an unknown or unsupported protocol. For character-oriented |
| 1199 |
or fixed-length interfaces that support protocol |
| 1200 |
multiplexing the number of transmission units received via |
| 1201 |
the interface which were discarded because of an unknown or |
| 1202 |
unsupported protocol. For any interface that does not |
| 1203 |
support protocol multiplexing, this counter will always be |
| 1204 |
0. |
| 1205 |
|
| 1206 |
Discontinuities in the value of this counter can occur at |
| 1207 |
re-initialization of the management system, and at other |
| 1208 |
times as indicated by the value of |
| 1209 |
ifCounterDiscontinuityTime. |
| 1210 |
* |
| 1211 |
* Attributes: |
| 1212 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 1213 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1214 |
* settable 0 |
| 1215 |
* |
| 1216 |
* |
| 1217 |
* Its syntax is COUNTER (based on perltype COUNTER) |
| 1218 |
* The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) |
| 1219 |
*/ |
| 1220 |
/** |
| 1221 |
* Extract the current value of the ifInUnknownProtos data. |
| 1222 |
* |
| 1223 |
* Set a value using the data context for the row. |
| 1224 |
* |
| 1225 |
* @param rowreq_ctx |
| 1226 |
* Pointer to the row request context. |
| 1227 |
* @param ifInUnknownProtos_val_ptr |
| 1228 |
* Pointer to storage for a u_long variable |
| 1229 |
* |
| 1230 |
* @retval MFD_SUCCESS : success |
| 1231 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1232 |
* @retval MFD_ERROR : Any other error |
| 1233 |
*/ |
| 1234 |
int |
| 1235 |
ifInUnknownProtos_get(ifTable_rowreq_ctx * rowreq_ctx, |
| 1236 |
u_long * ifInUnknownProtos_val_ptr) |
| 1237 |
{ |
| 1238 |
/** we should have a non-NULL pointer */ |
| 1239 |
netsnmp_assert(NULL != ifInUnknownProtos_val_ptr); |
| 1240 |
|
| 1241 |
|
| 1242 |
DEBUGMSGTL(("verbose:ifTable:ifInUnknownProtos_get", "called\n")); |
| 1243 |
|
| 1244 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1245 |
|
| 1246 |
/* |
| 1247 |
* TODO:231:o: |-> Extract the current value of the ifInUnknownProtos data. |
| 1248 |
* copy (* ifInUnknownProtos_val_ptr ) from rowreq_ctx->data |
| 1249 |
*/ |
| 1250 |
(*ifInUnknownProtos_val_ptr) = rowreq_ctx->data.ifInUnknownProtos; |
| 1251 |
|
| 1252 |
return MFD_SUCCESS; |
| 1253 |
} /* ifInUnknownProtos_get */ |
| 1254 |
|
| 1255 |
/*--------------------------------------------------------------------- |
| 1256 |
* IF-MIB::ifEntry.ifOutOctets |
| 1257 |
* ifOutOctets is subid 16 of ifEntry. |
| 1258 |
* Its status is Current, and its access level is ReadOnly. |
| 1259 |
* OID: .1.3.6.1.2.1.2.2.1.16 |
| 1260 |
* Description: |
| 1261 |
The total number of octets transmitted out of the |
| 1262 |
interface, including framing characters. |
| 1263 |
|
| 1264 |
Discontinuities in the value of this counter can occur at |
| 1265 |
re-initialization of the management system, and at other |
| 1266 |
times as indicated by the value of |
| 1267 |
ifCounterDiscontinuityTime. |
| 1268 |
* |
| 1269 |
* Attributes: |
| 1270 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 1271 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1272 |
* settable 0 |
| 1273 |
* |
| 1274 |
* |
| 1275 |
* Its syntax is COUNTER (based on perltype COUNTER) |
| 1276 |
* The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) |
| 1277 |
*/ |
| 1278 |
/** |
| 1279 |
* Extract the current value of the ifOutOctets data. |
| 1280 |
* |
| 1281 |
* Set a value using the data context for the row. |
| 1282 |
* |
| 1283 |
* @param rowreq_ctx |
| 1284 |
* Pointer to the row request context. |
| 1285 |
* @param ifOutOctets_val_ptr |
| 1286 |
* Pointer to storage for a u_long variable |
| 1287 |
* |
| 1288 |
* @retval MFD_SUCCESS : success |
| 1289 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1290 |
* @retval MFD_ERROR : Any other error |
| 1291 |
*/ |
| 1292 |
int |
| 1293 |
ifOutOctets_get(ifTable_rowreq_ctx * rowreq_ctx, |
| 1294 |
u_long * ifOutOctets_val_ptr) |
| 1295 |
{ |
| 1296 |
/** we should have a non-NULL pointer */ |
| 1297 |
netsnmp_assert(NULL != ifOutOctets_val_ptr); |
| 1298 |
|
| 1299 |
|
| 1300 |
DEBUGMSGTL(("verbose:ifTable:ifOutOctets_get", "called\n")); |
| 1301 |
|
| 1302 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1303 |
|
| 1304 |
/* |
| 1305 |
* TODO:231:o: |-> Extract the current value of the ifOutOctets data. |
| 1306 |
* copy (* ifOutOctets_val_ptr ) from rowreq_ctx->data |
| 1307 |
*/ |
| 1308 |
(*ifOutOctets_val_ptr) = rowreq_ctx->data.ifOutOctets; |
| 1309 |
|
| 1310 |
return MFD_SUCCESS; |
| 1311 |
} /* ifOutOctets_get */ |
| 1312 |
|
| 1313 |
/*--------------------------------------------------------------------- |
| 1314 |
* IF-MIB::ifEntry.ifOutUcastPkts |
| 1315 |
* ifOutUcastPkts is subid 17 of ifEntry. |
| 1316 |
* Its status is Current, and its access level is ReadOnly. |
| 1317 |
* OID: .1.3.6.1.2.1.2.2.1.17 |
| 1318 |
* Description: |
| 1319 |
The total number of packets that higher-level protocols |
| 1320 |
requested be transmitted, and which were not addressed to a |
| 1321 |
multicast or broadcast address at this sub-layer, including |
| 1322 |
those that were discarded or not sent. |
| 1323 |
|
| 1324 |
Discontinuities in the value of this counter can occur at |
| 1325 |
re-initialization of the management system, and at other |
| 1326 |
times as indicated by the value of |
| 1327 |
ifCounterDiscontinuityTime. |
| 1328 |
* |
| 1329 |
* Attributes: |
| 1330 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 1331 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1332 |
* settable 0 |
| 1333 |
* |
| 1334 |
* |
| 1335 |
* Its syntax is COUNTER (based on perltype COUNTER) |
| 1336 |
* The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) |
| 1337 |
*/ |
| 1338 |
/** |
| 1339 |
* Extract the current value of the ifOutUcastPkts data. |
| 1340 |
* |
| 1341 |
* Set a value using the data context for the row. |
| 1342 |
* |
| 1343 |
* @param rowreq_ctx |
| 1344 |
* Pointer to the row request context. |
| 1345 |
* @param ifOutUcastPkts_val_ptr |
| 1346 |
* Pointer to storage for a u_long variable |
| 1347 |
* |
| 1348 |
* @retval MFD_SUCCESS : success |
| 1349 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1350 |
* @retval MFD_ERROR : Any other error |
| 1351 |
*/ |
| 1352 |
int |
| 1353 |
ifOutUcastPkts_get(ifTable_rowreq_ctx * rowreq_ctx, |
| 1354 |
u_long * ifOutUcastPkts_val_ptr) |
| 1355 |
{ |
| 1356 |
/** we should have a non-NULL pointer */ |
| 1357 |
netsnmp_assert(NULL != ifOutUcastPkts_val_ptr); |
| 1358 |
|
| 1359 |
|
| 1360 |
DEBUGMSGTL(("verbose:ifTable:ifOutUcastPkts_get", "called\n")); |
| 1361 |
|
| 1362 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1363 |
|
| 1364 |
/* |
| 1365 |
* TODO:231:o: |-> Extract the current value of the ifOutUcastPkts data. |
| 1366 |
* copy (* ifOutUcastPkts_val_ptr ) from rowreq_ctx->data |
| 1367 |
*/ |
| 1368 |
(*ifOutUcastPkts_val_ptr) = rowreq_ctx->data.ifOutUcastPkts; |
| 1369 |
|
| 1370 |
return MFD_SUCCESS; |
| 1371 |
} /* ifOutUcastPkts_get */ |
| 1372 |
|
| 1373 |
/*--------------------------------------------------------------------- |
| 1374 |
* IF-MIB::ifEntry.ifOutNUcastPkts |
| 1375 |
* ifOutNUcastPkts is subid 18 of ifEntry. |
| 1376 |
* Its status is Deprecated, and its access level is ReadOnly. |
| 1377 |
* OID: .1.3.6.1.2.1.2.2.1.18 |
| 1378 |
* Description: |
| 1379 |
The total number of packets that higher-level protocols |
| 1380 |
requested be transmitted, and which were addressed to a |
| 1381 |
multicast or broadcast address at this sub-layer, including |
| 1382 |
those that were discarded or not sent. |
| 1383 |
|
| 1384 |
Discontinuities in the value of this counter can occur at |
| 1385 |
re-initialization of the management system, and at other |
| 1386 |
times as indicated by the value of |
| 1387 |
ifCounterDiscontinuityTime. |
| 1388 |
|
| 1389 |
This object is deprecated in favour of ifOutMulticastPkts |
| 1390 |
and ifOutBroadcastPkts. |
| 1391 |
* |
| 1392 |
* Attributes: |
| 1393 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 1394 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1395 |
* settable 0 |
| 1396 |
* |
| 1397 |
* |
| 1398 |
* Its syntax is COUNTER (based on perltype COUNTER) |
| 1399 |
* The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) |
| 1400 |
*/ |
| 1401 |
/** |
| 1402 |
* Extract the current value of the ifOutNUcastPkts data. |
| 1403 |
* |
| 1404 |
* Set a value using the data context for the row. |
| 1405 |
* |
| 1406 |
* @param rowreq_ctx |
| 1407 |
* Pointer to the row request context. |
| 1408 |
* @param ifOutNUcastPkts_val_ptr |
| 1409 |
* Pointer to storage for a u_long variable |
| 1410 |
* |
| 1411 |
* @retval MFD_SUCCESS : success |
| 1412 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1413 |
* @retval MFD_ERROR : Any other error |
| 1414 |
*/ |
| 1415 |
int |
| 1416 |
ifOutNUcastPkts_get(ifTable_rowreq_ctx * rowreq_ctx, |
| 1417 |
u_long * ifOutNUcastPkts_val_ptr) |
| 1418 |
{ |
| 1419 |
/** we should have a non-NULL pointer */ |
| 1420 |
netsnmp_assert(NULL != ifOutNUcastPkts_val_ptr); |
| 1421 |
|
| 1422 |
|
| 1423 |
DEBUGMSGTL(("verbose:ifTable:ifOutNUcastPkts_get", "called\n")); |
| 1424 |
|
| 1425 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1426 |
|
| 1427 |
/* |
| 1428 |
* TODO:231:o: |-> Extract the current value of the ifOutNUcastPkts data. |
| 1429 |
* copy (* ifOutNUcastPkts_val_ptr ) from rowreq_ctx->data |
| 1430 |
*/ |
| 1431 |
(*ifOutNUcastPkts_val_ptr) = rowreq_ctx->data.ifOutNUcastPkts; |
| 1432 |
|
| 1433 |
return MFD_SUCCESS; |
| 1434 |
} /* ifOutNUcastPkts_get */ |
| 1435 |
|
| 1436 |
/*--------------------------------------------------------------------- |
| 1437 |
* IF-MIB::ifEntry.ifOutDiscards |
| 1438 |
* ifOutDiscards is subid 19 of ifEntry. |
| 1439 |
* Its status is Current, and its access level is ReadOnly. |
| 1440 |
* OID: .1.3.6.1.2.1.2.2.1.19 |
| 1441 |
* Description: |
| 1442 |
The number of outbound packets which were chosen to be |
| 1443 |
discarded even though no errors had been detected to prevent |
| 1444 |
their being transmitted. One possible reason for discarding |
| 1445 |
such a packet could be to free up buffer space. |
| 1446 |
|
| 1447 |
Discontinuities in the value of this counter can occur at |
| 1448 |
re-initialization of the management system, and at other |
| 1449 |
times as indicated by the value of |
| 1450 |
ifCounterDiscontinuityTime. |
| 1451 |
* |
| 1452 |
* Attributes: |
| 1453 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 1454 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1455 |
* settable 0 |
| 1456 |
* |
| 1457 |
* |
| 1458 |
* Its syntax is COUNTER (based on perltype COUNTER) |
| 1459 |
* The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) |
| 1460 |
*/ |
| 1461 |
/** |
| 1462 |
* Extract the current value of the ifOutDiscards data. |
| 1463 |
* |
| 1464 |
* Set a value using the data context for the row. |
| 1465 |
* |
| 1466 |
* @param rowreq_ctx |
| 1467 |
* Pointer to the row request context. |
| 1468 |
* @param ifOutDiscards_val_ptr |
| 1469 |
* Pointer to storage for a u_long variable |
| 1470 |
* |
| 1471 |
* @retval MFD_SUCCESS : success |
| 1472 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1473 |
* @retval MFD_ERROR : Any other error |
| 1474 |
*/ |
| 1475 |
int |
| 1476 |
ifOutDiscards_get(ifTable_rowreq_ctx * rowreq_ctx, |
| 1477 |
u_long * ifOutDiscards_val_ptr) |
| 1478 |
{ |
| 1479 |
/** we should have a non-NULL pointer */ |
| 1480 |
netsnmp_assert(NULL != ifOutDiscards_val_ptr); |
| 1481 |
|
| 1482 |
|
| 1483 |
DEBUGMSGTL(("verbose:ifTable:ifOutDiscards_get", "called\n")); |
| 1484 |
|
| 1485 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1486 |
|
| 1487 |
/* |
| 1488 |
* TODO:231:o: |-> Extract the current value of the ifOutDiscards data. |
| 1489 |
* copy (* ifOutDiscards_val_ptr ) from rowreq_ctx->data |
| 1490 |
*/ |
| 1491 |
(*ifOutDiscards_val_ptr) = rowreq_ctx->data.ifOutDiscards; |
| 1492 |
|
| 1493 |
return MFD_SUCCESS; |
| 1494 |
} /* ifOutDiscards_get */ |
| 1495 |
|
| 1496 |
/*--------------------------------------------------------------------- |
| 1497 |
* IF-MIB::ifEntry.ifOutErrors |
| 1498 |
* ifOutErrors is subid 20 of ifEntry. |
| 1499 |
* Its status is Current, and its access level is ReadOnly. |
| 1500 |
* OID: .1.3.6.1.2.1.2.2.1.20 |
| 1501 |
* Description: |
| 1502 |
For packet-oriented interfaces, the number of outbound |
| 1503 |
packets that could not be transmitted because of errors. |
| 1504 |
For character-oriented or fixed-length interfaces, the |
| 1505 |
number of outbound transmission units that could not be |
| 1506 |
transmitted because of errors. |
| 1507 |
|
| 1508 |
Discontinuities in the value of this counter can occur at |
| 1509 |
re-initialization of the management system, and at other |
| 1510 |
times as indicated by the value of |
| 1511 |
ifCounterDiscontinuityTime. |
| 1512 |
* |
| 1513 |
* Attributes: |
| 1514 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 1515 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1516 |
* settable 0 |
| 1517 |
* |
| 1518 |
* |
| 1519 |
* Its syntax is COUNTER (based on perltype COUNTER) |
| 1520 |
* The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) |
| 1521 |
*/ |
| 1522 |
/** |
| 1523 |
* Extract the current value of the ifOutErrors data. |
| 1524 |
* |
| 1525 |
* Set a value using the data context for the row. |
| 1526 |
* |
| 1527 |
* @param rowreq_ctx |
| 1528 |
* Pointer to the row request context. |
| 1529 |
* @param ifOutErrors_val_ptr |
| 1530 |
* Pointer to storage for a u_long variable |
| 1531 |
* |
| 1532 |
* @retval MFD_SUCCESS : success |
| 1533 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1534 |
* @retval MFD_ERROR : Any other error |
| 1535 |
*/ |
| 1536 |
int |
| 1537 |
ifOutErrors_get(ifTable_rowreq_ctx * rowreq_ctx, |
| 1538 |
u_long * ifOutErrors_val_ptr) |
| 1539 |
{ |
| 1540 |
/** we should have a non-NULL pointer */ |
| 1541 |
netsnmp_assert(NULL != ifOutErrors_val_ptr); |
| 1542 |
|
| 1543 |
|
| 1544 |
DEBUGMSGTL(("verbose:ifTable:ifOutErrors_get", "called\n")); |
| 1545 |
|
| 1546 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1547 |
|
| 1548 |
/* |
| 1549 |
* TODO:231:o: |-> Extract the current value of the ifOutErrors data. |
| 1550 |
* copy (* ifOutErrors_val_ptr ) from rowreq_ctx->data |
| 1551 |
*/ |
| 1552 |
(*ifOutErrors_val_ptr) = rowreq_ctx->data.ifOutErrors; |
| 1553 |
|
| 1554 |
return MFD_SUCCESS; |
| 1555 |
} /* ifOutErrors_get */ |
| 1556 |
|
| 1557 |
/*--------------------------------------------------------------------- |
| 1558 |
* IF-MIB::ifEntry.ifOutQLen |
| 1559 |
* ifOutQLen is subid 21 of ifEntry. |
| 1560 |
* Its status is Deprecated, and its access level is ReadOnly. |
| 1561 |
* OID: .1.3.6.1.2.1.2.2.1.21 |
| 1562 |
* Description: |
| 1563 |
The length of the output packet queue (in packets). |
| 1564 |
* |
| 1565 |
* Attributes: |
| 1566 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 1567 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1568 |
* settable 0 |
| 1569 |
* |
| 1570 |
* |
| 1571 |
* Its syntax is GAUGE (based on perltype GAUGE) |
| 1572 |
* The net-snmp type is ASN_GAUGE. The C type decl is u_long (u_long) |
| 1573 |
*/ |
| 1574 |
/** |
| 1575 |
* Extract the current value of the ifOutQLen data. |
| 1576 |
* |
| 1577 |
* Set a value using the data context for the row. |
| 1578 |
* |
| 1579 |
* @param rowreq_ctx |
| 1580 |
* Pointer to the row request context. |
| 1581 |
* @param ifOutQLen_val_ptr |
| 1582 |
* Pointer to storage for a u_long variable |
| 1583 |
* |
| 1584 |
* @retval MFD_SUCCESS : success |
| 1585 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1586 |
* @retval MFD_ERROR : Any other error |
| 1587 |
*/ |
| 1588 |
int |
| 1589 |
ifOutQLen_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifOutQLen_val_ptr) |
| 1590 |
{ |
| 1591 |
/** we should have a non-NULL pointer */ |
| 1592 |
netsnmp_assert(NULL != ifOutQLen_val_ptr); |
| 1593 |
|
| 1594 |
|
| 1595 |
DEBUGMSGTL(("verbose:ifTable:ifOutQLen_get", "called\n")); |
| 1596 |
|
| 1597 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1598 |
|
| 1599 |
/* |
| 1600 |
* TODO:231:o: |-> Extract the current value of the ifOutQLen data. |
| 1601 |
* copy (* ifOutQLen_val_ptr ) from rowreq_ctx->data |
| 1602 |
*/ |
| 1603 |
(*ifOutQLen_val_ptr) = rowreq_ctx->data.ifOutQLen; |
| 1604 |
|
| 1605 |
return MFD_SUCCESS; |
| 1606 |
} /* ifOutQLen_get */ |
| 1607 |
|
| 1608 |
/*--------------------------------------------------------------------- |
| 1609 |
* IF-MIB::ifEntry.ifSpecific |
| 1610 |
* ifSpecific is subid 22 of ifEntry. |
| 1611 |
* Its status is Deprecated, and its access level is ReadOnly. |
| 1612 |
* OID: .1.3.6.1.2.1.2.2.1.22 |
| 1613 |
* Description: |
| 1614 |
A reference to MIB definitions specific to the particular |
| 1615 |
media being used to realize the interface. It is |
| 1616 |
|
| 1617 |
recommended that this value point to an instance of a MIB |
| 1618 |
object in the media-specific MIB, i.e., that this object |
| 1619 |
have the semantics associated with the InstancePointer |
| 1620 |
textual convention defined in RFC 2579. In fact, it is |
| 1621 |
recommended that the media-specific MIB specify what value |
| 1622 |
ifSpecific should/can take for values of ifType. If no MIB |
| 1623 |
definitions specific to the particular media are available, |
| 1624 |
the value should be set to the OBJECT IDENTIFIER { 0 0 }. |
| 1625 |
* |
| 1626 |
* Attributes: |
| 1627 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 1628 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1629 |
* settable 0 |
| 1630 |
* |
| 1631 |
* |
| 1632 |
* Its syntax is OBJECTID (based on perltype OBJECTID) |
| 1633 |
* The net-snmp type is ASN_OBJECT_ID. The C type decl is oid (oid) |
| 1634 |
* This data type requires a length. (Max 255) |
| 1635 |
*/ |
| 1636 |
/** |
| 1637 |
* Extract the current value of the ifSpecific data. |
| 1638 |
* |
| 1639 |
* Set a value using the data context for the row. |
| 1640 |
* |
| 1641 |
* @param rowreq_ctx |
| 1642 |
* Pointer to the row request context. |
| 1643 |
* @param ifSpecific_val_ptr_ptr |
| 1644 |
* Pointer to storage for a oid variable |
| 1645 |
* @param ifSpecific_val_ptr_len_ptr |
| 1646 |
* Pointer to a size_t. On entry, it will contain the size (in bytes) |
| 1647 |
* pointed to by ifSpecific. |
| 1648 |
* On exit, this value should contain the data size (in bytes). |
| 1649 |
* |
| 1650 |
* @retval MFD_SUCCESS : success |
| 1651 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1652 |
* @retval MFD_ERROR : Any other error |
| 1653 |
* |
| 1654 |
* @note If you need more than (*ifSpecific_val_ptr_len_ptr) bytes of memory, |
| 1655 |
* allocate it using malloc() and update ifSpecific_val_ptr_ptr. |
| 1656 |
* <b>DO NOT</b> free the previous pointer. |
| 1657 |
* The MFD helper will release the memory you allocate. |
| 1658 |
* |
| 1659 |
* @remark If you call this function yourself, you are responsible |
| 1660 |
* for checking if the pointer changed, and freeing any |
| 1661 |
* previously allocated memory. (Not necessary if you pass |
| 1662 |
* in a pointer to static memory, obviously.) |
| 1663 |
*/ |
| 1664 |
int |
| 1665 |
ifSpecific_get(ifTable_rowreq_ctx * rowreq_ctx, |
| 1666 |
oid ** ifSpecific_val_ptr_ptr, |
| 1667 |
size_t * ifSpecific_val_ptr_len_ptr) |
| 1668 |
{ |
| 1669 |
/** we should have a non-NULL pointer and enough storage */ |
| 1670 |
netsnmp_assert((NULL != ifSpecific_val_ptr_ptr) |
| 1671 |
&& (NULL != *ifSpecific_val_ptr_ptr)); |
| 1672 |
netsnmp_assert(NULL != ifSpecific_val_ptr_len_ptr); |
| 1673 |
|
| 1674 |
|
| 1675 |
DEBUGMSGTL(("verbose:ifTable:ifSpecific_get", "called\n")); |
| 1676 |
|
| 1677 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1678 |
|
| 1679 |
/* |
| 1680 |
* TODO:231:o: |-> Extract the current value of the ifSpecific data. |
| 1681 |
* copy (* ifSpecific_val_ptr_ptr ) data and (* ifSpecific_val_ptr_len_ptr ) from rowreq_ctx->data |
| 1682 |
*/ |
| 1683 |
#ifdef IFTABLE_HAS_IFSPECIFIC |
| 1684 |
/* |
| 1685 |
* make sure there is enough space for ifSpecific data |
| 1686 |
*/ |
| 1687 |
if ((NULL == (*ifSpecific_val_ptr_ptr)) || |
| 1688 |
((*ifSpecific_val_ptr_len_ptr) < |
| 1689 |
(rowreq_ctx->data.ifSpecific_len * |
| 1690 |
sizeof(rowreq_ctx->data.ifSpecific[0])))) { |
| 1691 |
/* |
| 1692 |
* allocate space for ifSpecific data |
| 1693 |
*/ |
| 1694 |
(*ifSpecific_val_ptr_ptr) = |
| 1695 |
malloc(rowreq_ctx->data.ifSpecific_len * |
| 1696 |
sizeof(rowreq_ctx->data.ifSpecific[0])); |
| 1697 |
if (NULL == (*ifSpecific_val_ptr_ptr)) { |
| 1698 |
snmp_log(LOG_ERR, "could not allocate memory\n"); |
| 1699 |
return MFD_ERROR; |
| 1700 |
} |
| 1701 |
} |
| 1702 |
(*ifSpecific_val_ptr_len_ptr) = |
| 1703 |
rowreq_ctx->data.ifSpecific_len * |
| 1704 |
sizeof(rowreq_ctx->data.ifSpecific[0]); |
| 1705 |
memcpy((*ifSpecific_val_ptr_ptr), rowreq_ctx->data.ifSpecific, |
| 1706 |
(*ifSpecific_val_ptr_len_ptr)); |
| 1707 |
#else |
| 1708 |
/* |
| 1709 |
* hard coded |
| 1710 |
*/ |
| 1711 |
netsnmp_assert((*ifSpecific_val_ptr_len_ptr) > (size_t)nullOidLen); |
| 1712 |
(*ifSpecific_val_ptr_len_ptr) = (size_t)nullOidLen; |
| 1713 |
memcpy(*ifSpecific_val_ptr_ptr, &nullOid, (size_t)nullOidLen); |
| 1714 |
#endif |
| 1715 |
|
| 1716 |
return MFD_SUCCESS; |
| 1717 |
} /* ifSpecific_get */ |
| 1718 |
|
| 1719 |
|
| 1720 |
|
| 1721 |
/** @} */ |
| 1722 |
|
| 1723 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 1724 |
|
| 1725 |
/********************************************************************** |
| 1726 |
********************************************************************** |
| 1727 |
*** |
| 1728 |
*** Table ifTable |
| 1729 |
*** |
| 1730 |
********************************************************************** |
| 1731 |
**********************************************************************/ |
| 1732 |
/* |
| 1733 |
* IF-MIB::ifTable is subid 2 of interfaces. |
| 1734 |
* Its status is Current. |
| 1735 |
* OID: .1.3.6.1.2.1.2.2, length: 8 |
| 1736 |
*/ |
| 1737 |
/* |
| 1738 |
* NOTE: if you update this chart, please update the versions in |
| 1739 |
* local/mib2c-conf.d/parent-set.m2i |
| 1740 |
* agent/mibgroup/helpers/baby_steps.c |
| 1741 |
* while you're at it. |
| 1742 |
*/ |
| 1743 |
/* |
| 1744 |
*********************************************************************** |
| 1745 |
* Baby Steps Flow Chart (2004.06.05) * |
| 1746 |
* * |
| 1747 |
* +--------------+ +================+ U = unconditional path * |
| 1748 |
* |optional state| ||required state|| S = path for success * |
| 1749 |
* +--------------+ +================+ E = path for error * |
| 1750 |
*********************************************************************** |
| 1751 |
* |
| 1752 |
* +--------------+ |
| 1753 |
* | pre | |
| 1754 |
* | request | |
| 1755 |
* +--------------+ |
| 1756 |
* | U |
| 1757 |
* +==============+ |
| 1758 |
* +----------------|| object || |
| 1759 |
* | E || lookup || |
| 1760 |
* | +==============+ |
| 1761 |
* | | S |
| 1762 |
* | +==============+ |
| 1763 |
* | E || check || |
| 1764 |
* |<---------------|| values || |
| 1765 |
* | +==============+ |
| 1766 |
* | | S |
| 1767 |
* | +==============+ |
| 1768 |
* | +<-------|| undo || |
| 1769 |
* | | E || setup || |
| 1770 |
* | | +==============+ |
| 1771 |
* | | | S |
| 1772 |
* | | +==============+ |
| 1773 |
* | | || set ||-------------------------->+ |
| 1774 |
* | | || value || E | |
| 1775 |
* | | +==============+ | |
| 1776 |
* | | | S | |
| 1777 |
* | | +--------------+ | |
| 1778 |
* | | | check |-------------------------->| |
| 1779 |
* | | | consistency | E | |
| 1780 |
* | | +--------------+ | |
| 1781 |
* | | | S | |
| 1782 |
* | | +==============+ +==============+ | |
| 1783 |
* | | || commit ||-------->|| undo || | |
| 1784 |
* | | || || E || commit || | |
| 1785 |
* | | +==============+ +==============+ | |
| 1786 |
* | | | S U |<--------+ |
| 1787 |
* | | +--------------+ +==============+ |
| 1788 |
* | | | irreversible | || undo || |
| 1789 |
* | | | commit | || set || |
| 1790 |
* | | +--------------+ +==============+ |
| 1791 |
* | | | U U | |
| 1792 |
* | +-------------->|<------------------------+ |
| 1793 |
* | +==============+ |
| 1794 |
* | || undo || |
| 1795 |
* | || cleanup || |
| 1796 |
* | +==============+ |
| 1797 |
* +---------------------->| U |
| 1798 |
* +--------------+ |
| 1799 |
* | post | |
| 1800 |
* | request | |
| 1801 |
* +--------------+ |
| 1802 |
* |
| 1803 |
*/ |
| 1804 |
|
| 1805 |
/** |
| 1806 |
* Setup up context with information needed to undo a set request. |
| 1807 |
* |
| 1808 |
* Undo storage is in (* ifSpecific_val_ptr_ptr )* |
| 1809 |
* This function will be called before the individual node undo setup |
| 1810 |
* functions are called. If you need to do any undo setup that is not |
| 1811 |
* related to a specific column, you can do it here. |
| 1812 |
* |
| 1813 |
* Note that the undo context has been allocated with ifTable_allocate_data(). |
| 1814 |
* Note that an individual node's undo_setup function will only be called |
| 1815 |
* if that node is being set to a new value. |
| 1816 |
* |
| 1817 |
* If there is any setup specific to a particular column (e.g. allocating |
| 1818 |
* memory for a string), you should do that setup in the node's undo_setup |
| 1819 |
* function, so it won't be done unless it is necessary. |
| 1820 |
* |
| 1821 |
* @param rowreq_ctx |
| 1822 |
* Pointer to the table context (ifTable_rowreq_ctx) |
| 1823 |
* |
| 1824 |
* @retval MFD_SUCCESS : success |
| 1825 |
* Undo storage is in (* ifSpecific_val_ptr_ptr )* |
| 1826 |
* @retval MFD_ERROR : error. set will fail. |
| 1827 |
*/ |
| 1828 |
int |
| 1829 |
ifTable_undo_setup(ifTable_rowreq_ctx * rowreq_ctx) |
| 1830 |
{ |
| 1831 |
int rc = MFD_SUCCESS; |
| 1832 |
|
| 1833 |
DEBUGMSGTL(("verbose:ifTable:ifTable_undo_setup", "called\n")); |
| 1834 |
|
| 1835 |
/** we should have a non-NULL pointer */ |
| 1836 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1837 |
|
| 1838 |
/* |
| 1839 |
* TODO:451:M: |-> Setup ifTable undo. |
| 1840 |
* set up ifTable undo information, in preparation for a set. |
| 1841 |
* Undo storage is in (* ifSpecific_val_ptr_ptr )* |
| 1842 |
*/ |
| 1843 |
|
| 1844 |
return rc; |
| 1845 |
} /* ifTable_undo_setup */ |
| 1846 |
|
| 1847 |
/** |
| 1848 |
* Undo a set request. |
| 1849 |
* |
| 1850 |
* This function will be called before the individual node undo |
| 1851 |
* functions are called. If you need to do any undo that is not |
| 1852 |
* related to a specific column, you can do it here. |
| 1853 |
* |
| 1854 |
* Note that an individual node's undo function will only be called |
| 1855 |
* if that node is being set to a new value. |
| 1856 |
* |
| 1857 |
* If there is anything specific to a particular column (e.g. releasing |
| 1858 |
* memory for a string), you should do that setup in the node's undo |
| 1859 |
* function, so it won't be done unless it is necessary. |
| 1860 |
* |
| 1861 |
* @param rowreq_ctx |
| 1862 |
* Pointer to the table context (ifTable_rowreq_ctx) |
| 1863 |
* |
| 1864 |
* @retval MFD_SUCCESS : success |
| 1865 |
* @retval MFD_ERROR : error. set will fail. |
| 1866 |
*/ |
| 1867 |
int |
| 1868 |
ifTable_undo(ifTable_rowreq_ctx * rowreq_ctx) |
| 1869 |
{ |
| 1870 |
int rc = MFD_SUCCESS; |
| 1871 |
|
| 1872 |
DEBUGMSGTL(("verbose:ifTable:ifTable_undo", "called\n")); |
| 1873 |
|
| 1874 |
/** we should have a non-NULL pointer */ |
| 1875 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1876 |
|
| 1877 |
/* |
| 1878 |
* TODO:451:M: |-> ifTable undo. |
| 1879 |
* ifTable undo information, in response to a failed set. |
| 1880 |
* Undo storage is in (* ifSpecific_val_ptr_ptr )* |
| 1881 |
*/ |
| 1882 |
|
| 1883 |
return rc; |
| 1884 |
} /* ifTable_undo_setup */ |
| 1885 |
|
| 1886 |
/** |
| 1887 |
* Cleanup up context undo information. |
| 1888 |
* |
| 1889 |
* This function will be called after set/commit processing. If you |
| 1890 |
* allocated any resources in undo_setup, this is the place to release |
| 1891 |
* those resources. |
| 1892 |
* |
| 1893 |
* This function is called regardless of the success or failure of the set |
| 1894 |
* request. If you need to perform different steps for cleanup depending |
| 1895 |
* on success or failure, you can add a flag to the rowreq_ctx. |
| 1896 |
* |
| 1897 |
* @param rowreq_ctx |
| 1898 |
* Pointer to the table context (ifTable_rowreq_ctx) |
| 1899 |
* |
| 1900 |
* @retval MFD_SUCCESS : success |
| 1901 |
* @retval MFD_ERROR : error |
| 1902 |
*/ |
| 1903 |
int |
| 1904 |
ifTable_undo_cleanup(ifTable_rowreq_ctx * rowreq_ctx) |
| 1905 |
{ |
| 1906 |
int rc = MFD_SUCCESS; |
| 1907 |
|
| 1908 |
DEBUGMSGTL(("verbose:ifTable:ifTable_undo_cleanup", "called\n")); |
| 1909 |
|
| 1910 |
/** we should have a non-NULL pointer */ |
| 1911 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1912 |
|
| 1913 |
/* |
| 1914 |
* TODO:452:M: |-> Cleanup ifTable undo. |
| 1915 |
* Undo storage is in (* ifSpecific_val_ptr_ptr )* |
| 1916 |
*/ |
| 1917 |
|
| 1918 |
return rc; |
| 1919 |
} /* ifTable_undo_cleanup */ |
| 1920 |
|
| 1921 |
/** |
| 1922 |
* commit new values. |
| 1923 |
* |
| 1924 |
* At this point, you should have done everything you can to ensure that |
| 1925 |
* this commit will not fail. |
| 1926 |
* |
| 1927 |
* Should you need different behavior depending on which columns were |
| 1928 |
* set, rowreq_ctx->column_set_flags will indicate which writeable columns were |
| 1929 |
* set. The definitions for the COLUMN_*_FLAG bits can be found in |
| 1930 |
* ifTable.h. |
| 1931 |
* A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. |
| 1932 |
* |
| 1933 |
* @param rowreq_ctx Pointer to the users context. |
| 1934 |
* |
| 1935 |
* @retval MFD_SUCCESS : success |
| 1936 |
* @retval MFD_ERROR : error |
| 1937 |
*/ |
| 1938 |
int |
| 1939 |
ifTable_commit(ifTable_rowreq_ctx * rowreq_ctx) |
| 1940 |
{ |
| 1941 |
int rc = MFD_SUCCESS; |
| 1942 |
int save_flags; |
| 1943 |
|
| 1944 |
DEBUGMSGTL(("verbose:ifTable:ifTable_commit", "called\n")); |
| 1945 |
|
| 1946 |
/** we should have a non-NULL pointer */ |
| 1947 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1948 |
|
| 1949 |
/* |
| 1950 |
* save flags, then clear until we actually do something |
| 1951 |
*/ |
| 1952 |
save_flags = rowreq_ctx->column_set_flags; |
| 1953 |
rowreq_ctx->column_set_flags = 0; |
| 1954 |
|
| 1955 |
/* |
| 1956 |
* commit ifTable data |
| 1957 |
* 1) check the column's flag in save_flags to see if it was set. |
| 1958 |
* 2) clear the flag when you handle that column |
| 1959 |
* 3) set the column's flag in column_set_flags if it needs undo |
| 1960 |
* processing in case of a failure. |
| 1961 |
*/ |
| 1962 |
if (save_flags & COLUMN_IFADMINSTATUS_FLAG) { |
| 1963 |
save_flags &= ~COLUMN_IFADMINSTATUS_FLAG; /* clear ifAdminStatus */ |
| 1964 |
/* |
| 1965 |
* TODO:482:o: |-> commit column ifAdminStatus. |
| 1966 |
*/ |
| 1967 |
rc = netsnmp_access_interface_entry_set_admin_status(rowreq_ctx-> |
| 1968 |
data.ifentry, |
| 1969 |
rowreq_ctx-> |
| 1970 |
data. |
| 1971 |
ifAdminStatus); |
| 1972 |
if (0 != rc) { |
| 1973 |
snmp_log(LOG_ERR, |
| 1974 |
"ifTable column ifAdminStatus commit failed\n"); |
| 1975 |
} else { |
| 1976 |
/* |
| 1977 |
* set flag, in case we need to undo ifAdminStatus |
| 1978 |
*/ |
| 1979 |
rowreq_ctx->column_set_flags |= COLUMN_IFADMINSTATUS_FLAG; |
| 1980 |
} |
| 1981 |
} |
| 1982 |
|
| 1983 |
/* |
| 1984 |
* if we successfully committed this row, set the dirty flag. |
| 1985 |
*/ |
| 1986 |
if (MFD_SUCCESS == rc) { |
| 1987 |
rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY; |
| 1988 |
} |
| 1989 |
|
| 1990 |
if (save_flags) { |
| 1991 |
snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n", |
| 1992 |
save_flags); |
| 1993 |
return MFD_ERROR; |
| 1994 |
} |
| 1995 |
|
| 1996 |
return rc; |
| 1997 |
} /* ifTable_commit */ |
| 1998 |
|
| 1999 |
/** |
| 2000 |
* undo commit new values. |
| 2001 |
* |
| 2002 |
* Should you need different behavior depending on which columns were |
| 2003 |
* set, rowreq_ctx->column_set_flags will indicate which writeable columns were |
| 2004 |
* set. The definitions for the COLUMN_*_FLAG bits can be found in |
| 2005 |
* ifTable.h. |
| 2006 |
* A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. |
| 2007 |
* |
| 2008 |
* @param rowreq_ctx |
| 2009 |
* Pointer to the users context. |
| 2010 |
* |
| 2011 |
* @retval MFD_SUCCESS : success |
| 2012 |
* @retval MFD_ERROR : error |
| 2013 |
*/ |
| 2014 |
int |
| 2015 |
ifTable_undo_commit(ifTable_rowreq_ctx * rowreq_ctx) |
| 2016 |
{ |
| 2017 |
int rc = MFD_SUCCESS; |
| 2018 |
|
| 2019 |
DEBUGMSGTL(("verbose:ifTable:ifTable_undo_commit", "called\n")); |
| 2020 |
|
| 2021 |
/** we should have a non-NULL pointer */ |
| 2022 |
netsnmp_assert(NULL != rowreq_ctx); |
| 2023 |
|
| 2024 |
/* |
| 2025 |
* TODO:485:M: |-> Undo ifTable commit. |
| 2026 |
* check the column's flag in rowreq_ctx->column_set_flags to see |
| 2027 |
* if it was set during commit, then undo it. |
| 2028 |
* |
| 2029 |
* eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {} |
| 2030 |
*/ |
| 2031 |
/* |
| 2032 |
* no undo cleanup, undo entry simply freed |
| 2033 |
*/ |
| 2034 |
|
| 2035 |
|
| 2036 |
/* |
| 2037 |
* if we successfully un-committed this row, clear the dirty flag. |
| 2038 |
*/ |
| 2039 |
if (MFD_SUCCESS == rc) { |
| 2040 |
rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY; |
| 2041 |
} |
| 2042 |
|
| 2043 |
return rc; |
| 2044 |
} /* ifTable_undo_commit */ |
| 2045 |
|
| 2046 |
/* |
| 2047 |
* TODO:440:M: Implement ifTable node value checks. |
| 2048 |
* TODO:450:M: Implement ifTable undo functions. |
| 2049 |
* TODO:460:M: Implement ifTable set functions. |
| 2050 |
* TODO:480:M: Implement ifTable commit functions. |
| 2051 |
*/ |
| 2052 |
/*--------------------------------------------------------------------- |
| 2053 |
* IF-MIB::ifEntry.ifAdminStatus |
| 2054 |
* ifAdminStatus is subid 7 of ifEntry. |
| 2055 |
* Its status is Current, and its access level is ReadWrite. |
| 2056 |
* OID: .1.3.6.1.2.1.2.2.1.7 |
| 2057 |
* Description: |
| 2058 |
The desired state of the interface. The testing(3) state |
| 2059 |
indicates that no operational packets can be passed. When a |
| 2060 |
managed system initializes, all interfaces start with |
| 2061 |
ifAdminStatus in the down(2) state. As a result of either |
| 2062 |
explicit management action or per configuration information |
| 2063 |
retained by the managed system, ifAdminStatus is then |
| 2064 |
changed to either the up(1) or testing(3) states (or remains |
| 2065 |
in the down(2) state). |
| 2066 |
* |
| 2067 |
* Attributes: |
| 2068 |
* accessible 1 isscalar 0 enums 1 hasdefval 0 |
| 2069 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 2070 |
* settable 1 |
| 2071 |
* |
| 2072 |
* Enum range: 2/8. Values: up(1), down(2), testing(3) |
| 2073 |
* |
| 2074 |
* Its syntax is INTEGER (based on perltype INTEGER) |
| 2075 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 2076 |
*/ |
| 2077 |
/** |
| 2078 |
* Check that the proposed new value is potentially valid. |
| 2079 |
* |
| 2080 |
* @param rowreq_ctx |
| 2081 |
* Pointer to the row request context. |
| 2082 |
* @param ifAdminStatus_val |
| 2083 |
* A long containing the new value. |
| 2084 |
* |
| 2085 |
* @retval MFD_SUCCESS : incoming value is legal |
| 2086 |
* @retval MFD_NOT_VALID_NOW : incoming value is not valid now |
| 2087 |
* @retval MFD_NOT_VALID_EVER : incoming value is never valid |
| 2088 |
* |
| 2089 |
* This is the place to check for requirements that are not |
| 2090 |
* expressed in the mib syntax (for example, a requirement that |
| 2091 |
* is detailed in the description for an object). |
| 2092 |
* |
| 2093 |
* You should check that the requested change between the undo value and the |
| 2094 |
* new value is legal (ie, the transistion from one value to another |
| 2095 |
* is legal). |
| 2096 |
* |
| 2097 |
*@note |
| 2098 |
* This check is only to determine if the new value |
| 2099 |
* is \b potentially valid. This is the first check of many, and |
| 2100 |
* is one of the simplest ones. |
| 2101 |
* |
| 2102 |
*@note |
| 2103 |
* this is not the place to do any checks for values |
| 2104 |
* which depend on some other value in the mib. Those |
| 2105 |
* types of checks should be done in the |
| 2106 |
* ifTable_check_dependencies() function. |
| 2107 |
* |
| 2108 |
* The following checks have already been done for you: |
| 2109 |
* The syntax is ASN_INTEGER |
| 2110 |
* The value is one of up(1), down(2), testing(3) |
| 2111 |
* |
| 2112 |
* If there a no other checks you need to do, simply return MFD_SUCCESS. |
| 2113 |
* |
| 2114 |
*/ |
| 2115 |
int |
| 2116 |
ifAdminStatus_check_value(ifTable_rowreq_ctx * rowreq_ctx, |
| 2117 |
u_long ifAdminStatus_val) |
| 2118 |
{ |
| 2119 |
DEBUGMSGTL(("verbose:ifTable:ifAdminStatus_check_value", "called\n")); |
| 2120 |
|
| 2121 |
/** should never get a NULL pointer */ |
| 2122 |
netsnmp_assert(NULL != rowreq_ctx); |
| 2123 |
|
| 2124 |
/* |
| 2125 |
* TODO:441:o: |-> Check for valid ifAdminStatus value. |
| 2126 |
*/ |
| 2127 |
/* |
| 2128 |
* we don't support test |
| 2129 |
*/ |
| 2130 |
if (ifAdminStatus_val == IFADMINSTATUS_TESTING) |
| 2131 |
return MFD_ERROR; |
| 2132 |
|
| 2133 |
return MFD_SUCCESS; /* ifAdminStatus value not illegal */ |
| 2134 |
} /* ifAdminStatus_check_value */ |
| 2135 |
|
| 2136 |
/** |
| 2137 |
* Save old value information |
| 2138 |
* |
| 2139 |
* @param rowreq_ctx |
| 2140 |
* Pointer to the table context (ifTable_rowreq_ctx) |
| 2141 |
* |
| 2142 |
* @retval MFD_SUCCESS : success |
| 2143 |
* @retval MFD_ERROR : error. set will fail. |
| 2144 |
* |
| 2145 |
* This function will be called after the table level undo setup function |
| 2146 |
* ifTable_undo_setup has been called. |
| 2147 |
* |
| 2148 |
*@note |
| 2149 |
* this function will only be called if a new value is set for this column. |
| 2150 |
* |
| 2151 |
* If there is any setup specific to a particular column (e.g. allocating |
| 2152 |
* memory for a string), you should do that setup in this function, so it |
| 2153 |
* won't be done unless it is necessary. |
| 2154 |
*/ |
| 2155 |
int |
| 2156 |
ifAdminStatus_undo_setup(ifTable_rowreq_ctx * rowreq_ctx) |
| 2157 |
{ |
| 2158 |
DEBUGMSGTL(("verbose:ifTable:ifAdminStatus_undo_setup", "called\n")); |
| 2159 |
|
| 2160 |
/** should never get a NULL pointer */ |
| 2161 |
netsnmp_assert(NULL != rowreq_ctx); |
| 2162 |
|
| 2163 |
/* |
| 2164 |
* TODO:455:o: |-> Setup ifAdminStatus undo. |
| 2165 |
*/ |
| 2166 |
/* |
| 2167 |
* copy ifAdminStatus data |
| 2168 |
* set rowreq_ctx->undo->ifAdminStatus from rowreq_ctx->data.ifAdminStatus |
| 2169 |
*/ |
| 2170 |
rowreq_ctx->undo->ifAdminStatus = rowreq_ctx->data.ifAdminStatus; |
| 2171 |
|
| 2172 |
return MFD_SUCCESS; |
| 2173 |
} /* ifAdminStatus_undo_setup */ |
| 2174 |
|
| 2175 |
/** |
| 2176 |
* Set the new value. |
| 2177 |
* |
| 2178 |
* @param rowreq_ctx |
| 2179 |
* Pointer to the users context. You should know how to |
| 2180 |
* manipulate the value from this object. |
| 2181 |
* @param ifAdminStatus_val |
| 2182 |
* A long containing the new value. |
| 2183 |
*/ |
| 2184 |
int |
| 2185 |
ifAdminStatus_set(ifTable_rowreq_ctx * rowreq_ctx, |
| 2186 |
u_long ifAdminStatus_val) |
| 2187 |
{ |
| 2188 |
|
| 2189 |
DEBUGMSGTL(("verbose:ifTable:ifAdminStatus_set", "called\n")); |
| 2190 |
|
| 2191 |
/** should never get a NULL pointer */ |
| 2192 |
netsnmp_assert(NULL != rowreq_ctx); |
| 2193 |
|
| 2194 |
/* |
| 2195 |
* TODO:461:M: |-> Set ifAdminStatus value. |
| 2196 |
* set ifAdminStatus value in rowreq_ctx->data |
| 2197 |
*/ |
| 2198 |
rowreq_ctx->data.ifAdminStatus = ifAdminStatus_val; |
| 2199 |
|
| 2200 |
return MFD_SUCCESS; |
| 2201 |
} /* ifAdminStatus_set */ |
| 2202 |
|
| 2203 |
/** |
| 2204 |
* undo the previous set. |
| 2205 |
* |
| 2206 |
* @param rowreq_ctx |
| 2207 |
* Pointer to the users context. |
| 2208 |
*/ |
| 2209 |
int |
| 2210 |
ifAdminStatus_undo(ifTable_rowreq_ctx * rowreq_ctx) |
| 2211 |
{ |
| 2212 |
|
| 2213 |
DEBUGMSGTL(("verbose:ifTable:ifAdminStatus_undo", "called\n")); |
| 2214 |
|
| 2215 |
netsnmp_assert(NULL != rowreq_ctx); |
| 2216 |
|
| 2217 |
/* |
| 2218 |
* TODO:456:o: |-> Clean up ifAdminStatus undo. |
| 2219 |
*/ |
| 2220 |
/* |
| 2221 |
* copy ifAdminStatus data |
| 2222 |
* set rowreq_ctx->data.ifAdminStatus from rowreq_ctx->undo->ifAdminStatus |
| 2223 |
*/ |
| 2224 |
rowreq_ctx->data.ifAdminStatus = rowreq_ctx->undo->ifAdminStatus; |
| 2225 |
|
| 2226 |
|
| 2227 |
return MFD_SUCCESS; |
| 2228 |
} /* ifAdminStatus_undo */ |
| 2229 |
|
| 2230 |
/** |
| 2231 |
* check dependencies |
| 2232 |
* |
| 2233 |
* This is useful for for tables which have dependencies between columns |
| 2234 |
* (or rows, or tables). For example, two columns allocating a percentage |
| 2235 |
* of something add up 100%. |
| 2236 |
* |
| 2237 |
* Should you need different behavior depending on which columns were |
| 2238 |
* set, rowreq_ctx->column_set_flags will indicate which writeable columns were |
| 2239 |
* set. The definitions for the COLUMN_*_FLAG bits can be found in |
| 2240 |
* ifTable.h. |
| 2241 |
* A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. |
| 2242 |
* |
| 2243 |
* @param rowreq_ctx |
| 2244 |
* |
| 2245 |
* @retval MFD_SUCCESS all the changes to the row are legal |
| 2246 |
* @retval MFD_ERROR one or more changes are not legal |
| 2247 |
* |
| 2248 |
* (see README-table-ifTable if you don't have dependencies) |
| 2249 |
*/ |
| 2250 |
int |
| 2251 |
ifTable_check_dependencies(ifTable_rowreq_ctx * rowreq_ctx) |
| 2252 |
{ |
| 2253 |
int rc = MFD_SUCCESS; |
| 2254 |
|
| 2255 |
DEBUGMSGTL(("internal:ifTable:ifTable_check_dependencies", |
| 2256 |
"called\n")); |
| 2257 |
|
| 2258 |
netsnmp_assert(NULL != rowreq_ctx); |
| 2259 |
|
| 2260 |
/* |
| 2261 |
* TODO:470:o: Check ifTable row dependencies. |
| 2262 |
* check that all new value are legal and consistent with each other |
| 2263 |
*/ |
| 2264 |
return rc; |
| 2265 |
} /* ifTable_check_dependencies */ |
| 2266 |
|
| 2267 |
|
| 2268 |
#endif /* !NETSNMP_NO_WRITE_SUPPORT */ |
| 2269 |
|
| 2270 |
static int |
| 2271 |
_if_number_handler(netsnmp_mib_handler *handler, |
| 2272 |
netsnmp_handler_registration *reginfo, |
| 2273 |
netsnmp_agent_request_info *reqinfo, |
| 2274 |
netsnmp_request_info *requests) |
| 2275 |
{ |
| 2276 |
if (MODE_GET == reqinfo->mode) { |
| 2277 |
int val = ifTable_container_size(); |
| 2278 |
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, |
| 2279 |
(u_char *) &val, sizeof(val)); |
| 2280 |
} else |
| 2281 |
netsnmp_assert("bad mode in RO handler"); |
| 2282 |
|
| 2283 |
if (handler->next && handler->next->access_method) |
| 2284 |
return netsnmp_call_next_handler(handler, reginfo, reqinfo, |
| 2285 |
requests); |
| 2286 |
|
| 2287 |
return SNMP_ERR_NOERROR; |
| 2288 |
} |
| 2289 |
|
| 2290 |
/** @} */ |
| 2291 |
/** @{ */ |