| 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 ipv6InterfaceTable |
| 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 "ipv6InterfaceTable.h" |
| 24 |
|
| 25 |
#include <net-snmp/agent/mib_modules.h> |
| 26 |
|
| 27 |
#include "ipv6InterfaceTable_interface.h" |
| 28 |
|
| 29 |
const oid ipv6InterfaceTable_oid[] = { IPV6INTERFACETABLE_OID }; |
| 30 |
const int ipv6InterfaceTable_oid_size = |
| 31 |
OID_LENGTH(ipv6InterfaceTable_oid); |
| 32 |
|
| 33 |
ipv6InterfaceTable_registration ipv6InterfaceTable_user_context; |
| 34 |
static ipv6InterfaceTable_registration *ipv6InterfaceTable_user_context_p; |
| 35 |
|
| 36 |
static void shutdown_table_ipv6InterfaceTable(void); |
| 37 |
|
| 38 |
|
| 39 |
/** |
| 40 |
* Initializes the ipv6InterfaceTable module |
| 41 |
*/ |
| 42 |
void |
| 43 |
init_ipv6InterfaceTable(void) |
| 44 |
{ |
| 45 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:init_ipv6InterfaceTable", |
| 46 |
"called\n")); |
| 47 |
|
| 48 |
/* |
| 49 |
* TODO:300:o: Perform ipv6InterfaceTable one-time module initialization. |
| 50 |
*/ |
| 51 |
|
| 52 |
/* |
| 53 |
* we depend on the ifTable, so we put our init in with it |
| 54 |
* to guarantee order of execution. |
| 55 |
*/ |
| 56 |
init_ifTable(); |
| 57 |
|
| 58 |
/* |
| 59 |
* last changed should be 0 at startup |
| 60 |
*/ |
| 61 |
ipv6InterfaceTable_lastChange_set(0); |
| 62 |
|
| 63 |
} /* init_ipv6InterfaceTable */ |
| 64 |
|
| 65 |
/** |
| 66 |
* Shut-down the ipv6InterfaceTable module (agent is exiting) |
| 67 |
*/ |
| 68 |
void |
| 69 |
shutdown_ipv6InterfaceTable(void) |
| 70 |
{ |
| 71 |
if (should_init("ipv6InterfaceTable")) |
| 72 |
shutdown_table_ipv6InterfaceTable(); |
| 73 |
|
| 74 |
} |
| 75 |
|
| 76 |
/** |
| 77 |
* Initialize the table ipv6InterfaceTable |
| 78 |
* (Define its contents and how it's structured) |
| 79 |
*/ |
| 80 |
void |
| 81 |
initialize_table_ipv6InterfaceTable(void) |
| 82 |
{ |
| 83 |
u_long flags; |
| 84 |
|
| 85 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:initialize_table_ipv6InterfaceTable", "called\n")); |
| 86 |
|
| 87 |
/* |
| 88 |
* TODO:301:o: Perform ipv6InterfaceTable one-time table initialization. |
| 89 |
*/ |
| 90 |
|
| 91 |
/* |
| 92 |
* TODO:302:o: |->Initialize ipv6InterfaceTable user context |
| 93 |
* if you'd like to pass in a pointer to some data for this |
| 94 |
* table, allocate or set it up here. |
| 95 |
*/ |
| 96 |
/* |
| 97 |
* a netsnmp_data_list is a simple way to store void pointers. A simple |
| 98 |
* string token is used to add, find or remove pointers. |
| 99 |
*/ |
| 100 |
ipv6InterfaceTable_user_context_p = |
| 101 |
netsnmp_create_data_list("ipv6InterfaceTable", NULL, NULL); |
| 102 |
|
| 103 |
/* |
| 104 |
* No support for any flags yet, but in the future you would |
| 105 |
* set any flags here. |
| 106 |
*/ |
| 107 |
flags = 0; |
| 108 |
|
| 109 |
/* |
| 110 |
* call interface initialization code |
| 111 |
*/ |
| 112 |
_ipv6InterfaceTable_initialize_interface |
| 113 |
(ipv6InterfaceTable_user_context_p, flags); |
| 114 |
} /* initialize_table_ipv6InterfaceTable */ |
| 115 |
|
| 116 |
/** |
| 117 |
* Shutdown the table ipv6InterfaceTable |
| 118 |
*/ |
| 119 |
void |
| 120 |
shutdown_table_ipv6InterfaceTable(void) |
| 121 |
{ |
| 122 |
/* |
| 123 |
* call interface shutdown code |
| 124 |
*/ |
| 125 |
_ipv6InterfaceTable_shutdown_interface |
| 126 |
(ipv6InterfaceTable_user_context_p); |
| 127 |
netsnmp_free_all_list_data(ipv6InterfaceTable_user_context_p); |
| 128 |
ipv6InterfaceTable_user_context_p = NULL; |
| 129 |
} |
| 130 |
|
| 131 |
/** |
| 132 |
* extra context initialization (eg default values) |
| 133 |
* |
| 134 |
* @param rowreq_ctx : row request context |
| 135 |
* @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate) |
| 136 |
* |
| 137 |
* @retval MFD_SUCCESS : no errors |
| 138 |
* @retval MFD_ERROR : error (context allocate will fail) |
| 139 |
*/ |
| 140 |
int |
| 141 |
ipv6InterfaceTable_rowreq_ctx_init(ipv6InterfaceTable_rowreq_ctx * |
| 142 |
rowreq_ctx, void *user_init_ctx) |
| 143 |
{ |
| 144 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_rowreq_ctx_init", "called\n")); |
| 145 |
|
| 146 |
netsnmp_assert(NULL != rowreq_ctx); |
| 147 |
|
| 148 |
/* |
| 149 |
* TODO:210:o: |-> Perform extra ipv6InterfaceTable rowreq initialization. (eg DEFVALS) |
| 150 |
*/ |
| 151 |
|
| 152 |
return MFD_SUCCESS; |
| 153 |
} /* ipv6InterfaceTable_rowreq_ctx_init */ |
| 154 |
|
| 155 |
/** |
| 156 |
* extra context cleanup |
| 157 |
* @param rowreq_ctx |
| 158 |
*/ |
| 159 |
void |
| 160 |
ipv6InterfaceTable_rowreq_ctx_cleanup(ipv6InterfaceTable_rowreq_ctx * |
| 161 |
rowreq_ctx) |
| 162 |
{ |
| 163 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_rowreq_ctx_cleanup", "called\n")); |
| 164 |
|
| 165 |
netsnmp_assert(NULL != rowreq_ctx); |
| 166 |
|
| 167 |
/* |
| 168 |
* TODO:211:o: |-> Perform extra ipv6InterfaceTable rowreq cleanup. |
| 169 |
*/ |
| 170 |
} /* ipv6InterfaceTable_rowreq_ctx_cleanup */ |
| 171 |
|
| 172 |
/** |
| 173 |
* pre-request callback |
| 174 |
* |
| 175 |
* @param user_context |
| 176 |
* |
| 177 |
* @retval MFD_SUCCESS : success. |
| 178 |
* @retval MFD_ERROR : other error |
| 179 |
*/ |
| 180 |
int |
| 181 |
ipv6InterfaceTable_pre_request(ipv6InterfaceTable_registration * |
| 182 |
user_context) |
| 183 |
{ |
| 184 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_pre_request", "called\n")); |
| 185 |
|
| 186 |
/* |
| 187 |
* TODO:510:o: Perform ipv6InterfaceTable pre-request actions. |
| 188 |
*/ |
| 189 |
|
| 190 |
return MFD_SUCCESS; |
| 191 |
} /* ipv6InterfaceTable_pre_request */ |
| 192 |
|
| 193 |
/** |
| 194 |
* post-request callback |
| 195 |
* |
| 196 |
* Note: |
| 197 |
* New rows have been inserted into the container, and |
| 198 |
* deleted rows have been removed from the container and |
| 199 |
* released. |
| 200 |
* @param user_context |
| 201 |
* @param rc : MFD_SUCCESS if all requests succeeded |
| 202 |
* |
| 203 |
* @retval MFD_SUCCESS : success. |
| 204 |
* @retval MFD_ERROR : other error (ignored) |
| 205 |
*/ |
| 206 |
int |
| 207 |
ipv6InterfaceTable_post_request(ipv6InterfaceTable_registration * |
| 208 |
user_context, int rc) |
| 209 |
{ |
| 210 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_post_request", "called\n")); |
| 211 |
|
| 212 |
/* |
| 213 |
* TODO:511:o: Perform ipv6InterfaceTable post-request actions. |
| 214 |
*/ |
| 215 |
|
| 216 |
/* |
| 217 |
* check to set if any rows were changed. |
| 218 |
*/ |
| 219 |
if (ipv6InterfaceTable_dirty_get()) { |
| 220 |
/* |
| 221 |
* check if request was successful. If so, this would be |
| 222 |
* a good place to save data to its persistent store. |
| 223 |
*/ |
| 224 |
if (MFD_SUCCESS == rc) { |
| 225 |
/* |
| 226 |
* save changed rows, if you haven't already |
| 227 |
*/ |
| 228 |
} |
| 229 |
|
| 230 |
ipv6InterfaceTable_dirty_set(0); /* clear table dirty flag */ |
| 231 |
} |
| 232 |
|
| 233 |
return MFD_SUCCESS; |
| 234 |
} /* ipv6InterfaceTable_post_request */ |
| 235 |
|
| 236 |
|
| 237 |
/********************************************************************** |
| 238 |
********************************************************************** |
| 239 |
*** |
| 240 |
*** Table ipv6InterfaceTable |
| 241 |
*** |
| 242 |
********************************************************************** |
| 243 |
**********************************************************************/ |
| 244 |
/* |
| 245 |
* IP-MIB::ipv6InterfaceTable is subid 30 of ip. |
| 246 |
* Its status is Current. |
| 247 |
* OID: .1.3.6.1.2.1.4.30, length: 8 |
| 248 |
*/ |
| 249 |
|
| 250 |
/* |
| 251 |
* --------------------------------------------------------------------- |
| 252 |
* * TODO:200:r: Implement ipv6InterfaceTable data context functions. |
| 253 |
*/ |
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
/*--------------------------------------------------------------------- |
| 258 |
* IP-MIB::ipv6InterfaceEntry.ipv6InterfaceReasmMaxSize |
| 259 |
* ipv6InterfaceReasmMaxSize is subid 2 of ipv6InterfaceEntry. |
| 260 |
* Its status is Current, and its access level is ReadOnly. |
| 261 |
* OID: .1.3.6.1.2.1.4.30.1.2 |
| 262 |
* Description: |
| 263 |
The size of the largest IPv6 datagram which this entity can |
| 264 |
re-assemble from incoming IPv6 fragmented datagrams received |
| 265 |
on this interface. |
| 266 |
* |
| 267 |
* Attributes: |
| 268 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 269 |
* readable 1 iscolumn 1 ranges 1 hashint 0 |
| 270 |
* settable 0 |
| 271 |
* |
| 272 |
* Ranges: 1500 - 65535; |
| 273 |
* |
| 274 |
* Its syntax is UNSIGNED32 (based on perltype UNSIGNED32) |
| 275 |
* The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) |
| 276 |
*/ |
| 277 |
/** |
| 278 |
* Extract the current value of the ipv6InterfaceReasmMaxSize data. |
| 279 |
* |
| 280 |
* Set a value using the data context for the row. |
| 281 |
* |
| 282 |
* @param rowreq_ctx |
| 283 |
* Pointer to the row request context. |
| 284 |
* @param ipv6InterfaceReasmMaxSize_val_ptr |
| 285 |
* Pointer to storage for a u_long variable |
| 286 |
* |
| 287 |
* @retval MFD_SUCCESS : success |
| 288 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 289 |
* @retval MFD_ERROR : Any other error |
| 290 |
*/ |
| 291 |
int |
| 292 |
ipv6InterfaceReasmMaxSize_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, |
| 293 |
u_long * ipv6InterfaceReasmMaxSize_val_ptr) |
| 294 |
{ |
| 295 |
/** we should have a non-NULL pointer */ |
| 296 |
netsnmp_assert(NULL != ipv6InterfaceReasmMaxSize_val_ptr); |
| 297 |
|
| 298 |
|
| 299 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceReasmMaxSize_get", |
| 300 |
"called\n")); |
| 301 |
|
| 302 |
netsnmp_assert(NULL != rowreq_ctx); |
| 303 |
|
| 304 |
if (! |
| 305 |
(rowreq_ctx->data.ifentry-> |
| 306 |
ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_REASMMAX)) |
| 307 |
return MFD_SKIP; |
| 308 |
|
| 309 |
/* |
| 310 |
* TODO:231:o: |-> Extract the current value of the ipv6InterfaceReasmMaxSize data. |
| 311 |
* copy (* ipv6InterfaceReasmMaxSize_val_ptr ) from rowreq_ctx->data |
| 312 |
*/ |
| 313 |
(*ipv6InterfaceReasmMaxSize_val_ptr) = |
| 314 |
rowreq_ctx->data.ipv6InterfaceReasmMaxSize; |
| 315 |
|
| 316 |
return MFD_SUCCESS; |
| 317 |
} /* ipv6InterfaceReasmMaxSize_get */ |
| 318 |
|
| 319 |
/*--------------------------------------------------------------------- |
| 320 |
* IP-MIB::ipv6InterfaceEntry.ipv6InterfaceIdentifier |
| 321 |
* ipv6InterfaceIdentifier is subid 3 of ipv6InterfaceEntry. |
| 322 |
* Its status is Current, and its access level is ReadOnly. |
| 323 |
* OID: .1.3.6.1.2.1.4.30.1.3 |
| 324 |
* Description: |
| 325 |
The Interface Identifier for this interface. The Interface |
| 326 |
Identifier is combined with an address prefix to form an |
| 327 |
interface address. |
| 328 |
|
| 329 |
|
| 330 |
By default, the Interface Identifier is auto-configured |
| 331 |
according to the rules of the link type this interface is |
| 332 |
attached to. |
| 333 |
|
| 334 |
|
| 335 |
A zero length identifier may be used where appropriate. One |
| 336 |
possible example is a loopback interface. |
| 337 |
* |
| 338 |
* Attributes: |
| 339 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 340 |
* readable 1 iscolumn 1 ranges 1 hashint 1 |
| 341 |
* settable 0 |
| 342 |
* hint: 2x: |
| 343 |
* |
| 344 |
* Ranges: 0 - 8; |
| 345 |
* |
| 346 |
* Its syntax is Ipv6AddressIfIdentifierTC (based on perltype OCTETSTR) |
| 347 |
* The net-snmp type is ASN_OCTET_STR. The C type decl is char (char) |
| 348 |
* This data type requires a length. (Max 8) |
| 349 |
*/ |
| 350 |
/** |
| 351 |
* Extract the current value of the ipv6InterfaceIdentifier data. |
| 352 |
* |
| 353 |
* Set a value using the data context for the row. |
| 354 |
* |
| 355 |
* @param rowreq_ctx |
| 356 |
* Pointer to the row request context. |
| 357 |
* @param ipv6InterfaceIdentifier_val_ptr_ptr |
| 358 |
* Pointer to storage for a char variable |
| 359 |
* @param ipv6InterfaceIdentifier_val_ptr_len_ptr |
| 360 |
* Pointer to a size_t. On entry, it will contain the size (in bytes) |
| 361 |
* pointed to by ipv6InterfaceIdentifier. |
| 362 |
* On exit, this value should contain the data size (in bytes). |
| 363 |
* |
| 364 |
* @retval MFD_SUCCESS : success |
| 365 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 366 |
* @retval MFD_ERROR : Any other error |
| 367 |
* |
| 368 |
* @note If you need more than (*ipv6InterfaceIdentifier_val_ptr_len_ptr) bytes of memory, |
| 369 |
* allocate it using malloc() and update ipv6InterfaceIdentifier_val_ptr_ptr. |
| 370 |
* <b>DO NOT</b> free the previous pointer. |
| 371 |
* The MFD helper will release the memory you allocate. |
| 372 |
* |
| 373 |
* @remark If you call this function yourself, you are responsible |
| 374 |
* for checking if the pointer changed, and freeing any |
| 375 |
* previously allocated memory. (Not necessary if you pass |
| 376 |
* in a pointer to static memory, obviously.) |
| 377 |
*/ |
| 378 |
int |
| 379 |
ipv6InterfaceIdentifier_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, |
| 380 |
char **ipv6InterfaceIdentifier_val_ptr_ptr, |
| 381 |
size_t |
| 382 |
* ipv6InterfaceIdentifier_val_ptr_len_ptr) |
| 383 |
{ |
| 384 |
/** we should have a non-NULL pointer and enough storage */ |
| 385 |
netsnmp_assert((NULL != ipv6InterfaceIdentifier_val_ptr_ptr) |
| 386 |
&& (NULL != *ipv6InterfaceIdentifier_val_ptr_ptr)); |
| 387 |
netsnmp_assert(NULL != ipv6InterfaceIdentifier_val_ptr_len_ptr); |
| 388 |
|
| 389 |
|
| 390 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceIdentifier_get", |
| 391 |
"called\n")); |
| 392 |
|
| 393 |
netsnmp_assert(NULL != rowreq_ctx); |
| 394 |
|
| 395 |
if (! |
| 396 |
(rowreq_ctx->data.ifentry-> |
| 397 |
ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_IFID)) |
| 398 |
return MFD_SKIP; |
| 399 |
|
| 400 |
/* |
| 401 |
* TODO:231:o: |-> Extract the current value of the ipv6InterfaceIdentifier data. |
| 402 |
* copy (* ipv6InterfaceIdentifier_val_ptr_ptr ) data and (* ipv6InterfaceIdentifier_val_ptr_len_ptr ) from rowreq_ctx->data |
| 403 |
*/ |
| 404 |
/* |
| 405 |
* make sure there is enough space for ipv6InterfaceIdentifier data |
| 406 |
*/ |
| 407 |
if ((NULL == (*ipv6InterfaceIdentifier_val_ptr_ptr)) || |
| 408 |
((*ipv6InterfaceIdentifier_val_ptr_len_ptr) < |
| 409 |
(rowreq_ctx->data.ipv6InterfaceIdentifier_len * |
| 410 |
sizeof(rowreq_ctx->data.ipv6InterfaceIdentifier[0])))) { |
| 411 |
/* |
| 412 |
* allocate space for ipv6InterfaceIdentifier data |
| 413 |
*/ |
| 414 |
(*ipv6InterfaceIdentifier_val_ptr_ptr) = |
| 415 |
malloc(rowreq_ctx->data.ipv6InterfaceIdentifier_len * |
| 416 |
sizeof(rowreq_ctx->data.ipv6InterfaceIdentifier[0])); |
| 417 |
if (NULL == (*ipv6InterfaceIdentifier_val_ptr_ptr)) { |
| 418 |
snmp_log(LOG_ERR, "could not allocate memory\n"); |
| 419 |
return MFD_ERROR; |
| 420 |
} |
| 421 |
} |
| 422 |
(*ipv6InterfaceIdentifier_val_ptr_len_ptr) = |
| 423 |
rowreq_ctx->data.ipv6InterfaceIdentifier_len * |
| 424 |
sizeof(rowreq_ctx->data.ipv6InterfaceIdentifier[0]); |
| 425 |
memcpy((*ipv6InterfaceIdentifier_val_ptr_ptr), |
| 426 |
rowreq_ctx->data.ipv6InterfaceIdentifier, |
| 427 |
rowreq_ctx->data.ipv6InterfaceIdentifier_len * |
| 428 |
sizeof(rowreq_ctx->data.ipv6InterfaceIdentifier[0])); |
| 429 |
|
| 430 |
return MFD_SUCCESS; |
| 431 |
} /* ipv6InterfaceIdentifier_get */ |
| 432 |
|
| 433 |
/*--------------------------------------------------------------------- |
| 434 |
* IP-MIB::ipv6InterfaceEntry.ipv6InterfaceEnableStatus |
| 435 |
* ipv6InterfaceEnableStatus is subid 5 of ipv6InterfaceEntry. |
| 436 |
* Its status is Current, and its access level is ReadWrite. |
| 437 |
* OID: .1.3.6.1.2.1.4.30.1.5 |
| 438 |
* Description: |
| 439 |
The indication of whether IPv6 is enabled (up) or disabled |
| 440 |
(down) on this interface. This object does not affect the |
| 441 |
state of the interface itself, only its connection to an |
| 442 |
IPv6 stack. The IF-MIB should be used to control the state |
| 443 |
of the interface. |
| 444 |
|
| 445 |
|
| 446 |
When this object is written the entity SHOULD save the |
| 447 |
change to non-volatile storage and restore the object from |
| 448 |
non-volatile storage upon re-initialization of the system. |
| 449 |
* |
| 450 |
* Attributes: |
| 451 |
* accessible 1 isscalar 0 enums 1 hasdefval 0 |
| 452 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 453 |
* settable 1 |
| 454 |
* |
| 455 |
* Enum range: 1/8. Values: up(1), down(2) |
| 456 |
* |
| 457 |
* Its syntax is INTEGER (based on perltype INTEGER) |
| 458 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 459 |
*/ |
| 460 |
/** |
| 461 |
* Extract the current value of the ipv6InterfaceEnableStatus data. |
| 462 |
* |
| 463 |
* Set a value using the data context for the row. |
| 464 |
* |
| 465 |
* @param rowreq_ctx |
| 466 |
* Pointer to the row request context. |
| 467 |
* @param ipv6InterfaceEnableStatus_val_ptr |
| 468 |
* Pointer to storage for a long variable |
| 469 |
* |
| 470 |
* @retval MFD_SUCCESS : success |
| 471 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 472 |
* @retval MFD_ERROR : Any other error |
| 473 |
*/ |
| 474 |
int |
| 475 |
ipv6InterfaceEnableStatus_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, |
| 476 |
u_long * ipv6InterfaceEnableStatus_val_ptr) |
| 477 |
{ |
| 478 |
/** we should have a non-NULL pointer */ |
| 479 |
netsnmp_assert(NULL != ipv6InterfaceEnableStatus_val_ptr); |
| 480 |
|
| 481 |
|
| 482 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceEnableStatus_get", |
| 483 |
"called\n")); |
| 484 |
|
| 485 |
netsnmp_assert(NULL != rowreq_ctx); |
| 486 |
|
| 487 |
/* |
| 488 |
* TODO:231:o: |-> Extract the current value of the ipv6InterfaceEnableStatus data. |
| 489 |
* copy (* ipv6InterfaceEnableStatus_val_ptr ) from rowreq_ctx->data |
| 490 |
*/ |
| 491 |
(*ipv6InterfaceEnableStatus_val_ptr) = |
| 492 |
rowreq_ctx->data.ipv6InterfaceEnableStatus; |
| 493 |
|
| 494 |
return MFD_SUCCESS; |
| 495 |
} /* ipv6InterfaceEnableStatus_get */ |
| 496 |
|
| 497 |
/*--------------------------------------------------------------------- |
| 498 |
* IP-MIB::ipv6InterfaceEntry.ipv6InterfaceReachableTime |
| 499 |
* ipv6InterfaceReachableTime is subid 6 of ipv6InterfaceEntry. |
| 500 |
* Its status is Current, and its access level is ReadOnly. |
| 501 |
* OID: .1.3.6.1.2.1.4.30.1.6 |
| 502 |
* Description: |
| 503 |
The time a neighbor is considered reachable after receiving |
| 504 |
a reachability confirmation. |
| 505 |
* |
| 506 |
* Attributes: |
| 507 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 508 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 509 |
* settable 0 |
| 510 |
* |
| 511 |
* |
| 512 |
* Its syntax is UNSIGNED32 (based on perltype UNSIGNED32) |
| 513 |
* The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) |
| 514 |
*/ |
| 515 |
/** |
| 516 |
* Extract the current value of the ipv6InterfaceReachableTime data. |
| 517 |
* |
| 518 |
* Set a value using the data context for the row. |
| 519 |
* |
| 520 |
* @param rowreq_ctx |
| 521 |
* Pointer to the row request context. |
| 522 |
* @param ipv6InterfaceReachableTime_val_ptr |
| 523 |
* Pointer to storage for a u_long variable |
| 524 |
* |
| 525 |
* @retval MFD_SUCCESS : success |
| 526 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 527 |
* @retval MFD_ERROR : Any other error |
| 528 |
*/ |
| 529 |
int |
| 530 |
ipv6InterfaceReachableTime_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, |
| 531 |
u_long * ipv6InterfaceReachableTime_val_ptr) |
| 532 |
{ |
| 533 |
/** we should have a non-NULL pointer */ |
| 534 |
netsnmp_assert(NULL != ipv6InterfaceReachableTime_val_ptr); |
| 535 |
|
| 536 |
|
| 537 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceReachableTime_get", "called\n")); |
| 538 |
|
| 539 |
netsnmp_assert(NULL != rowreq_ctx); |
| 540 |
|
| 541 |
if (! |
| 542 |
(rowreq_ctx->data.ifentry-> |
| 543 |
ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_REACHABLE)) |
| 544 |
return MFD_SKIP; |
| 545 |
|
| 546 |
/* |
| 547 |
* TODO:231:o: |-> Extract the current value of the ipv6InterfaceReachableTime data. |
| 548 |
* copy (* ipv6InterfaceReachableTime_val_ptr ) from rowreq_ctx->data |
| 549 |
*/ |
| 550 |
(*ipv6InterfaceReachableTime_val_ptr) = |
| 551 |
rowreq_ctx->data.ipv6InterfaceReachableTime; |
| 552 |
|
| 553 |
return MFD_SUCCESS; |
| 554 |
} /* ipv6InterfaceReachableTime_get */ |
| 555 |
|
| 556 |
/*--------------------------------------------------------------------- |
| 557 |
* IP-MIB::ipv6InterfaceEntry.ipv6InterfaceRetransmitTime |
| 558 |
* ipv6InterfaceRetransmitTime is subid 7 of ipv6InterfaceEntry. |
| 559 |
* Its status is Current, and its access level is ReadOnly. |
| 560 |
* OID: .1.3.6.1.2.1.4.30.1.7 |
| 561 |
* Description: |
| 562 |
The time between retransmissions of Neighbor Solicitation |
| 563 |
messages to a neighbor when resolving the address or when |
| 564 |
probing the reachability of a neighbor. |
| 565 |
* |
| 566 |
* Attributes: |
| 567 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 568 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 569 |
* settable 0 |
| 570 |
* |
| 571 |
* |
| 572 |
* Its syntax is UNSIGNED32 (based on perltype UNSIGNED32) |
| 573 |
* The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) |
| 574 |
*/ |
| 575 |
/** |
| 576 |
* Extract the current value of the ipv6InterfaceRetransmitTime data. |
| 577 |
* |
| 578 |
* Set a value using the data context for the row. |
| 579 |
* |
| 580 |
* @param rowreq_ctx |
| 581 |
* Pointer to the row request context. |
| 582 |
* @param ipv6InterfaceRetransmitTime_val_ptr |
| 583 |
* Pointer to storage for a u_long variable |
| 584 |
* |
| 585 |
* @retval MFD_SUCCESS : success |
| 586 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 587 |
* @retval MFD_ERROR : Any other error |
| 588 |
*/ |
| 589 |
int |
| 590 |
ipv6InterfaceRetransmitTime_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, |
| 591 |
u_long * |
| 592 |
ipv6InterfaceRetransmitTime_val_ptr) |
| 593 |
{ |
| 594 |
/** we should have a non-NULL pointer */ |
| 595 |
netsnmp_assert(NULL != ipv6InterfaceRetransmitTime_val_ptr); |
| 596 |
|
| 597 |
|
| 598 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceRetransmitTime_get", "called\n")); |
| 599 |
|
| 600 |
netsnmp_assert(NULL != rowreq_ctx); |
| 601 |
|
| 602 |
if (! |
| 603 |
(rowreq_ctx->data.ifentry-> |
| 604 |
ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_RETRANSMIT)) |
| 605 |
return MFD_SKIP; |
| 606 |
|
| 607 |
/* |
| 608 |
* TODO:231:o: |-> Extract the current value of the ipv6InterfaceRetransmitTime data. |
| 609 |
* copy (* ipv6InterfaceRetransmitTime_val_ptr ) from rowreq_ctx->data |
| 610 |
*/ |
| 611 |
(*ipv6InterfaceRetransmitTime_val_ptr) = |
| 612 |
rowreq_ctx->data.ipv6InterfaceRetransmitTime; |
| 613 |
|
| 614 |
return MFD_SUCCESS; |
| 615 |
} /* ipv6InterfaceRetransmitTime_get */ |
| 616 |
|
| 617 |
/*--------------------------------------------------------------------- |
| 618 |
* IP-MIB::ipv6InterfaceEntry.ipv6InterfaceForwarding |
| 619 |
* ipv6InterfaceForwarding is subid 8 of ipv6InterfaceEntry. |
| 620 |
* Its status is Current, and its access level is ReadWrite. |
| 621 |
* OID: .1.3.6.1.2.1.4.30.1.8 |
| 622 |
* Description: |
| 623 |
The indication of whether this entity is acting as an IPv6 |
| 624 |
router on this interface with respect to the forwarding of |
| 625 |
datagrams received by, but not addressed to, this entity. |
| 626 |
IPv6 routers forward datagrams. IPv6 hosts do not (except |
| 627 |
those source-routed via the host). |
| 628 |
|
| 629 |
|
| 630 |
|
| 631 |
|
| 632 |
|
| 633 |
This object is constrained by ipv6IpForwarding and is |
| 634 |
ignored if ipv6IpForwarding is set to notForwarding. Those |
| 635 |
systems that do not provide per-interface control of the |
| 636 |
forwarding function should set this object to forwarding for |
| 637 |
all interfaces and allow the ipv6IpForwarding object to |
| 638 |
control the forwarding capability. |
| 639 |
|
| 640 |
|
| 641 |
When this object is written the entity SHOULD save the |
| 642 |
change to non-volatile storage and restore the object from |
| 643 |
non-volatile storage upon re-initialization of the system. |
| 644 |
* |
| 645 |
* Attributes: |
| 646 |
* accessible 1 isscalar 0 enums 1 hasdefval 0 |
| 647 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 648 |
* settable 1 |
| 649 |
* |
| 650 |
* Enum range: 2/8. Values: forwarding(1), notForwarding(2) |
| 651 |
* |
| 652 |
* Its syntax is INTEGER (based on perltype INTEGER) |
| 653 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 654 |
*/ |
| 655 |
/** |
| 656 |
* Extract the current value of the ipv6InterfaceForwarding data. |
| 657 |
* |
| 658 |
* Set a value using the data context for the row. |
| 659 |
* |
| 660 |
* @param rowreq_ctx |
| 661 |
* Pointer to the row request context. |
| 662 |
* @param ipv6InterfaceForwarding_val_ptr |
| 663 |
* Pointer to storage for a long variable |
| 664 |
* |
| 665 |
* @retval MFD_SUCCESS : success |
| 666 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 667 |
* @retval MFD_ERROR : Any other error |
| 668 |
*/ |
| 669 |
int |
| 670 |
ipv6InterfaceForwarding_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, |
| 671 |
u_long * ipv6InterfaceForwarding_val_ptr) |
| 672 |
{ |
| 673 |
/** we should have a non-NULL pointer */ |
| 674 |
netsnmp_assert(NULL != ipv6InterfaceForwarding_val_ptr); |
| 675 |
|
| 676 |
|
| 677 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceForwarding_get", |
| 678 |
"called\n")); |
| 679 |
|
| 680 |
netsnmp_assert(NULL != rowreq_ctx); |
| 681 |
|
| 682 |
if (! |
| 683 |
(rowreq_ctx->data.ifentry-> |
| 684 |
ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_FORWARDING)) |
| 685 |
return MFD_SKIP; |
| 686 |
|
| 687 |
/* |
| 688 |
* TODO:231:o: |-> Extract the current value of the ipv6InterfaceForwarding data. |
| 689 |
* copy (* ipv6InterfaceForwarding_val_ptr ) from rowreq_ctx->data |
| 690 |
*/ |
| 691 |
(*ipv6InterfaceForwarding_val_ptr) = |
| 692 |
(rowreq_ctx->data.ipv6InterfaceForwarding) ? 1 : 2; |
| 693 |
|
| 694 |
return MFD_SUCCESS; |
| 695 |
} /* ipv6InterfaceForwarding_get */ |
| 696 |
|
| 697 |
|
| 698 |
|
| 699 |
/** @} */ |
| 700 |
/********************************************************************** |
| 701 |
********************************************************************** |
| 702 |
*** |
| 703 |
*** Table ipv6InterfaceTable |
| 704 |
*** |
| 705 |
********************************************************************** |
| 706 |
**********************************************************************/ |
| 707 |
/* |
| 708 |
* IP-MIB::ipv6InterfaceTable is subid 30 of ip. |
| 709 |
* Its status is Current. |
| 710 |
* OID: .1.3.6.1.2.1.4.30, length: 8 |
| 711 |
*/ |
| 712 |
/* |
| 713 |
* NOTE: if you update this chart, please update the versions in |
| 714 |
* local/mib2c-conf.d/parent-set.m2i |
| 715 |
* agent/mibgroup/helpers/baby_steps.c |
| 716 |
* while you're at it. |
| 717 |
*/ |
| 718 |
/* |
| 719 |
*********************************************************************** |
| 720 |
* Baby Steps Flow Chart (2004.06.05) * |
| 721 |
* * |
| 722 |
* +--------------+ +================+ U = unconditional path * |
| 723 |
* |optional state| ||required state|| S = path for success * |
| 724 |
* +--------------+ +================+ E = path for error * |
| 725 |
*********************************************************************** |
| 726 |
* |
| 727 |
* +--------------+ |
| 728 |
* | pre | |
| 729 |
* | request | |
| 730 |
* +--------------+ |
| 731 |
* | U |
| 732 |
* +==============+ |
| 733 |
* +----------------|| object || |
| 734 |
* | E || lookup || |
| 735 |
* | +==============+ |
| 736 |
* | | S |
| 737 |
* | +==============+ |
| 738 |
* | E || check || |
| 739 |
* |<---------------|| values || |
| 740 |
* | +==============+ |
| 741 |
* | | S |
| 742 |
* | +==============+ |
| 743 |
* | +<-------|| undo || |
| 744 |
* | | E || setup || |
| 745 |
* | | +==============+ |
| 746 |
* | | | S |
| 747 |
* | | +==============+ |
| 748 |
* | | || set ||-------------------------->+ |
| 749 |
* | | || value || E | |
| 750 |
* | | +==============+ | |
| 751 |
* | | | S | |
| 752 |
* | | +--------------+ | |
| 753 |
* | | | check |-------------------------->| |
| 754 |
* | | | consistency | E | |
| 755 |
* | | +--------------+ | |
| 756 |
* | | | S | |
| 757 |
* | | +==============+ +==============+ | |
| 758 |
* | | || commit ||-------->|| undo || | |
| 759 |
* | | || || E || commit || | |
| 760 |
* | | +==============+ +==============+ | |
| 761 |
* | | | S U |<--------+ |
| 762 |
* | | +--------------+ +==============+ |
| 763 |
* | | | irreversible | || undo || |
| 764 |
* | | | commit | || set || |
| 765 |
* | | +--------------+ +==============+ |
| 766 |
* | | | U U | |
| 767 |
* | +-------------->|<------------------------+ |
| 768 |
* | +==============+ |
| 769 |
* | || undo || |
| 770 |
* | || cleanup || |
| 771 |
* | +==============+ |
| 772 |
* +---------------------->| U |
| 773 |
* +--------------+ |
| 774 |
* | post | |
| 775 |
* | request | |
| 776 |
* +--------------+ |
| 777 |
* |
| 778 |
*/ |
| 779 |
|
| 780 |
/** |
| 781 |
* Setup up context with information needed to undo a set request. |
| 782 |
* |
| 783 |
* This function will be called before the individual node undo setup |
| 784 |
* functions are called. If you need to do any undo setup that is not |
| 785 |
* related to a specific column, you can do it here. |
| 786 |
* |
| 787 |
* Note that the undo context has been allocated with |
| 788 |
* ipv6InterfaceTable_allocate_data(), but may need extra |
| 789 |
* initialization similar to what you may have done in |
| 790 |
* ipv6InterfaceTable_rowreq_ctx_init(). |
| 791 |
* Note that an individual node's undo_setup function will only be called |
| 792 |
* if that node is being set to a new value. |
| 793 |
* |
| 794 |
* If there is any setup specific to a particular column (e.g. allocating |
| 795 |
* memory for a string), you should do that setup in the node's undo_setup |
| 796 |
* function, so it won't be done unless it is necessary. |
| 797 |
* |
| 798 |
* @param rowreq_ctx |
| 799 |
* Pointer to the table context (ipv6InterfaceTable_rowreq_ctx) |
| 800 |
* |
| 801 |
* @retval MFD_SUCCESS : success |
| 802 |
* @retval MFD_ERROR : error. set will fail. |
| 803 |
*/ |
| 804 |
int |
| 805 |
ipv6InterfaceTable_undo_setup(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx) |
| 806 |
{ |
| 807 |
int rc = MFD_SUCCESS; |
| 808 |
|
| 809 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_undo_setup", |
| 810 |
"called\n")); |
| 811 |
|
| 812 |
/** we should have a non-NULL pointer */ |
| 813 |
netsnmp_assert(NULL != rowreq_ctx); |
| 814 |
|
| 815 |
/* |
| 816 |
* TODO:451:M: |-> Setup ipv6InterfaceTable undo. |
| 817 |
* set up ipv6InterfaceTable undo information, in preparation for a set. |
| 818 |
* Undo storage is in (* ipv6InterfaceForwarding_val_ptr )* |
| 819 |
*/ |
| 820 |
|
| 821 |
return rc; |
| 822 |
} /* ipv6InterfaceTable_undo_setup */ |
| 823 |
|
| 824 |
/** |
| 825 |
* Undo a set request. |
| 826 |
* |
| 827 |
* This function will be called before the individual node undo |
| 828 |
* functions are called. If you need to do any undo that is not |
| 829 |
* related to a specific column, you can do it here. |
| 830 |
* |
| 831 |
* Note that an individual node's undo function will only be called |
| 832 |
* if that node is being set to a new value. |
| 833 |
* |
| 834 |
* If there is anything specific to a particular column (e.g. releasing |
| 835 |
* memory for a string), you should do that setup in the node's undo |
| 836 |
* function, so it won't be done unless it is necessary. |
| 837 |
* |
| 838 |
* @param rowreq_ctx |
| 839 |
* Pointer to the table context (ipv6InterfaceTable_rowreq_ctx) |
| 840 |
* |
| 841 |
* @retval MFD_SUCCESS : success |
| 842 |
* @retval MFD_ERROR : error. set will fail. |
| 843 |
*/ |
| 844 |
int |
| 845 |
ipv6InterfaceTable_undo(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx) |
| 846 |
{ |
| 847 |
int rc = MFD_SUCCESS; |
| 848 |
|
| 849 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_undo", |
| 850 |
"called\n")); |
| 851 |
|
| 852 |
/** we should have a non-NULL pointer */ |
| 853 |
netsnmp_assert(NULL != rowreq_ctx); |
| 854 |
|
| 855 |
/* |
| 856 |
* TODO:451:M: |-> ipv6InterfaceTable undo. |
| 857 |
* ipv6InterfaceTable undo information, in response to a failed set. |
| 858 |
* Undo storage is in (* ipv6InterfaceForwarding_val_ptr )* |
| 859 |
*/ |
| 860 |
|
| 861 |
return rc; |
| 862 |
} /* ipv6InterfaceTable_undo_setup */ |
| 863 |
|
| 864 |
/** |
| 865 |
* Cleanup up context undo information. |
| 866 |
* |
| 867 |
* This function will be called after set/commit processing. If you |
| 868 |
* allocated any resources in undo_setup, this is the place to release |
| 869 |
* those resources. |
| 870 |
* |
| 871 |
* This function is called regardless of the success or failure of the set |
| 872 |
* request. If you need to perform different steps for cleanup depending |
| 873 |
* on success or failure, you can add a flag to the rowreq_ctx. |
| 874 |
* |
| 875 |
* @param rowreq_ctx |
| 876 |
* Pointer to the table context (ipv6InterfaceTable_rowreq_ctx) |
| 877 |
* |
| 878 |
* @retval MFD_SUCCESS : success |
| 879 |
* @retval MFD_ERROR : error |
| 880 |
*/ |
| 881 |
int |
| 882 |
ipv6InterfaceTable_undo_cleanup(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx) |
| 883 |
{ |
| 884 |
int rc = MFD_SUCCESS; |
| 885 |
|
| 886 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_undo_cleanup", "called\n")); |
| 887 |
|
| 888 |
/** we should have a non-NULL pointer */ |
| 889 |
netsnmp_assert(NULL != rowreq_ctx); |
| 890 |
|
| 891 |
/* |
| 892 |
* TODO:452:M: |-> Cleanup ipv6InterfaceTable undo. |
| 893 |
* Undo storage is in (* ipv6InterfaceForwarding_val_ptr )* |
| 894 |
*/ |
| 895 |
|
| 896 |
return rc; |
| 897 |
} /* ipv6InterfaceTable_undo_cleanup */ |
| 898 |
|
| 899 |
/** |
| 900 |
* commit new values. |
| 901 |
* |
| 902 |
* At this point, you should have done everything you can to ensure that |
| 903 |
* this commit will not fail. |
| 904 |
* |
| 905 |
* Should you need different behavior depending on which columns were |
| 906 |
* set, rowreq_ctx->column_set_flags will indicate which writeable columns were |
| 907 |
* set. The definitions for the COLUMN_*_FLAG bits can be found in |
| 908 |
* ipv6InterfaceTable.h. |
| 909 |
* A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. |
| 910 |
* |
| 911 |
* @param rowreq_ctx |
| 912 |
* Pointer to the users context. |
| 913 |
* |
| 914 |
* @retval MFD_SUCCESS : success |
| 915 |
* @retval MFD_ERROR : error |
| 916 |
*/ |
| 917 |
int |
| 918 |
ipv6InterfaceTable_commit(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx) |
| 919 |
{ |
| 920 |
int rc = MFD_SUCCESS; |
| 921 |
int save_flags; |
| 922 |
|
| 923 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_commit", |
| 924 |
"called\n")); |
| 925 |
|
| 926 |
/** we should have a non-NULL pointer */ |
| 927 |
netsnmp_assert(NULL != rowreq_ctx); |
| 928 |
|
| 929 |
/* |
| 930 |
* save flags, then clear until we actually do something |
| 931 |
*/ |
| 932 |
save_flags = rowreq_ctx->column_set_flags; |
| 933 |
rowreq_ctx->column_set_flags = 0; |
| 934 |
|
| 935 |
/* |
| 936 |
* commit ipv6InterfaceTable data |
| 937 |
* 1) check the column's flag in save_flags to see if it was set. |
| 938 |
* 2) clear the flag when you handle that column |
| 939 |
* 3) set the column's flag in column_set_flags if it needs undo |
| 940 |
* processing in case of a failure. |
| 941 |
*/ |
| 942 |
if (save_flags & COLUMN_IPV6INTERFACEENABLESTATUS_FLAG) { |
| 943 |
save_flags &= ~COLUMN_IPV6INTERFACEENABLESTATUS_FLAG; /* clear ipv6InterfaceEnableStatus */ |
| 944 |
/* |
| 945 |
* TODO:482:o: |-> commit column ipv6InterfaceEnableStatus. |
| 946 |
*/ |
| 947 |
rc = -1; |
| 948 |
if (-1 == rc) { |
| 949 |
snmp_log(LOG_ERR, |
| 950 |
"ipv6InterfaceTable column ipv6InterfaceEnableStatus commit failed\n"); |
| 951 |
} else { |
| 952 |
/* |
| 953 |
* set flag, in case we need to undo ipv6InterfaceEnableStatus |
| 954 |
*/ |
| 955 |
rowreq_ctx->column_set_flags |= |
| 956 |
COLUMN_IPV6INTERFACEENABLESTATUS_FLAG; |
| 957 |
} |
| 958 |
} |
| 959 |
|
| 960 |
if (save_flags & COLUMN_IPV6INTERFACEFORWARDING_FLAG) { |
| 961 |
save_flags &= ~COLUMN_IPV6INTERFACEFORWARDING_FLAG; /* clear ipv6InterfaceForwarding */ |
| 962 |
/* |
| 963 |
* TODO:482:o: |-> commit column ipv6InterfaceForwarding. |
| 964 |
*/ |
| 965 |
rc = -1; |
| 966 |
if (-1 == rc) { |
| 967 |
snmp_log(LOG_ERR, |
| 968 |
"ipv6InterfaceTable column ipv6InterfaceForwarding commit failed\n"); |
| 969 |
} else { |
| 970 |
/* |
| 971 |
* set flag, in case we need to undo ipv6InterfaceForwarding |
| 972 |
*/ |
| 973 |
rowreq_ctx->column_set_flags |= |
| 974 |
COLUMN_IPV6INTERFACEFORWARDING_FLAG; |
| 975 |
} |
| 976 |
} |
| 977 |
|
| 978 |
/* |
| 979 |
* if we successfully committed this row, set the dirty flag. |
| 980 |
*/ |
| 981 |
if (MFD_SUCCESS == rc) { |
| 982 |
rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY; |
| 983 |
} |
| 984 |
|
| 985 |
if (save_flags) { |
| 986 |
snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n", |
| 987 |
save_flags); |
| 988 |
return MFD_ERROR; |
| 989 |
} |
| 990 |
|
| 991 |
return rc; |
| 992 |
} /* ipv6InterfaceTable_commit */ |
| 993 |
|
| 994 |
/** |
| 995 |
* undo commit new values. |
| 996 |
* |
| 997 |
* Should you need different behavior depending on which columns were |
| 998 |
* set, rowreq_ctx->column_set_flags will indicate which writeable columns were |
| 999 |
* set. The definitions for the COLUMN_*_FLAG bits can be found in |
| 1000 |
* ipv6InterfaceTable.h. |
| 1001 |
* A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. |
| 1002 |
* |
| 1003 |
* @param rowreq_ctx |
| 1004 |
* Pointer to the users context. |
| 1005 |
* |
| 1006 |
* @retval MFD_SUCCESS : success |
| 1007 |
* @retval MFD_ERROR : error |
| 1008 |
*/ |
| 1009 |
int |
| 1010 |
ipv6InterfaceTable_undo_commit(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx) |
| 1011 |
{ |
| 1012 |
int rc = MFD_SUCCESS; |
| 1013 |
|
| 1014 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_undo_commit", "called\n")); |
| 1015 |
|
| 1016 |
/** we should have a non-NULL pointer */ |
| 1017 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1018 |
|
| 1019 |
/* |
| 1020 |
* TODO:485:M: |-> Undo ipv6InterfaceTable commit. |
| 1021 |
* check the column's flag in rowreq_ctx->column_set_flags to see |
| 1022 |
* if it was set during commit, then undo it. |
| 1023 |
* |
| 1024 |
* eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {} |
| 1025 |
*/ |
| 1026 |
|
| 1027 |
|
| 1028 |
/* |
| 1029 |
* if we successfully un-committed this row, clear the dirty flag. |
| 1030 |
*/ |
| 1031 |
if (MFD_SUCCESS == rc) { |
| 1032 |
rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY; |
| 1033 |
} |
| 1034 |
|
| 1035 |
return rc; |
| 1036 |
} /* ipv6InterfaceTable_undo_commit */ |
| 1037 |
|
| 1038 |
/* |
| 1039 |
* TODO:440:M: Implement ipv6InterfaceTable node value checks. |
| 1040 |
* TODO:450:M: Implement ipv6InterfaceTable undo functions. |
| 1041 |
* TODO:460:M: Implement ipv6InterfaceTable set functions. |
| 1042 |
* TODO:480:M: Implement ipv6InterfaceTable commit functions. |
| 1043 |
*/ |
| 1044 |
/*--------------------------------------------------------------------- |
| 1045 |
* IP-MIB::ipv6InterfaceEntry.ipv6InterfaceEnableStatus |
| 1046 |
* ipv6InterfaceEnableStatus is subid 5 of ipv6InterfaceEntry. |
| 1047 |
* Its status is Current, and its access level is ReadWrite. |
| 1048 |
* OID: .1.3.6.1.2.1.4.30.1.5 |
| 1049 |
* Description: |
| 1050 |
The indication of whether IPv6 is enabled (up) or disabled |
| 1051 |
(down) on this interface. This object does not affect the |
| 1052 |
state of the interface itself, only its connection to an |
| 1053 |
IPv6 stack. The IF-MIB should be used to control the state |
| 1054 |
of the interface. |
| 1055 |
|
| 1056 |
|
| 1057 |
When this object is written the entity SHOULD save the |
| 1058 |
change to non-volatile storage and restore the object from |
| 1059 |
non-volatile storage upon re-initialization of the system. |
| 1060 |
* |
| 1061 |
* Attributes: |
| 1062 |
* accessible 1 isscalar 0 enums 1 hasdefval 0 |
| 1063 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1064 |
* settable 1 |
| 1065 |
* |
| 1066 |
* Enum range: 1/8. Values: up(1), down(2) |
| 1067 |
* |
| 1068 |
* Its syntax is INTEGER (based on perltype INTEGER) |
| 1069 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 1070 |
*/ |
| 1071 |
/** |
| 1072 |
* Check that the proposed new value is potentially valid. |
| 1073 |
* |
| 1074 |
* @param rowreq_ctx |
| 1075 |
* Pointer to the row request context. |
| 1076 |
* @param ipv6InterfaceEnableStatus_val |
| 1077 |
* A long containing the new value. |
| 1078 |
* |
| 1079 |
* @retval MFD_SUCCESS : incoming value is legal |
| 1080 |
* @retval MFD_NOT_VALID_NOW : incoming value is not valid now |
| 1081 |
* @retval MFD_NOT_VALID_EVER : incoming value is never valid |
| 1082 |
* |
| 1083 |
* This is the place to check for requirements that are not |
| 1084 |
* expressed in the mib syntax (for example, a requirement that |
| 1085 |
* is detailed in the description for an object). |
| 1086 |
* |
| 1087 |
* You should check that the requested change between the undo value and the |
| 1088 |
* new value is legal (ie, the transistion from one value to another |
| 1089 |
* is legal). |
| 1090 |
* |
| 1091 |
*@note |
| 1092 |
* This check is only to determine if the new value |
| 1093 |
* is \b potentially valid. This is the first check of many, and |
| 1094 |
* is one of the simplest ones. |
| 1095 |
* |
| 1096 |
*@note |
| 1097 |
* this is not the place to do any checks for values |
| 1098 |
* which depend on some other value in the mib. Those |
| 1099 |
* types of checks should be done in the |
| 1100 |
* ipv6InterfaceTable_check_dependencies() function. |
| 1101 |
* |
| 1102 |
* The following checks have already been done for you: |
| 1103 |
* The syntax is ASN_INTEGER |
| 1104 |
* The value is one of up(1), down(2) |
| 1105 |
* |
| 1106 |
* If there a no other checks you need to do, simply return MFD_SUCCESS. |
| 1107 |
* |
| 1108 |
*/ |
| 1109 |
int |
| 1110 |
ipv6InterfaceEnableStatus_check_value(ipv6InterfaceTable_rowreq_ctx * |
| 1111 |
rowreq_ctx, |
| 1112 |
u_long ipv6InterfaceEnableStatus_val) |
| 1113 |
{ |
| 1114 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceEnableStatus_check_value", "called\n")); |
| 1115 |
|
| 1116 |
/** should never get a NULL pointer */ |
| 1117 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1118 |
|
| 1119 |
/* |
| 1120 |
* TODO:441:o: |-> Check for valid ipv6InterfaceEnableStatus value. |
| 1121 |
*/ |
| 1122 |
|
| 1123 |
return MFD_SUCCESS; /* ipv6InterfaceEnableStatus value not illegal */ |
| 1124 |
} /* ipv6InterfaceEnableStatus_check_value */ |
| 1125 |
|
| 1126 |
/** |
| 1127 |
* Save old value information |
| 1128 |
* |
| 1129 |
* @param rowreq_ctx |
| 1130 |
* Pointer to the table context (ipv6InterfaceTable_rowreq_ctx) |
| 1131 |
* |
| 1132 |
* @retval MFD_SUCCESS : success |
| 1133 |
* @retval MFD_ERROR : error. set will fail. |
| 1134 |
* |
| 1135 |
* This function will be called after the table level undo setup function |
| 1136 |
* ipv6InterfaceTable_undo_setup has been called. |
| 1137 |
* |
| 1138 |
*@note |
| 1139 |
* this function will only be called if a new value is set for this column. |
| 1140 |
* |
| 1141 |
* If there is any setup specific to a particular column (e.g. allocating |
| 1142 |
* memory for a string), you should do that setup in this function, so it |
| 1143 |
* won't be done unless it is necessary. |
| 1144 |
*/ |
| 1145 |
int |
| 1146 |
ipv6InterfaceEnableStatus_undo_setup(ipv6InterfaceTable_rowreq_ctx * |
| 1147 |
rowreq_ctx) |
| 1148 |
{ |
| 1149 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceEnableStatus_undo_setup", "called\n")); |
| 1150 |
|
| 1151 |
/** should never get a NULL pointer */ |
| 1152 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1153 |
|
| 1154 |
/* |
| 1155 |
* TODO:455:o: |-> Setup ipv6InterfaceEnableStatus undo. |
| 1156 |
*/ |
| 1157 |
/* |
| 1158 |
* copy ipv6InterfaceEnableStatus data |
| 1159 |
* set rowreq_ctx->undo->ipv6InterfaceEnableStatus from rowreq_ctx->data.ipv6InterfaceEnableStatus |
| 1160 |
*/ |
| 1161 |
rowreq_ctx->undo->ipv6InterfaceEnableStatus = |
| 1162 |
rowreq_ctx->data.ipv6InterfaceEnableStatus; |
| 1163 |
|
| 1164 |
|
| 1165 |
return MFD_SUCCESS; |
| 1166 |
} /* ipv6InterfaceEnableStatus_undo_setup */ |
| 1167 |
|
| 1168 |
/** |
| 1169 |
* Set the new value. |
| 1170 |
* |
| 1171 |
* @param rowreq_ctx |
| 1172 |
* Pointer to the users context. You should know how to |
| 1173 |
* manipulate the value from this object. |
| 1174 |
* @param ipv6InterfaceEnableStatus_val |
| 1175 |
* A long containing the new value. |
| 1176 |
*/ |
| 1177 |
int |
| 1178 |
ipv6InterfaceEnableStatus_set(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, |
| 1179 |
u_long ipv6InterfaceEnableStatus_val) |
| 1180 |
{ |
| 1181 |
|
| 1182 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceEnableStatus_set", |
| 1183 |
"called\n")); |
| 1184 |
|
| 1185 |
/** should never get a NULL pointer */ |
| 1186 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1187 |
|
| 1188 |
/* |
| 1189 |
* TODO:461:M: |-> Set ipv6InterfaceEnableStatus value. |
| 1190 |
* set ipv6InterfaceEnableStatus value in rowreq_ctx->data |
| 1191 |
*/ |
| 1192 |
rowreq_ctx->data.ipv6InterfaceEnableStatus = |
| 1193 |
ipv6InterfaceEnableStatus_val; |
| 1194 |
|
| 1195 |
return MFD_SUCCESS; |
| 1196 |
} /* ipv6InterfaceEnableStatus_set */ |
| 1197 |
|
| 1198 |
/** |
| 1199 |
* undo the previous set. |
| 1200 |
* |
| 1201 |
* @param rowreq_ctx |
| 1202 |
* Pointer to the users context. |
| 1203 |
*/ |
| 1204 |
int |
| 1205 |
ipv6InterfaceEnableStatus_undo(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx) |
| 1206 |
{ |
| 1207 |
|
| 1208 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceEnableStatus_undo", "called\n")); |
| 1209 |
|
| 1210 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1211 |
|
| 1212 |
/* |
| 1213 |
* TODO:456:o: |-> Clean up ipv6InterfaceEnableStatus undo. |
| 1214 |
*/ |
| 1215 |
/* |
| 1216 |
* copy ipv6InterfaceEnableStatus data |
| 1217 |
* set rowreq_ctx->data.ipv6InterfaceEnableStatus from rowreq_ctx->undo->ipv6InterfaceEnableStatus |
| 1218 |
*/ |
| 1219 |
rowreq_ctx->data.ipv6InterfaceEnableStatus = |
| 1220 |
rowreq_ctx->undo->ipv6InterfaceEnableStatus; |
| 1221 |
|
| 1222 |
|
| 1223 |
return MFD_SUCCESS; |
| 1224 |
} /* ipv6InterfaceEnableStatus_undo */ |
| 1225 |
|
| 1226 |
/*--------------------------------------------------------------------- |
| 1227 |
* IP-MIB::ipv6InterfaceEntry.ipv6InterfaceForwarding |
| 1228 |
* ipv6InterfaceForwarding is subid 8 of ipv6InterfaceEntry. |
| 1229 |
* Its status is Current, and its access level is ReadWrite. |
| 1230 |
* OID: .1.3.6.1.2.1.4.30.1.8 |
| 1231 |
* Description: |
| 1232 |
The indication of whether this entity is acting as an IPv6 |
| 1233 |
router on this interface with respect to the forwarding of |
| 1234 |
datagrams received by, but not addressed to, this entity. |
| 1235 |
IPv6 routers forward datagrams. IPv6 hosts do not (except |
| 1236 |
those source-routed via the host). |
| 1237 |
|
| 1238 |
|
| 1239 |
|
| 1240 |
|
| 1241 |
|
| 1242 |
This object is constrained by ipv6IpForwarding and is |
| 1243 |
ignored if ipv6IpForwarding is set to notForwarding. Those |
| 1244 |
systems that do not provide per-interface control of the |
| 1245 |
forwarding function should set this object to forwarding for |
| 1246 |
all interfaces and allow the ipv6IpForwarding object to |
| 1247 |
control the forwarding capability. |
| 1248 |
|
| 1249 |
|
| 1250 |
When this object is written the entity SHOULD save the |
| 1251 |
change to non-volatile storage and restore the object from |
| 1252 |
non-volatile storage upon re-initialization of the system. |
| 1253 |
* |
| 1254 |
* Attributes: |
| 1255 |
* accessible 1 isscalar 0 enums 1 hasdefval 0 |
| 1256 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 1257 |
* settable 1 |
| 1258 |
* |
| 1259 |
* Enum range: 2/8. Values: forwarding(1), notForwarding(2) |
| 1260 |
* |
| 1261 |
* Its syntax is INTEGER (based on perltype INTEGER) |
| 1262 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 1263 |
*/ |
| 1264 |
/** |
| 1265 |
* Check that the proposed new value is potentially valid. |
| 1266 |
* |
| 1267 |
* @param rowreq_ctx |
| 1268 |
* Pointer to the row request context. |
| 1269 |
* @param ipv6InterfaceForwarding_val |
| 1270 |
* A long containing the new value. |
| 1271 |
* |
| 1272 |
* @retval MFD_SUCCESS : incoming value is legal |
| 1273 |
* @retval MFD_NOT_VALID_NOW : incoming value is not valid now |
| 1274 |
* @retval MFD_NOT_VALID_EVER : incoming value is never valid |
| 1275 |
* |
| 1276 |
* This is the place to check for requirements that are not |
| 1277 |
* expressed in the mib syntax (for example, a requirement that |
| 1278 |
* is detailed in the description for an object). |
| 1279 |
* |
| 1280 |
* You should check that the requested change between the undo value and the |
| 1281 |
* new value is legal (ie, the transistion from one value to another |
| 1282 |
* is legal). |
| 1283 |
* |
| 1284 |
*@note |
| 1285 |
* This check is only to determine if the new value |
| 1286 |
* is \b potentially valid. This is the first check of many, and |
| 1287 |
* is one of the simplest ones. |
| 1288 |
* |
| 1289 |
*@note |
| 1290 |
* this is not the place to do any checks for values |
| 1291 |
* which depend on some other value in the mib. Those |
| 1292 |
* types of checks should be done in the |
| 1293 |
* ipv6InterfaceTable_check_dependencies() function. |
| 1294 |
* |
| 1295 |
* The following checks have already been done for you: |
| 1296 |
* The syntax is ASN_INTEGER |
| 1297 |
* The value is one of forwarding(1), notForwarding(2) |
| 1298 |
* |
| 1299 |
* If there a no other checks you need to do, simply return MFD_SUCCESS. |
| 1300 |
* |
| 1301 |
*/ |
| 1302 |
int |
| 1303 |
ipv6InterfaceForwarding_check_value(ipv6InterfaceTable_rowreq_ctx * |
| 1304 |
rowreq_ctx, |
| 1305 |
u_long ipv6InterfaceForwarding_val) |
| 1306 |
{ |
| 1307 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceForwarding_check_value", "called\n")); |
| 1308 |
|
| 1309 |
/** should never get a NULL pointer */ |
| 1310 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1311 |
|
| 1312 |
/* |
| 1313 |
* TODO:441:o: |-> Check for valid ipv6InterfaceForwarding value. |
| 1314 |
*/ |
| 1315 |
|
| 1316 |
return MFD_SUCCESS; /* ipv6InterfaceForwarding value not illegal */ |
| 1317 |
} /* ipv6InterfaceForwarding_check_value */ |
| 1318 |
|
| 1319 |
/** |
| 1320 |
* Save old value information |
| 1321 |
* |
| 1322 |
* @param rowreq_ctx |
| 1323 |
* Pointer to the table context (ipv6InterfaceTable_rowreq_ctx) |
| 1324 |
* |
| 1325 |
* @retval MFD_SUCCESS : success |
| 1326 |
* @retval MFD_ERROR : error. set will fail. |
| 1327 |
* |
| 1328 |
* This function will be called after the table level undo setup function |
| 1329 |
* ipv6InterfaceTable_undo_setup has been called. |
| 1330 |
* |
| 1331 |
*@note |
| 1332 |
* this function will only be called if a new value is set for this column. |
| 1333 |
* |
| 1334 |
* If there is any setup specific to a particular column (e.g. allocating |
| 1335 |
* memory for a string), you should do that setup in this function, so it |
| 1336 |
* won't be done unless it is necessary. |
| 1337 |
*/ |
| 1338 |
int |
| 1339 |
ipv6InterfaceForwarding_undo_setup(ipv6InterfaceTable_rowreq_ctx * |
| 1340 |
rowreq_ctx) |
| 1341 |
{ |
| 1342 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceForwarding_undo_setup", "called\n")); |
| 1343 |
|
| 1344 |
/** should never get a NULL pointer */ |
| 1345 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1346 |
|
| 1347 |
/* |
| 1348 |
* TODO:455:o: |-> Setup ipv6InterfaceForwarding undo. |
| 1349 |
*/ |
| 1350 |
/* |
| 1351 |
* copy ipv6InterfaceForwarding data |
| 1352 |
* set rowreq_ctx->undo->ipv6InterfaceForwarding from rowreq_ctx->data.ipv6InterfaceForwarding |
| 1353 |
*/ |
| 1354 |
rowreq_ctx->undo->ipv6InterfaceForwarding = |
| 1355 |
rowreq_ctx->data.ipv6InterfaceForwarding; |
| 1356 |
|
| 1357 |
|
| 1358 |
return MFD_SUCCESS; |
| 1359 |
} /* ipv6InterfaceForwarding_undo_setup */ |
| 1360 |
|
| 1361 |
/** |
| 1362 |
* Set the new value. |
| 1363 |
* |
| 1364 |
* @param rowreq_ctx |
| 1365 |
* Pointer to the users context. You should know how to |
| 1366 |
* manipulate the value from this object. |
| 1367 |
* @param ipv6InterfaceForwarding_val |
| 1368 |
* A long containing the new value. |
| 1369 |
*/ |
| 1370 |
int |
| 1371 |
ipv6InterfaceForwarding_set(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, |
| 1372 |
u_long ipv6InterfaceForwarding_val) |
| 1373 |
{ |
| 1374 |
|
| 1375 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceForwarding_set", |
| 1376 |
"called\n")); |
| 1377 |
|
| 1378 |
/** should never get a NULL pointer */ |
| 1379 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1380 |
|
| 1381 |
/* |
| 1382 |
* TODO:461:M: |-> Set ipv6InterfaceForwarding value. |
| 1383 |
* set ipv6InterfaceForwarding value in rowreq_ctx->data |
| 1384 |
*/ |
| 1385 |
rowreq_ctx->data.ipv6InterfaceForwarding = ipv6InterfaceForwarding_val; |
| 1386 |
|
| 1387 |
return MFD_SUCCESS; |
| 1388 |
} /* ipv6InterfaceForwarding_set */ |
| 1389 |
|
| 1390 |
/** |
| 1391 |
* undo the previous set. |
| 1392 |
* |
| 1393 |
* @param rowreq_ctx |
| 1394 |
* Pointer to the users context. |
| 1395 |
*/ |
| 1396 |
int |
| 1397 |
ipv6InterfaceForwarding_undo(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx) |
| 1398 |
{ |
| 1399 |
|
| 1400 |
DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceForwarding_undo", |
| 1401 |
"called\n")); |
| 1402 |
|
| 1403 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1404 |
|
| 1405 |
/* |
| 1406 |
* TODO:456:o: |-> Clean up ipv6InterfaceForwarding undo. |
| 1407 |
*/ |
| 1408 |
/* |
| 1409 |
* copy ipv6InterfaceForwarding data |
| 1410 |
* set rowreq_ctx->data.ipv6InterfaceForwarding from rowreq_ctx->undo->ipv6InterfaceForwarding |
| 1411 |
*/ |
| 1412 |
rowreq_ctx->data.ipv6InterfaceForwarding = |
| 1413 |
rowreq_ctx->undo->ipv6InterfaceForwarding; |
| 1414 |
|
| 1415 |
|
| 1416 |
return MFD_SUCCESS; |
| 1417 |
} /* ipv6InterfaceForwarding_undo */ |
| 1418 |
|
| 1419 |
/** @} */ |
| 1420 |
/** @{ */ |