| 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 inetNetToMediaTable |
| 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-includes.h> |
| 18 |
#include <net-snmp/agent/net-snmp-agent-includes.h> |
| 19 |
|
| 20 |
/* |
| 21 |
* include our parent header |
| 22 |
*/ |
| 23 |
#include "inetNetToMediaTable.h" |
| 24 |
|
| 25 |
#include <net-snmp/agent/mib_modules.h> |
| 26 |
|
| 27 |
#include "inetNetToMediaTable_interface.h" |
| 28 |
|
| 29 |
const oid inetNetToMediaTable_oid[] = { INETNETTOMEDIATABLE_OID }; |
| 30 |
const int inetNetToMediaTable_oid_size = |
| 31 |
OID_LENGTH(inetNetToMediaTable_oid); |
| 32 |
|
| 33 |
inetNetToMediaTable_registration inetNetToMediaTable_user_context; |
| 34 |
static inetNetToMediaTable_registration *inetNetToMediaTable_user_context_p; |
| 35 |
|
| 36 |
void initialize_table_inetNetToMediaTable(void); |
| 37 |
void shutdown_table_inetNetToMediaTable(void); |
| 38 |
|
| 39 |
|
| 40 |
/** |
| 41 |
* Initializes the inetNetToMediaTable module |
| 42 |
*/ |
| 43 |
void |
| 44 |
init_inetNetToMediaTable(void) |
| 45 |
{ |
| 46 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:init_inetNetToMediaTable", |
| 47 |
"called\n")); |
| 48 |
|
| 49 |
/* |
| 50 |
* TODO:300:o: Perform inetNetToMediaTable one-time module initialization. |
| 51 |
*/ |
| 52 |
|
| 53 |
/* |
| 54 |
* here we initialize all the tables we're planning on supporting |
| 55 |
*/ |
| 56 |
if (should_init("inetNetToMediaTable")) |
| 57 |
initialize_table_inetNetToMediaTable(); |
| 58 |
|
| 59 |
} /* init_inetNetToMediaTable */ |
| 60 |
|
| 61 |
/** |
| 62 |
* Shut-down the inetNetToMediaTable module (agent is exiting) |
| 63 |
*/ |
| 64 |
void |
| 65 |
shutdown_inetNetToMediaTable(void) |
| 66 |
{ |
| 67 |
if (should_init("inetNetToMediaTable")) |
| 68 |
shutdown_table_inetNetToMediaTable(); |
| 69 |
|
| 70 |
} |
| 71 |
|
| 72 |
/** |
| 73 |
* Initialize the table inetNetToMediaTable |
| 74 |
* (Define its contents and how it's structured) |
| 75 |
*/ |
| 76 |
void |
| 77 |
initialize_table_inetNetToMediaTable(void) |
| 78 |
{ |
| 79 |
u_long flags; |
| 80 |
|
| 81 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:initialize_table_inetNetToMediaTable", "called\n")); |
| 82 |
|
| 83 |
/* |
| 84 |
* TODO:301:o: Perform inetNetToMediaTable one-time table initialization. |
| 85 |
*/ |
| 86 |
|
| 87 |
/* |
| 88 |
* TODO:302:o: |->Initialize inetNetToMediaTable user context |
| 89 |
* if you'd like to pass in a pointer to some data for this |
| 90 |
* table, allocate or set it up here. |
| 91 |
*/ |
| 92 |
/* |
| 93 |
* a netsnmp_data_list is a simple way to store void pointers. A simple |
| 94 |
* string token is used to add, find or remove pointers. |
| 95 |
*/ |
| 96 |
inetNetToMediaTable_user_context_p = |
| 97 |
netsnmp_create_data_list("inetNetToMediaTable", NULL, NULL); |
| 98 |
|
| 99 |
/* |
| 100 |
* No support for any flags yet, but in the future you would |
| 101 |
* set any flags here. |
| 102 |
*/ |
| 103 |
flags = 0; |
| 104 |
|
| 105 |
/* |
| 106 |
* call interface initialization code |
| 107 |
*/ |
| 108 |
_inetNetToMediaTable_initialize_interface |
| 109 |
(inetNetToMediaTable_user_context_p, flags); |
| 110 |
} /* initialize_table_inetNetToMediaTable */ |
| 111 |
|
| 112 |
/** |
| 113 |
* Shutdown the table inetNetToMediaTable |
| 114 |
*/ |
| 115 |
void |
| 116 |
shutdown_table_inetNetToMediaTable(void) |
| 117 |
{ |
| 118 |
/* |
| 119 |
* call interface shutdown code |
| 120 |
*/ |
| 121 |
_inetNetToMediaTable_shutdown_interface |
| 122 |
(inetNetToMediaTable_user_context_p); |
| 123 |
netsnmp_free_all_list_data(inetNetToMediaTable_user_context_p); |
| 124 |
inetNetToMediaTable_user_context_p = NULL; |
| 125 |
} |
| 126 |
|
| 127 |
/** |
| 128 |
* extra context initialization (eg default values) |
| 129 |
* |
| 130 |
* @param rowreq_ctx : row request context |
| 131 |
* @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate) |
| 132 |
* |
| 133 |
* @retval MFD_SUCCESS : no errors |
| 134 |
* @retval MFD_ERROR : error (context allocate will fail) |
| 135 |
*/ |
| 136 |
int |
| 137 |
inetNetToMediaTable_rowreq_ctx_init(inetNetToMediaTable_rowreq_ctx * |
| 138 |
rowreq_ctx, void *user_init_ctx) |
| 139 |
{ |
| 140 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_rowreq_ctx_init", "called\n")); |
| 141 |
|
| 142 |
netsnmp_assert(NULL != rowreq_ctx); |
| 143 |
|
| 144 |
/* |
| 145 |
* TODO:210:o: |-> Perform extra inetNetToMediaTable rowreq initialization. (eg DEFVALS) |
| 146 |
*/ |
| 147 |
|
| 148 |
return MFD_SUCCESS; |
| 149 |
} /* inetNetToMediaTable_rowreq_ctx_init */ |
| 150 |
|
| 151 |
/** |
| 152 |
* extra context cleanup |
| 153 |
* |
| 154 |
*/ |
| 155 |
void |
| 156 |
inetNetToMediaTable_rowreq_ctx_cleanup(inetNetToMediaTable_rowreq_ctx * |
| 157 |
rowreq_ctx) |
| 158 |
{ |
| 159 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_rowreq_ctx_cleanup", "called\n")); |
| 160 |
|
| 161 |
netsnmp_assert(NULL != rowreq_ctx); |
| 162 |
/* |
| 163 |
* TODO:211:o: |-> Perform extra inetNetToMediaTable rowreq cleanup. |
| 164 |
*/ |
| 165 |
SNMP_FREE(rowreq_ctx->data); |
| 166 |
} /* inetNetToMediaTable_rowreq_ctx_cleanup */ |
| 167 |
|
| 168 |
/** |
| 169 |
* pre-request callback |
| 170 |
* |
| 171 |
* |
| 172 |
* @retval MFD_SUCCESS : success. |
| 173 |
* @retval MFD_ERROR : other error |
| 174 |
*/ |
| 175 |
int |
| 176 |
inetNetToMediaTable_pre_request(inetNetToMediaTable_registration * |
| 177 |
user_context) |
| 178 |
{ |
| 179 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_pre_request", "called\n")); |
| 180 |
|
| 181 |
/* |
| 182 |
* TODO:510:o: Perform inetNetToMediaTable pre-request actions. |
| 183 |
*/ |
| 184 |
|
| 185 |
return MFD_SUCCESS; |
| 186 |
} /* inetNetToMediaTable_pre_request */ |
| 187 |
|
| 188 |
/** |
| 189 |
* post-request callback |
| 190 |
* |
| 191 |
* Note: |
| 192 |
* New rows have been inserted into the container, and |
| 193 |
* deleted rows have been removed from the container and |
| 194 |
* released. |
| 195 |
* |
| 196 |
* @param user_context |
| 197 |
* @param rc : MFD_SUCCESS if all requests succeeded |
| 198 |
* |
| 199 |
* @retval MFD_SUCCESS : success. |
| 200 |
* @retval MFD_ERROR : other error (ignored) |
| 201 |
*/ |
| 202 |
int |
| 203 |
inetNetToMediaTable_post_request(inetNetToMediaTable_registration * |
| 204 |
user_context, int rc) |
| 205 |
{ |
| 206 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_post_request", "called\n")); |
| 207 |
|
| 208 |
/* |
| 209 |
* TODO:511:o: Perform inetNetToMediaTable post-request actions. |
| 210 |
*/ |
| 211 |
|
| 212 |
/* |
| 213 |
* check to set if any rows were changed. |
| 214 |
*/ |
| 215 |
if (inetNetToMediaTable_dirty_get()) { |
| 216 |
/* |
| 217 |
* check if request was successful. If so, this would be |
| 218 |
* a good place to save data to its persistent store. |
| 219 |
*/ |
| 220 |
if (MFD_SUCCESS == rc) { |
| 221 |
/* |
| 222 |
* save changed rows, if you haven't already |
| 223 |
*/ |
| 224 |
} |
| 225 |
|
| 226 |
inetNetToMediaTable_dirty_set(0); /* clear table dirty flag */ |
| 227 |
} |
| 228 |
|
| 229 |
return MFD_SUCCESS; |
| 230 |
} /* inetNetToMediaTable_post_request */ |
| 231 |
|
| 232 |
|
| 233 |
/********************************************************************** |
| 234 |
********************************************************************** |
| 235 |
*** |
| 236 |
*** Table inetNetToMediaTable |
| 237 |
*** |
| 238 |
********************************************************************** |
| 239 |
**********************************************************************/ |
| 240 |
/* |
| 241 |
* IP-MIB::inetNetToMediaTable is subid 35 of ip. |
| 242 |
* Its status is Current. |
| 243 |
* OID: .1.3.6.1.2.1.4.35, length: 8 |
| 244 |
*/ |
| 245 |
|
| 246 |
/* |
| 247 |
* --------------------------------------------------------------------- |
| 248 |
* * TODO:200:r: Implement inetNetToMediaTable data context functions. |
| 249 |
*/ |
| 250 |
/* |
| 251 |
* inetNetToMediaTable_allocate_data |
| 252 |
* |
| 253 |
* Purpose: create new inetNetToMediaTable_data. |
| 254 |
*/ |
| 255 |
inetNetToMediaTable_data * |
| 256 |
inetNetToMediaTable_allocate_data(void) |
| 257 |
{ |
| 258 |
/* |
| 259 |
* TODO:201:r: |-> allocate memory for the inetNetToMediaTable data context. |
| 260 |
*/ |
| 261 |
/** this might not be right for netsnmp_inetmedia_entry */ |
| 262 |
inetNetToMediaTable_data *rtn = netsnmp_access_arp_entry_create(); |
| 263 |
|
| 264 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_allocate_data", "called\n")); |
| 265 |
|
| 266 |
if (NULL == rtn) { |
| 267 |
snmp_log(LOG_ERR, "unable to malloc memory for new " |
| 268 |
"inetNetToMediaTable_data.\n"); |
| 269 |
} |
| 270 |
|
| 271 |
return rtn; |
| 272 |
} /* inetNetToMediaTable_allocate_data */ |
| 273 |
|
| 274 |
/* |
| 275 |
* inetNetToMediaTable_release_data |
| 276 |
* |
| 277 |
* Purpose: release inetNetToMediaTable data. |
| 278 |
*/ |
| 279 |
void |
| 280 |
inetNetToMediaTable_release_data(inetNetToMediaTable_data * data) |
| 281 |
{ |
| 282 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_release_data", "called\n")); |
| 283 |
|
| 284 |
/* |
| 285 |
* TODO:202:r: |-> release memory for the inetNetToMediaTable data context. |
| 286 |
*/ |
| 287 |
netsnmp_access_arp_entry_free(data); |
| 288 |
} /* inetNetToMediaTable_release_data */ |
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
/** |
| 293 |
* set mib index(es) |
| 294 |
* |
| 295 |
* @param tbl_idx mib index structure |
| 296 |
* @param inetNetToMediaIfIndex_val |
| 297 |
* @param inetNetToMediaNetAddressType_val |
| 298 |
* @param inetNetToMediaNetAddress_val_ptr |
| 299 |
* @param inetNetToMediaNetAddress_val_ptr_len |
| 300 |
* |
| 301 |
* @retval MFD_SUCCESS : success. |
| 302 |
* @retval MFD_ERROR : other error. |
| 303 |
* |
| 304 |
* @remark |
| 305 |
* This convenience function is useful for setting all the MIB index |
| 306 |
* components with a single function call. It is assume that the C values |
| 307 |
* have already been mapped from their native/rawformat to the MIB format. |
| 308 |
*/ |
| 309 |
int |
| 310 |
inetNetToMediaTable_indexes_set_tbl_idx(inetNetToMediaTable_mib_index * |
| 311 |
tbl_idx, |
| 312 |
long inetNetToMediaIfIndex_val, |
| 313 |
u_long |
| 314 |
inetNetToMediaNetAddressType_val, |
| 315 |
char |
| 316 |
*inetNetToMediaNetAddress_val_ptr, |
| 317 |
size_t |
| 318 |
inetNetToMediaNetAddress_val_ptr_len) |
| 319 |
{ |
| 320 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_indexes_set_tbl_idx", "called\n")); |
| 321 |
|
| 322 |
/* |
| 323 |
* inetNetToMediaIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H |
| 324 |
*/ |
| 325 |
/** WARNING: this code might not work for netsnmp_arp_entry */ |
| 326 |
tbl_idx->inetNetToMediaIfIndex = inetNetToMediaIfIndex_val; |
| 327 |
|
| 328 |
/* |
| 329 |
* inetNetToMediaNetAddressType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h |
| 330 |
*/ |
| 331 |
/** WARNING: this code might not work for netsnmp_arp_entry */ |
| 332 |
tbl_idx->inetNetToMediaNetAddressType = |
| 333 |
inetNetToMediaNetAddressType_val; |
| 334 |
|
| 335 |
/* |
| 336 |
* inetNetToMediaNetAddress(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h |
| 337 |
*/ |
| 338 |
tbl_idx->inetNetToMediaNetAddress_len = sizeof(tbl_idx->inetNetToMediaNetAddress) / sizeof(tbl_idx->inetNetToMediaNetAddress[0]); /* max length */ |
| 339 |
/** WARNING: this code might not work for netsnmp_arp_entry */ |
| 340 |
/* |
| 341 |
* make sure there is enough space for inetNetToMediaNetAddress data |
| 342 |
*/ |
| 343 |
if (tbl_idx->inetNetToMediaNetAddress_len < |
| 344 |
inetNetToMediaNetAddress_val_ptr_len) { |
| 345 |
snmp_log(LOG_ERR, "not enough space for value\n"); |
| 346 |
return MFD_ERROR; |
| 347 |
} |
| 348 |
tbl_idx->inetNetToMediaNetAddress_len = |
| 349 |
inetNetToMediaNetAddress_val_ptr_len; |
| 350 |
memcpy(tbl_idx->inetNetToMediaNetAddress, |
| 351 |
inetNetToMediaNetAddress_val_ptr, |
| 352 |
inetNetToMediaNetAddress_val_ptr_len * |
| 353 |
sizeof(inetNetToMediaNetAddress_val_ptr[0])); |
| 354 |
|
| 355 |
|
| 356 |
return MFD_SUCCESS; |
| 357 |
} /* inetNetToMediaTable_indexes_set_tbl_idx */ |
| 358 |
|
| 359 |
/** |
| 360 |
* @internal |
| 361 |
* set row context indexes |
| 362 |
* |
| 363 |
* @param reqreq_ctx the row context that needs updated indexes |
| 364 |
* |
| 365 |
* @retval MFD_SUCCESS : success. |
| 366 |
* @retval MFD_ERROR : other error. |
| 367 |
* |
| 368 |
* @remark |
| 369 |
* This function sets the mib indexs, then updates the oid indexs |
| 370 |
* from the mib index. |
| 371 |
*/ |
| 372 |
int |
| 373 |
inetNetToMediaTable_indexes_set(inetNetToMediaTable_rowreq_ctx * |
| 374 |
rowreq_ctx, long inetNetToMediaIfIndex_val, |
| 375 |
u_long inetNetToMediaNetAddressType_val, |
| 376 |
char *inetNetToMediaNetAddress_val_ptr, |
| 377 |
size_t |
| 378 |
inetNetToMediaNetAddress_val_ptr_len) |
| 379 |
{ |
| 380 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_indexes_set", "called\n")); |
| 381 |
|
| 382 |
if (MFD_SUCCESS != |
| 383 |
inetNetToMediaTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx, |
| 384 |
inetNetToMediaIfIndex_val, |
| 385 |
inetNetToMediaNetAddressType_val, |
| 386 |
inetNetToMediaNetAddress_val_ptr, |
| 387 |
inetNetToMediaNetAddress_val_ptr_len)) |
| 388 |
return MFD_ERROR; |
| 389 |
|
| 390 |
/* |
| 391 |
* convert mib index to oid index |
| 392 |
*/ |
| 393 |
rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid); |
| 394 |
if (0 != inetNetToMediaTable_index_to_oid(&rowreq_ctx->oid_idx, |
| 395 |
&rowreq_ctx->tbl_idx)) { |
| 396 |
return MFD_ERROR; |
| 397 |
} |
| 398 |
|
| 399 |
return MFD_SUCCESS; |
| 400 |
} /* inetNetToMediaTable_indexes_set */ |
| 401 |
|
| 402 |
|
| 403 |
/*--------------------------------------------------------------------- |
| 404 |
* IP-MIB::inetNetToMediaEntry.inetNetToMediaPhysAddress |
| 405 |
* inetNetToMediaPhysAddress is subid 4 of inetNetToMediaEntry. |
| 406 |
* Its status is Current, and its access level is Create. |
| 407 |
* OID: .1.3.6.1.2.1.4.35.1.4 |
| 408 |
* Description: |
| 409 |
The media-dependent `physical' address. |
| 410 |
|
| 411 |
|
| 412 |
As the entries in this table are typically not persistent |
| 413 |
when this object is written the entity SHOULD NOT save the |
| 414 |
change to non-volatile storage. |
| 415 |
* |
| 416 |
* Attributes: |
| 417 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 418 |
* readable 1 iscolumn 1 ranges 1 hashint 1 |
| 419 |
* settable 1 |
| 420 |
* hint: 1x: |
| 421 |
* |
| 422 |
* Ranges: 0 - 65535; |
| 423 |
* |
| 424 |
* Its syntax is PhysAddress (based on perltype OCTETSTR) |
| 425 |
* The net-snmp type is ASN_OCTET_STR. The C type decl is char (char) |
| 426 |
* This data type requires a length. (Max 65535) |
| 427 |
*/ |
| 428 |
/** |
| 429 |
* Extract the current value of the inetNetToMediaPhysAddress data. |
| 430 |
* |
| 431 |
* Set a value using the data context for the row. |
| 432 |
* |
| 433 |
* @param rowreq_ctx |
| 434 |
* Pointer to the row request context. |
| 435 |
* @param inetNetToMediaPhysAddress_val_ptr_ptr |
| 436 |
* Pointer to storage for a char variable |
| 437 |
* @param inetNetToMediaPhysAddress_val_ptr_len_ptr |
| 438 |
* Pointer to a size_t. On entry, it will contain the size (in bytes) |
| 439 |
* pointed to by inetNetToMediaPhysAddress. |
| 440 |
* On exit, this value should contain the data size (in bytes). |
| 441 |
* |
| 442 |
* @retval MFD_SUCCESS : success |
| 443 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 444 |
* @retval MFD_ERROR : Any other error |
| 445 |
* |
| 446 |
* @note If you need more than (*inetNetToMediaPhysAddress_val_ptr_len_ptr) bytes of memory, |
| 447 |
* allocate it using malloc() and update inetNetToMediaPhysAddress_val_ptr_ptr. |
| 448 |
* <b>DO NOT</b> free the previous pointer. |
| 449 |
* The MFD helper will release the memory you allocate. |
| 450 |
* |
| 451 |
* @remark If you call this function yourself, you are responsible |
| 452 |
* for checking if the pointer changed, and freeing any |
| 453 |
* previously allocated memory. (Not necessary if you pass |
| 454 |
* in a pointer to static memory, obviously.) |
| 455 |
*/ |
| 456 |
int |
| 457 |
inetNetToMediaPhysAddress_get(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, |
| 458 |
char **inetNetToMediaPhysAddress_val_ptr_ptr, |
| 459 |
size_t |
| 460 |
* inetNetToMediaPhysAddress_val_ptr_len_ptr) |
| 461 |
{ |
| 462 |
/** we should have a non-NULL pointer and enough storage */ |
| 463 |
netsnmp_assert((NULL != inetNetToMediaPhysAddress_val_ptr_ptr) |
| 464 |
&& (NULL != *inetNetToMediaPhysAddress_val_ptr_ptr)); |
| 465 |
netsnmp_assert(NULL != inetNetToMediaPhysAddress_val_ptr_len_ptr); |
| 466 |
|
| 467 |
|
| 468 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaPhysAddress_get", "called\n")); |
| 469 |
|
| 470 |
netsnmp_assert(NULL != rowreq_ctx); |
| 471 |
|
| 472 |
/* |
| 473 |
* TODO:231:o: |-> Extract the current value of the inetNetToMediaPhysAddress data. |
| 474 |
* copy (* inetNetToMediaPhysAddress_val_ptr_ptr ) data and (* inetNetToMediaPhysAddress_val_ptr_len_ptr ) from rowreq_ctx->data |
| 475 |
*/ |
| 476 |
if ((*inetNetToMediaPhysAddress_val_ptr_len_ptr) < |
| 477 |
rowreq_ctx->data->arp_physaddress_len) |
| 478 |
return MFD_SKIP; |
| 479 |
|
| 480 |
memcpy((*inetNetToMediaPhysAddress_val_ptr_ptr), |
| 481 |
rowreq_ctx->data->arp_physaddress, |
| 482 |
rowreq_ctx->data->arp_physaddress_len); |
| 483 |
(*inetNetToMediaPhysAddress_val_ptr_len_ptr) = |
| 484 |
rowreq_ctx->data->arp_physaddress_len; |
| 485 |
|
| 486 |
return MFD_SUCCESS; |
| 487 |
} /* inetNetToMediaPhysAddress_get */ |
| 488 |
|
| 489 |
/*--------------------------------------------------------------------- |
| 490 |
* IP-MIB::inetNetToMediaEntry.inetNetToMediaLastUpdated |
| 491 |
* inetNetToMediaLastUpdated is subid 5 of inetNetToMediaEntry. |
| 492 |
* Its status is Current, and its access level is ReadOnly. |
| 493 |
* OID: .1.3.6.1.2.1.4.35.1.5 |
| 494 |
* Description: |
| 495 |
The value of sysUpTime at the time this entry was last |
| 496 |
updated. If this entry was updated prior to the last re- |
| 497 |
initialization of the local network management subsystem, |
| 498 |
then this object contains a zero value. |
| 499 |
* |
| 500 |
* Attributes: |
| 501 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 502 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 503 |
* settable 0 |
| 504 |
* |
| 505 |
* |
| 506 |
* Its syntax is TimeStamp (based on perltype TICKS) |
| 507 |
* The net-snmp type is ASN_TIMETICKS. The C type decl is u_long (u_long) |
| 508 |
*/ |
| 509 |
/** |
| 510 |
* Extract the current value of the inetNetToMediaLastUpdated data. |
| 511 |
* |
| 512 |
* Set a value using the data context for the row. |
| 513 |
* |
| 514 |
* @param rowreq_ctx |
| 515 |
* Pointer to the row request context. |
| 516 |
* @param inetNetToMediaLastUpdated_val_ptr |
| 517 |
* Pointer to storage for a u_long variable |
| 518 |
* |
| 519 |
* @retval MFD_SUCCESS : success |
| 520 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 521 |
* @retval MFD_ERROR : Any other error |
| 522 |
*/ |
| 523 |
int |
| 524 |
inetNetToMediaLastUpdated_get(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, |
| 525 |
u_long * inetNetToMediaLastUpdated_val_ptr) |
| 526 |
{ |
| 527 |
/** we should have a non-NULL pointer */ |
| 528 |
netsnmp_assert(NULL != inetNetToMediaLastUpdated_val_ptr); |
| 529 |
|
| 530 |
|
| 531 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaLastUpdated_get", "called\n")); |
| 532 |
|
| 533 |
netsnmp_assert(NULL != rowreq_ctx); |
| 534 |
|
| 535 |
/* |
| 536 |
* TODO:231:o: |-> Extract the current value of the inetNetToMediaLastUpdated data. |
| 537 |
* copy (* inetNetToMediaLastUpdated_val_ptr ) from rowreq_ctx->data |
| 538 |
*/ |
| 539 |
*inetNetToMediaLastUpdated_val_ptr = rowreq_ctx->data->arp_last_updated; |
| 540 |
return MFD_SUCCESS; |
| 541 |
} /* inetNetToMediaLastUpdated_get */ |
| 542 |
|
| 543 |
/*--------------------------------------------------------------------- |
| 544 |
* IP-MIB::inetNetToMediaEntry.inetNetToMediaType |
| 545 |
* inetNetToMediaType is subid 6 of inetNetToMediaEntry. |
| 546 |
* Its status is Current, and its access level is Create. |
| 547 |
* OID: .1.3.6.1.2.1.4.35.1.6 |
| 548 |
* Description: |
| 549 |
The type of mapping. |
| 550 |
|
| 551 |
|
| 552 |
Setting this object to the value invalid(2) has the effect |
| 553 |
of invalidating the corresponding entry in the |
| 554 |
inetNetToMediaTable. That is, it effectively dis- |
| 555 |
associates the interface identified with said entry from the |
| 556 |
mapping identified with said entry. It is an |
| 557 |
implementation- specific matter as to whether the agent |
| 558 |
removes an invalidated entry from the table. Accordingly, |
| 559 |
management stations must be prepared to receive tabular |
| 560 |
information from agents that corresponds to entries not |
| 561 |
currently in use. Proper interpretation of such entries |
| 562 |
requires examination of the relevant inetNetToMediaType |
| 563 |
object. |
| 564 |
|
| 565 |
|
| 566 |
The 'dynamic(3)' type indicates that the IP address to |
| 567 |
physical addresses mapping has been dynamically resolved |
| 568 |
using e.g. IPv4 ARP or the IPv6 Neighbor Discovery protocol. |
| 569 |
|
| 570 |
|
| 571 |
The 'static(4)' type indicates that the mapping has been |
| 572 |
statically configured. Both of these refer to entries that |
| 573 |
provide mappings for other entities addresses. |
| 574 |
|
| 575 |
|
| 576 |
The 'local(5)' type indicates that the mapping is provided |
| 577 |
for an entity's own interface address. |
| 578 |
|
| 579 |
|
| 580 |
As the entries in this table are typically not persistent |
| 581 |
when this object is written the entity SHOULD NOT save the |
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
change to non-volatile storage. |
| 587 |
* |
| 588 |
* Attributes: |
| 589 |
* accessible 1 isscalar 0 enums 1 hasdefval 1 |
| 590 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 591 |
* settable 1 |
| 592 |
* defval: static |
| 593 |
* |
| 594 |
* Enum range: 5/8. Values: other(1), invalid(2), dynamic(3), static(4), local(5) |
| 595 |
* |
| 596 |
* Its syntax is INTEGER (based on perltype INTEGER) |
| 597 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 598 |
*/ |
| 599 |
/** |
| 600 |
* Extract the current value of the inetNetToMediaType data. |
| 601 |
* |
| 602 |
* Set a value using the data context for the row. |
| 603 |
* |
| 604 |
* @param rowreq_ctx |
| 605 |
* Pointer to the row request context. |
| 606 |
* @param inetNetToMediaType_val_ptr |
| 607 |
* Pointer to storage for a long variable |
| 608 |
* |
| 609 |
* @retval MFD_SUCCESS : success |
| 610 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 611 |
* @retval MFD_ERROR : Any other error |
| 612 |
*/ |
| 613 |
int |
| 614 |
inetNetToMediaType_get(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, |
| 615 |
u_long * inetNetToMediaType_val_ptr) |
| 616 |
{ |
| 617 |
/** we should have a non-NULL pointer */ |
| 618 |
netsnmp_assert(NULL != inetNetToMediaType_val_ptr); |
| 619 |
|
| 620 |
|
| 621 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaType_get", |
| 622 |
"called\n")); |
| 623 |
|
| 624 |
netsnmp_assert(NULL != rowreq_ctx); |
| 625 |
|
| 626 |
/* |
| 627 |
* TODO:231:o: |-> Extract the current value of the inetNetToMediaType data. |
| 628 |
* copy (* inetNetToMediaType_val_ptr ) from rowreq_ctx->data |
| 629 |
*/ |
| 630 |
(*inetNetToMediaType_val_ptr) = rowreq_ctx->data->arp_type; |
| 631 |
|
| 632 |
return MFD_SUCCESS; |
| 633 |
} /* inetNetToMediaType_get */ |
| 634 |
|
| 635 |
/*--------------------------------------------------------------------- |
| 636 |
* IP-MIB::inetNetToMediaEntry.inetNetToMediaState |
| 637 |
* inetNetToMediaState is subid 7 of inetNetToMediaEntry. |
| 638 |
* Its status is Current, and its access level is ReadOnly. |
| 639 |
* OID: .1.3.6.1.2.1.4.35.1.7 |
| 640 |
* Description: |
| 641 |
The Neighbor Unreachability Detection [4] state for the |
| 642 |
interface when the address mapping in this entry is used. |
| 643 |
If Neighbor Unreachability Detection is not in use (e.g. for |
| 644 |
IPv4), this object is always unknown(6). |
| 645 |
* |
| 646 |
* Attributes: |
| 647 |
* accessible 1 isscalar 0 enums 1 hasdefval 0 |
| 648 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 649 |
* settable 0 |
| 650 |
* |
| 651 |
* Enum range: 6/8. Values: reachable(1), stale(2), delay(3), probe(4), invalid(5), unknown(6), incomplete(7) |
| 652 |
* |
| 653 |
* Its syntax is INTEGER (based on perltype INTEGER) |
| 654 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 655 |
*/ |
| 656 |
/** |
| 657 |
* Extract the current value of the inetNetToMediaState data. |
| 658 |
* |
| 659 |
* Set a value using the data context for the row. |
| 660 |
* |
| 661 |
* @param rowreq_ctx |
| 662 |
* Pointer to the row request context. |
| 663 |
* @param inetNetToMediaState_val_ptr |
| 664 |
* Pointer to storage for a long variable |
| 665 |
* |
| 666 |
* @retval MFD_SUCCESS : success |
| 667 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 668 |
* @retval MFD_ERROR : Any other error |
| 669 |
*/ |
| 670 |
int |
| 671 |
inetNetToMediaState_get(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, |
| 672 |
u_long * inetNetToMediaState_val_ptr) |
| 673 |
{ |
| 674 |
/** we should have a non-NULL pointer */ |
| 675 |
netsnmp_assert(NULL != inetNetToMediaState_val_ptr); |
| 676 |
|
| 677 |
|
| 678 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaState_get", |
| 679 |
"called\n")); |
| 680 |
|
| 681 |
netsnmp_assert(NULL != rowreq_ctx); |
| 682 |
|
| 683 |
/* |
| 684 |
* TODO:231:o: |-> Extract the current value of the inetNetToMediaState data. |
| 685 |
* copy (* inetNetToMediaState_val_ptr ) from rowreq_ctx->data |
| 686 |
*/ |
| 687 |
(*inetNetToMediaState_val_ptr) = rowreq_ctx->data->arp_state; |
| 688 |
|
| 689 |
return MFD_SUCCESS; |
| 690 |
} /* inetNetToMediaState_get */ |
| 691 |
|
| 692 |
/*--------------------------------------------------------------------- |
| 693 |
* IP-MIB::inetNetToMediaEntry.inetNetToMediaRowStatus |
| 694 |
* inetNetToMediaRowStatus is subid 8 of inetNetToMediaEntry. |
| 695 |
* Its status is Current, and its access level is Create. |
| 696 |
* OID: .1.3.6.1.2.1.4.35.1.8 |
| 697 |
* Description: |
| 698 |
The status of this conceptual row. |
| 699 |
|
| 700 |
|
| 701 |
The RowStatus TC requires that this DESCRIPTION clause |
| 702 |
states under which circumstances other objects in this row |
| 703 |
can be modified. The value of this object has no effect on |
| 704 |
whether other objects in this conceptual row can be |
| 705 |
modified. |
| 706 |
|
| 707 |
|
| 708 |
A conceptual row can not be made active until the |
| 709 |
inetNetToMediaPhysAddress object has been set. |
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
|
| 714 |
Note that if the inetNetToMediaType is set to 'invalid' the |
| 715 |
managed node may delete the entry independent of the state |
| 716 |
of this object. |
| 717 |
* |
| 718 |
* Attributes: |
| 719 |
* accessible 1 isscalar 0 enums 1 hasdefval 0 |
| 720 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 721 |
* settable 1 |
| 722 |
* |
| 723 |
* Enum range: 3/8. Values: active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6) |
| 724 |
* |
| 725 |
* Its syntax is RowStatus (based on perltype INTEGER) |
| 726 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 727 |
*/ |
| 728 |
/** |
| 729 |
* Extract the current value of the inetNetToMediaRowStatus data. |
| 730 |
* |
| 731 |
* Set a value using the data context for the row. |
| 732 |
* |
| 733 |
* @param rowreq_ctx |
| 734 |
* Pointer to the row request context. |
| 735 |
* @param inetNetToMediaRowStatus_val_ptr |
| 736 |
* Pointer to storage for a long variable |
| 737 |
* |
| 738 |
* @retval MFD_SUCCESS : success |
| 739 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 740 |
* @retval MFD_ERROR : Any other error |
| 741 |
*/ |
| 742 |
int |
| 743 |
inetNetToMediaRowStatus_get(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, |
| 744 |
u_long * inetNetToMediaRowStatus_val_ptr) |
| 745 |
{ |
| 746 |
/** we should have a non-NULL pointer */ |
| 747 |
netsnmp_assert(NULL != inetNetToMediaRowStatus_val_ptr); |
| 748 |
|
| 749 |
(*inetNetToMediaRowStatus_val_ptr) = |
| 750 |
rowreq_ctx->inetNetToMediaRowStatus; |
| 751 |
|
| 752 |
return MFD_SUCCESS; |
| 753 |
} /* inetNetToMediaRowStatus_get */ |
| 754 |
|
| 755 |
|
| 756 |
|
| 757 |
/** @} */ |
| 758 |
/********************************************************************** |
| 759 |
********************************************************************** |
| 760 |
*** |
| 761 |
*** Table inetNetToMediaTable |
| 762 |
*** |
| 763 |
********************************************************************** |
| 764 |
**********************************************************************/ |
| 765 |
/* |
| 766 |
* IP-MIB::inetNetToMediaTable is subid 35 of ip. |
| 767 |
* Its status is Current. |
| 768 |
* OID: .1.3.6.1.2.1.4.35, length: 8 |
| 769 |
*/ |
| 770 |
/* |
| 771 |
* NOTE: if you update this chart, please update the versions in |
| 772 |
* local/mib2c-conf.d/parent-set.m2i |
| 773 |
* agent/mibgroup/helpers/baby_steps.c |
| 774 |
* while you're at it. |
| 775 |
*/ |
| 776 |
/* |
| 777 |
*********************************************************************** |
| 778 |
* Baby Steps Flow Chart (2004.06.05) * |
| 779 |
* * |
| 780 |
* +--------------+ +================+ U = unconditional path * |
| 781 |
* |optional state| ||required state|| S = path for success * |
| 782 |
* +--------------+ +================+ E = path for error * |
| 783 |
*********************************************************************** |
| 784 |
* |
| 785 |
* +--------------+ |
| 786 |
* | pre | |
| 787 |
* | request | |
| 788 |
* +--------------+ |
| 789 |
* | U |
| 790 |
* +-------------+ +==============+ |
| 791 |
* | row |f|<-------|| object || |
| 792 |
* | create |1| E || lookup || |
| 793 |
* +-------------+ +==============+ |
| 794 |
* E | | S | S |
| 795 |
* | +------------------>| |
| 796 |
* | +==============+ |
| 797 |
* | E || check || |
| 798 |
* |<---------------|| values || |
| 799 |
* | +==============+ |
| 800 |
* | | S |
| 801 |
* | +==============+ |
| 802 |
* | +<-------|| undo || |
| 803 |
* | | E || setup || |
| 804 |
* | | +==============+ |
| 805 |
* | | | S |
| 806 |
* | | +==============+ |
| 807 |
* | | || set ||-------------------------->+ |
| 808 |
* | | || value || E | |
| 809 |
* | | +==============+ | |
| 810 |
* | | | S | |
| 811 |
* | | +--------------+ | |
| 812 |
* | | | check |-------------------------->| |
| 813 |
* | | | consistency | E | |
| 814 |
* | | +--------------+ | |
| 815 |
* | | | S | |
| 816 |
* | | +==============+ +==============+ | |
| 817 |
* | | || commit ||-------->|| undo || | |
| 818 |
* | | || || E || commit || | |
| 819 |
* | | +==============+ +==============+ | |
| 820 |
* | | | S U |<--------+ |
| 821 |
* | | +--------------+ +==============+ |
| 822 |
* | | | irreversible | || undo || |
| 823 |
* | | | commit | || set || |
| 824 |
* | | +--------------+ +==============+ |
| 825 |
* | | | U U | |
| 826 |
* | +-------------->|<------------------------+ |
| 827 |
* | +==============+ |
| 828 |
* | || undo || |
| 829 |
* | || cleanup || |
| 830 |
* | +==============+ |
| 831 |
* +---------------------->| U |
| 832 |
* | |
| 833 |
* (err && f1)------------------->+ |
| 834 |
* | | |
| 835 |
* +--------------+ +--------------+ |
| 836 |
* | post |<--------| row | |
| 837 |
* | request | U | release | |
| 838 |
* +--------------+ +--------------+ |
| 839 |
* |
| 840 |
*/ |
| 841 |
|
| 842 |
/** |
| 843 |
* Setup up context with information needed to undo a set request. |
| 844 |
* |
| 845 |
* This function will be called before the individual node undo setup |
| 846 |
* functions are called. If you need to do any undo setup that is not |
| 847 |
* related to a specific column, you can do it here. |
| 848 |
* |
| 849 |
* Note that the undo context has been allocated with |
| 850 |
* inetNetToMediaTable_allocate_data(), but may need extra |
| 851 |
* initialization similar to what you may have done in |
| 852 |
* inetNetToMediaTable_rowreq_ctx_init(). |
| 853 |
* Note that an individual node's undo_setup function will only be called |
| 854 |
* if that node is being set to a new value. |
| 855 |
* |
| 856 |
* If there is any setup specific to a particular column (e.g. allocating |
| 857 |
* memory for a string), you should do that setup in the node's undo_setup |
| 858 |
* function, so it won't be done unless it is necessary. |
| 859 |
* |
| 860 |
* @param rowreq_ctx |
| 861 |
* Pointer to the table context (inetNetToMediaTable_rowreq_ctx) |
| 862 |
* |
| 863 |
* @retval MFD_SUCCESS : success |
| 864 |
* @retval MFD_ERROR : error. set will fail. |
| 865 |
*/ |
| 866 |
int |
| 867 |
inetNetToMediaTable_undo_setup(inetNetToMediaTable_rowreq_ctx * rowreq_ctx) |
| 868 |
{ |
| 869 |
int rc = MFD_SUCCESS; |
| 870 |
|
| 871 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_undo_setup", "called\n")); |
| 872 |
|
| 873 |
/** we should have a non-NULL pointer */ |
| 874 |
netsnmp_assert(NULL != rowreq_ctx); |
| 875 |
|
| 876 |
/* |
| 877 |
* TODO:451:M: |-> Setup inetNetToMediaTable undo. |
| 878 |
* set up inetNetToMediaTable undo information, in preparation for a set. |
| 879 |
* Undo storage is in (* inetNetToMediaRowStatus_val_ptr )* |
| 880 |
*/ |
| 881 |
|
| 882 |
return rc; |
| 883 |
} /* inetNetToMediaTable_undo_setup */ |
| 884 |
|
| 885 |
/** |
| 886 |
* Undo a set request. |
| 887 |
* |
| 888 |
* This function will be called before the individual node undo |
| 889 |
* functions are called. If you need to do any undo that is not |
| 890 |
* related to a specific column, you can do it here. |
| 891 |
* |
| 892 |
* Note that an individual node's undo function will only be called |
| 893 |
* if that node is being set to a new value. |
| 894 |
* |
| 895 |
* If there is anything specific to a particular column (e.g. releasing |
| 896 |
* memory for a string), you should do that setup in the node's undo |
| 897 |
* function, so it won't be done unless it is necessary. |
| 898 |
* |
| 899 |
* @param rowreq_ctx |
| 900 |
* Pointer to the table context (inetNetToMediaTable_rowreq_ctx) |
| 901 |
* |
| 902 |
* @retval MFD_SUCCESS : success |
| 903 |
* @retval MFD_ERROR : error. set will fail. |
| 904 |
*/ |
| 905 |
int |
| 906 |
inetNetToMediaTable_undo(inetNetToMediaTable_rowreq_ctx * rowreq_ctx) |
| 907 |
{ |
| 908 |
int rc = MFD_SUCCESS; |
| 909 |
|
| 910 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_undo", |
| 911 |
"called\n")); |
| 912 |
|
| 913 |
/** we should have a non-NULL pointer */ |
| 914 |
netsnmp_assert(NULL != rowreq_ctx); |
| 915 |
|
| 916 |
/* |
| 917 |
* TODO:451:M: |-> inetNetToMediaTable undo. |
| 918 |
* inetNetToMediaTable undo information, in response to a failed set. |
| 919 |
* Undo storage is in (* inetNetToMediaRowStatus_val_ptr )* |
| 920 |
*/ |
| 921 |
|
| 922 |
return rc; |
| 923 |
} /* inetNetToMediaTable_undo_setup */ |
| 924 |
|
| 925 |
/** |
| 926 |
* Cleanup up context undo information. |
| 927 |
* |
| 928 |
* This function will be called after set/commit processing. If you |
| 929 |
* allocated any resources in undo_setup, this is the place to release |
| 930 |
* those resources. |
| 931 |
* |
| 932 |
* This function is called regardless of the success or failure of the set |
| 933 |
* request. If you need to perform different steps for cleanup depending |
| 934 |
* on success or failure, you can add a flag to the rowreq_ctx. |
| 935 |
* |
| 936 |
* @param rowreq_ctx |
| 937 |
* Pointer to the table context (inetNetToMediaTable_rowreq_ctx) |
| 938 |
* |
| 939 |
* @retval MFD_SUCCESS : success |
| 940 |
* @retval MFD_ERROR : error |
| 941 |
*/ |
| 942 |
int |
| 943 |
inetNetToMediaTable_undo_cleanup(inetNetToMediaTable_rowreq_ctx * |
| 944 |
rowreq_ctx) |
| 945 |
{ |
| 946 |
int rc = MFD_SUCCESS; |
| 947 |
|
| 948 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_undo_cleanup", "called\n")); |
| 949 |
|
| 950 |
/** we should have a non-NULL pointer */ |
| 951 |
netsnmp_assert(NULL != rowreq_ctx); |
| 952 |
|
| 953 |
/* |
| 954 |
* TODO:452:M: |-> Cleanup inetNetToMediaTable undo. |
| 955 |
* Undo storage is in (* inetNetToMediaRowStatus_val_ptr )* |
| 956 |
*/ |
| 957 |
|
| 958 |
return rc; |
| 959 |
} /* inetNetToMediaTable_undo_cleanup */ |
| 960 |
|
| 961 |
/** |
| 962 |
* commit new values. |
| 963 |
* |
| 964 |
* At this point, you should have done everything you can to ensure that |
| 965 |
* this commit will not fail. |
| 966 |
* |
| 967 |
* Should you need different behavior depending on which columns were |
| 968 |
* set, rowreq_ctx->column_set_flags will indicate which writeable columns were |
| 969 |
* set. The definitions for the COLUMN_*_FLAG bits can be found in |
| 970 |
* inetNetToMediaTable.h. |
| 971 |
* A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. |
| 972 |
* |
| 973 |
* @param rowreq_ctx |
| 974 |
* Pointer to the users context. |
| 975 |
* |
| 976 |
* @retval MFD_SUCCESS : success |
| 977 |
* @retval MFD_ERROR : error |
| 978 |
*/ |
| 979 |
int |
| 980 |
inetNetToMediaTable_commit(inetNetToMediaTable_rowreq_ctx * rowreq_ctx) |
| 981 |
{ |
| 982 |
int rc = MFD_SUCCESS; |
| 983 |
int save_flags; |
| 984 |
|
| 985 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_commit", |
| 986 |
"called\n")); |
| 987 |
|
| 988 |
/** we should have a non-NULL pointer */ |
| 989 |
netsnmp_assert(NULL != rowreq_ctx); |
| 990 |
|
| 991 |
/* |
| 992 |
* save flags, then clear until we actually do something |
| 993 |
*/ |
| 994 |
save_flags = rowreq_ctx->column_set_flags; |
| 995 |
rowreq_ctx->column_set_flags = 0; |
| 996 |
|
| 997 |
/* |
| 998 |
* commit inetNetToMediaTable data |
| 999 |
* 1) check the column's flag in save_flags to see if it was set. |
| 1000 |
* 2) clear the flag when you handle that column |
| 1001 |
* 3) set the column's flag in column_set_flags if it needs undo |
| 1002 |
* processing in case of a failure. |
| 1003 |
*/ |
| 1004 |
#if 1 |
| 1005 |
/** xxx-rks:9 nettomedia commit */ |
| 1006 |
#else |
| 1007 |
if (save_flags & COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG) { |
| 1008 |
save_flags &= ~COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG; /* clear inetNetToMediaPhysAddress */ |
| 1009 |
/* |
| 1010 |
* TODO:482:o: |-> commit column inetNetToMediaPhysAddress. |
| 1011 |
*/ |
| 1012 |
rc = -1; |
| 1013 |
if (-1 == rc) { |
| 1014 |
snmp_log(LOG_ERR, |
| 1015 |
"inetNetToMediaTable column inetNetToMediaPhysAddress commit failed\n"); |
| 1016 |
} else { |
| 1017 |
/* |
| 1018 |
* set flag, in case we need to undo inetNetToMediaPhysAddress |
| 1019 |
*/ |
| 1020 |
rowreq_ctx->column_set_flags |= |
| 1021 |
COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG; |
| 1022 |
} |
| 1023 |
} |
| 1024 |
|
| 1025 |
if (save_flags & COLUMN_INETNETTOMEDIATYPE_FLAG) { |
| 1026 |
save_flags &= ~COLUMN_INETNETTOMEDIATYPE_FLAG; /* clear inetNetToMediaType */ |
| 1027 |
/* |
| 1028 |
* TODO:482:o: |-> commit column inetNetToMediaType. |
| 1029 |
*/ |
| 1030 |
rc = -1; |
| 1031 |
if (-1 == rc) { |
| 1032 |
snmp_log(LOG_ERR, |
| 1033 |
"inetNetToMediaTable column inetNetToMediaType commit failed\n"); |
| 1034 |
} else { |
| 1035 |
/* |
| 1036 |
* set flag, in case we need to undo inetNetToMediaType |
| 1037 |
*/ |
| 1038 |
rowreq_ctx->column_set_flags |= COLUMN_INETNETTOMEDIATYPE_FLAG; |
| 1039 |
} |
| 1040 |
} |
| 1041 |
|
| 1042 |
if (save_flags & COLUMN_INETNETTOMEDIAROWSTATUS_FLAG) { |
| 1043 |
save_flags &= ~COLUMN_INETNETTOMEDIAROWSTATUS_FLAG; /* clear inetNetToMediaRowStatus */ |
| 1044 |
/* |
| 1045 |
* TODO:482:o: |-> commit column inetNetToMediaRowStatus. |
| 1046 |
*/ |
| 1047 |
rc = -1; |
| 1048 |
if (-1 == rc) { |
| 1049 |
snmp_log(LOG_ERR, |
| 1050 |
"inetNetToMediaTable column inetNetToMediaRowStatus commit failed\n"); |
| 1051 |
} else { |
| 1052 |
/* |
| 1053 |
* set flag, in case we need to undo inetNetToMediaRowStatus |
| 1054 |
*/ |
| 1055 |
rowreq_ctx->column_set_flags |= |
| 1056 |
COLUMN_INETNETTOMEDIAROWSTATUS_FLAG; |
| 1057 |
} |
| 1058 |
} |
| 1059 |
|
| 1060 |
/* |
| 1061 |
* if we successfully committed this row, set the dirty flag. |
| 1062 |
*/ |
| 1063 |
if (MFD_SUCCESS == rc) { |
| 1064 |
rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY; |
| 1065 |
} |
| 1066 |
#endif |
| 1067 |
|
| 1068 |
if (save_flags) { |
| 1069 |
snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n", |
| 1070 |
save_flags); |
| 1071 |
return MFD_ERROR; |
| 1072 |
} |
| 1073 |
|
| 1074 |
return rc; |
| 1075 |
} /* inetNetToMediaTable_commit */ |
| 1076 |
|
| 1077 |
/** |
| 1078 |
* undo commit new values. |
| 1079 |
* |
| 1080 |
* Should you need different behavior depending on which columns were |
| 1081 |
* set, rowreq_ctx->column_set_flags will indicate which writeable columns were |
| 1082 |
* set. The definitions for the COLUMN_*_FLAG bits can be found in |
| 1083 |
* inetNetToMediaTable.h. |
| 1084 |
* A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. |
| 1085 |
* |
| 1086 |
* @param rowreq_ctx |
| 1087 |
* Pointer to the users context. |
| 1088 |
* |
| 1089 |
* @retval MFD_SUCCESS : success |
| 1090 |
* @retval MFD_ERROR : error |
| 1091 |
*/ |
| 1092 |
int |
| 1093 |
inetNetToMediaTable_undo_commit(inetNetToMediaTable_rowreq_ctx * |
| 1094 |
rowreq_ctx) |
| 1095 |
{ |
| 1096 |
int rc = MFD_SUCCESS; |
| 1097 |
|
| 1098 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_undo_commit", "called\n")); |
| 1099 |
|
| 1100 |
/** we should have a non-NULL pointer */ |
| 1101 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1102 |
|
| 1103 |
/* |
| 1104 |
* TODO:485:M: |-> Undo inetNetToMediaTable commit. |
| 1105 |
* check the column's flag in rowreq_ctx->column_set_flags to see |
| 1106 |
* if it was set during commit, then undo it. |
| 1107 |
* |
| 1108 |
* eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {} |
| 1109 |
*/ |
| 1110 |
|
| 1111 |
|
| 1112 |
/* |
| 1113 |
* if we successfully un-committed this row, clear the dirty flag. |
| 1114 |
*/ |
| 1115 |
if (MFD_SUCCESS == rc) { |
| 1116 |
rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY; |
| 1117 |
} |
| 1118 |
|
| 1119 |
return rc; |
| 1120 |
} /* inetNetToMediaTable_undo_commit */ |
| 1121 |
|
| 1122 |
/* |
| 1123 |
* TODO:440:M: Implement inetNetToMediaTable node value checks. |
| 1124 |
* TODO:450:M: Implement inetNetToMediaTable undo functions. |
| 1125 |
* TODO:460:M: Implement inetNetToMediaTable set functions. |
| 1126 |
* TODO:480:M: Implement inetNetToMediaTable commit functions. |
| 1127 |
*/ |
| 1128 |
/*--------------------------------------------------------------------- |
| 1129 |
* IP-MIB::inetNetToMediaEntry.inetNetToMediaPhysAddress |
| 1130 |
* inetNetToMediaPhysAddress is subid 4 of inetNetToMediaEntry. |
| 1131 |
* Its status is Current, and its access level is Create. |
| 1132 |
* OID: .1.3.6.1.2.1.4.35.1.4 |
| 1133 |
* Description: |
| 1134 |
The media-dependent `physical' address. |
| 1135 |
|
| 1136 |
|
| 1137 |
As the entries in this table are typically not persistent |
| 1138 |
when this object is written the entity SHOULD NOT save the |
| 1139 |
change to non-volatile storage. |
| 1140 |
* |
| 1141 |
* Attributes: |
| 1142 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 1143 |
* readable 1 iscolumn 1 ranges 1 hashint 1 |
| 1144 |
* settable 1 |
| 1145 |
* hint: 1x: |
| 1146 |
* |
| 1147 |
* Ranges: 0 - 65535; |
| 1148 |
* |
| 1149 |
* Its syntax is PhysAddress (based on perltype OCTETSTR) |
| 1150 |
* The net-snmp type is ASN_OCTET_STR. The C type decl is char (char) |
| 1151 |
* This data type requires a length. (Max 65535) |
| 1152 |
*/ |
| 1153 |
/** |
| 1154 |
* Check that the proposed new value is potentially valid. |
| 1155 |
* |
| 1156 |
* @param rowreq_ctx |
| 1157 |
* Pointer to the row request context. |
| 1158 |
* @param inetNetToMediaPhysAddress_val_ptr |
| 1159 |
* A char containing the new value. |
| 1160 |
* @param inetNetToMediaPhysAddress_val_ptr_len |
| 1161 |
* The size (in bytes) of the data pointed to by inetNetToMediaPhysAddress_val_ptr |
| 1162 |
* |
| 1163 |
* @retval MFD_SUCCESS : incoming value is legal |
| 1164 |
* @retval MFD_NOT_VALID_NOW : incoming value is not valid now |
| 1165 |
* @retval MFD_NOT_VALID_EVER : incoming value is never valid |
| 1166 |
* |
| 1167 |
* This is the place to check for requirements that are not |
| 1168 |
* expressed in the mib syntax (for example, a requirement that |
| 1169 |
* is detailed in the description for an object). |
| 1170 |
* |
| 1171 |
* Since you aren't using a generated data context, you also need to |
| 1172 |
* check the length, to make sure you don't overflow your storage space. |
| 1173 |
* |
| 1174 |
* You should check that the requested change between the undo value and the |
| 1175 |
* new value is legal (ie, the transistion from one value to another |
| 1176 |
* is legal). |
| 1177 |
* |
| 1178 |
*@note |
| 1179 |
* This check is only to determine if the new value |
| 1180 |
* is \b potentially valid. This is the first check of many, and |
| 1181 |
* is one of the simplest ones. |
| 1182 |
* |
| 1183 |
*@note |
| 1184 |
* this is not the place to do any checks for values |
| 1185 |
* which depend on some other value in the mib. Those |
| 1186 |
* types of checks should be done in the |
| 1187 |
* inetNetToMediaTable_check_dependencies() function. |
| 1188 |
* |
| 1189 |
* The following checks have already been done for you: |
| 1190 |
* The syntax is ASN_OCTET_STR |
| 1191 |
* The length is in (one of) the range set(s): 0 - 65535 |
| 1192 |
* |
| 1193 |
* If there a no other checks you need to do, simply return MFD_SUCCESS. |
| 1194 |
* |
| 1195 |
*/ |
| 1196 |
int |
| 1197 |
inetNetToMediaPhysAddress_check_value(inetNetToMediaTable_rowreq_ctx * |
| 1198 |
rowreq_ctx, char |
| 1199 |
*inetNetToMediaPhysAddress_val_ptr, |
| 1200 |
size_t |
| 1201 |
inetNetToMediaPhysAddress_val_ptr_len) |
| 1202 |
{ |
| 1203 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaPhysAddress_check_value", "called\n")); |
| 1204 |
|
| 1205 |
/** should never get a NULL pointer */ |
| 1206 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1207 |
netsnmp_assert(NULL != inetNetToMediaPhysAddress_val_ptr); |
| 1208 |
|
| 1209 |
/* |
| 1210 |
* TODO:441:o: |-> Check for valid inetNetToMediaPhysAddress value. |
| 1211 |
*/ |
| 1212 |
|
| 1213 |
return MFD_SUCCESS; /* inetNetToMediaPhysAddress value not illegal */ |
| 1214 |
} /* inetNetToMediaPhysAddress_check_value */ |
| 1215 |
|
| 1216 |
/** |
| 1217 |
* Save old value information |
| 1218 |
* |
| 1219 |
* @param rowreq_ctx |
| 1220 |
* Pointer to the table context (inetNetToMediaTable_rowreq_ctx) |
| 1221 |
* |
| 1222 |
* @retval MFD_SUCCESS : success |
| 1223 |
* @retval MFD_ERROR : error. set will fail. |
| 1224 |
* |
| 1225 |
* This function will be called after the table level undo setup function |
| 1226 |
* inetNetToMediaTable_undo_setup has been called. |
| 1227 |
* |
| 1228 |
*@note |
| 1229 |
* this function will only be called if a new value is set for this column. |
| 1230 |
* |
| 1231 |
* If there is any setup specific to a particular column (e.g. allocating |
| 1232 |
* memory for a string), you should do that setup in this function, so it |
| 1233 |
* won't be done unless it is necessary. |
| 1234 |
*/ |
| 1235 |
int |
| 1236 |
inetNetToMediaPhysAddress_undo_setup(inetNetToMediaTable_rowreq_ctx * |
| 1237 |
rowreq_ctx) |
| 1238 |
{ |
| 1239 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaPhysAddress_undo_setup", "called\n")); |
| 1240 |
|
| 1241 |
/** should never get a NULL pointer */ |
| 1242 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1243 |
|
| 1244 |
/* |
| 1245 |
* TODO:455:o: |-> Setup inetNetToMediaPhysAddress undo. |
| 1246 |
*/ |
| 1247 |
/* |
| 1248 |
* copy inetNetToMediaPhysAddress and inetNetToMediaPhysAddress_len data |
| 1249 |
* set rowreq_ctx->undo->inetNetToMediaPhysAddress from rowreq_ctx->data->inetNetToMediaPhysAddress |
| 1250 |
*/ |
| 1251 |
|
| 1252 |
|
| 1253 |
return MFD_SUCCESS; |
| 1254 |
} /* inetNetToMediaPhysAddress_undo_setup */ |
| 1255 |
|
| 1256 |
/** |
| 1257 |
* Set the new value. |
| 1258 |
* |
| 1259 |
* @param rowreq_ctx |
| 1260 |
* Pointer to the users context. You should know how to |
| 1261 |
* manipulate the value from this object. |
| 1262 |
* @param inetNetToMediaPhysAddress_val_ptr |
| 1263 |
* A char containing the new value. |
| 1264 |
* @param inetNetToMediaPhysAddress_val_ptr_len |
| 1265 |
* The size (in bytes) of the data pointed to by inetNetToMediaPhysAddress_val_ptr |
| 1266 |
*/ |
| 1267 |
int |
| 1268 |
inetNetToMediaPhysAddress_set(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, |
| 1269 |
char *inetNetToMediaPhysAddress_val_ptr, |
| 1270 |
size_t inetNetToMediaPhysAddress_val_ptr_len) |
| 1271 |
{ |
| 1272 |
|
| 1273 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaPhysAddress_set", "called\n")); |
| 1274 |
|
| 1275 |
/** should never get a NULL pointer */ |
| 1276 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1277 |
netsnmp_assert(NULL != inetNetToMediaPhysAddress_val_ptr); |
| 1278 |
|
| 1279 |
/* |
| 1280 |
* TODO:461:M: |-> Set inetNetToMediaPhysAddress value. |
| 1281 |
* set inetNetToMediaPhysAddress value in rowreq_ctx->data |
| 1282 |
*/ |
| 1283 |
|
| 1284 |
return MFD_SUCCESS; |
| 1285 |
} /* inetNetToMediaPhysAddress_set */ |
| 1286 |
|
| 1287 |
/** |
| 1288 |
* undo the previous set. |
| 1289 |
* |
| 1290 |
* @param rowreq_ctx |
| 1291 |
* Pointer to the users context. |
| 1292 |
*/ |
| 1293 |
int |
| 1294 |
inetNetToMediaPhysAddress_undo(inetNetToMediaTable_rowreq_ctx * rowreq_ctx) |
| 1295 |
{ |
| 1296 |
|
| 1297 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaPhysAddress_undo", "called\n")); |
| 1298 |
|
| 1299 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1300 |
|
| 1301 |
/* |
| 1302 |
* TODO:456:o: |-> Clean up inetNetToMediaPhysAddress undo. |
| 1303 |
*/ |
| 1304 |
/* |
| 1305 |
* copy inetNetToMediaPhysAddress and inetNetToMediaPhysAddress_len data |
| 1306 |
* set rowreq_ctx->data->inetNetToMediaPhysAddress from rowreq_ctx->undo->inetNetToMediaPhysAddress |
| 1307 |
*/ |
| 1308 |
|
| 1309 |
|
| 1310 |
return MFD_SUCCESS; |
| 1311 |
} /* inetNetToMediaPhysAddress_undo */ |
| 1312 |
|
| 1313 |
/*--------------------------------------------------------------------- |
| 1314 |
* IP-MIB::inetNetToMediaEntry.inetNetToMediaType |
| 1315 |
* inetNetToMediaType is subid 6 of inetNetToMediaEntry. |
| 1316 |
* Its status is Current, and its access level is Create. |
| 1317 |
* OID: .1.3.6.1.2.1.4.35.1.6 |
| 1318 |
* Description: |
| 1319 |
The type of mapping. |
| 1320 |
|
| 1321 |
|
| 1322 |
Setting this object to the value invalid(2) has the effect |
| 1323 |
of invalidating the corresponding entry in the |
| 1324 |
inetNetToMediaTable. That is, it effectively dis- |
| 1325 |
associates the interface identified with said entry from the |
| 1326 |
mapping identified with said entry. It is an |
| 1327 |
implementation- specific matter as to whether the agent |
| 1328 |
removes an invalidated entry from the table. Accordingly, |
| 1329 |
management stations must be prepared to receive tabular |
| 1330 |
information from agents that corresponds to entries not |
| 1331 |
currently in use. Proper interpretation of such entries |
| 1332 |
requires examination of the relevant inetNetToMediaType |
| 1333 |
object. |
| 1334 |
|
| 1335 |
|
| 1336 |
The 'dynamic(3)' type indicates that the IP address to |
| 1337 |
physical addresses mapping has been dynamically resolved |
| 1338 |
using e.g. IPv4 ARP or the IPv6 Neighbor Discovery protocol. |
| 1339 |
|
| 1340 |
|
| 1341 |
The 'static(4)' type indicates that the mapping has been |
| 1342 |
statically configured. Both of these refer to entries that |
| 1343 |
provide mappings for other entities addresses. |
| 1344 |
|
| 1345 |
|
| 1346 |
The 'local(5)' type indicates that the mapping is provided |
| 1347 |
for an entity's own interface address. |
| 1348 |
|
| 1349 |
|
| 1350 |
As the entries in this table are typically not persistent |
| 1351 |
when this object is written the entity SHOULD NOT save the |
| 1352 |
|
| 1353 |
|
| 1354 |
|
| 1355 |
|
| 1356 |
change to non-volatile storage. |
| 1357 |
* |
| 1358 |
* Attributes: |
| 1359 |
* accessible 1 isscalar 0 enums 1 hasdefval 1 |
| 1360 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1361 |
* settable 1 |
| 1362 |
* defval: static |
| 1363 |
* |
| 1364 |
* Enum range: 5/8. Values: other(1), invalid(2), dynamic(3), static(4), local(5) |
| 1365 |
* |
| 1366 |
* Its syntax is INTEGER (based on perltype INTEGER) |
| 1367 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 1368 |
*/ |
| 1369 |
/** |
| 1370 |
* Check that the proposed new value is potentially valid. |
| 1371 |
* |
| 1372 |
* @param rowreq_ctx |
| 1373 |
* Pointer to the row request context. |
| 1374 |
* @param inetNetToMediaType_val |
| 1375 |
* A long containing the new value. |
| 1376 |
* |
| 1377 |
* @retval MFD_SUCCESS : incoming value is legal |
| 1378 |
* @retval MFD_NOT_VALID_NOW : incoming value is not valid now |
| 1379 |
* @retval MFD_NOT_VALID_EVER : incoming value is never valid |
| 1380 |
* |
| 1381 |
* This is the place to check for requirements that are not |
| 1382 |
* expressed in the mib syntax (for example, a requirement that |
| 1383 |
* is detailed in the description for an object). |
| 1384 |
* |
| 1385 |
* You should check that the requested change between the undo value and the |
| 1386 |
* new value is legal (ie, the transistion from one value to another |
| 1387 |
* is legal). |
| 1388 |
* |
| 1389 |
*@note |
| 1390 |
* This check is only to determine if the new value |
| 1391 |
* is \b potentially valid. This is the first check of many, and |
| 1392 |
* is one of the simplest ones. |
| 1393 |
* |
| 1394 |
*@note |
| 1395 |
* this is not the place to do any checks for values |
| 1396 |
* which depend on some other value in the mib. Those |
| 1397 |
* types of checks should be done in the |
| 1398 |
* inetNetToMediaTable_check_dependencies() function. |
| 1399 |
* |
| 1400 |
* The following checks have already been done for you: |
| 1401 |
* The syntax is ASN_INTEGER |
| 1402 |
* The value is one of other(1), invalid(2), dynamic(3), static(4), local(5) |
| 1403 |
* |
| 1404 |
* If there a no other checks you need to do, simply return MFD_SUCCESS. |
| 1405 |
* |
| 1406 |
*/ |
| 1407 |
int |
| 1408 |
inetNetToMediaType_check_value(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, |
| 1409 |
u_long inetNetToMediaType_val) |
| 1410 |
{ |
| 1411 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaType_check_value", "called\n")); |
| 1412 |
|
| 1413 |
/** should never get a NULL pointer */ |
| 1414 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1415 |
|
| 1416 |
/* |
| 1417 |
* TODO:441:o: |-> Check for valid inetNetToMediaType value. |
| 1418 |
*/ |
| 1419 |
|
| 1420 |
return MFD_SUCCESS; /* inetNetToMediaType value not illegal */ |
| 1421 |
} /* inetNetToMediaType_check_value */ |
| 1422 |
|
| 1423 |
/** |
| 1424 |
* Save old value information |
| 1425 |
* |
| 1426 |
* @param rowreq_ctx |
| 1427 |
* Pointer to the table context (inetNetToMediaTable_rowreq_ctx) |
| 1428 |
* |
| 1429 |
* @retval MFD_SUCCESS : success |
| 1430 |
* @retval MFD_ERROR : error. set will fail. |
| 1431 |
* |
| 1432 |
* This function will be called after the table level undo setup function |
| 1433 |
* inetNetToMediaTable_undo_setup has been called. |
| 1434 |
* |
| 1435 |
*@note |
| 1436 |
* this function will only be called if a new value is set for this column. |
| 1437 |
* |
| 1438 |
* If there is any setup specific to a particular column (e.g. allocating |
| 1439 |
* memory for a string), you should do that setup in this function, so it |
| 1440 |
* won't be done unless it is necessary. |
| 1441 |
*/ |
| 1442 |
int |
| 1443 |
inetNetToMediaType_undo_setup(inetNetToMediaTable_rowreq_ctx * rowreq_ctx) |
| 1444 |
{ |
| 1445 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaType_undo_setup", "called\n")); |
| 1446 |
|
| 1447 |
/** should never get a NULL pointer */ |
| 1448 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1449 |
|
| 1450 |
/* |
| 1451 |
* TODO:455:o: |-> Setup inetNetToMediaType undo. |
| 1452 |
*/ |
| 1453 |
/* |
| 1454 |
* copy inetNetToMediaType data |
| 1455 |
* set rowreq_ctx->undo->inetNetToMediaType from rowreq_ctx->data->inetNetToMediaType |
| 1456 |
*/ |
| 1457 |
|
| 1458 |
|
| 1459 |
return MFD_SUCCESS; |
| 1460 |
} /* inetNetToMediaType_undo_setup */ |
| 1461 |
|
| 1462 |
/** |
| 1463 |
* Set the new value. |
| 1464 |
* |
| 1465 |
* @param rowreq_ctx |
| 1466 |
* Pointer to the users context. You should know how to |
| 1467 |
* manipulate the value from this object. |
| 1468 |
* @param inetNetToMediaType_val |
| 1469 |
* A long containing the new value. |
| 1470 |
*/ |
| 1471 |
int |
| 1472 |
inetNetToMediaType_set(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, |
| 1473 |
u_long inetNetToMediaType_val) |
| 1474 |
{ |
| 1475 |
|
| 1476 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaType_set", |
| 1477 |
"called\n")); |
| 1478 |
|
| 1479 |
/** should never get a NULL pointer */ |
| 1480 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1481 |
|
| 1482 |
/* |
| 1483 |
* TODO:461:M: |-> Set inetNetToMediaType value. |
| 1484 |
* set inetNetToMediaType value in rowreq_ctx->data |
| 1485 |
*/ |
| 1486 |
|
| 1487 |
return MFD_SUCCESS; |
| 1488 |
} /* inetNetToMediaType_set */ |
| 1489 |
|
| 1490 |
/** |
| 1491 |
* undo the previous set. |
| 1492 |
* |
| 1493 |
* @param rowreq_ctx |
| 1494 |
* Pointer to the users context. |
| 1495 |
*/ |
| 1496 |
int |
| 1497 |
inetNetToMediaType_undo(inetNetToMediaTable_rowreq_ctx * rowreq_ctx) |
| 1498 |
{ |
| 1499 |
|
| 1500 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaType_undo", |
| 1501 |
"called\n")); |
| 1502 |
|
| 1503 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1504 |
|
| 1505 |
/* |
| 1506 |
* TODO:456:o: |-> Clean up inetNetToMediaType undo. |
| 1507 |
*/ |
| 1508 |
/* |
| 1509 |
* copy inetNetToMediaType data |
| 1510 |
* set rowreq_ctx->data->inetNetToMediaType from rowreq_ctx->undo->inetNetToMediaType |
| 1511 |
*/ |
| 1512 |
|
| 1513 |
|
| 1514 |
return MFD_SUCCESS; |
| 1515 |
} /* inetNetToMediaType_undo */ |
| 1516 |
|
| 1517 |
/*--------------------------------------------------------------------- |
| 1518 |
* IP-MIB::inetNetToMediaEntry.inetNetToMediaRowStatus |
| 1519 |
* inetNetToMediaRowStatus is subid 8 of inetNetToMediaEntry. |
| 1520 |
* Its status is Current, and its access level is Create. |
| 1521 |
* OID: .1.3.6.1.2.1.4.35.1.8 |
| 1522 |
* Description: |
| 1523 |
The status of this conceptual row. |
| 1524 |
|
| 1525 |
|
| 1526 |
The RowStatus TC requires that this DESCRIPTION clause |
| 1527 |
states under which circumstances other objects in this row |
| 1528 |
can be modified. The value of this object has no effect on |
| 1529 |
whether other objects in this conceptual row can be |
| 1530 |
modified. |
| 1531 |
|
| 1532 |
|
| 1533 |
A conceptual row can not be made active until the |
| 1534 |
inetNetToMediaPhysAddress object has been set. |
| 1535 |
|
| 1536 |
|
| 1537 |
|
| 1538 |
|
| 1539 |
Note that if the inetNetToMediaType is set to 'invalid' the |
| 1540 |
managed node may delete the entry independent of the state |
| 1541 |
of this object. |
| 1542 |
* |
| 1543 |
* Attributes: |
| 1544 |
* accessible 1 isscalar 0 enums 1 hasdefval 0 |
| 1545 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1546 |
* settable 1 |
| 1547 |
* |
| 1548 |
* Enum range: 3/8. Values: active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6) |
| 1549 |
* |
| 1550 |
* Its syntax is RowStatus (based on perltype INTEGER) |
| 1551 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 1552 |
*/ |
| 1553 |
/** |
| 1554 |
* Check that the proposed new value is potentially valid. |
| 1555 |
* |
| 1556 |
* @param rowreq_ctx |
| 1557 |
* Pointer to the row request context. |
| 1558 |
* @param inetNetToMediaRowStatus_val |
| 1559 |
* A long containing the new value. |
| 1560 |
* |
| 1561 |
* @retval MFD_SUCCESS : incoming value is legal |
| 1562 |
* @retval MFD_NOT_VALID_NOW : incoming value is not valid now |
| 1563 |
* @retval MFD_NOT_VALID_EVER : incoming value is never valid |
| 1564 |
* |
| 1565 |
* This is the place to check for requirements that are not |
| 1566 |
* expressed in the mib syntax (for example, a requirement that |
| 1567 |
* is detailed in the description for an object). |
| 1568 |
* |
| 1569 |
* You should check that the requested change between the undo value and the |
| 1570 |
* new value is legal (ie, the transistion from one value to another |
| 1571 |
* is legal). |
| 1572 |
* |
| 1573 |
*@note |
| 1574 |
* This check is only to determine if the new value |
| 1575 |
* is \b potentially valid. This is the first check of many, and |
| 1576 |
* is one of the simplest ones. |
| 1577 |
* |
| 1578 |
*@note |
| 1579 |
* this is not the place to do any checks for values |
| 1580 |
* which depend on some other value in the mib. Those |
| 1581 |
* types of checks should be done in the |
| 1582 |
* inetNetToMediaTable_check_dependencies() function. |
| 1583 |
* |
| 1584 |
* The following checks have already been done for you: |
| 1585 |
* The syntax is ASN_INTEGER |
| 1586 |
* The value is one of active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6) |
| 1587 |
* |
| 1588 |
* If there a no other checks you need to do, simply return MFD_SUCCESS. |
| 1589 |
* |
| 1590 |
*/ |
| 1591 |
int |
| 1592 |
inetNetToMediaRowStatus_check_value(inetNetToMediaTable_rowreq_ctx * |
| 1593 |
rowreq_ctx, |
| 1594 |
u_long inetNetToMediaRowStatus_val) |
| 1595 |
{ |
| 1596 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaRowStatus_check_value", "called\n")); |
| 1597 |
|
| 1598 |
/** should never get a NULL pointer */ |
| 1599 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1600 |
|
| 1601 |
/* |
| 1602 |
* TODO:441:o: |-> Check for valid inetNetToMediaRowStatus value. |
| 1603 |
*/ |
| 1604 |
|
| 1605 |
return MFD_SUCCESS; /* inetNetToMediaRowStatus value not illegal */ |
| 1606 |
} /* inetNetToMediaRowStatus_check_value */ |
| 1607 |
|
| 1608 |
/** |
| 1609 |
* Save old value information |
| 1610 |
* |
| 1611 |
* @param rowreq_ctx |
| 1612 |
* Pointer to the table context (inetNetToMediaTable_rowreq_ctx) |
| 1613 |
* |
| 1614 |
* @retval MFD_SUCCESS : success |
| 1615 |
* @retval MFD_ERROR : error. set will fail. |
| 1616 |
* |
| 1617 |
* This function will be called after the table level undo setup function |
| 1618 |
* inetNetToMediaTable_undo_setup has been called. |
| 1619 |
* |
| 1620 |
*@note |
| 1621 |
* this function will only be called if a new value is set for this column. |
| 1622 |
* |
| 1623 |
* If there is any setup specific to a particular column (e.g. allocating |
| 1624 |
* memory for a string), you should do that setup in this function, so it |
| 1625 |
* won't be done unless it is necessary. |
| 1626 |
*/ |
| 1627 |
int |
| 1628 |
inetNetToMediaRowStatus_undo_setup(inetNetToMediaTable_rowreq_ctx * |
| 1629 |
rowreq_ctx) |
| 1630 |
{ |
| 1631 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaRowStatus_undo_setup", "called\n")); |
| 1632 |
|
| 1633 |
/** should never get a NULL pointer */ |
| 1634 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1635 |
|
| 1636 |
/* |
| 1637 |
* TODO:455:o: |-> Setup inetNetToMediaRowStatus undo. |
| 1638 |
*/ |
| 1639 |
/* |
| 1640 |
* copy inetNetToMediaRowStatus data |
| 1641 |
* set rowreq_ctx->undo->inetNetToMediaRowStatus from rowreq_ctx->data->inetNetToMediaRowStatus |
| 1642 |
*/ |
| 1643 |
rowreq_ctx->inetNetToMediaRowStatus_undo = |
| 1644 |
rowreq_ctx->inetNetToMediaRowStatus; |
| 1645 |
|
| 1646 |
return MFD_SUCCESS; |
| 1647 |
} /* inetNetToMediaRowStatus_undo_setup */ |
| 1648 |
|
| 1649 |
/** |
| 1650 |
* Set the new value. |
| 1651 |
* |
| 1652 |
* @param rowreq_ctx |
| 1653 |
* Pointer to the users context. You should know how to |
| 1654 |
* manipulate the value from this object. |
| 1655 |
* @param inetNetToMediaRowStatus_val |
| 1656 |
* A long containing the new value. |
| 1657 |
*/ |
| 1658 |
int |
| 1659 |
inetNetToMediaRowStatus_set(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, |
| 1660 |
u_long inetNetToMediaRowStatus_val) |
| 1661 |
{ |
| 1662 |
|
| 1663 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaRowStatus_set", |
| 1664 |
"called\n")); |
| 1665 |
|
| 1666 |
/** should never get a NULL pointer */ |
| 1667 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1668 |
|
| 1669 |
/* |
| 1670 |
* TODO:461:M: |-> Set inetNetToMediaRowStatus value. |
| 1671 |
* set inetNetToMediaRowStatus value in rowreq_ctx->data |
| 1672 |
*/ |
| 1673 |
|
| 1674 |
return MFD_SUCCESS; |
| 1675 |
} /* inetNetToMediaRowStatus_set */ |
| 1676 |
|
| 1677 |
/** |
| 1678 |
* undo the previous set. |
| 1679 |
* |
| 1680 |
* @param rowreq_ctx |
| 1681 |
* Pointer to the users context. |
| 1682 |
*/ |
| 1683 |
int |
| 1684 |
inetNetToMediaRowStatus_undo(inetNetToMediaTable_rowreq_ctx * rowreq_ctx) |
| 1685 |
{ |
| 1686 |
|
| 1687 |
DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaRowStatus_undo", |
| 1688 |
"called\n")); |
| 1689 |
|
| 1690 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1691 |
|
| 1692 |
/* |
| 1693 |
* TODO:456:o: |-> Clean up inetNetToMediaRowStatus undo. |
| 1694 |
*/ |
| 1695 |
/* |
| 1696 |
* copy inetNetToMediaRowStatus data |
| 1697 |
* set rowreq_ctx->data->inetNetToMediaRowStatus from rowreq_ctx->undo->inetNetToMediaRowStatus |
| 1698 |
*/ |
| 1699 |
rowreq_ctx->inetNetToMediaRowStatus = |
| 1700 |
rowreq_ctx->inetNetToMediaRowStatus_undo; |
| 1701 |
|
| 1702 |
|
| 1703 |
return MFD_SUCCESS; |
| 1704 |
} /* inetNetToMediaRowStatus_undo */ |
| 1705 |
|
| 1706 |
/** |
| 1707 |
* check dependencies |
| 1708 |
* |
| 1709 |
* This is useful for for tables which have dependencies between columns |
| 1710 |
* (or rows, or tables). For example, two columns allocating a percentage |
| 1711 |
* of something add up 100%. |
| 1712 |
* |
| 1713 |
* Should you need different behavior depending on which columns were |
| 1714 |
* set, rowreq_ctx->column_set_flags will indicate which writeable columns were |
| 1715 |
* set. The definitions for the COLUMN_*_FLAG bits can be found in |
| 1716 |
* inetNetToMediaTable.h. |
| 1717 |
* A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. |
| 1718 |
* |
| 1719 |
* @param rowreq_ctx |
| 1720 |
* |
| 1721 |
* @retval MFD_SUCCESS all the changes to the row are legal |
| 1722 |
* @retval MFD_ERROR one or more changes are not legal |
| 1723 |
* |
| 1724 |
* (see README-table-inetNetToMediaTable if you don't have dependencies) |
| 1725 |
*/ |
| 1726 |
int |
| 1727 |
inetNetToMediaTable_check_dependencies(inetNetToMediaTable_rowreq_ctx * |
| 1728 |
rowreq_ctx) |
| 1729 |
{ |
| 1730 |
int rc = MFD_SUCCESS; |
| 1731 |
|
| 1732 |
DEBUGMSGTL(("internal:inetNetToMediaTable:inetNetToMediaTable_check_dependencies", "called\n")); |
| 1733 |
|
| 1734 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1735 |
|
| 1736 |
/* |
| 1737 |
* TODO:470:o: Check inetNetToMediaTable row dependencies. |
| 1738 |
* check that all new value are legal and consistent with each other |
| 1739 |
*/ |
| 1740 |
/* |
| 1741 |
* check RowStatus dependencies |
| 1742 |
*/ |
| 1743 |
if (rowreq_ctx->column_set_flags & COLUMN_INETNETTOMEDIAROWSTATUS_FLAG) { |
| 1744 |
/* |
| 1745 |
* check for valid RowStatus transition (old, new) |
| 1746 |
* (Note: move transition check to |
| 1747 |
* to catch errors earlier) |
| 1748 |
*/ |
| 1749 |
rc = check_rowstatus_transition(rowreq_ctx-> |
| 1750 |
inetNetToMediaRowStatus_undo, |
| 1751 |
rowreq_ctx-> |
| 1752 |
inetNetToMediaRowStatus); |
| 1753 |
if (MFD_SUCCESS != rc) |
| 1754 |
return rc; |
| 1755 |
|
| 1756 |
/* |
| 1757 |
* row creation requirements |
| 1758 |
*/ |
| 1759 |
if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) { |
| 1760 |
if (ROWSTATUS_DESTROY == rowreq_ctx->inetNetToMediaRowStatus) { |
| 1761 |
rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED; |
| 1762 |
} else if (ROWSTATUS_CREATEANDGO == |
| 1763 |
rowreq_ctx->inetNetToMediaRowStatus) { |
| 1764 |
if ((rowreq_ctx-> |
| 1765 |
column_set_flags & INETNETTOMEDIATABLE_REQUIRED_COLS) |
| 1766 |
!= INETNETTOMEDIATABLE_REQUIRED_COLS) { |
| 1767 |
DEBUGMSGTL(("inetNetToMediaTable", |
| 1768 |
"required columns missing (0x%0x != 0x%0x)\n", |
| 1769 |
rowreq_ctx->column_set_flags, |
| 1770 |
INETNETTOMEDIATABLE_REQUIRED_COLS)); |
| 1771 |
return MFD_CANNOT_CREATE_NOW; |
| 1772 |
} |
| 1773 |
rowreq_ctx->inetNetToMediaRowStatus = ROWSTATUS_ACTIVE; |
| 1774 |
} |
| 1775 |
} /* row creation */ |
| 1776 |
else { |
| 1777 |
/* |
| 1778 |
* row change requirements |
| 1779 |
*/ |
| 1780 |
/* |
| 1781 |
* don't allow a destroy if any other value was changed, since |
| 1782 |
* that might call data access routines with bad info. |
| 1783 |
* |
| 1784 |
* you may or may not require the row be notInService before it |
| 1785 |
* can be destroyed. |
| 1786 |
*/ |
| 1787 |
if (ROWSTATUS_DESTROY == rowreq_ctx->inetNetToMediaRowStatus) { |
| 1788 |
if (rowreq_ctx-> |
| 1789 |
column_set_flags & |
| 1790 |
~COLUMN_INETNETTOMEDIAROWSTATUS_FLAG) { |
| 1791 |
DEBUGMSGTL(("inetNetToMediaTable", |
| 1792 |
"destroy must be only varbind for row\n")); |
| 1793 |
return MFD_NOT_VALID_NOW; |
| 1794 |
} |
| 1795 |
rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED; |
| 1796 |
|
| 1797 |
} /* row destroy */ |
| 1798 |
} /* row change */ |
| 1799 |
} else { |
| 1800 |
/* |
| 1801 |
* must have row status to create a row |
| 1802 |
*/ |
| 1803 |
if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) { |
| 1804 |
DEBUGMSGTL(("inetNetToMediaTable", |
| 1805 |
"must use RowStatus to create rows\n")); |
| 1806 |
return MFD_CANNOT_CREATE_NOW; |
| 1807 |
} |
| 1808 |
} /* row status not set */ |
| 1809 |
|
| 1810 |
if (MFD_SUCCESS != rc) |
| 1811 |
return rc; |
| 1812 |
|
| 1813 |
return rc; |
| 1814 |
} /* inetNetToMediaTable_check_dependencies */ |
| 1815 |
|
| 1816 |
/** @} */ |
| 1817 |
/** @{ */ |