| 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 ifXTable |
| 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 |
#include <ctype.h> |
| 22 |
|
| 23 |
/* |
| 24 |
* include our parent header |
| 25 |
*/ |
| 26 |
#include "ifXTable.h" |
| 27 |
#include "if-mib/ifTable/ifTable_defs.h" |
| 28 |
|
| 29 |
#include <net-snmp/agent/mib_modules.h> |
| 30 |
|
| 31 |
#include "ifXTable_interface.h" |
| 32 |
|
| 33 |
netsnmp_feature_require(ifTable_container_get); |
| 34 |
netsnmp_feature_require(ifTable_container_size); |
| 35 |
|
| 36 |
/* |
| 37 |
* not sure if we want to support set for promiscuous mode, because |
| 38 |
* 1) careful thought should go into any settable object that performs |
| 39 |
* an action that requires root access |
| 40 |
* 2) i don't want to write the code right now |
| 41 |
* |
| 42 |
*/ |
| 43 |
#undef NETSNMP_ENABLE_PROMISCUOUSMODE_SET |
| 44 |
|
| 45 |
const oid ifXTable_oid[] = { IFXTABLE_OID }; |
| 46 |
const int ifXTable_oid_size = OID_LENGTH(ifXTable_oid); |
| 47 |
|
| 48 |
ifXTable_registration ifXTable_user_context; |
| 49 |
static ifXTable_registration *ifXTable_user_context_p; |
| 50 |
|
| 51 |
/** |
| 52 |
* Initializes the ifXTable module |
| 53 |
*/ |
| 54 |
void |
| 55 |
init_ifXTable(void) |
| 56 |
{ |
| 57 |
DEBUGMSGTL(("verbose:ifXTable:init_ifXTable", "called\n")); |
| 58 |
|
| 59 |
/* |
| 60 |
* TODO:300:o: Perform ifXTable one-time module initialization. |
| 61 |
*/ |
| 62 |
|
| 63 |
/* |
| 64 |
* here we initialize all the tables we're planning on supporting |
| 65 |
*/ |
| 66 |
init_ifTable(); |
| 67 |
|
| 68 |
} /* init_ifXTable */ |
| 69 |
|
| 70 |
/** |
| 71 |
* Initialize the table ifXTable |
| 72 |
* (Define its contents and how it's structured) |
| 73 |
*/ |
| 74 |
void |
| 75 |
initialize_table_ifXTable(void) |
| 76 |
{ |
| 77 |
u_long flags; |
| 78 |
|
| 79 |
DEBUGMSGTL(("verbose:ifXTable:initialize_table_ifXTable", "called\n")); |
| 80 |
|
| 81 |
/* |
| 82 |
* TODO:301:o: Perform ifXTable one-time table initialization. |
| 83 |
*/ |
| 84 |
|
| 85 |
/* |
| 86 |
* TODO:302:o: |->Initialize ifXTable user context |
| 87 |
* if you'd like to pass in a pointer to some data for this |
| 88 |
* table, allocate or set it up here. |
| 89 |
*/ |
| 90 |
/* |
| 91 |
* a netsnmp_data_list is a simple way to store void pointers. A simple |
| 92 |
* string token is used to add, find or remove pointers. |
| 93 |
*/ |
| 94 |
ifXTable_user_context_p = netsnmp_create_data_list("ifXTable", NULL, NULL); |
| 95 |
|
| 96 |
/* |
| 97 |
* No support for any flags yet, but in the future you would |
| 98 |
* set any flags here. |
| 99 |
*/ |
| 100 |
flags = 0; |
| 101 |
|
| 102 |
/* |
| 103 |
* call interface initialization code |
| 104 |
*/ |
| 105 |
_ifXTable_initialize_interface(ifXTable_user_context_p, flags); |
| 106 |
|
| 107 |
/* |
| 108 |
* if there is no container, bail. otherwise, register the callbacks |
| 109 |
* for persistent storage. |
| 110 |
*/ |
| 111 |
if (NULL == ifTable_container_get()) |
| 112 |
return; /* msg already logged */ |
| 113 |
|
| 114 |
} /* initialize_table_ifXTable */ |
| 115 |
|
| 116 |
void |
| 117 |
shutdown_ifXTable(void) |
| 118 |
{ |
| 119 |
netsnmp_free_all_list_data(ifXTable_user_context_p); |
| 120 |
ifXTable_user_context_p = NULL; |
| 121 |
} |
| 122 |
|
| 123 |
/** |
| 124 |
* extra context initialization (eg default values) |
| 125 |
* |
| 126 |
* @param rowreq_ctx : row request context |
| 127 |
* @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate) |
| 128 |
* |
| 129 |
* @retval MFD_SUCCESS : no errors |
| 130 |
* @retval MFD_ERROR : error (context allocate will fail) |
| 131 |
*/ |
| 132 |
int |
| 133 |
ifXTable_rowreq_ctx_init(ifXTable_rowreq_ctx * rowreq_ctx, |
| 134 |
void *user_init_ctx) |
| 135 |
{ |
| 136 |
DEBUGMSGTL(("verbose:ifXTable:ifXTable_rowreq_ctx_init", "called\n")); |
| 137 |
|
| 138 |
netsnmp_assert(NULL != rowreq_ctx); |
| 139 |
|
| 140 |
/* |
| 141 |
* TODO:210:o: |-> Perform extra ifXTable rowreq initialization. (eg DEFVALS) |
| 142 |
* should never get here - ifTable should handle this |
| 143 |
*/ |
| 144 |
netsnmp_assert(0); |
| 145 |
|
| 146 |
return MFD_ERROR; |
| 147 |
} /* ifXTable_rowreq_ctx_init */ |
| 148 |
|
| 149 |
/** |
| 150 |
* extra context cleanup |
| 151 |
* |
| 152 |
*/ |
| 153 |
void |
| 154 |
ifXTable_rowreq_ctx_cleanup(ifXTable_rowreq_ctx * rowreq_ctx) |
| 155 |
{ |
| 156 |
DEBUGMSGTL(("verbose:ifXTable:ifXTable_rowreq_ctx_cleanup", |
| 157 |
"called\n")); |
| 158 |
|
| 159 |
netsnmp_assert(NULL != rowreq_ctx); |
| 160 |
|
| 161 |
/* |
| 162 |
* TODO:211:o: |-> Perform extra ifXTable rowreq cleanup. |
| 163 |
*/ |
| 164 |
/* |
| 165 |
* should never get here - ifTable should handle this |
| 166 |
*/ |
| 167 |
netsnmp_assert(0); |
| 168 |
} /* ifXTable_rowreq_ctx_cleanup */ |
| 169 |
|
| 170 |
/** |
| 171 |
* the *_should_save routine is called to determine if a row |
| 172 |
* should be stored persistently. |
| 173 |
* |
| 174 |
* Note that this is not a 'dirty' check (i.e. if a row has changed), |
| 175 |
* but a check for volatile rows that should not be saved between |
| 176 |
* restarts. |
| 177 |
* |
| 178 |
* @param rowreq_ctx |
| 179 |
* |
| 180 |
* @return 1 if the row should be stored |
| 181 |
* @return 0 if the row should not be stored |
| 182 |
*/ |
| 183 |
int |
| 184 |
ifXTable_container_should_save(ifXTable_rowreq_ctx * rowreq_ctx) |
| 185 |
{ |
| 186 |
|
| 187 |
return 1; /* save the row */ |
| 188 |
} |
| 189 |
|
| 190 |
/** |
| 191 |
* pre-request callback |
| 192 |
* |
| 193 |
* @param user_context |
| 194 |
* @retval MFD_SUCCESS : success. |
| 195 |
* @retval MFD_ERROR : other error |
| 196 |
*/ |
| 197 |
int |
| 198 |
ifXTable_pre_request(ifXTable_registration * user_context) |
| 199 |
{ |
| 200 |
DEBUGMSGTL(("verbose:ifXTable:ifXTable_pre_request", "called\n")); |
| 201 |
|
| 202 |
/* |
| 203 |
* TODO:510:o: Perform ifXTable pre-request actions. |
| 204 |
*/ |
| 205 |
|
| 206 |
return MFD_SUCCESS; |
| 207 |
} /* ifXTable_pre_request */ |
| 208 |
|
| 209 |
/** |
| 210 |
* post-request callback |
| 211 |
* |
| 212 |
* Note: |
| 213 |
* New rows have been inserted into the container, and |
| 214 |
* deleted rows have been removed from the container and |
| 215 |
* released. |
| 216 |
* |
| 217 |
* @param user_context |
| 218 |
* @param rc : MFD_SUCCESS if all requests succeeded |
| 219 |
* |
| 220 |
* @retval MFD_SUCCESS : success. |
| 221 |
* @retval MFD_ERROR : other error (ignored) |
| 222 |
*/ |
| 223 |
int |
| 224 |
ifXTable_post_request(ifXTable_registration * user_context, int rc) |
| 225 |
{ |
| 226 |
DEBUGMSGTL(("verbose:ifXTable:ifXTable_post_request", "called\n")); |
| 227 |
|
| 228 |
/* |
| 229 |
* TODO:511:o: Perform ifXTable post-request actions. |
| 230 |
*/ |
| 231 |
|
| 232 |
/* |
| 233 |
* check to set if any rows were changed. |
| 234 |
*/ |
| 235 |
if (ifXTable_dirty_get()) { |
| 236 |
/* |
| 237 |
* check if request was successful. If so, this would be |
| 238 |
* a good place to save data to its persistent store. |
| 239 |
*/ |
| 240 |
if (MFD_SUCCESS == rc) { |
| 241 |
/* |
| 242 |
* notify library to save changed rows |
| 243 |
*/ |
| 244 |
snmp_store_needed(netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, |
| 245 |
NETSNMP_DS_LIB_APPTYPE)); |
| 246 |
} |
| 247 |
|
| 248 |
ifXTable_dirty_set(0); /* clear table dirty flag */ |
| 249 |
} |
| 250 |
|
| 251 |
return MFD_SUCCESS; |
| 252 |
} /* ifXTable_post_request */ |
| 253 |
|
| 254 |
|
| 255 |
/********************************************************************** |
| 256 |
********************************************************************** |
| 257 |
*** |
| 258 |
*** Table ifXTable |
| 259 |
*** |
| 260 |
********************************************************************** |
| 261 |
**********************************************************************/ |
| 262 |
/* |
| 263 |
* IF-MIB::ifXTable is subid 1 of ifMIBObjects. |
| 264 |
* Its status is Current. |
| 265 |
* OID: .1.3.6.1.2.1.31.1.1, length: 9 |
| 266 |
*/ |
| 267 |
|
| 268 |
/* |
| 269 |
* --------------------------------------------------------------------- |
| 270 |
* * TODO:200:r: Implement ifXTable data context functions. |
| 271 |
*/ |
| 272 |
|
| 273 |
|
| 274 |
/** |
| 275 |
* set mib index(es) |
| 276 |
* |
| 277 |
* @param tbl_idx mib index structure |
| 278 |
* @param ifIndex_val |
| 279 |
* |
| 280 |
* @retval MFD_SUCCESS : success. |
| 281 |
* @retval MFD_ERROR : other error. |
| 282 |
* |
| 283 |
* @remark |
| 284 |
* This convenience function is useful for setting all the MIB index |
| 285 |
* components with a single function call. It is assume that the C values |
| 286 |
* have already been mapped from their native/rawformat to the MIB format. |
| 287 |
*/ |
| 288 |
int |
| 289 |
ifXTable_indexes_set_tbl_idx(ifXTable_mib_index * tbl_idx, |
| 290 |
long ifIndex_val) |
| 291 |
{ |
| 292 |
DEBUGMSGTL(("verbose:ifXTable:ifXTable_indexes_set_tbl_idx", |
| 293 |
"called\n")); |
| 294 |
|
| 295 |
/* |
| 296 |
* ifIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H |
| 297 |
*/ |
| 298 |
tbl_idx->ifIndex = ifIndex_val; |
| 299 |
|
| 300 |
|
| 301 |
return MFD_SUCCESS; |
| 302 |
} /* ifXTable_indexes_set_tbl_idx */ |
| 303 |
|
| 304 |
/** |
| 305 |
* @internal |
| 306 |
* set row context indexes |
| 307 |
* |
| 308 |
* @param reqreq_ctx the row context that needs updated indexes |
| 309 |
* @param ifIndex_val |
| 310 |
* |
| 311 |
* @retval MFD_SUCCESS : success. |
| 312 |
* @retval MFD_ERROR : other error. |
| 313 |
* |
| 314 |
* @remark |
| 315 |
* This function sets the mib indexs, then updates the oid indexs |
| 316 |
* from the mib index. |
| 317 |
*/ |
| 318 |
int |
| 319 |
ifXTable_indexes_set(ifXTable_rowreq_ctx * rowreq_ctx, long ifIndex_val) |
| 320 |
{ |
| 321 |
DEBUGMSGTL(("verbose:ifXTable:ifXTable_indexes_set", "called\n")); |
| 322 |
|
| 323 |
if (MFD_SUCCESS != |
| 324 |
ifXTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx, ifIndex_val)) |
| 325 |
return MFD_ERROR; |
| 326 |
|
| 327 |
/* |
| 328 |
* convert mib index to oid index |
| 329 |
*/ |
| 330 |
rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid); |
| 331 |
if (0 != ifXTable_index_to_oid(&rowreq_ctx->oid_idx, |
| 332 |
&rowreq_ctx->tbl_idx)) { |
| 333 |
return MFD_ERROR; |
| 334 |
} |
| 335 |
|
| 336 |
return MFD_SUCCESS; |
| 337 |
} /* ifXTable_indexes_set */ |
| 338 |
|
| 339 |
|
| 340 |
/*--------------------------------------------------------------------- |
| 341 |
* IF-MIB::ifXEntry.ifName |
| 342 |
* ifName is subid 1 of ifXEntry. |
| 343 |
* Its status is Current, and its access level is ReadOnly. |
| 344 |
* OID: .1.3.6.1.2.1.31.1.1.1.1 |
| 345 |
* Description: |
| 346 |
The textual name of the interface. The value of this |
| 347 |
object should be the name of the interface as assigned by |
| 348 |
the local device and should be suitable for use in commands |
| 349 |
entered at the device's `console'. This might be a text |
| 350 |
name, such as `le0' or a simple port number, such as `1', |
| 351 |
depending on the interface naming syntax of the device. If |
| 352 |
several entries in the ifTable together represent a single |
| 353 |
interface as named by the device, then each will have the |
| 354 |
same value of ifName. Note that for an agent which responds |
| 355 |
to SNMP queries concerning an interface on some other |
| 356 |
(proxied) device, then the value of ifName for such an |
| 357 |
interface is the proxied device's local name for it. |
| 358 |
|
| 359 |
If there is no local name, or this object is otherwise not |
| 360 |
applicable, then this object contains a zero-length string. |
| 361 |
* |
| 362 |
* Attributes: |
| 363 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 364 |
* readable 1 iscolumn 1 ranges 1 hashint 1 |
| 365 |
* settable 0 |
| 366 |
* hint: 255a |
| 367 |
* |
| 368 |
* Ranges: 0 - 255; |
| 369 |
* |
| 370 |
* Its syntax is DisplayString (based on perltype OCTETSTR) |
| 371 |
* The net-snmp type is ASN_OCTET_STR. The C type decl is char (char) |
| 372 |
* This data type requires a length. (Max 255) |
| 373 |
*/ |
| 374 |
/** |
| 375 |
* Extract the current value of the ifName data. |
| 376 |
* |
| 377 |
* Set a value using the data context for the row. |
| 378 |
* |
| 379 |
* @param rowreq_ctx |
| 380 |
* Pointer to the row request context. |
| 381 |
* @param ifName_val_ptr_ptr |
| 382 |
* Pointer to storage for a char variable |
| 383 |
* @param ifName_val_ptr_len_ptr |
| 384 |
* Pointer to a size_t. On entry, it will contain the size (in bytes) |
| 385 |
* pointed to by ifName. |
| 386 |
* On exit, this value should contain the data size (in bytes). |
| 387 |
* |
| 388 |
* @retval MFD_SUCCESS : success |
| 389 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 390 |
* @retval MFD_ERROR : Any other error |
| 391 |
* |
| 392 |
* @note If you need more than (*ifName_val_ptr_len_ptr) bytes of memory, |
| 393 |
* allocate it using malloc() and update ifName_val_ptr_ptr. |
| 394 |
* <b>DO NOT</b> free the previous pointer. |
| 395 |
* The MFD helper will release the memory you allocate. |
| 396 |
* |
| 397 |
* @remark If you call this function yourself, you are responsible |
| 398 |
* for checking if the pointer changed, and freeing any |
| 399 |
* previously allocated memory. (Not necessary if you pass |
| 400 |
* in a pointer to static memory, obviously.) |
| 401 |
*/ |
| 402 |
int |
| 403 |
ifName_get(ifXTable_rowreq_ctx * rowreq_ctx, char **ifName_val_ptr_ptr, |
| 404 |
size_t * ifName_val_ptr_len_ptr) |
| 405 |
{ |
| 406 |
size_t tmp_len; |
| 407 |
|
| 408 |
/** we should have a non-NULL pointer and enough storage */ |
| 409 |
netsnmp_assert((NULL != ifName_val_ptr_ptr) |
| 410 |
&& (NULL != *ifName_val_ptr_ptr)); |
| 411 |
netsnmp_assert(NULL != ifName_val_ptr_len_ptr); |
| 412 |
|
| 413 |
|
| 414 |
DEBUGMSGTL(("verbose:ifXTable:ifName_get", "called\n")); |
| 415 |
|
| 416 |
netsnmp_assert(NULL != rowreq_ctx); |
| 417 |
|
| 418 |
/* |
| 419 |
* TODO:231:o: |-> Extract the current value of the ifName data. |
| 420 |
* copy (* ifName_val_ptr_ptr ) data and (* ifName_val_ptr_len_ptr ) from rowreq_ctx->data |
| 421 |
*/ |
| 422 |
/* |
| 423 |
* make sure there is enough space for ifName data |
| 424 |
*/ |
| 425 |
tmp_len = strlen(rowreq_ctx->data.ifName); |
| 426 |
if ((NULL == (*ifName_val_ptr_ptr)) || |
| 427 |
((*ifName_val_ptr_len_ptr) < tmp_len)) { |
| 428 |
/* |
| 429 |
* allocate space for ifName data |
| 430 |
*/ |
| 431 |
(*ifName_val_ptr_ptr) = (char*)malloc(tmp_len); |
| 432 |
if (NULL == (*ifName_val_ptr_ptr)) { |
| 433 |
snmp_log(LOG_ERR, "could not allocate memory\n"); |
| 434 |
return MFD_ERROR; |
| 435 |
} |
| 436 |
} |
| 437 |
(*ifName_val_ptr_len_ptr) = tmp_len; |
| 438 |
memcpy((*ifName_val_ptr_ptr), rowreq_ctx->data.ifName, tmp_len); |
| 439 |
|
| 440 |
return MFD_SUCCESS; |
| 441 |
} /* ifName_get */ |
| 442 |
|
| 443 |
/*--------------------------------------------------------------------- |
| 444 |
* IF-MIB::ifXEntry.ifInMulticastPkts |
| 445 |
* ifInMulticastPkts is subid 2 of ifXEntry. |
| 446 |
* Its status is Current, and its access level is ReadOnly. |
| 447 |
* OID: .1.3.6.1.2.1.31.1.1.1.2 |
| 448 |
* Description: |
| 449 |
The number of packets, delivered by this sub-layer to a |
| 450 |
higher (sub-)layer, which were addressed to a multicast |
| 451 |
address at this sub-layer. For a MAC layer protocol, this |
| 452 |
includes both Group and Functional addresses. |
| 453 |
|
| 454 |
Discontinuities in the value of this counter can occur at |
| 455 |
re-initialization of the management system, and at other |
| 456 |
|
| 457 |
times as indicated by the value of |
| 458 |
ifCounterDiscontinuityTime. |
| 459 |
* |
| 460 |
* Attributes: |
| 461 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 462 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 463 |
* settable 0 |
| 464 |
* |
| 465 |
* |
| 466 |
* Its syntax is COUNTER (based on perltype COUNTER) |
| 467 |
* The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) |
| 468 |
*/ |
| 469 |
/** |
| 470 |
* Extract the current value of the ifInMulticastPkts data. |
| 471 |
* |
| 472 |
* Set a value using the data context for the row. |
| 473 |
* |
| 474 |
* @param rowreq_ctx |
| 475 |
* Pointer to the row request context. |
| 476 |
* @param ifInMulticastPkts_val_ptr |
| 477 |
* Pointer to storage for a u_long variable |
| 478 |
* |
| 479 |
* @retval MFD_SUCCESS : success |
| 480 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 481 |
* @retval MFD_ERROR : Any other error |
| 482 |
*/ |
| 483 |
int |
| 484 |
ifInMulticastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx, |
| 485 |
u_long * ifInMulticastPkts_val_ptr) |
| 486 |
{ |
| 487 |
/** we should have a non-NULL pointer */ |
| 488 |
netsnmp_assert(NULL != ifInMulticastPkts_val_ptr); |
| 489 |
|
| 490 |
|
| 491 |
DEBUGMSGTL(("verbose:ifXTable:ifInMulticastPkts_get", "called\n")); |
| 492 |
|
| 493 |
netsnmp_assert(NULL != rowreq_ctx); |
| 494 |
|
| 495 |
/* |
| 496 |
* TODO:231:o: |-> Extract the current value of the ifInMulticastPkts data. |
| 497 |
* copy (* ifInMulticastPkts_val_ptr ) from rowreq_ctx->data |
| 498 |
*/ |
| 499 |
(*ifInMulticastPkts_val_ptr) = rowreq_ctx->data.ifInMulticastPkts; |
| 500 |
|
| 501 |
return MFD_SUCCESS; |
| 502 |
} /* ifInMulticastPkts_get */ |
| 503 |
|
| 504 |
/*--------------------------------------------------------------------- |
| 505 |
* IF-MIB::ifXEntry.ifInBroadcastPkts |
| 506 |
* ifInBroadcastPkts is subid 3 of ifXEntry. |
| 507 |
* Its status is Current, and its access level is ReadOnly. |
| 508 |
* OID: .1.3.6.1.2.1.31.1.1.1.3 |
| 509 |
* Description: |
| 510 |
The number of packets, delivered by this sub-layer to a |
| 511 |
higher (sub-)layer, which were addressed to a broadcast |
| 512 |
address at this sub-layer. |
| 513 |
|
| 514 |
Discontinuities in the value of this counter can occur at |
| 515 |
re-initialization of the management system, and at other |
| 516 |
times as indicated by the value of |
| 517 |
ifCounterDiscontinuityTime. |
| 518 |
* |
| 519 |
* Attributes: |
| 520 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 521 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 522 |
* settable 0 |
| 523 |
* |
| 524 |
* |
| 525 |
* Its syntax is COUNTER (based on perltype COUNTER) |
| 526 |
* The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) |
| 527 |
*/ |
| 528 |
/** |
| 529 |
* Extract the current value of the ifInBroadcastPkts data. |
| 530 |
* |
| 531 |
* Set a value using the data context for the row. |
| 532 |
* |
| 533 |
* @param rowreq_ctx |
| 534 |
* Pointer to the row request context. |
| 535 |
* @param ifInBroadcastPkts_val_ptr |
| 536 |
* Pointer to storage for a u_long variable |
| 537 |
* |
| 538 |
* @retval MFD_SUCCESS : success |
| 539 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 540 |
* @retval MFD_ERROR : Any other error |
| 541 |
*/ |
| 542 |
int |
| 543 |
ifInBroadcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx, |
| 544 |
u_long * ifInBroadcastPkts_val_ptr) |
| 545 |
{ |
| 546 |
/** we should have a non-NULL pointer */ |
| 547 |
netsnmp_assert(NULL != ifInBroadcastPkts_val_ptr); |
| 548 |
|
| 549 |
|
| 550 |
DEBUGMSGTL(("verbose:ifXTable:ifInBroadcastPkts_get", "called\n")); |
| 551 |
|
| 552 |
netsnmp_assert(NULL != rowreq_ctx); |
| 553 |
|
| 554 |
/* |
| 555 |
* TODO:231:o: |-> Extract the current value of the ifInBroadcastPkts data. |
| 556 |
* copy (* ifInBroadcastPkts_val_ptr ) from rowreq_ctx->data |
| 557 |
*/ |
| 558 |
(*ifInBroadcastPkts_val_ptr) = rowreq_ctx->data.ifInBroadcastPkts; |
| 559 |
|
| 560 |
return MFD_SUCCESS; |
| 561 |
} /* ifInBroadcastPkts_get */ |
| 562 |
|
| 563 |
/*--------------------------------------------------------------------- |
| 564 |
* IF-MIB::ifXEntry.ifOutMulticastPkts |
| 565 |
* ifOutMulticastPkts is subid 4 of ifXEntry. |
| 566 |
* Its status is Current, and its access level is ReadOnly. |
| 567 |
* OID: .1.3.6.1.2.1.31.1.1.1.4 |
| 568 |
* Description: |
| 569 |
The total number of packets that higher-level protocols |
| 570 |
requested be transmitted, and which were addressed to a |
| 571 |
multicast address at this sub-layer, including those that |
| 572 |
were discarded or not sent. For a MAC layer protocol, this |
| 573 |
includes both Group and Functional addresses. |
| 574 |
|
| 575 |
Discontinuities in the value of this counter can occur at |
| 576 |
re-initialization of the management system, and at other |
| 577 |
times as indicated by the value of |
| 578 |
ifCounterDiscontinuityTime. |
| 579 |
* |
| 580 |
* Attributes: |
| 581 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 582 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 583 |
* settable 0 |
| 584 |
* |
| 585 |
* |
| 586 |
* Its syntax is COUNTER (based on perltype COUNTER) |
| 587 |
* The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) |
| 588 |
*/ |
| 589 |
/** |
| 590 |
* Extract the current value of the ifOutMulticastPkts data. |
| 591 |
* |
| 592 |
* Set a value using the data context for the row. |
| 593 |
* |
| 594 |
* @param rowreq_ctx |
| 595 |
* Pointer to the row request context. |
| 596 |
* @param ifOutMulticastPkts_val_ptr |
| 597 |
* Pointer to storage for a u_long variable |
| 598 |
* |
| 599 |
* @retval MFD_SUCCESS : success |
| 600 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 601 |
* @retval MFD_ERROR : Any other error |
| 602 |
*/ |
| 603 |
int |
| 604 |
ifOutMulticastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx, |
| 605 |
u_long * ifOutMulticastPkts_val_ptr) |
| 606 |
{ |
| 607 |
/** we should have a non-NULL pointer */ |
| 608 |
netsnmp_assert(NULL != ifOutMulticastPkts_val_ptr); |
| 609 |
|
| 610 |
|
| 611 |
DEBUGMSGTL(("verbose:ifXTable:ifOutMulticastPkts_get", "called\n")); |
| 612 |
|
| 613 |
netsnmp_assert(NULL != rowreq_ctx); |
| 614 |
|
| 615 |
/* |
| 616 |
* TODO:231:o: |-> Extract the current value of the ifOutMulticastPkts data. |
| 617 |
* copy (* ifOutMulticastPkts_val_ptr ) from rowreq_ctx->data |
| 618 |
*/ |
| 619 |
(*ifOutMulticastPkts_val_ptr) = rowreq_ctx->data.ifOutMulticastPkts; |
| 620 |
|
| 621 |
return MFD_SUCCESS; |
| 622 |
} /* ifOutMulticastPkts_get */ |
| 623 |
|
| 624 |
/*--------------------------------------------------------------------- |
| 625 |
* IF-MIB::ifXEntry.ifOutBroadcastPkts |
| 626 |
* ifOutBroadcastPkts is subid 5 of ifXEntry. |
| 627 |
* Its status is Current, and its access level is ReadOnly. |
| 628 |
* OID: .1.3.6.1.2.1.31.1.1.1.5 |
| 629 |
* Description: |
| 630 |
The total number of packets that higher-level protocols |
| 631 |
requested be transmitted, and which were addressed to a |
| 632 |
broadcast address at this sub-layer, including those that |
| 633 |
were discarded or not sent. |
| 634 |
|
| 635 |
Discontinuities in the value of this counter can occur at |
| 636 |
re-initialization of the management system, and at other |
| 637 |
|
| 638 |
times as indicated by the value of |
| 639 |
ifCounterDiscontinuityTime. |
| 640 |
* |
| 641 |
* Attributes: |
| 642 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 643 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 644 |
* settable 0 |
| 645 |
* |
| 646 |
* |
| 647 |
* Its syntax is COUNTER (based on perltype COUNTER) |
| 648 |
* The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long) |
| 649 |
*/ |
| 650 |
/** |
| 651 |
* Extract the current value of the ifOutBroadcastPkts data. |
| 652 |
* |
| 653 |
* Set a value using the data context for the row. |
| 654 |
* |
| 655 |
* @param rowreq_ctx |
| 656 |
* Pointer to the row request context. |
| 657 |
* @param ifOutBroadcastPkts_val_ptr |
| 658 |
* Pointer to storage for a u_long variable |
| 659 |
* |
| 660 |
* @retval MFD_SUCCESS : success |
| 661 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 662 |
* @retval MFD_ERROR : Any other error |
| 663 |
*/ |
| 664 |
int |
| 665 |
ifOutBroadcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx, |
| 666 |
u_long * ifOutBroadcastPkts_val_ptr) |
| 667 |
{ |
| 668 |
/** we should have a non-NULL pointer */ |
| 669 |
netsnmp_assert(NULL != ifOutBroadcastPkts_val_ptr); |
| 670 |
|
| 671 |
|
| 672 |
DEBUGMSGTL(("verbose:ifXTable:ifOutBroadcastPkts_get", "called\n")); |
| 673 |
|
| 674 |
netsnmp_assert(NULL != rowreq_ctx); |
| 675 |
|
| 676 |
/* |
| 677 |
* TODO:231:o: |-> Extract the current value of the ifOutBroadcastPkts data. |
| 678 |
* copy (* ifOutBroadcastPkts_val_ptr ) from rowreq_ctx->data |
| 679 |
*/ |
| 680 |
(*ifOutBroadcastPkts_val_ptr) = rowreq_ctx->data.ifOutBroadcastPkts; |
| 681 |
|
| 682 |
return MFD_SUCCESS; |
| 683 |
} /* ifOutBroadcastPkts_get */ |
| 684 |
|
| 685 |
/*--------------------------------------------------------------------- |
| 686 |
* IF-MIB::ifXEntry.ifHCInOctets |
| 687 |
* ifHCInOctets is subid 6 of ifXEntry. |
| 688 |
* Its status is Current, and its access level is ReadOnly. |
| 689 |
* OID: .1.3.6.1.2.1.31.1.1.1.6 |
| 690 |
* Description: |
| 691 |
The total number of octets received on the interface, |
| 692 |
including framing characters. This object is a 64-bit |
| 693 |
version of ifInOctets. |
| 694 |
|
| 695 |
Discontinuities in the value of this counter can occur at |
| 696 |
re-initialization of the management system, and at other |
| 697 |
times as indicated by the value of |
| 698 |
ifCounterDiscontinuityTime. |
| 699 |
* |
| 700 |
* Attributes: |
| 701 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 702 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 703 |
* settable 0 |
| 704 |
* |
| 705 |
* |
| 706 |
* Its syntax is COUNTER64 (based on perltype COUNTER64) |
| 707 |
* The net-snmp type is ASN_COUNTER64. The C type is struct counter64. |
| 708 |
*/ |
| 709 |
/** |
| 710 |
* Extract the current value of the ifHCInOctets data. |
| 711 |
* |
| 712 |
* Set a value using the data context for the row. |
| 713 |
* |
| 714 |
* @param rowreq_ctx |
| 715 |
* Pointer to the row request context. |
| 716 |
* @param ifHCInOctets_val_ptr |
| 717 |
* Pointer to storage for a struct counter64 variable |
| 718 |
* |
| 719 |
* @retval MFD_SUCCESS : success |
| 720 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 721 |
* @retval MFD_ERROR : Any other error |
| 722 |
*/ |
| 723 |
int |
| 724 |
ifHCInOctets_get(ifXTable_rowreq_ctx * rowreq_ctx, |
| 725 |
struct counter64 *ifHCInOctets_val_ptr) |
| 726 |
{ |
| 727 |
/** we should have a non-NULL pointer */ |
| 728 |
netsnmp_assert(NULL != ifHCInOctets_val_ptr); |
| 729 |
|
| 730 |
/* |
| 731 |
* TODO:231:o: |-> copy ifHCInOctets data. |
| 732 |
* get (* ifHCInOctets_val_ptr ).low and (* ifHCInOctets_val_ptr ).high from rowreq_ctx->data |
| 733 |
*/ |
| 734 |
(*ifHCInOctets_val_ptr).high = rowreq_ctx->data.ifHCInOctets.high; |
| 735 |
(*ifHCInOctets_val_ptr).low = rowreq_ctx->data.ifHCInOctets.low; |
| 736 |
|
| 737 |
|
| 738 |
return MFD_SUCCESS; |
| 739 |
} /* ifHCInOctets_get */ |
| 740 |
|
| 741 |
/*--------------------------------------------------------------------- |
| 742 |
* IF-MIB::ifXEntry.ifHCInUcastPkts |
| 743 |
* ifHCInUcastPkts is subid 7 of ifXEntry. |
| 744 |
* Its status is Current, and its access level is ReadOnly. |
| 745 |
* OID: .1.3.6.1.2.1.31.1.1.1.7 |
| 746 |
* Description: |
| 747 |
The number of packets, delivered by this sub-layer to a |
| 748 |
higher (sub-)layer, which were not addressed to a multicast |
| 749 |
or broadcast address at this sub-layer. This object is a |
| 750 |
64-bit version of ifInUcastPkts. |
| 751 |
|
| 752 |
Discontinuities in the value of this counter can occur at |
| 753 |
re-initialization of the management system, and at other |
| 754 |
times as indicated by the value of |
| 755 |
ifCounterDiscontinuityTime. |
| 756 |
* |
| 757 |
* Attributes: |
| 758 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 759 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 760 |
* settable 0 |
| 761 |
* |
| 762 |
* |
| 763 |
* Its syntax is COUNTER64 (based on perltype COUNTER64) |
| 764 |
* The net-snmp type is ASN_COUNTER64. The C type is struct counter64 |
| 765 |
*/ |
| 766 |
/** |
| 767 |
* Extract the current value of the ifHCInUcastPkts data. |
| 768 |
* |
| 769 |
* Set a value using the data context for the row. |
| 770 |
* |
| 771 |
* @param rowreq_ctx |
| 772 |
* Pointer to the row request context. |
| 773 |
* @param ifHCInUcastPkts_val_ptr |
| 774 |
* Pointer to storage for a struct counter64 variable |
| 775 |
* |
| 776 |
* @retval MFD_SUCCESS : success |
| 777 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 778 |
* @retval MFD_ERROR : Any other error |
| 779 |
*/ |
| 780 |
int |
| 781 |
ifHCInUcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx, |
| 782 |
struct counter64 *ifHCInUcastPkts_val_ptr) |
| 783 |
{ |
| 784 |
/** we should have a non-NULL pointer */ |
| 785 |
netsnmp_assert(NULL != ifHCInUcastPkts_val_ptr); |
| 786 |
|
| 787 |
/* |
| 788 |
* TODO:231:o: |-> copy ifHCInUcastPkts data. |
| 789 |
* get (* ifHCInUcastPkts_val_ptr ).low and (* ifHCInUcastPkts_val_ptr ).high from rowreq_ctx->data |
| 790 |
*/ |
| 791 |
(*ifHCInUcastPkts_val_ptr).high = |
| 792 |
rowreq_ctx->data.ifHCInUcastPkts.high; |
| 793 |
(*ifHCInUcastPkts_val_ptr).low = rowreq_ctx->data.ifHCInUcastPkts.low; |
| 794 |
|
| 795 |
|
| 796 |
return MFD_SUCCESS; |
| 797 |
} /* ifHCInUcastPkts_get */ |
| 798 |
|
| 799 |
/*--------------------------------------------------------------------- |
| 800 |
* IF-MIB::ifXEntry.ifHCInMulticastPkts |
| 801 |
* ifHCInMulticastPkts is subid 8 of ifXEntry. |
| 802 |
* Its status is Current, and its access level is ReadOnly. |
| 803 |
* OID: .1.3.6.1.2.1.31.1.1.1.8 |
| 804 |
* Description: |
| 805 |
The number of packets, delivered by this sub-layer to a |
| 806 |
higher (sub-)layer, which were addressed to a multicast |
| 807 |
address at this sub-layer. For a MAC layer protocol, this |
| 808 |
includes both Group and Functional addresses. This object |
| 809 |
is a 64-bit version of ifInMulticastPkts. |
| 810 |
|
| 811 |
Discontinuities in the value of this counter can occur at |
| 812 |
re-initialization of the management system, and at other |
| 813 |
times as indicated by the value of |
| 814 |
ifCounterDiscontinuityTime. |
| 815 |
* |
| 816 |
* Attributes: |
| 817 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 818 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 819 |
* settable 0 |
| 820 |
* |
| 821 |
* |
| 822 |
* Its syntax is COUNTER64 (based on perltype COUNTER64) |
| 823 |
* The net-snmp type is ASN_COUNTER64. The C type is struct counter64 |
| 824 |
*/ |
| 825 |
/** |
| 826 |
* Extract the current value of the ifHCInMulticastPkts data. |
| 827 |
* |
| 828 |
* Set a value using the data context for the row. |
| 829 |
* |
| 830 |
* @param rowreq_ctx |
| 831 |
* Pointer to the row request context. |
| 832 |
* @param ifHCInMulticastPkts_val_ptr |
| 833 |
* Pointer to storage for a struct counter64 variable |
| 834 |
* |
| 835 |
* @retval MFD_SUCCESS : success |
| 836 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 837 |
* @retval MFD_ERROR : Any other error |
| 838 |
*/ |
| 839 |
int |
| 840 |
ifHCInMulticastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx, |
| 841 |
struct counter64 *ifHCInMulticastPkts_val_ptr) |
| 842 |
{ |
| 843 |
/** we should have a non-NULL pointer */ |
| 844 |
netsnmp_assert(NULL != ifHCInMulticastPkts_val_ptr); |
| 845 |
|
| 846 |
/* |
| 847 |
* TODO:231:o: |-> copy ifHCInMulticastPkts data. |
| 848 |
* get (* ifHCInMulticastPkts_val_ptr ).low and (* ifHCInMulticastPkts_val_ptr ).high from rowreq_ctx->data |
| 849 |
*/ |
| 850 |
(*ifHCInMulticastPkts_val_ptr).high = |
| 851 |
rowreq_ctx->data.ifHCInMulticastPkts.high; |
| 852 |
(*ifHCInMulticastPkts_val_ptr).low = |
| 853 |
rowreq_ctx->data.ifHCInMulticastPkts.low; |
| 854 |
|
| 855 |
|
| 856 |
return MFD_SUCCESS; |
| 857 |
} /* ifHCInMulticastPkts_get */ |
| 858 |
|
| 859 |
/*--------------------------------------------------------------------- |
| 860 |
* IF-MIB::ifXEntry.ifHCInBroadcastPkts |
| 861 |
* ifHCInBroadcastPkts is subid 9 of ifXEntry. |
| 862 |
* Its status is Current, and its access level is ReadOnly. |
| 863 |
* OID: .1.3.6.1.2.1.31.1.1.1.9 |
| 864 |
* Description: |
| 865 |
The number of packets, delivered by this sub-layer to a |
| 866 |
higher (sub-)layer, which were addressed to a broadcast |
| 867 |
address at this sub-layer. This object is a 64-bit version |
| 868 |
of ifInBroadcastPkts. |
| 869 |
|
| 870 |
Discontinuities in the value of this counter can occur at |
| 871 |
re-initialization of the management system, and at other |
| 872 |
times as indicated by the value of |
| 873 |
ifCounterDiscontinuityTime. |
| 874 |
* |
| 875 |
* Attributes: |
| 876 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 877 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 878 |
* settable 0 |
| 879 |
* |
| 880 |
* |
| 881 |
* Its syntax is COUNTER64 (based on perltype COUNTER64) |
| 882 |
* The net-snmp type is ASN_COUNTER64. The C type is struct counter64. |
| 883 |
*/ |
| 884 |
/** |
| 885 |
* Extract the current value of the ifHCInBroadcastPkts data. |
| 886 |
* |
| 887 |
* Set a value using the data context for the row. |
| 888 |
* |
| 889 |
* @param rowreq_ctx |
| 890 |
* Pointer to the row request context. |
| 891 |
* @param ifHCInBroadcastPkts_val_ptr |
| 892 |
* Pointer to storage for a struct counter64 variable |
| 893 |
* |
| 894 |
* @retval MFD_SUCCESS : success |
| 895 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 896 |
* @retval MFD_ERROR : Any other error |
| 897 |
*/ |
| 898 |
int |
| 899 |
ifHCInBroadcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx, |
| 900 |
struct counter64 *ifHCInBroadcastPkts_val_ptr) |
| 901 |
{ |
| 902 |
/** we should have a non-NULL pointer */ |
| 903 |
netsnmp_assert(NULL != ifHCInBroadcastPkts_val_ptr); |
| 904 |
|
| 905 |
/* |
| 906 |
* TODO:231:o: |-> copy ifHCInBroadcastPkts data. |
| 907 |
* get (* ifHCInBroadcastPkts_val_ptr ).low and (* ifHCInBroadcastPkts_val_ptr ).high from rowreq_ctx->data |
| 908 |
*/ |
| 909 |
(*ifHCInBroadcastPkts_val_ptr).high = |
| 910 |
rowreq_ctx->data.ifHCInBroadcastPkts.high; |
| 911 |
(*ifHCInBroadcastPkts_val_ptr).low = |
| 912 |
rowreq_ctx->data.ifHCInBroadcastPkts.low; |
| 913 |
|
| 914 |
|
| 915 |
return MFD_SUCCESS; |
| 916 |
} /* ifHCInBroadcastPkts_get */ |
| 917 |
|
| 918 |
/*--------------------------------------------------------------------- |
| 919 |
* IF-MIB::ifXEntry.ifHCOutOctets |
| 920 |
* ifHCOutOctets is subid 10 of ifXEntry. |
| 921 |
* Its status is Current, and its access level is ReadOnly. |
| 922 |
* OID: .1.3.6.1.2.1.31.1.1.1.10 |
| 923 |
* Description: |
| 924 |
The total number of octets transmitted out of the |
| 925 |
interface, including framing characters. This object is a |
| 926 |
64-bit version of ifOutOctets. |
| 927 |
|
| 928 |
Discontinuities in the value of this counter can occur at |
| 929 |
re-initialization of the management system, and at other |
| 930 |
times as indicated by the value of |
| 931 |
ifCounterDiscontinuityTime. |
| 932 |
* |
| 933 |
* Attributes: |
| 934 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 935 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 936 |
* settable 0 |
| 937 |
* |
| 938 |
* |
| 939 |
* Its syntax is COUNTER64 (based on perltype COUNTER64) |
| 940 |
* The net-snmp type is ASN_COUNTER64. The C type is struct counter64. |
| 941 |
*/ |
| 942 |
/** |
| 943 |
* Extract the current value of the ifHCOutOctets data. |
| 944 |
* |
| 945 |
* Set a value using the data context for the row. |
| 946 |
* |
| 947 |
* @param rowreq_ctx |
| 948 |
* Pointer to the row request context. |
| 949 |
* @param ifHCOutOctets_val_ptr |
| 950 |
* Pointer to storage for a struct counter64 variable |
| 951 |
* |
| 952 |
* @retval MFD_SUCCESS : success |
| 953 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 954 |
* @retval MFD_ERROR : Any other error |
| 955 |
*/ |
| 956 |
int |
| 957 |
ifHCOutOctets_get(ifXTable_rowreq_ctx * rowreq_ctx, |
| 958 |
struct counter64 *ifHCOutOctets_val_ptr) |
| 959 |
{ |
| 960 |
/** we should have a non-NULL pointer */ |
| 961 |
netsnmp_assert(NULL != ifHCOutOctets_val_ptr); |
| 962 |
|
| 963 |
/* |
| 964 |
* TODO:231:o: |-> copy ifHCOutOctets data. |
| 965 |
* get (* ifHCOutOctets_val_ptr ).low and (* ifHCOutOctets_val_ptr ).high from rowreq_ctx->data |
| 966 |
*/ |
| 967 |
(*ifHCOutOctets_val_ptr).high = rowreq_ctx->data.ifHCOutOctets.high; |
| 968 |
(*ifHCOutOctets_val_ptr).low = rowreq_ctx->data.ifHCOutOctets.low; |
| 969 |
|
| 970 |
|
| 971 |
return MFD_SUCCESS; |
| 972 |
} /* ifHCOutOctets_get */ |
| 973 |
|
| 974 |
/*--------------------------------------------------------------------- |
| 975 |
* IF-MIB::ifXEntry.ifHCOutUcastPkts |
| 976 |
* ifHCOutUcastPkts is subid 11 of ifXEntry. |
| 977 |
* Its status is Current, and its access level is ReadOnly. |
| 978 |
* OID: .1.3.6.1.2.1.31.1.1.1.11 |
| 979 |
* Description: |
| 980 |
The total number of packets that higher-level protocols |
| 981 |
requested be transmitted, and which were not addressed to a |
| 982 |
multicast or broadcast address at this sub-layer, including |
| 983 |
those that were discarded or not sent. This object is a |
| 984 |
64-bit version of ifOutUcastPkts. |
| 985 |
|
| 986 |
Discontinuities in the value of this counter can occur at |
| 987 |
re-initialization of the management system, and at other |
| 988 |
times as indicated by the value of |
| 989 |
ifCounterDiscontinuityTime. |
| 990 |
* |
| 991 |
* Attributes: |
| 992 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 993 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 994 |
* settable 0 |
| 995 |
* |
| 996 |
* |
| 997 |
* Its syntax is COUNTER64 (based on perltype COUNTER64) |
| 998 |
* The net-snmp type is ASN_COUNTER64. The C type is struct counter64. |
| 999 |
*/ |
| 1000 |
/** |
| 1001 |
* Extract the current value of the ifHCOutUcastPkts data. |
| 1002 |
* |
| 1003 |
* Set a value using the data context for the row. |
| 1004 |
* |
| 1005 |
* @param rowreq_ctx |
| 1006 |
* Pointer to the row request context. |
| 1007 |
* @param ifHCOutUcastPkts_val_ptr |
| 1008 |
* Pointer to storage for a struct counter64 variable |
| 1009 |
* |
| 1010 |
* @retval MFD_SUCCESS : success |
| 1011 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1012 |
* @retval MFD_ERROR : Any other error |
| 1013 |
*/ |
| 1014 |
int |
| 1015 |
ifHCOutUcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx, |
| 1016 |
struct counter64 *ifHCOutUcastPkts_val_ptr) |
| 1017 |
{ |
| 1018 |
/** we should have a non-NULL pointer */ |
| 1019 |
netsnmp_assert(NULL != ifHCOutUcastPkts_val_ptr); |
| 1020 |
|
| 1021 |
/* |
| 1022 |
* TODO:231:o: |-> copy ifHCOutUcastPkts data. |
| 1023 |
* get (* ifHCOutUcastPkts_val_ptr ).low and (* ifHCOutUcastPkts_val_ptr ).high from rowreq_ctx->data |
| 1024 |
*/ |
| 1025 |
(*ifHCOutUcastPkts_val_ptr).high = |
| 1026 |
rowreq_ctx->data.ifHCOutUcastPkts.high; |
| 1027 |
(*ifHCOutUcastPkts_val_ptr).low = |
| 1028 |
rowreq_ctx->data.ifHCOutUcastPkts.low; |
| 1029 |
|
| 1030 |
|
| 1031 |
return MFD_SUCCESS; |
| 1032 |
} /* ifHCOutUcastPkts_get */ |
| 1033 |
|
| 1034 |
/*--------------------------------------------------------------------- |
| 1035 |
* IF-MIB::ifXEntry.ifHCOutMulticastPkts |
| 1036 |
* ifHCOutMulticastPkts is subid 12 of ifXEntry. |
| 1037 |
* Its status is Current, and its access level is ReadOnly. |
| 1038 |
* OID: .1.3.6.1.2.1.31.1.1.1.12 |
| 1039 |
* Description: |
| 1040 |
The total number of packets that higher-level protocols |
| 1041 |
requested be transmitted, and which were addressed to a |
| 1042 |
multicast address at this sub-layer, including those that |
| 1043 |
were discarded or not sent. For a MAC layer protocol, this |
| 1044 |
includes both Group and Functional addresses. This object |
| 1045 |
is a 64-bit version of ifOutMulticastPkts. |
| 1046 |
|
| 1047 |
Discontinuities in the value of this counter can occur at |
| 1048 |
re-initialization of the management system, and at other |
| 1049 |
times as indicated by the value of |
| 1050 |
ifCounterDiscontinuityTime. |
| 1051 |
* |
| 1052 |
* Attributes: |
| 1053 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 1054 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1055 |
* settable 0 |
| 1056 |
* |
| 1057 |
* |
| 1058 |
* Its syntax is COUNTER64 (based on perltype COUNTER64) |
| 1059 |
* The net-snmp type is ASN_COUNTER64. The C type is struct counter64. |
| 1060 |
*/ |
| 1061 |
/** |
| 1062 |
* Extract the current value of the ifHCOutMulticastPkts data. |
| 1063 |
* |
| 1064 |
* Set a value using the data context for the row. |
| 1065 |
* |
| 1066 |
* @param rowreq_ctx |
| 1067 |
* Pointer to the row request context. |
| 1068 |
* @param ifHCOutMulticastPkts_val_ptr |
| 1069 |
* Pointer to storage for a struct counter64 variable |
| 1070 |
* |
| 1071 |
* @retval MFD_SUCCESS : success |
| 1072 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1073 |
* @retval MFD_ERROR : Any other error |
| 1074 |
*/ |
| 1075 |
int |
| 1076 |
ifHCOutMulticastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx, |
| 1077 |
struct counter64 *ifHCOutMulticastPkts_val_ptr) |
| 1078 |
{ |
| 1079 |
/** we should have a non-NULL pointer */ |
| 1080 |
netsnmp_assert(NULL != ifHCOutMulticastPkts_val_ptr); |
| 1081 |
|
| 1082 |
/* |
| 1083 |
* TODO:231:o: |-> copy ifHCOutMulticastPkts data. |
| 1084 |
* get (* ifHCOutMulticastPkts_val_ptr ).low and (* ifHCOutMulticastPkts_val_ptr ).high from rowreq_ctx->data |
| 1085 |
*/ |
| 1086 |
(*ifHCOutMulticastPkts_val_ptr).high = |
| 1087 |
rowreq_ctx->data.ifHCOutMulticastPkts.high; |
| 1088 |
(*ifHCOutMulticastPkts_val_ptr).low = |
| 1089 |
rowreq_ctx->data.ifHCOutMulticastPkts.low; |
| 1090 |
|
| 1091 |
|
| 1092 |
return MFD_SUCCESS; |
| 1093 |
} /* ifHCOutMulticastPkts_get */ |
| 1094 |
|
| 1095 |
/*--------------------------------------------------------------------- |
| 1096 |
* IF-MIB::ifXEntry.ifHCOutBroadcastPkts |
| 1097 |
* ifHCOutBroadcastPkts is subid 13 of ifXEntry. |
| 1098 |
* Its status is Current, and its access level is ReadOnly. |
| 1099 |
* OID: .1.3.6.1.2.1.31.1.1.1.13 |
| 1100 |
* Description: |
| 1101 |
The total number of packets that higher-level protocols |
| 1102 |
requested be transmitted, and which were addressed to a |
| 1103 |
broadcast address at this sub-layer, including those that |
| 1104 |
were discarded or not sent. This object is a 64-bit version |
| 1105 |
of ifOutBroadcastPkts. |
| 1106 |
|
| 1107 |
Discontinuities in the value of this counter can occur at |
| 1108 |
re-initialization of the management system, and at other |
| 1109 |
times as indicated by the value of |
| 1110 |
ifCounterDiscontinuityTime. |
| 1111 |
* |
| 1112 |
* Attributes: |
| 1113 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 1114 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1115 |
* settable 0 |
| 1116 |
* |
| 1117 |
* |
| 1118 |
* Its syntax is COUNTER64 (based on perltype COUNTER64) |
| 1119 |
* The net-snmp type is ASN_COUNTER64. The C type is struct counter64. |
| 1120 |
*/ |
| 1121 |
/** |
| 1122 |
* Extract the current value of the ifHCOutBroadcastPkts data. |
| 1123 |
* |
| 1124 |
* Set a value using the data context for the row. |
| 1125 |
* |
| 1126 |
* @param rowreq_ctx |
| 1127 |
* Pointer to the row request context. |
| 1128 |
* @param ifHCOutBroadcastPkts_val_ptr |
| 1129 |
* Pointer to storage for a struct counter64 variable |
| 1130 |
* |
| 1131 |
* @retval MFD_SUCCESS : success |
| 1132 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1133 |
* @retval MFD_ERROR : Any other error |
| 1134 |
*/ |
| 1135 |
int |
| 1136 |
ifHCOutBroadcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx, |
| 1137 |
struct counter64 *ifHCOutBroadcastPkts_val_ptr) |
| 1138 |
{ |
| 1139 |
/** we should have a non-NULL pointer */ |
| 1140 |
netsnmp_assert(NULL != ifHCOutBroadcastPkts_val_ptr); |
| 1141 |
|
| 1142 |
/* |
| 1143 |
* TODO:231:o: |-> copy ifHCOutBroadcastPkts data. |
| 1144 |
* get (* ifHCOutBroadcastPkts_val_ptr ).low and (* ifHCOutBroadcastPkts_val_ptr ).high from rowreq_ctx->data |
| 1145 |
*/ |
| 1146 |
(*ifHCOutBroadcastPkts_val_ptr).high = |
| 1147 |
rowreq_ctx->data.ifHCOutBroadcastPkts.high; |
| 1148 |
(*ifHCOutBroadcastPkts_val_ptr).low = |
| 1149 |
rowreq_ctx->data.ifHCOutBroadcastPkts.low; |
| 1150 |
|
| 1151 |
|
| 1152 |
return MFD_SUCCESS; |
| 1153 |
} /* ifHCOutBroadcastPkts_get */ |
| 1154 |
|
| 1155 |
/*--------------------------------------------------------------------- |
| 1156 |
* IF-MIB::ifXEntry.ifLinkUpDownTrapEnable |
| 1157 |
* ifLinkUpDownTrapEnable is subid 14 of ifXEntry. |
| 1158 |
* Its status is Current, and its access level is ReadWrite. |
| 1159 |
* OID: .1.3.6.1.2.1.31.1.1.1.14 |
| 1160 |
* Description: |
| 1161 |
Indicates whether linkUp/linkDown traps should be generated |
| 1162 |
for this interface. |
| 1163 |
|
| 1164 |
By default, this object should have the value enabled(1) for |
| 1165 |
interfaces which do not operate on 'top' of any other |
| 1166 |
interface (as defined in the ifStackTable), and disabled(2) |
| 1167 |
otherwise. |
| 1168 |
* |
| 1169 |
* Attributes: |
| 1170 |
* accessible 1 isscalar 0 enums 1 hasdefval 0 |
| 1171 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1172 |
* settable 1 |
| 1173 |
* |
| 1174 |
* Enum range: 2/8. Values: enabled(1), disabled(2) |
| 1175 |
* |
| 1176 |
* Its syntax is INTEGER (based on perltype INTEGER) |
| 1177 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 1178 |
*/ |
| 1179 |
/** |
| 1180 |
* Extract the current value of the ifLinkUpDownTrapEnable data. |
| 1181 |
* |
| 1182 |
* Set a value using the data context for the row. |
| 1183 |
* |
| 1184 |
* @param rowreq_ctx |
| 1185 |
* Pointer to the row request context. |
| 1186 |
* @param ifLinkUpDownTrapEnable_val_ptr |
| 1187 |
* Pointer to storage for a long variable |
| 1188 |
* |
| 1189 |
* @retval MFD_SUCCESS : success |
| 1190 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1191 |
* @retval MFD_ERROR : Any other error |
| 1192 |
*/ |
| 1193 |
int |
| 1194 |
ifLinkUpDownTrapEnable_get(ifXTable_rowreq_ctx * rowreq_ctx, |
| 1195 |
u_long * ifLinkUpDownTrapEnable_val_ptr) |
| 1196 |
{ |
| 1197 |
/** we should have a non-NULL pointer */ |
| 1198 |
netsnmp_assert(NULL != ifLinkUpDownTrapEnable_val_ptr); |
| 1199 |
|
| 1200 |
|
| 1201 |
DEBUGMSGTL(("verbose:ifXTable:ifLinkUpDownTrapEnable_get", |
| 1202 |
"called\n")); |
| 1203 |
|
| 1204 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1205 |
|
| 1206 |
if (0 == rowreq_ctx->data.ifLinkUpDownTrapEnable) |
| 1207 |
return MFD_SKIP; |
| 1208 |
|
| 1209 |
/* |
| 1210 |
* TODO:231:o: |-> Extract the current value of the ifLinkUpDownTrapEnable data. |
| 1211 |
* copy (* ifLinkUpDownTrapEnable_val_ptr ) from rowreq_ctx->data |
| 1212 |
*/ |
| 1213 |
(*ifLinkUpDownTrapEnable_val_ptr) = |
| 1214 |
rowreq_ctx->data.ifLinkUpDownTrapEnable; |
| 1215 |
|
| 1216 |
return MFD_SUCCESS; |
| 1217 |
} /* ifLinkUpDownTrapEnable_get */ |
| 1218 |
|
| 1219 |
/*--------------------------------------------------------------------- |
| 1220 |
* IF-MIB::ifXEntry.ifHighSpeed |
| 1221 |
* ifHighSpeed is subid 15 of ifXEntry. |
| 1222 |
* Its status is Current, and its access level is ReadOnly. |
| 1223 |
* OID: .1.3.6.1.2.1.31.1.1.1.15 |
| 1224 |
* Description: |
| 1225 |
An estimate of the interface's current bandwidth in units |
| 1226 |
of 1,000,000 bits per second. If this object reports a |
| 1227 |
value of `n' then the speed of the interface is somewhere in |
| 1228 |
the range of `n-500,000' to `n+499,999'. For interfaces |
| 1229 |
which do not vary in bandwidth or for those where no |
| 1230 |
accurate estimation can be made, this object should contain |
| 1231 |
the nominal bandwidth. For a sub-layer which has no concept |
| 1232 |
of bandwidth, this object should be zero. |
| 1233 |
* |
| 1234 |
* Attributes: |
| 1235 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 1236 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1237 |
* settable 0 |
| 1238 |
* |
| 1239 |
* |
| 1240 |
* Its syntax is GAUGE (based on perltype GAUGE) |
| 1241 |
* The net-snmp type is ASN_GAUGE. The C type decl is u_long (u_long) |
| 1242 |
*/ |
| 1243 |
/** |
| 1244 |
* Extract the current value of the ifHighSpeed data. |
| 1245 |
* |
| 1246 |
* Set a value using the data context for the row. |
| 1247 |
* |
| 1248 |
* @param rowreq_ctx |
| 1249 |
* Pointer to the row request context. |
| 1250 |
* @param ifHighSpeed_val_ptr |
| 1251 |
* Pointer to storage for a u_long variable |
| 1252 |
* |
| 1253 |
* @retval MFD_SUCCESS : success |
| 1254 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1255 |
* @retval MFD_ERROR : Any other error |
| 1256 |
*/ |
| 1257 |
int |
| 1258 |
ifHighSpeed_get(ifXTable_rowreq_ctx * rowreq_ctx, |
| 1259 |
u_long * ifHighSpeed_val_ptr) |
| 1260 |
{ |
| 1261 |
/** we should have a non-NULL pointer */ |
| 1262 |
netsnmp_assert(NULL != ifHighSpeed_val_ptr); |
| 1263 |
|
| 1264 |
|
| 1265 |
DEBUGMSGTL(("verbose:ifXTable:ifHighSpeed_get", "called\n")); |
| 1266 |
|
| 1267 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1268 |
|
| 1269 |
/* |
| 1270 |
* TODO:231:o: |-> Extract the current value of the ifHighSpeed data. |
| 1271 |
* copy (* ifHighSpeed_val_ptr ) from rowreq_ctx->data |
| 1272 |
*/ |
| 1273 |
if (0 == rowreq_ctx->data.ifHighSpeed) |
| 1274 |
(*ifHighSpeed_val_ptr) = rowreq_ctx->data.ifSpeed / 1000000; |
| 1275 |
else |
| 1276 |
(*ifHighSpeed_val_ptr) = rowreq_ctx->data.ifHighSpeed; |
| 1277 |
|
| 1278 |
return MFD_SUCCESS; |
| 1279 |
} /* ifHighSpeed_get */ |
| 1280 |
|
| 1281 |
/*--------------------------------------------------------------------- |
| 1282 |
* IF-MIB::ifXEntry.ifPromiscuousMode |
| 1283 |
* ifPromiscuousMode is subid 16 of ifXEntry. |
| 1284 |
* Its status is Current, and its access level is ReadWrite. |
| 1285 |
* OID: .1.3.6.1.2.1.31.1.1.1.16 |
| 1286 |
* Description: |
| 1287 |
This object has a value of false(2) if this interface only |
| 1288 |
accepts packets/frames that are addressed to this station. |
| 1289 |
This object has a value of true(1) when the station accepts |
| 1290 |
all packets/frames transmitted on the media. The value |
| 1291 |
true(1) is only legal on certain types of media. If legal, |
| 1292 |
setting this object to a value of true(1) may require the |
| 1293 |
interface to be reset before becoming effective. |
| 1294 |
|
| 1295 |
The value of ifPromiscuousMode does not affect the reception |
| 1296 |
of broadcast and multicast packets/frames by the interface. |
| 1297 |
* |
| 1298 |
* Attributes: |
| 1299 |
* accessible 1 isscalar 0 enums 1 hasdefval 0 |
| 1300 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1301 |
* settable 1 |
| 1302 |
* |
| 1303 |
* Enum range: 2/8. Values: true(1), false(2) |
| 1304 |
* |
| 1305 |
* Its syntax is TruthValue (based on perltype INTEGER) |
| 1306 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 1307 |
*/ |
| 1308 |
/** |
| 1309 |
* Extract the current value of the ifPromiscuousMode data. |
| 1310 |
* |
| 1311 |
* Set a value using the data context for the row. |
| 1312 |
* |
| 1313 |
* @param rowreq_ctx |
| 1314 |
* Pointer to the row request context. |
| 1315 |
* @param ifPromiscuousMode_val_ptr |
| 1316 |
* Pointer to storage for a long variable |
| 1317 |
* |
| 1318 |
* @retval MFD_SUCCESS : success |
| 1319 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1320 |
* @retval MFD_ERROR : Any other error |
| 1321 |
*/ |
| 1322 |
int |
| 1323 |
ifPromiscuousMode_get(ifXTable_rowreq_ctx * rowreq_ctx, |
| 1324 |
u_long * ifPromiscuousMode_val_ptr) |
| 1325 |
{ |
| 1326 |
/** we should have a non-NULL pointer */ |
| 1327 |
netsnmp_assert(NULL != ifPromiscuousMode_val_ptr); |
| 1328 |
|
| 1329 |
|
| 1330 |
DEBUGMSGTL(("verbose:ifXTable:ifPromiscuousMode_get", "called\n")); |
| 1331 |
|
| 1332 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1333 |
|
| 1334 |
/* |
| 1335 |
* TODO:231:o: |-> Extract the current value of the ifPromiscuousMode data. |
| 1336 |
* copy (* ifPromiscuousMode_val_ptr ) from rowreq_ctx->data |
| 1337 |
*/ |
| 1338 |
/** this is coming from the interface entry, which is a boolean */ |
| 1339 |
if (rowreq_ctx->data.ifPromiscuousMode) |
| 1340 |
(*ifPromiscuousMode_val_ptr) = 1; |
| 1341 |
else |
| 1342 |
(*ifPromiscuousMode_val_ptr) = 2; |
| 1343 |
|
| 1344 |
return MFD_SUCCESS; |
| 1345 |
} /* ifPromiscuousMode_get */ |
| 1346 |
|
| 1347 |
/*--------------------------------------------------------------------- |
| 1348 |
* IF-MIB::ifXEntry.ifConnectorPresent |
| 1349 |
* ifConnectorPresent is subid 17 of ifXEntry. |
| 1350 |
* Its status is Current, and its access level is ReadOnly. |
| 1351 |
* OID: .1.3.6.1.2.1.31.1.1.1.17 |
| 1352 |
* Description: |
| 1353 |
This object has the value 'true(1)' if the interface |
| 1354 |
sublayer has a physical connector and the value 'false(2)' |
| 1355 |
otherwise. |
| 1356 |
* |
| 1357 |
* Attributes: |
| 1358 |
* accessible 1 isscalar 0 enums 1 hasdefval 0 |
| 1359 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1360 |
* settable 0 |
| 1361 |
* |
| 1362 |
* Enum range: 2/8. Values: true(1), false(2) |
| 1363 |
* |
| 1364 |
* Its syntax is TruthValue (based on perltype INTEGER) |
| 1365 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 1366 |
*/ |
| 1367 |
/** |
| 1368 |
* Extract the current value of the ifConnectorPresent data. |
| 1369 |
* |
| 1370 |
* Set a value using the data context for the row. |
| 1371 |
* |
| 1372 |
* @param rowreq_ctx |
| 1373 |
* Pointer to the row request context. |
| 1374 |
* @param ifConnectorPresent_val_ptr |
| 1375 |
* Pointer to storage for a long variable |
| 1376 |
* |
| 1377 |
* @retval MFD_SUCCESS : success |
| 1378 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1379 |
* @retval MFD_ERROR : Any other error |
| 1380 |
*/ |
| 1381 |
int |
| 1382 |
ifConnectorPresent_get(ifXTable_rowreq_ctx * rowreq_ctx, |
| 1383 |
u_long * ifConnectorPresent_val_ptr) |
| 1384 |
{ |
| 1385 |
/** we should have a non-NULL pointer */ |
| 1386 |
netsnmp_assert(NULL != ifConnectorPresent_val_ptr); |
| 1387 |
|
| 1388 |
|
| 1389 |
DEBUGMSGTL(("verbose:ifXTable:ifConnectorPresent_get", "called\n")); |
| 1390 |
|
| 1391 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1392 |
|
| 1393 |
(*ifConnectorPresent_val_ptr) = rowreq_ctx->data.ifConnectorPresent ? |
| 1394 |
TV_TRUE : TV_FALSE; |
| 1395 |
|
| 1396 |
return MFD_SUCCESS; |
| 1397 |
} /* ifConnectorPresent_get */ |
| 1398 |
|
| 1399 |
/*--------------------------------------------------------------------- |
| 1400 |
* IF-MIB::ifXEntry.ifAlias |
| 1401 |
* ifAlias is subid 18 of ifXEntry. |
| 1402 |
* Its status is Current, and its access level is ReadWrite. |
| 1403 |
* OID: .1.3.6.1.2.1.31.1.1.1.18 |
| 1404 |
* Description: |
| 1405 |
This object is an 'alias' name for the interface as |
| 1406 |
specified by a network manager, and provides a non-volatile |
| 1407 |
'handle' for the interface. |
| 1408 |
|
| 1409 |
On the first instantiation of an interface, the value of |
| 1410 |
ifAlias associated with that interface is the zero-length |
| 1411 |
string. As and when a value is written into an instance of |
| 1412 |
ifAlias through a network management set operation, then the |
| 1413 |
agent must retain the supplied value in the ifAlias instance |
| 1414 |
associated with the same interface for as long as that |
| 1415 |
interface remains instantiated, including across all re- |
| 1416 |
initializations/reboots of the network management system, |
| 1417 |
including those which result in a change of the interface's |
| 1418 |
ifIndex value. |
| 1419 |
|
| 1420 |
An example of the value which a network manager might store |
| 1421 |
in this object for a WAN interface is the (Telco's) circuit |
| 1422 |
number/identifier of the interface. |
| 1423 |
|
| 1424 |
Some agents may support write-access only for interfaces |
| 1425 |
having particular values of ifType. An agent which supports |
| 1426 |
write access to this object is required to keep the value in |
| 1427 |
non-volatile storage, but it may limit the length of new |
| 1428 |
values depending on how much storage is already occupied by |
| 1429 |
the current values for other interfaces. |
| 1430 |
* |
| 1431 |
* Attributes: |
| 1432 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 1433 |
* readable 1 iscolumn 1 ranges 1 hashint 1 |
| 1434 |
* settable 1 |
| 1435 |
* hint: 255a |
| 1436 |
* |
| 1437 |
* Ranges: 0 - 64; |
| 1438 |
* |
| 1439 |
* Its syntax is DisplayString (based on perltype OCTETSTR) |
| 1440 |
* The net-snmp type is ASN_OCTET_STR. The C type decl is char (char) |
| 1441 |
* This data type requires a length. (Max 64) |
| 1442 |
*/ |
| 1443 |
/** |
| 1444 |
* Extract the current value of the ifAlias data. |
| 1445 |
* |
| 1446 |
* Set a value using the data context for the row. |
| 1447 |
* |
| 1448 |
* @param rowreq_ctx |
| 1449 |
* Pointer to the row request context. |
| 1450 |
* @param ifAlias_val_ptr_ptr |
| 1451 |
* Pointer to storage for a char variable |
| 1452 |
* @param ifAlias_val_ptr_len_ptr |
| 1453 |
* Pointer to a size_t. On entry, it will contain the size (in bytes) |
| 1454 |
* pointed to by ifAlias. |
| 1455 |
* On exit, this value should contain the data size (in bytes). |
| 1456 |
* |
| 1457 |
* @retval MFD_SUCCESS : success |
| 1458 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1459 |
* @retval MFD_ERROR : Any other error |
| 1460 |
* |
| 1461 |
* @note If you need more than (*ifAlias_val_ptr_len_ptr) bytes of memory, |
| 1462 |
* allocate it using malloc() and update ifAlias_val_ptr_ptr. |
| 1463 |
* <b>DO NOT</b> free the previous pointer. |
| 1464 |
* The MFD helper will release the memory you allocate. |
| 1465 |
* |
| 1466 |
* @remark If you call this function yourself, you are responsible |
| 1467 |
* for checking if the pointer changed, and freeing any |
| 1468 |
* previously allocated memory. (Not necessary if you pass |
| 1469 |
* in a pointer to static memory, obviously.) |
| 1470 |
*/ |
| 1471 |
int |
| 1472 |
ifAlias_get(ifXTable_rowreq_ctx * rowreq_ctx, char **ifAlias_val_ptr_ptr, |
| 1473 |
size_t * ifAlias_val_ptr_len_ptr) |
| 1474 |
{ |
| 1475 |
/** we should have a non-NULL pointer and enough storage */ |
| 1476 |
netsnmp_assert((NULL != ifAlias_val_ptr_ptr) |
| 1477 |
&& (NULL != *ifAlias_val_ptr_ptr)); |
| 1478 |
netsnmp_assert(NULL != ifAlias_val_ptr_len_ptr); |
| 1479 |
|
| 1480 |
|
| 1481 |
DEBUGMSGTL(("verbose:ifXTable:ifAlias_get", "called\n")); |
| 1482 |
|
| 1483 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1484 |
|
| 1485 |
/* |
| 1486 |
* TODO:231:o: |-> Extract the current value of the ifAlias data. |
| 1487 |
* copy (* ifAlias_val_ptr_ptr ) data and (* ifAlias_val_ptr_len_ptr ) from rowreq_ctx->data |
| 1488 |
*/ |
| 1489 |
/* |
| 1490 |
* make sure there is enough space for ifAlias data |
| 1491 |
*/ |
| 1492 |
if ((NULL == (*ifAlias_val_ptr_ptr)) || |
| 1493 |
((*ifAlias_val_ptr_len_ptr) < |
| 1494 |
(rowreq_ctx->data.ifAlias_len * |
| 1495 |
sizeof(rowreq_ctx->data.ifAlias[0])))) { |
| 1496 |
/* |
| 1497 |
* allocate space for ifAlias data |
| 1498 |
*/ |
| 1499 |
(*ifAlias_val_ptr_ptr) = (char*) |
| 1500 |
malloc(rowreq_ctx->data.ifAlias_len * |
| 1501 |
sizeof(rowreq_ctx->data.ifAlias[0])); |
| 1502 |
if (NULL == (*ifAlias_val_ptr_ptr)) { |
| 1503 |
snmp_log(LOG_ERR, "could not allocate memory\n"); |
| 1504 |
return MFD_ERROR; |
| 1505 |
} |
| 1506 |
} |
| 1507 |
(*ifAlias_val_ptr_len_ptr) = |
| 1508 |
rowreq_ctx->data.ifAlias_len * sizeof(rowreq_ctx->data.ifAlias[0]); |
| 1509 |
memcpy((*ifAlias_val_ptr_ptr), rowreq_ctx->data.ifAlias, |
| 1510 |
rowreq_ctx->data.ifAlias_len * |
| 1511 |
sizeof(rowreq_ctx->data.ifAlias[0])); |
| 1512 |
|
| 1513 |
return MFD_SUCCESS; |
| 1514 |
} /* ifAlias_get */ |
| 1515 |
|
| 1516 |
/*--------------------------------------------------------------------- |
| 1517 |
* IF-MIB::ifXEntry.ifCounterDiscontinuityTime |
| 1518 |
* ifCounterDiscontinuityTime is subid 19 of ifXEntry. |
| 1519 |
* Its status is Current, and its access level is ReadOnly. |
| 1520 |
* OID: .1.3.6.1.2.1.31.1.1.1.19 |
| 1521 |
* Description: |
| 1522 |
The value of sysUpTime on the most recent occasion at which |
| 1523 |
any one or more of this interface's counters suffered a |
| 1524 |
discontinuity. The relevant counters are the specific |
| 1525 |
instances associated with this interface of any Counter32 or |
| 1526 |
|
| 1527 |
Counter64 object contained in the ifTable or ifXTable. If |
| 1528 |
no such discontinuities have occurred since the last re- |
| 1529 |
initialization of the local management subsystem, then this |
| 1530 |
object contains a zero value. |
| 1531 |
* |
| 1532 |
* Attributes: |
| 1533 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 1534 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1535 |
* settable 0 |
| 1536 |
* |
| 1537 |
* |
| 1538 |
* Its syntax is TimeStamp (based on perltype TICKS) |
| 1539 |
* The net-snmp type is ASN_TIMETICKS. The C type decl is u_long (u_long) |
| 1540 |
*/ |
| 1541 |
/** |
| 1542 |
* Extract the current value of the ifCounterDiscontinuityTime data. |
| 1543 |
* |
| 1544 |
* Set a value using the data context for the row. |
| 1545 |
* |
| 1546 |
* @param rowreq_ctx |
| 1547 |
* Pointer to the row request context. |
| 1548 |
* @param ifCounterDiscontinuityTime_val_ptr |
| 1549 |
* Pointer to storage for a u_long variable |
| 1550 |
* |
| 1551 |
* @retval MFD_SUCCESS : success |
| 1552 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 1553 |
* @retval MFD_ERROR : Any other error |
| 1554 |
*/ |
| 1555 |
int |
| 1556 |
ifCounterDiscontinuityTime_get(ifXTable_rowreq_ctx * rowreq_ctx, |
| 1557 |
u_long * ifCounterDiscontinuityTime_val_ptr) |
| 1558 |
{ |
| 1559 |
/** we should have a non-NULL pointer */ |
| 1560 |
netsnmp_assert(NULL != ifCounterDiscontinuityTime_val_ptr); |
| 1561 |
|
| 1562 |
|
| 1563 |
DEBUGMSGTL(("verbose:ifXTable:ifCounterDiscontinuityTime_get", |
| 1564 |
"called\n")); |
| 1565 |
|
| 1566 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1567 |
|
| 1568 |
/* |
| 1569 |
* TODO:231:o: |-> Extract the current value of the ifCounterDiscontinuityTime data. |
| 1570 |
* copy (* ifCounterDiscontinuityTime_val_ptr ) from rowreq_ctx->data |
| 1571 |
*/ |
| 1572 |
(*ifCounterDiscontinuityTime_val_ptr) = |
| 1573 |
rowreq_ctx->data.ifCounterDiscontinuityTime; |
| 1574 |
|
| 1575 |
return MFD_SUCCESS; |
| 1576 |
} /* ifCounterDiscontinuityTime_get */ |
| 1577 |
|
| 1578 |
|
| 1579 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 1580 |
|
| 1581 |
/** @} */ |
| 1582 |
/********************************************************************** |
| 1583 |
********************************************************************** |
| 1584 |
*** |
| 1585 |
*** Table ifXTable |
| 1586 |
*** |
| 1587 |
********************************************************************** |
| 1588 |
**********************************************************************/ |
| 1589 |
/* |
| 1590 |
* IF-MIB::ifXTable is subid 1 of ifMIBObjects. |
| 1591 |
* Its status is Current. |
| 1592 |
* OID: .1.3.6.1.2.1.31.1.1, length: 9 |
| 1593 |
*/ |
| 1594 |
/* |
| 1595 |
* NOTE: if you update this chart, please update the versions in |
| 1596 |
* local/mib2c-conf.d/parent-set.m2i |
| 1597 |
* agent/mibgroup/helpers/baby_steps.c |
| 1598 |
* while you're at it. |
| 1599 |
*/ |
| 1600 |
/* |
| 1601 |
*********************************************************************** |
| 1602 |
* Baby Steps Flow Chart (2004.06.05) * |
| 1603 |
* * |
| 1604 |
* +--------------+ +================+ U = unconditional path * |
| 1605 |
* |optional state| ||required state|| S = path for success * |
| 1606 |
* +--------------+ +================+ E = path for error * |
| 1607 |
*********************************************************************** |
| 1608 |
* |
| 1609 |
* +--------------+ |
| 1610 |
* | pre | |
| 1611 |
* | request | |
| 1612 |
* +--------------+ |
| 1613 |
* | U |
| 1614 |
* +==============+ |
| 1615 |
* +----------------|| object || |
| 1616 |
* | E || lookup || |
| 1617 |
* | +==============+ |
| 1618 |
* | | S |
| 1619 |
* | +==============+ |
| 1620 |
* | E || check || |
| 1621 |
* |<---------------|| values || |
| 1622 |
* | +==============+ |
| 1623 |
* | | S |
| 1624 |
* | +==============+ |
| 1625 |
* | +<-------|| undo || |
| 1626 |
* | | E || setup || |
| 1627 |
* | | +==============+ |
| 1628 |
* | | | S |
| 1629 |
* | | +==============+ |
| 1630 |
* | | || set ||-------------------------->+ |
| 1631 |
* | | || value || E | |
| 1632 |
* | | +==============+ | |
| 1633 |
* | | | S | |
| 1634 |
* | | +--------------+ | |
| 1635 |
* | | | check |-------------------------->| |
| 1636 |
* | | | consistency | E | |
| 1637 |
* | | +--------------+ | |
| 1638 |
* | | | S | |
| 1639 |
* | | +==============+ +==============+ | |
| 1640 |
* | | || commit ||-------->|| undo || | |
| 1641 |
* | | || || E || commit || | |
| 1642 |
* | | +==============+ +==============+ | |
| 1643 |
* | | | S U |<--------+ |
| 1644 |
* | | +--------------+ +==============+ |
| 1645 |
* | | | irreversible | || undo || |
| 1646 |
* | | | commit | || set || |
| 1647 |
* | | +--------------+ +==============+ |
| 1648 |
* | | | U U | |
| 1649 |
* | +-------------->|<------------------------+ |
| 1650 |
* | +==============+ |
| 1651 |
* | || undo || |
| 1652 |
* | || cleanup || |
| 1653 |
* | +==============+ |
| 1654 |
* +---------------------->| U |
| 1655 |
* +--------------+ |
| 1656 |
* | post | |
| 1657 |
* | request | |
| 1658 |
* +--------------+ |
| 1659 |
* |
| 1660 |
*/ |
| 1661 |
|
| 1662 |
/** |
| 1663 |
* Setup up context with information needed to undo a set request. |
| 1664 |
* |
| 1665 |
* This function will be called before the individual node undo setup |
| 1666 |
* functions are called. If you need to do any undo setup that is not |
| 1667 |
* related to a specific column, you can do it here. |
| 1668 |
* |
| 1669 |
* Note that the undo context has been allocated with |
| 1670 |
* ifXTable_allocate_data(), but may need extra |
| 1671 |
* initialization similar to what you may have done in |
| 1672 |
* ifXTable_rowreq_ctx_init(). |
| 1673 |
* Note that an individual node's undo_setup function will only be called |
| 1674 |
* if that node is being set to a new value. |
| 1675 |
* |
| 1676 |
* If there is any setup specific to a particular column (e.g. allocating |
| 1677 |
* memory for a string), you should do that setup in the node's undo_setup |
| 1678 |
* function, so it won't be done unless it is necessary. |
| 1679 |
* |
| 1680 |
* @param rowreq_ctx |
| 1681 |
* Pointer to the table context (ifXTable_rowreq_ctx) |
| 1682 |
* |
| 1683 |
* @retval MFD_SUCCESS : success |
| 1684 |
* @retval MFD_ERROR : error. set will fail. |
| 1685 |
*/ |
| 1686 |
int |
| 1687 |
ifXTable_undo_setup(ifXTable_rowreq_ctx * rowreq_ctx) |
| 1688 |
{ |
| 1689 |
int rc = MFD_SUCCESS; |
| 1690 |
|
| 1691 |
DEBUGMSGTL(("verbose:ifXTable:ifXTable_undo_setup", "called\n")); |
| 1692 |
|
| 1693 |
/** we should have a non-NULL pointer */ |
| 1694 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1695 |
|
| 1696 |
/* |
| 1697 |
* TODO:451:M: |-> Setup ifXTable undo. |
| 1698 |
* set up ifXTable undo information, in preparation for a set. |
| 1699 |
* Undo storage is in (* ifCounterDiscontinuityTime_val_ptr )* |
| 1700 |
*/ |
| 1701 |
|
| 1702 |
return rc; |
| 1703 |
} /* ifXTable_undo_setup */ |
| 1704 |
|
| 1705 |
/** |
| 1706 |
* Undo a set request. |
| 1707 |
* |
| 1708 |
* This function will be called before the individual node undo |
| 1709 |
* functions are called. If you need to do any undo that is not |
| 1710 |
* related to a specific column, you can do it here. |
| 1711 |
* |
| 1712 |
* Note that an individual node's undo function will only be called |
| 1713 |
* if that node is being set to a new value. |
| 1714 |
* |
| 1715 |
* If there is anything specific to a particular column (e.g. releasing |
| 1716 |
* memory for a string), you should do that setup in the node's undo |
| 1717 |
* function, so it won't be done unless it is necessary. |
| 1718 |
* |
| 1719 |
* @param rowreq_ctx |
| 1720 |
* Pointer to the table context (ifXTable_rowreq_ctx) |
| 1721 |
* |
| 1722 |
* @retval MFD_SUCCESS : success |
| 1723 |
* @retval MFD_ERROR : error. set will fail. |
| 1724 |
*/ |
| 1725 |
int |
| 1726 |
ifXTable_undo(ifXTable_rowreq_ctx * rowreq_ctx) |
| 1727 |
{ |
| 1728 |
int rc = MFD_SUCCESS; |
| 1729 |
|
| 1730 |
DEBUGMSGTL(("verbose:ifXTable:ifXTable_undo", "called\n")); |
| 1731 |
|
| 1732 |
/** we should have a non-NULL pointer */ |
| 1733 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1734 |
|
| 1735 |
/* |
| 1736 |
* TODO:451:M: |-> ifXTable undo. |
| 1737 |
* ifXTable undo information, in response to a failed set. |
| 1738 |
* Undo storage is in (* ifCounterDiscontinuityTime_val_ptr )* |
| 1739 |
*/ |
| 1740 |
|
| 1741 |
return rc; |
| 1742 |
} /* ifXTable_undo_setup */ |
| 1743 |
|
| 1744 |
/** |
| 1745 |
* Cleanup up context undo information. |
| 1746 |
* |
| 1747 |
* This function will be called after set/commit processing. If you |
| 1748 |
* allocated any resources in undo_setup, this is the place to release |
| 1749 |
* those resources. |
| 1750 |
* |
| 1751 |
* This function is called regardless of the success or failure of the set |
| 1752 |
* request. If you need to perform different steps for cleanup depending |
| 1753 |
* on success or failure, you can add a flag to the rowreq_ctx. |
| 1754 |
* |
| 1755 |
* @param rowreq_ctx |
| 1756 |
* Pointer to the table context (ifXTable_rowreq_ctx) |
| 1757 |
* |
| 1758 |
* @retval MFD_SUCCESS : success |
| 1759 |
* @retval MFD_ERROR : error |
| 1760 |
*/ |
| 1761 |
int |
| 1762 |
ifXTable_undo_cleanup(ifXTable_rowreq_ctx * rowreq_ctx) |
| 1763 |
{ |
| 1764 |
int rc = MFD_SUCCESS; |
| 1765 |
|
| 1766 |
DEBUGMSGTL(("verbose:ifXTable:ifXTable_undo_cleanup", "called\n")); |
| 1767 |
|
| 1768 |
/** we should have a non-NULL pointer */ |
| 1769 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1770 |
|
| 1771 |
/* |
| 1772 |
* TODO:452:M: |-> Cleanup ifXTable undo. |
| 1773 |
* Undo storage is in (* ifCounterDiscontinuityTime_val_ptr )* |
| 1774 |
*/ |
| 1775 |
|
| 1776 |
return rc; |
| 1777 |
} /* ifXTable_undo_cleanup */ |
| 1778 |
|
| 1779 |
/** |
| 1780 |
* commit new values. |
| 1781 |
* |
| 1782 |
* At this point, you should have done everything you can to ensure that |
| 1783 |
* this commit will not fail. |
| 1784 |
* |
| 1785 |
* Should you need different behavior depending on which columns were |
| 1786 |
* set, rowreq_ctx->column_set_flags will indicate which writeable columns were |
| 1787 |
* set. The definitions for the COLUMN_*_FLAG bits can be found in |
| 1788 |
* ifXTable.h. |
| 1789 |
* A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. |
| 1790 |
* |
| 1791 |
* @param rowreq_ctx |
| 1792 |
* Pointer to the users context. |
| 1793 |
* |
| 1794 |
* @retval MFD_SUCCESS : success |
| 1795 |
* @retval MFD_ERROR : error |
| 1796 |
*/ |
| 1797 |
int |
| 1798 |
ifXTable_commit(ifXTable_rowreq_ctx * rowreq_ctx) |
| 1799 |
{ |
| 1800 |
int rc = MFD_SUCCESS; |
| 1801 |
int save_flags; |
| 1802 |
|
| 1803 |
DEBUGMSGTL(("verbose:ifXTable:ifXTable_commit", "called\n")); |
| 1804 |
|
| 1805 |
/** we should have a non-NULL pointer */ |
| 1806 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1807 |
|
| 1808 |
/* |
| 1809 |
* save flags, then clear until we actually do something |
| 1810 |
*/ |
| 1811 |
save_flags = rowreq_ctx->column_set_flags; |
| 1812 |
rowreq_ctx->column_set_flags = 0; |
| 1813 |
|
| 1814 |
/* |
| 1815 |
* commit ifXTable data |
| 1816 |
* 1) check the column's flag in save_flags to see if it was set. |
| 1817 |
* 2) clear the flag when you handle that column |
| 1818 |
* 3) set the column's flag in column_set_flags if it needs undo |
| 1819 |
* processing in case of a failure. |
| 1820 |
* |
| 1821 |
* this is where one would usually commit data. In this case, |
| 1822 |
* ifLinkUpDownTrapEnable and ifAlias are purely internal, so |
| 1823 |
* nothing needs to be done. That leaves ifPromiscuosMode, |
| 1824 |
* which I'm leery about implementing. Thus, at this point, |
| 1825 |
* there is nothing to do except twiddle flag bits. |
| 1826 |
*/ |
| 1827 |
if (save_flags & COLUMN_IFLINKUPDOWNTRAPENABLE_FLAG) { |
| 1828 |
save_flags &= ~COLUMN_IFLINKUPDOWNTRAPENABLE_FLAG; /* clear ifLinkUpDownTrapEnable */ |
| 1829 |
/* |
| 1830 |
* TODO:482:o: |-> commit column ifLinkUpDownTrapEnable. |
| 1831 |
*/ |
| 1832 |
/* |
| 1833 |
* set flag, in case we need to undo ifLinkUpDownTrapEnable |
| 1834 |
*/ |
| 1835 |
rowreq_ctx->column_set_flags |= COLUMN_IFLINKUPDOWNTRAPENABLE_FLAG; |
| 1836 |
} |
| 1837 |
#ifdef NETSNMP_ENABLE_PROMISCUOUSMODE_SET |
| 1838 |
if (save_flags & COLUMN_IFPROMISCUOUSMODE_FLAG) { |
| 1839 |
save_flags &= ~COLUMN_IFPROMISCUOUSMODE_FLAG; /* clear ifPromiscuousMode */ |
| 1840 |
/* |
| 1841 |
* TODO:482:o: |-> commit column ifPromiscuousMode. |
| 1842 |
*/ |
| 1843 |
rc = -1; |
| 1844 |
if (-1 == rc) { |
| 1845 |
snmp_log(LOG_ERR, |
| 1846 |
"ifXTable column ifPromiscuousMode commit failed\n"); |
| 1847 |
} else { |
| 1848 |
/* |
| 1849 |
* set flag, in case we need to undo ifPromiscuousMode |
| 1850 |
*/ |
| 1851 |
rowreq_ctx->column_set_flags |= COLUMN_IFPROMISCUOUSMODE_FLAG; |
| 1852 |
} |
| 1853 |
} |
| 1854 |
#endif /* NETSNMP_ENABLE_PROMISCUOUSMODE_SET */ |
| 1855 |
|
| 1856 |
if (save_flags & COLUMN_IFALIAS_FLAG) { |
| 1857 |
save_flags &= ~COLUMN_IFALIAS_FLAG; /* clear ifAlias */ |
| 1858 |
/* |
| 1859 |
* set flag, in case we need to undo ifAlias |
| 1860 |
*/ |
| 1861 |
rowreq_ctx->column_set_flags |= COLUMN_IFALIAS_FLAG; |
| 1862 |
} |
| 1863 |
|
| 1864 |
/* |
| 1865 |
* if we successfully committed this row, set the dirty flag. |
| 1866 |
*/ |
| 1867 |
if (MFD_SUCCESS == rc) { |
| 1868 |
rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY; |
| 1869 |
} |
| 1870 |
|
| 1871 |
if (save_flags) { |
| 1872 |
snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n", |
| 1873 |
save_flags); |
| 1874 |
return MFD_ERROR; |
| 1875 |
} |
| 1876 |
|
| 1877 |
return rc; |
| 1878 |
} /* ifXTable_commit */ |
| 1879 |
|
| 1880 |
/** |
| 1881 |
* undo commit new values. |
| 1882 |
* |
| 1883 |
* Should you need different behavior depending on which columns were |
| 1884 |
* set, rowreq_ctx->column_set_flags will indicate which writeable columns were |
| 1885 |
* set. The definitions for the COLUMN_*_FLAG bits can be found in |
| 1886 |
* ifXTable.h. |
| 1887 |
* A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. |
| 1888 |
* |
| 1889 |
* @param rowreq_ctx |
| 1890 |
* Pointer to the users context. |
| 1891 |
* |
| 1892 |
* @retval MFD_SUCCESS : success |
| 1893 |
* @retval MFD_ERROR : error |
| 1894 |
*/ |
| 1895 |
int |
| 1896 |
ifXTable_undo_commit(ifXTable_rowreq_ctx * rowreq_ctx) |
| 1897 |
{ |
| 1898 |
int rc = MFD_SUCCESS; |
| 1899 |
|
| 1900 |
DEBUGMSGTL(("verbose:ifXTable:ifXTable_undo_commit", "called\n")); |
| 1901 |
|
| 1902 |
/** we should have a non-NULL pointer */ |
| 1903 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1904 |
|
| 1905 |
/* |
| 1906 |
* TODO:485:M: |-> Undo ifXTable commit. |
| 1907 |
* check the column's flag in rowreq_ctx->column_set_flags to see |
| 1908 |
* if it was set during commit, then undo it. |
| 1909 |
* |
| 1910 |
* eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {} |
| 1911 |
*/ |
| 1912 |
|
| 1913 |
|
| 1914 |
/* |
| 1915 |
* if we successfully un-committed this row, clear the dirty flag. |
| 1916 |
*/ |
| 1917 |
if (MFD_SUCCESS == rc) { |
| 1918 |
rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY; |
| 1919 |
} |
| 1920 |
|
| 1921 |
return rc; |
| 1922 |
} /* ifXTable_undo_commit */ |
| 1923 |
|
| 1924 |
/* |
| 1925 |
* TODO:440:M: Implement ifXTable node value checks. |
| 1926 |
* TODO:450:M: Implement ifXTable undo functions. |
| 1927 |
* TODO:460:M: Implement ifXTable set functions. |
| 1928 |
* TODO:480:M: Implement ifXTable commit functions. |
| 1929 |
*/ |
| 1930 |
/*--------------------------------------------------------------------- |
| 1931 |
* IF-MIB::ifXEntry.ifLinkUpDownTrapEnable |
| 1932 |
* ifLinkUpDownTrapEnable is subid 14 of ifXEntry. |
| 1933 |
* Its status is Current, and its access level is ReadWrite. |
| 1934 |
* OID: .1.3.6.1.2.1.31.1.1.1.14 |
| 1935 |
* Description: |
| 1936 |
Indicates whether linkUp/linkDown traps should be generated |
| 1937 |
for this interface. |
| 1938 |
|
| 1939 |
By default, this object should have the value enabled(1) for |
| 1940 |
interfaces which do not operate on 'top' of any other |
| 1941 |
interface (as defined in the ifStackTable), and disabled(2) |
| 1942 |
otherwise. |
| 1943 |
* |
| 1944 |
* Attributes: |
| 1945 |
* accessible 1 isscalar 0 enums 1 hasdefval 0 |
| 1946 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1947 |
* settable 1 |
| 1948 |
* |
| 1949 |
* Enum range: 2/8. Values: enabled(1), disabled(2) |
| 1950 |
* |
| 1951 |
* Its syntax is INTEGER (based on perltype INTEGER) |
| 1952 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 1953 |
*/ |
| 1954 |
/** |
| 1955 |
* Check that the proposed new value is potentially valid. |
| 1956 |
* |
| 1957 |
* @param rowreq_ctx |
| 1958 |
* Pointer to the row request context. |
| 1959 |
* @param ifLinkUpDownTrapEnable_val |
| 1960 |
* A long containing the new value. |
| 1961 |
* |
| 1962 |
* @retval MFD_SUCCESS : incoming value is legal |
| 1963 |
* @retval MFD_NOT_VALID_NOW : incoming value is not valid now |
| 1964 |
* @retval MFD_NOT_VALID_EVER : incoming value is never valid |
| 1965 |
* |
| 1966 |
* This is the place to check for requirements that are not |
| 1967 |
* expressed in the mib syntax (for example, a requirement that |
| 1968 |
* is detailed in the description for an object). |
| 1969 |
* |
| 1970 |
* You should check that the requested change between the undo value and the |
| 1971 |
* new value is legal (ie, the transistion from one value to another |
| 1972 |
* is legal). |
| 1973 |
* |
| 1974 |
*@note |
| 1975 |
* This check is only to determine if the new value |
| 1976 |
* is \b potentially valid. This is the first check of many, and |
| 1977 |
* is one of the simplest ones. |
| 1978 |
* |
| 1979 |
*@note |
| 1980 |
* this is not the place to do any checks for values |
| 1981 |
* which depend on some other value in the mib. Those |
| 1982 |
* types of checks should be done in the |
| 1983 |
* ifXTable_check_dependencies() function. |
| 1984 |
* |
| 1985 |
* The following checks have already been done for you: |
| 1986 |
* The syntax is ASN_INTEGER |
| 1987 |
* The value is one of enabled(1), disabled(2) |
| 1988 |
* |
| 1989 |
* If there a no other checks you need to do, simply return MFD_SUCCESS. |
| 1990 |
* |
| 1991 |
*/ |
| 1992 |
int |
| 1993 |
ifLinkUpDownTrapEnable_check_value(ifXTable_rowreq_ctx * rowreq_ctx, |
| 1994 |
u_long ifLinkUpDownTrapEnable_val) |
| 1995 |
{ |
| 1996 |
DEBUGMSGTL(("verbose:ifXTable:ifLinkUpDownTrapEnable_check_value", |
| 1997 |
"called\n")); |
| 1998 |
|
| 1999 |
/** should never get a NULL pointer */ |
| 2000 |
netsnmp_assert(NULL != rowreq_ctx); |
| 2001 |
|
| 2002 |
/* |
| 2003 |
* TODO:441:o: |-> Check for valid ifLinkUpDownTrapEnable value. |
| 2004 |
*/ |
| 2005 |
|
| 2006 |
return MFD_SUCCESS; /* ifLinkUpDownTrapEnable value not illegal */ |
| 2007 |
} /* ifLinkUpDownTrapEnable_check_value */ |
| 2008 |
|
| 2009 |
/** |
| 2010 |
* Save old value information |
| 2011 |
* |
| 2012 |
* @param rowreq_ctx |
| 2013 |
* Pointer to the table context (ifXTable_rowreq_ctx) |
| 2014 |
* |
| 2015 |
* @retval MFD_SUCCESS : success |
| 2016 |
* @retval MFD_ERROR : error. set will fail. |
| 2017 |
* |
| 2018 |
* This function will be called after the table level undo setup function |
| 2019 |
* ifXTable_undo_setup has been called. |
| 2020 |
* |
| 2021 |
*@note |
| 2022 |
* this function will only be called if a new value is set for this column. |
| 2023 |
* |
| 2024 |
* If there is any setup specific to a particular column (e.g. allocating |
| 2025 |
* memory for a string), you should do that setup in this function, so it |
| 2026 |
* won't be done unless it is necessary. |
| 2027 |
*/ |
| 2028 |
int |
| 2029 |
ifLinkUpDownTrapEnable_undo_setup(ifXTable_rowreq_ctx * rowreq_ctx) |
| 2030 |
{ |
| 2031 |
DEBUGMSGTL(("verbose:ifXTable:ifLinkUpDownTrapEnable_undo_setup", |
| 2032 |
"called\n")); |
| 2033 |
|
| 2034 |
/** should never get a NULL pointer */ |
| 2035 |
netsnmp_assert(NULL != rowreq_ctx); |
| 2036 |
|
| 2037 |
/* |
| 2038 |
* TODO:455:o: |-> Setup ifLinkUpDownTrapEnable undo. |
| 2039 |
*/ |
| 2040 |
/* |
| 2041 |
* copy ifLinkUpDownTrapEnable data |
| 2042 |
* set rowreq_ctx->undo->ifLinkUpDownTrapEnable from rowreq_ctx->data.ifLinkUpDownTrapEnable |
| 2043 |
*/ |
| 2044 |
rowreq_ctx->undo->ifLinkUpDownTrapEnable = |
| 2045 |
rowreq_ctx->data.ifLinkUpDownTrapEnable; |
| 2046 |
|
| 2047 |
|
| 2048 |
return MFD_SUCCESS; |
| 2049 |
} /* ifLinkUpDownTrapEnable_undo_setup */ |
| 2050 |
|
| 2051 |
/** |
| 2052 |
* Set the new value. |
| 2053 |
* |
| 2054 |
* @param rowreq_ctx |
| 2055 |
* Pointer to the users context. You should know how to |
| 2056 |
* manipulate the value from this object. |
| 2057 |
* @param ifLinkUpDownTrapEnable_val |
| 2058 |
* A long containing the new value. |
| 2059 |
*/ |
| 2060 |
int |
| 2061 |
ifLinkUpDownTrapEnable_set(ifXTable_rowreq_ctx * rowreq_ctx, |
| 2062 |
u_long ifLinkUpDownTrapEnable_val) |
| 2063 |
{ |
| 2064 |
|
| 2065 |
DEBUGMSGTL(("verbose:ifXTable:ifLinkUpDownTrapEnable_set", |
| 2066 |
"called\n")); |
| 2067 |
|
| 2068 |
/** should never get a NULL pointer */ |
| 2069 |
netsnmp_assert(NULL != rowreq_ctx); |
| 2070 |
|
| 2071 |
/* |
| 2072 |
* TODO:461:M: |-> Set ifLinkUpDownTrapEnable value. |
| 2073 |
* set ifLinkUpDownTrapEnable value in rowreq_ctx->data |
| 2074 |
*/ |
| 2075 |
rowreq_ctx->data.ifLinkUpDownTrapEnable = ifLinkUpDownTrapEnable_val; |
| 2076 |
|
| 2077 |
return MFD_SUCCESS; |
| 2078 |
} /* ifLinkUpDownTrapEnable_set */ |
| 2079 |
|
| 2080 |
/** |
| 2081 |
* undo the previous set. |
| 2082 |
* |
| 2083 |
* @param rowreq_ctx |
| 2084 |
* Pointer to the users context. |
| 2085 |
*/ |
| 2086 |
int |
| 2087 |
ifLinkUpDownTrapEnable_undo(ifXTable_rowreq_ctx * rowreq_ctx) |
| 2088 |
{ |
| 2089 |
|
| 2090 |
DEBUGMSGTL(("verbose:ifXTable:ifLinkUpDownTrapEnable_undo", |
| 2091 |
"called\n")); |
| 2092 |
|
| 2093 |
netsnmp_assert(NULL != rowreq_ctx); |
| 2094 |
|
| 2095 |
/* |
| 2096 |
* TODO:456:o: |-> Clean up ifLinkUpDownTrapEnable undo. |
| 2097 |
*/ |
| 2098 |
/* |
| 2099 |
* copy ifLinkUpDownTrapEnable data |
| 2100 |
* set rowreq_ctx->data.ifLinkUpDownTrapEnable from rowreq_ctx->undo->ifLinkUpDownTrapEnable |
| 2101 |
*/ |
| 2102 |
rowreq_ctx->data.ifLinkUpDownTrapEnable = |
| 2103 |
rowreq_ctx->undo->ifLinkUpDownTrapEnable; |
| 2104 |
|
| 2105 |
|
| 2106 |
return MFD_SUCCESS; |
| 2107 |
} /* ifLinkUpDownTrapEnable_undo */ |
| 2108 |
|
| 2109 |
/*--------------------------------------------------------------------- |
| 2110 |
* IF-MIB::ifXEntry.ifPromiscuousMode |
| 2111 |
* ifPromiscuousMode is subid 16 of ifXEntry. |
| 2112 |
* Its status is Current, and its access level is ReadWrite. |
| 2113 |
* OID: .1.3.6.1.2.1.31.1.1.1.16 |
| 2114 |
* Description: |
| 2115 |
This object has a value of false(2) if this interface only |
| 2116 |
accepts packets/frames that are addressed to this station. |
| 2117 |
This object has a value of true(1) when the station accepts |
| 2118 |
all packets/frames transmitted on the media. The value |
| 2119 |
true(1) is only legal on certain types of media. If legal, |
| 2120 |
setting this object to a value of true(1) may require the |
| 2121 |
interface to be reset before becoming effective. |
| 2122 |
|
| 2123 |
The value of ifPromiscuousMode does not affect the reception |
| 2124 |
of broadcast and multicast packets/frames by the interface. |
| 2125 |
* |
| 2126 |
* Attributes: |
| 2127 |
* accessible 1 isscalar 0 enums 1 hasdefval 0 |
| 2128 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 2129 |
* settable 1 |
| 2130 |
* |
| 2131 |
* Enum range: 2/8. Values: true(1), false(2) |
| 2132 |
* |
| 2133 |
* Its syntax is TruthValue (based on perltype INTEGER) |
| 2134 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 2135 |
*/ |
| 2136 |
/** |
| 2137 |
* Check that the proposed new value is potentially valid. |
| 2138 |
* |
| 2139 |
* @param rowreq_ctx |
| 2140 |
* Pointer to the row request context. |
| 2141 |
* @param ifPromiscuousMode_val |
| 2142 |
* A long containing the new value. |
| 2143 |
* |
| 2144 |
* @retval MFD_SUCCESS : incoming value is legal |
| 2145 |
* @retval MFD_NOT_VALID_NOW : incoming value is not valid now |
| 2146 |
* @retval MFD_NOT_VALID_EVER : incoming value is never valid |
| 2147 |
* |
| 2148 |
* This is the place to check for requirements that are not |
| 2149 |
* expressed in the mib syntax (for example, a requirement that |
| 2150 |
* is detailed in the description for an object). |
| 2151 |
* |
| 2152 |
* You should check that the requested change between the undo value and the |
| 2153 |
* new value is legal (ie, the transistion from one value to another |
| 2154 |
* is legal). |
| 2155 |
* |
| 2156 |
*@note |
| 2157 |
* This check is only to determine if the new value |
| 2158 |
* is \b potentially valid. This is the first check of many, and |
| 2159 |
* is one of the simplest ones. |
| 2160 |
* |
| 2161 |
*@note |
| 2162 |
* this is not the place to do any checks for values |
| 2163 |
* which depend on some other value in the mib. Those |
| 2164 |
* types of checks should be done in the |
| 2165 |
* ifXTable_check_dependencies() function. |
| 2166 |
* |
| 2167 |
* The following checks have already been done for you: |
| 2168 |
* The syntax is ASN_INTEGER |
| 2169 |
* The value is one of true(1), false(2) |
| 2170 |
* |
| 2171 |
* If there a no other checks you need to do, simply return MFD_SUCCESS. |
| 2172 |
* |
| 2173 |
*/ |
| 2174 |
int |
| 2175 |
ifPromiscuousMode_check_value(ifXTable_rowreq_ctx * rowreq_ctx, |
| 2176 |
u_long ifPromiscuousMode_val) |
| 2177 |
{ |
| 2178 |
DEBUGMSGTL(("verbose:ifXTable:ifPromiscuousMode_check_value", |
| 2179 |
"called\n")); |
| 2180 |
|
| 2181 |
/** should never get a NULL pointer */ |
| 2182 |
netsnmp_assert(NULL != rowreq_ctx); |
| 2183 |
|
| 2184 |
/* |
| 2185 |
* TODO:441:o: |-> Check for valid ifPromiscuousMode value. |
| 2186 |
*/ |
| 2187 |
|
| 2188 |
return MFD_SUCCESS; /* ifPromiscuousMode value not illegal */ |
| 2189 |
} /* ifPromiscuousMode_check_value */ |
| 2190 |
|
| 2191 |
/** |
| 2192 |
* Save old value information |
| 2193 |
* |
| 2194 |
* @param rowreq_ctx |
| 2195 |
* Pointer to the table context (ifXTable_rowreq_ctx) |
| 2196 |
* |
| 2197 |
* @retval MFD_SUCCESS : success |
| 2198 |
* @retval MFD_ERROR : error. set will fail. |
| 2199 |
* |
| 2200 |
* This function will be called after the table level undo setup function |
| 2201 |
* ifXTable_undo_setup has been called. |
| 2202 |
* |
| 2203 |
*@note |
| 2204 |
* this function will only be called if a new value is set for this column. |
| 2205 |
* |
| 2206 |
* If there is any setup specific to a particular column (e.g. allocating |
| 2207 |
* memory for a string), you should do that setup in this function, so it |
| 2208 |
* won't be done unless it is necessary. |
| 2209 |
*/ |
| 2210 |
int |
| 2211 |
ifPromiscuousMode_undo_setup(ifXTable_rowreq_ctx * rowreq_ctx) |
| 2212 |
{ |
| 2213 |
DEBUGMSGTL(("verbose:ifXTable:ifPromiscuousMode_undo_setup", |
| 2214 |
"called\n")); |
| 2215 |
|
| 2216 |
/** should never get a NULL pointer */ |
| 2217 |
netsnmp_assert(NULL != rowreq_ctx); |
| 2218 |
|
| 2219 |
/* |
| 2220 |
* TODO:455:o: |-> Setup ifPromiscuousMode undo. |
| 2221 |
*/ |
| 2222 |
#ifdef NETSNMP_ENABLE_PROMISCUOUSMODE_SET |
| 2223 |
/* |
| 2224 |
* copy ifPromiscuousMode data |
| 2225 |
* set rowreq_ctx->undo->ifPromiscuousMode from rowreq_ctx->data.ifPromiscuousMode |
| 2226 |
*/ |
| 2227 |
rowreq_ctx->undo->ifPromiscuousMode = |
| 2228 |
rowreq_ctx->data.ifPromiscuousMode; |
| 2229 |
|
| 2230 |
|
| 2231 |
return MFD_SUCCESS; |
| 2232 |
#else |
| 2233 |
return MFD_NOT_VALID_EVER; |
| 2234 |
#endif |
| 2235 |
} /* ifPromiscuousMode_undo_setup */ |
| 2236 |
|
| 2237 |
/** |
| 2238 |
* Set the new value. |
| 2239 |
* |
| 2240 |
* @param rowreq_ctx |
| 2241 |
* Pointer to the users context. You should know how to |
| 2242 |
* manipulate the value from this object. |
| 2243 |
* @param ifPromiscuousMode_val |
| 2244 |
* A long containing the new value. |
| 2245 |
*/ |
| 2246 |
int |
| 2247 |
ifPromiscuousMode_set(ifXTable_rowreq_ctx * rowreq_ctx, |
| 2248 |
u_long ifPromiscuousMode_val) |
| 2249 |
{ |
| 2250 |
|
| 2251 |
DEBUGMSGTL(("verbose:ifXTable:ifPromiscuousMode_set", "called\n")); |
| 2252 |
|
| 2253 |
/** should never get a NULL pointer */ |
| 2254 |
netsnmp_assert(NULL != rowreq_ctx); |
| 2255 |
|
| 2256 |
/* |
| 2257 |
* TODO:461:M: |-> Set ifPromiscuousMode value. |
| 2258 |
* set ifPromiscuousMode value in rowreq_ctx->data |
| 2259 |
*/ |
| 2260 |
rowreq_ctx->data.ifPromiscuousMode = ifPromiscuousMode_val; |
| 2261 |
|
| 2262 |
return MFD_SUCCESS; |
| 2263 |
} /* ifPromiscuousMode_set */ |
| 2264 |
|
| 2265 |
/** |
| 2266 |
* undo the previous set. |
| 2267 |
* |
| 2268 |
* @param rowreq_ctx |
| 2269 |
* Pointer to the users context. |
| 2270 |
*/ |
| 2271 |
int |
| 2272 |
ifPromiscuousMode_undo(ifXTable_rowreq_ctx * rowreq_ctx) |
| 2273 |
{ |
| 2274 |
|
| 2275 |
DEBUGMSGTL(("verbose:ifXTable:ifPromiscuousMode_undo", "called\n")); |
| 2276 |
|
| 2277 |
netsnmp_assert(NULL != rowreq_ctx); |
| 2278 |
|
| 2279 |
/* |
| 2280 |
* TODO:456:o: |-> Clean up ifPromiscuousMode undo. |
| 2281 |
*/ |
| 2282 |
#ifdef NETSNMP_ENABLE_PROMISCUOUSMODE_SET |
| 2283 |
/* |
| 2284 |
* copy ifPromiscuousMode data |
| 2285 |
* set rowreq_ctx->data.ifPromiscuousMode from rowreq_ctx->undo->ifPromiscuousMode |
| 2286 |
*/ |
| 2287 |
rowreq_ctx->data.ifPromiscuousMode = |
| 2288 |
rowreq_ctx->undo->ifPromiscuousMode; |
| 2289 |
#endif |
| 2290 |
|
| 2291 |
return MFD_SUCCESS; |
| 2292 |
} /* ifPromiscuousMode_undo */ |
| 2293 |
|
| 2294 |
/*--------------------------------------------------------------------- |
| 2295 |
* IF-MIB::ifXEntry.ifAlias |
| 2296 |
* ifAlias is subid 18 of ifXEntry. |
| 2297 |
* Its status is Current, and its access level is ReadWrite. |
| 2298 |
* OID: .1.3.6.1.2.1.31.1.1.1.18 |
| 2299 |
* Description: |
| 2300 |
This object is an 'alias' name for the interface as |
| 2301 |
specified by a network manager, and provides a non-volatile |
| 2302 |
'handle' for the interface. |
| 2303 |
|
| 2304 |
On the first instantiation of an interface, the value of |
| 2305 |
ifAlias associated with that interface is the zero-length |
| 2306 |
string. As and when a value is written into an instance of |
| 2307 |
ifAlias through a network management set operation, then the |
| 2308 |
agent must retain the supplied value in the ifAlias instance |
| 2309 |
associated with the same interface for as long as that |
| 2310 |
interface remains instantiated, including across all re- |
| 2311 |
initializations/reboots of the network management system, |
| 2312 |
including those which result in a change of the interface's |
| 2313 |
ifIndex value. |
| 2314 |
|
| 2315 |
An example of the value which a network manager might store |
| 2316 |
in this object for a WAN interface is the (Telco's) circuit |
| 2317 |
number/identifier of the interface. |
| 2318 |
|
| 2319 |
Some agents may support write-access only for interfaces |
| 2320 |
having particular values of ifType. An agent which supports |
| 2321 |
write access to this object is required to keep the value in |
| 2322 |
non-volatile storage, but it may limit the length of new |
| 2323 |
values depending on how much storage is already occupied by |
| 2324 |
the current values for other interfaces. |
| 2325 |
* |
| 2326 |
* Attributes: |
| 2327 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 2328 |
* readable 1 iscolumn 1 ranges 1 hashint 1 |
| 2329 |
* settable 1 |
| 2330 |
* hint: 255a |
| 2331 |
* |
| 2332 |
* Ranges: 0 - 64; |
| 2333 |
* |
| 2334 |
* Its syntax is DisplayString (based on perltype OCTETSTR) |
| 2335 |
* The net-snmp type is ASN_OCTET_STR. The C type decl is char (char) |
| 2336 |
* This data type requires a length. (Max 64) |
| 2337 |
*/ |
| 2338 |
/** |
| 2339 |
* Check that the proposed new value is potentially valid. |
| 2340 |
* |
| 2341 |
* @param rowreq_ctx |
| 2342 |
* Pointer to the row request context. |
| 2343 |
* @param ifAlias_val_ptr |
| 2344 |
* A char containing the new value. |
| 2345 |
* @param ifAlias_val_ptr_len |
| 2346 |
* The size (in bytes) of the data pointed to by ifAlias_val_ptr |
| 2347 |
* |
| 2348 |
* @retval MFD_SUCCESS : incoming value is legal |
| 2349 |
* @retval MFD_NOT_VALID_NOW : incoming value is not valid now |
| 2350 |
* @retval MFD_NOT_VALID_EVER : incoming value is never valid |
| 2351 |
* |
| 2352 |
* This is the place to check for requirements that are not |
| 2353 |
* expressed in the mib syntax (for example, a requirement that |
| 2354 |
* is detailed in the description for an object). |
| 2355 |
* |
| 2356 |
* You should check that the requested change between the undo value and the |
| 2357 |
* new value is legal (ie, the transistion from one value to another |
| 2358 |
* is legal). |
| 2359 |
* |
| 2360 |
*@note |
| 2361 |
* This check is only to determine if the new value |
| 2362 |
* is \b potentially valid. This is the first check of many, and |
| 2363 |
* is one of the simplest ones. |
| 2364 |
* |
| 2365 |
*@note |
| 2366 |
* this is not the place to do any checks for values |
| 2367 |
* which depend on some other value in the mib. Those |
| 2368 |
* types of checks should be done in the |
| 2369 |
* ifXTable_check_dependencies() function. |
| 2370 |
* |
| 2371 |
* The following checks have already been done for you: |
| 2372 |
* The syntax is ASN_OCTET_STR |
| 2373 |
* The length is < sizeof(rowreq_ctx->data.ifAlias). |
| 2374 |
* The length is in (one of) the range set(s): 0 - 64 |
| 2375 |
* |
| 2376 |
* If there a no other checks you need to do, simply return MFD_SUCCESS. |
| 2377 |
* |
| 2378 |
*/ |
| 2379 |
int |
| 2380 |
ifAlias_check_value(ifXTable_rowreq_ctx * rowreq_ctx, |
| 2381 |
char *ifAlias_val_ptr, size_t ifAlias_val_ptr_len) |
| 2382 |
{ |
| 2383 |
DEBUGMSGTL(("verbose:ifXTable:ifAlias_check_value", "called\n")); |
| 2384 |
|
| 2385 |
/** should never get a NULL pointer */ |
| 2386 |
netsnmp_assert(NULL != rowreq_ctx); |
| 2387 |
netsnmp_assert(NULL != ifAlias_val_ptr); |
| 2388 |
|
| 2389 |
/* |
| 2390 |
* TODO:441:o: |-> Check for valid ifAlias value. |
| 2391 |
*/ |
| 2392 |
|
| 2393 |
return MFD_SUCCESS; /* ifAlias value not illegal */ |
| 2394 |
} /* ifAlias_check_value */ |
| 2395 |
|
| 2396 |
/** |
| 2397 |
* Save old value information |
| 2398 |
* |
| 2399 |
* @param rowreq_ctx |
| 2400 |
* Pointer to the table context (ifXTable_rowreq_ctx) |
| 2401 |
* |
| 2402 |
* @retval MFD_SUCCESS : success |
| 2403 |
* @retval MFD_ERROR : error. set will fail. |
| 2404 |
* |
| 2405 |
* This function will be called after the table level undo setup function |
| 2406 |
* ifXTable_undo_setup has been called. |
| 2407 |
* |
| 2408 |
*@note |
| 2409 |
* this function will only be called if a new value is set for this column. |
| 2410 |
* |
| 2411 |
* If there is any setup specific to a particular column (e.g. allocating |
| 2412 |
* memory for a string), you should do that setup in this function, so it |
| 2413 |
* won't be done unless it is necessary. |
| 2414 |
*/ |
| 2415 |
int |
| 2416 |
ifAlias_undo_setup(ifXTable_rowreq_ctx * rowreq_ctx) |
| 2417 |
{ |
| 2418 |
DEBUGMSGTL(("verbose:ifXTable:ifAlias_undo_setup", "called\n")); |
| 2419 |
|
| 2420 |
/** should never get a NULL pointer */ |
| 2421 |
netsnmp_assert(NULL != rowreq_ctx); |
| 2422 |
|
| 2423 |
/* |
| 2424 |
* TODO:455:o: |-> Setup ifAlias undo. |
| 2425 |
*/ |
| 2426 |
/* |
| 2427 |
* copy ifAlias and ifAlias_len data |
| 2428 |
* set rowreq_ctx->undo->ifAlias from rowreq_ctx->data.ifAlias |
| 2429 |
*/ |
| 2430 |
memcpy(rowreq_ctx->undo->ifAlias, rowreq_ctx->data.ifAlias, |
| 2431 |
(rowreq_ctx->data.ifAlias_len * |
| 2432 |
sizeof(rowreq_ctx->undo->ifAlias[0]))); |
| 2433 |
rowreq_ctx->undo->ifAlias_len = rowreq_ctx->data.ifAlias_len; |
| 2434 |
|
| 2435 |
|
| 2436 |
return MFD_SUCCESS; |
| 2437 |
} /* ifAlias_undo_setup */ |
| 2438 |
|
| 2439 |
/** |
| 2440 |
* Set the new value. |
| 2441 |
* |
| 2442 |
* @param rowreq_ctx |
| 2443 |
* Pointer to the users context. You should know how to |
| 2444 |
* manipulate the value from this object. |
| 2445 |
* @param ifAlias_val_ptr |
| 2446 |
* A char containing the new value. |
| 2447 |
* @param ifAlias_val_ptr_len |
| 2448 |
* The size (in bytes) of the data pointed to by ifAlias_val_ptr |
| 2449 |
*/ |
| 2450 |
int |
| 2451 |
ifAlias_set(ifXTable_rowreq_ctx * rowreq_ctx, char *ifAlias_val_ptr, |
| 2452 |
size_t ifAlias_val_ptr_len) |
| 2453 |
{ |
| 2454 |
|
| 2455 |
DEBUGMSGTL(("verbose:ifXTable:ifAlias_set", "called\n")); |
| 2456 |
|
| 2457 |
/** should never get a NULL pointer */ |
| 2458 |
netsnmp_assert(NULL != rowreq_ctx); |
| 2459 |
netsnmp_assert(NULL != ifAlias_val_ptr); |
| 2460 |
|
| 2461 |
/* |
| 2462 |
* TODO:461:M: |-> Set ifAlias value. |
| 2463 |
* set ifAlias value in rowreq_ctx->data |
| 2464 |
*/ |
| 2465 |
memcpy(rowreq_ctx->data.ifAlias, ifAlias_val_ptr, ifAlias_val_ptr_len); |
| 2466 |
/** convert bytes to number of char */ |
| 2467 |
rowreq_ctx->data.ifAlias_len = |
| 2468 |
ifAlias_val_ptr_len / sizeof(ifAlias_val_ptr[0]); |
| 2469 |
|
| 2470 |
return MFD_SUCCESS; |
| 2471 |
} /* ifAlias_set */ |
| 2472 |
|
| 2473 |
/** |
| 2474 |
* undo the previous set. |
| 2475 |
* |
| 2476 |
* @param rowreq_ctx |
| 2477 |
* Pointer to the users context. |
| 2478 |
*/ |
| 2479 |
int |
| 2480 |
ifAlias_undo(ifXTable_rowreq_ctx * rowreq_ctx) |
| 2481 |
{ |
| 2482 |
|
| 2483 |
DEBUGMSGTL(("verbose:ifXTable:ifAlias_undo", "called\n")); |
| 2484 |
|
| 2485 |
netsnmp_assert(NULL != rowreq_ctx); |
| 2486 |
|
| 2487 |
/* |
| 2488 |
* TODO:456:o: |-> Clean up ifAlias undo. |
| 2489 |
*/ |
| 2490 |
/* |
| 2491 |
* copy ifAlias and ifAlias_len data |
| 2492 |
* set rowreq_ctx->data.ifAlias from rowreq_ctx->undo->ifAlias |
| 2493 |
*/ |
| 2494 |
memcpy(rowreq_ctx->data.ifAlias, rowreq_ctx->undo->ifAlias, |
| 2495 |
(rowreq_ctx->undo->ifAlias_len * |
| 2496 |
sizeof(rowreq_ctx->data.ifAlias[0]))); |
| 2497 |
rowreq_ctx->data.ifAlias_len = rowreq_ctx->undo->ifAlias_len; |
| 2498 |
|
| 2499 |
|
| 2500 |
return MFD_SUCCESS; |
| 2501 |
} /* ifAlias_undo */ |
| 2502 |
|
| 2503 |
/** |
| 2504 |
* check dependencies |
| 2505 |
* |
| 2506 |
* This is useful for for tables which have dependencies between columns |
| 2507 |
* (or rows, or tables). For example, two columns allocating a percentage |
| 2508 |
* of something add up 100%. |
| 2509 |
* |
| 2510 |
* Should you need different behavior depending on which columns were |
| 2511 |
* set, rowreq_ctx->column_set_flags will indicate which writeable columns were |
| 2512 |
* set. The definitions for the COLUMN_*_FLAG bits can be found in |
| 2513 |
* ifXTable.h. |
| 2514 |
* A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. |
| 2515 |
* |
| 2516 |
* @retval MFD_SUCCESS all the changes to the row are legal |
| 2517 |
* @retval MFD_ERROR one or more changes are not legal |
| 2518 |
* |
| 2519 |
* (see README-table-ifXTable if you don't have dependencies) |
| 2520 |
*/ |
| 2521 |
int |
| 2522 |
ifXTable_check_dependencies(ifXTable_rowreq_ctx * rowreq_ctx) |
| 2523 |
{ |
| 2524 |
int rc = MFD_SUCCESS; |
| 2525 |
|
| 2526 |
DEBUGMSGTL(("internal:ifXTable:ifXTable_check_dependencies", |
| 2527 |
"called\n")); |
| 2528 |
|
| 2529 |
netsnmp_assert(NULL != rowreq_ctx); |
| 2530 |
|
| 2531 |
/* |
| 2532 |
* TODO:470:o: Check ifXTable row dependencies. |
| 2533 |
* check that all new value are legal and consistent with each other |
| 2534 |
*/ |
| 2535 |
return rc; |
| 2536 |
} /* ifXTable_check_dependencies */ |
| 2537 |
|
| 2538 |
#endif /* !NETSNMP_NO_WRITE_SUPPORT */ |
| 2539 |
|
| 2540 |
/** @} */ |
| 2541 |
/** @{ */ |