| 1 |
/* |
| 2 |
* Note: this file originally auto-generated by mib2c using |
| 3 |
* version : 1.17 $ of : mfd-data-access.m2c,v $ |
| 4 |
* |
| 5 |
* $Id$ |
| 6 |
*/ |
| 7 |
/* |
| 8 |
* standard Net-SNMP includes |
| 9 |
*/ |
| 10 |
#include <net-snmp/net-snmp-config.h> |
| 11 |
#include <net-snmp/net-snmp-includes.h> |
| 12 |
#include <net-snmp/agent/net-snmp-agent-includes.h> |
| 13 |
|
| 14 |
/* |
| 15 |
* include our parent header |
| 16 |
*/ |
| 17 |
#include "ipCidrRouteTable.h" |
| 18 |
|
| 19 |
|
| 20 |
#include "ipCidrRouteTable_data_access.h" |
| 21 |
|
| 22 |
|
| 23 |
/** @ingroup interface |
| 24 |
* @addtogroup data_access data_access: Routines to access data |
| 25 |
* |
| 26 |
* These routines are used to locate the data used to satisfy |
| 27 |
* requests. |
| 28 |
* |
| 29 |
* @{ |
| 30 |
*/ |
| 31 |
/********************************************************************** |
| 32 |
********************************************************************** |
| 33 |
*** |
| 34 |
*** Table ipCidrRouteTable |
| 35 |
*** |
| 36 |
********************************************************************** |
| 37 |
**********************************************************************/ |
| 38 |
/* |
| 39 |
* IP-FORWARD-MIB::ipCidrRouteTable is subid 4 of ipForward. |
| 40 |
* Its status is Deprecated. |
| 41 |
* OID: .1.3.6.1.2.1.4.24.4, length: 9 |
| 42 |
*/ |
| 43 |
|
| 44 |
/** |
| 45 |
* initialization for ipCidrRouteTable data access |
| 46 |
* |
| 47 |
* This function is called during startup to allow you to |
| 48 |
* allocate any resources you need for the data table. |
| 49 |
* |
| 50 |
* @param ipCidrRouteTable_reg |
| 51 |
* Pointer to ipCidrRouteTable_registration |
| 52 |
* |
| 53 |
* @retval MFD_SUCCESS : success. |
| 54 |
* @retval MFD_ERROR : unrecoverable error. |
| 55 |
*/ |
| 56 |
int |
| 57 |
ipCidrRouteTable_init_data(ipCidrRouteTable_registration * |
| 58 |
ipCidrRouteTable_reg) |
| 59 |
{ |
| 60 |
DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_init_data", |
| 61 |
"called\n")); |
| 62 |
|
| 63 |
/* |
| 64 |
* TODO:303:o: Initialize ipCidrRouteTable data. |
| 65 |
*/ |
| 66 |
|
| 67 |
return MFD_SUCCESS; |
| 68 |
} /* ipCidrRouteTable_init_data */ |
| 69 |
|
| 70 |
/** |
| 71 |
* container overview |
| 72 |
* |
| 73 |
*/ |
| 74 |
|
| 75 |
/** |
| 76 |
* container initialization |
| 77 |
* |
| 78 |
* @param container_ptr_ptr A pointer to a container pointer. If you |
| 79 |
* create a custom container, use this parameter to return it |
| 80 |
* to the MFD helper. If set to NULL, the MFD helper will |
| 81 |
* allocate a container for you. |
| 82 |
* @param cache A pointer to a cache structure. You can set the timeout |
| 83 |
* and other cache flags using this pointer. |
| 84 |
* |
| 85 |
* This function is called at startup to allow you to customize certain |
| 86 |
* aspects of the access method. For the most part, it is for advanced |
| 87 |
* users. The default code should suffice for most cases. If no custom |
| 88 |
* container is allocated, the MFD code will create one for your. |
| 89 |
* |
| 90 |
* This is also the place to set up cache behavior. The default, to |
| 91 |
* simply set the cache timeout, will work well with the default |
| 92 |
* container. If you are using a custom container, you may want to |
| 93 |
* look at the cache helper documentation to see if there are any |
| 94 |
* flags you want to set. |
| 95 |
* |
| 96 |
* @remark |
| 97 |
* This would also be a good place to do any initialization needed |
| 98 |
* for you data source. For example, opening a connection to another |
| 99 |
* process that will supply the data, opening a database, etc. |
| 100 |
*/ |
| 101 |
void |
| 102 |
ipCidrRouteTable_container_init(netsnmp_container **container_ptr_ptr, |
| 103 |
netsnmp_cache * cache) |
| 104 |
{ |
| 105 |
DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_container_init", |
| 106 |
"called\n")); |
| 107 |
|
| 108 |
if (NULL == container_ptr_ptr) { |
| 109 |
snmp_log(LOG_ERR, |
| 110 |
"bad container param to ipCidrRouteTable_container_init\n"); |
| 111 |
return; |
| 112 |
} |
| 113 |
|
| 114 |
/* |
| 115 |
* For advanced users, you can use a custom container. If you |
| 116 |
* do not create one, one will be created for you. |
| 117 |
*/ |
| 118 |
*container_ptr_ptr = NULL; |
| 119 |
|
| 120 |
if (NULL == cache) { |
| 121 |
snmp_log(LOG_ERR, |
| 122 |
"bad cache param to ipCidrRouteTable_container_init\n"); |
| 123 |
return; |
| 124 |
} |
| 125 |
|
| 126 |
/* |
| 127 |
* TODO:345:A: Set up ipCidrRouteTable cache properties. |
| 128 |
* |
| 129 |
* Also for advanced users, you can set parameters for the |
| 130 |
* cache. Do not change the magic pointer, as it is used |
| 131 |
* by the MFD helper. To completely disable caching, set |
| 132 |
* cache->enabled to 0. |
| 133 |
*/ |
| 134 |
cache->timeout = IPCIDRROUTETABLE_CACHE_TIMEOUT; /* seconds */ |
| 135 |
} /* ipCidrRouteTable_container_init */ |
| 136 |
|
| 137 |
/** |
| 138 |
* check entry for update |
| 139 |
* |
| 140 |
*/ |
| 141 |
static void |
| 142 |
_snarf_route_entry(void *p, void *q) |
| 143 |
{ |
| 144 |
netsnmp_route_entry *route_entry = p; |
| 145 |
netsnmp_container *container = q; |
| 146 |
ipCidrRouteTable_rowreq_ctx *rowreq_ctx; |
| 147 |
|
| 148 |
DEBUGTRACE; |
| 149 |
|
| 150 |
netsnmp_assert(NULL != route_entry); |
| 151 |
netsnmp_assert(NULL != container); |
| 152 |
|
| 153 |
/* |
| 154 |
* allocate an row context and set the index(es), then add it to |
| 155 |
* the container |
| 156 |
*/ |
| 157 |
rowreq_ctx = ipCidrRouteTable_allocate_rowreq_ctx(route_entry, NULL); |
| 158 |
if ((NULL != rowreq_ctx) && |
| 159 |
(MFD_SUCCESS == ipCidrRouteTable_indexes_set |
| 160 |
(rowreq_ctx, *((in_addr_t *) route_entry->rt_dest), |
| 161 |
route_entry->rt_mask, route_entry->rt_tos, |
| 162 |
*((in_addr_t *) route_entry->rt_nexthop)))) { |
| 163 |
|
| 164 |
CONTAINER_INSERT(container, rowreq_ctx); |
| 165 |
rowreq_ctx->ipCidrRouteStatus = ROWSTATUS_ACTIVE; |
| 166 |
} else { |
| 167 |
if (rowreq_ctx) { |
| 168 |
snmp_log(LOG_ERR, "error setting index while loading " |
| 169 |
"ipCidrRoute cache.\n"); |
| 170 |
ipCidrRouteTable_release_rowreq_ctx(rowreq_ctx); |
| 171 |
} else |
| 172 |
netsnmp_access_route_entry_free(route_entry); |
| 173 |
} |
| 174 |
} |
| 175 |
|
| 176 |
/** |
| 177 |
* container shutdown |
| 178 |
* |
| 179 |
* @param container_ptr A pointer to the container. |
| 180 |
* |
| 181 |
* This function is called at shutdown to allow you to customize certain |
| 182 |
* aspects of the access method. For the most part, it is for advanced |
| 183 |
* users. The default code should suffice for most cases. |
| 184 |
* |
| 185 |
* This function is called before ipCidrRouteTable_container_free(). |
| 186 |
* |
| 187 |
* @remark |
| 188 |
* This would also be a good place to do any cleanup needed |
| 189 |
* for you data source. For example, closing a connection to another |
| 190 |
* process that supplied the data, closing a database, etc. |
| 191 |
*/ |
| 192 |
void |
| 193 |
ipCidrRouteTable_container_shutdown(netsnmp_container *container_ptr) |
| 194 |
{ |
| 195 |
DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_container_shutdown", "called\n")); |
| 196 |
|
| 197 |
if (NULL == container_ptr) { |
| 198 |
snmp_log(LOG_ERR, |
| 199 |
"bad params to ipCidrRouteTable_container_shutdown\n"); |
| 200 |
return; |
| 201 |
} |
| 202 |
|
| 203 |
} /* ipCidrRouteTable_container_shutdown */ |
| 204 |
|
| 205 |
/** |
| 206 |
* load initial data |
| 207 |
* |
| 208 |
* TODO:350:M: Implement ipCidrRouteTable data load |
| 209 |
* This function will also be called by the cache helper to load |
| 210 |
* the container again (after the container free function has been |
| 211 |
* called to free the previous contents). |
| 212 |
* |
| 213 |
* @param container container to which items should be inserted |
| 214 |
* |
| 215 |
* @retval MFD_SUCCESS : success. |
| 216 |
* @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source |
| 217 |
* @retval MFD_ERROR : other error. |
| 218 |
* |
| 219 |
* This function is called to load the index(es) (and data, optionally) |
| 220 |
* for the every row in the data set. |
| 221 |
* |
| 222 |
* @remark |
| 223 |
* While loading the data, the only important thing is the indexes. |
| 224 |
* If access to your data is cheap/fast (e.g. you have a pointer to a |
| 225 |
* structure in memory), it would make sense to update the data here. |
| 226 |
* If, however, the accessing the data involves more work (e.g. parsing |
| 227 |
* some other existing data, or performing calculations to derive the data), |
| 228 |
* then you can limit yourself to setting the indexes and saving any |
| 229 |
* information you will need later. Then use the saved information in |
| 230 |
* ipCidrRouteTable_row_prep() for populating data. |
| 231 |
* |
| 232 |
* @note |
| 233 |
* If you need consistency between rows (like you want statistics |
| 234 |
* for each row to be from the same time frame), you should set all |
| 235 |
* data here. |
| 236 |
* |
| 237 |
*/ |
| 238 |
int |
| 239 |
ipCidrRouteTable_container_load(netsnmp_container *container) |
| 240 |
{ |
| 241 |
netsnmp_container *route_container; |
| 242 |
|
| 243 |
DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_cache_load", |
| 244 |
"called\n")); |
| 245 |
|
| 246 |
/* |
| 247 |
* TODO:351:M: |-> Load/update data in the ipCidrRouteTable container. |
| 248 |
* loop over your ipCidrRouteTable data, allocate a rowreq context, |
| 249 |
* set the index(es) [and data, optionally] and insert into |
| 250 |
* the container. |
| 251 |
*/ |
| 252 |
route_container = |
| 253 |
netsnmp_access_route_container_load(NULL, |
| 254 |
NETSNMP_ACCESS_ROUTE_LOAD_IPV4_ONLY); |
| 255 |
|
| 256 |
if (NULL == route_container) |
| 257 |
return MFD_RESOURCE_UNAVAILABLE; /* msg already logged */ |
| 258 |
|
| 259 |
/* |
| 260 |
* we just got a fresh copy of route data. snarf data |
| 261 |
*/ |
| 262 |
CONTAINER_FOR_EACH(route_container, _snarf_route_entry, container); |
| 263 |
|
| 264 |
/* |
| 265 |
* free the container. we've either claimed each ifentry, or released it, |
| 266 |
* so the dal function doesn't need to clear the container. |
| 267 |
*/ |
| 268 |
netsnmp_access_route_container_free(route_container, |
| 269 |
NETSNMP_ACCESS_ROUTE_FREE_DONT_CLEAR); |
| 270 |
|
| 271 |
DEBUGMSGT(("verbose:ipCidrRouteTable:ipCidrRouteTable_cache_load", |
| 272 |
"%d records\n", (int)CONTAINER_SIZE(container))); |
| 273 |
|
| 274 |
return MFD_SUCCESS; |
| 275 |
} /* ipCidrRouteTable_container_load */ |
| 276 |
|
| 277 |
/** |
| 278 |
* container clean up |
| 279 |
* |
| 280 |
* @param container container with all current items |
| 281 |
* |
| 282 |
* This optional callback is called prior to all |
| 283 |
* item's being removed from the container. If you |
| 284 |
* need to do any processing before that, do it here. |
| 285 |
* |
| 286 |
* @note |
| 287 |
* The MFD helper will take care of releasing all the row contexts. |
| 288 |
* |
| 289 |
*/ |
| 290 |
void |
| 291 |
ipCidrRouteTable_container_free(netsnmp_container *container) |
| 292 |
{ |
| 293 |
DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_container_free", |
| 294 |
"called\n")); |
| 295 |
|
| 296 |
/* |
| 297 |
* TODO:380:M: Free ipCidrRouteTable container data. |
| 298 |
*/ |
| 299 |
} /* ipCidrRouteTable_container_free */ |
| 300 |
|
| 301 |
/** |
| 302 |
* prepare row for processing. |
| 303 |
* |
| 304 |
* When the agent has located the row for a request, this function is |
| 305 |
* called to prepare the row for processing. If you fully populated |
| 306 |
* the data context during the index setup phase, you may not need to |
| 307 |
* do anything. |
| 308 |
* |
| 309 |
* @param rowreq_ctx pointer to a context. |
| 310 |
* |
| 311 |
* @retval MFD_SUCCESS : success. |
| 312 |
* @retval MFD_ERROR : other error. |
| 313 |
*/ |
| 314 |
int |
| 315 |
ipCidrRouteTable_row_prep(ipCidrRouteTable_rowreq_ctx * rowreq_ctx) |
| 316 |
{ |
| 317 |
DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_row_prep", |
| 318 |
"called\n")); |
| 319 |
|
| 320 |
netsnmp_assert(NULL != rowreq_ctx); |
| 321 |
|
| 322 |
/* |
| 323 |
* TODO:390:o: Prepare row for request. |
| 324 |
* If populating row data was delayed, this is the place to |
| 325 |
* fill in the row for this request. |
| 326 |
*/ |
| 327 |
|
| 328 |
return MFD_SUCCESS; |
| 329 |
} /* ipCidrRouteTable_row_prep */ |
| 330 |
|
| 331 |
/* |
| 332 |
* TODO:420:r: Implement ipCidrRouteTable index validation. |
| 333 |
*/ |
| 334 |
/*--------------------------------------------------------------------- |
| 335 |
* IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteDest |
| 336 |
* ipCidrRouteDest is subid 1 of ipCidrRouteEntry. |
| 337 |
* Its status is Deprecated, and its access level is ReadOnly. |
| 338 |
* OID: .1.3.6.1.2.1.4.24.4.1.1 |
| 339 |
* Description: |
| 340 |
The destination IP address of this route. |
| 341 |
|
| 342 |
This object may not take a Multicast (Class D) address |
| 343 |
value. |
| 344 |
|
| 345 |
Any assignment (implicit or otherwise) of an instance |
| 346 |
of this object to a value x must be rejected if the |
| 347 |
bitwise logical-AND of x with the value of the |
| 348 |
corresponding instance of the ipCidrRouteMask object is |
| 349 |
not equal to x. |
| 350 |
* |
| 351 |
* Attributes: |
| 352 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 353 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 354 |
* settable 0 |
| 355 |
* |
| 356 |
* |
| 357 |
* Its syntax is IPADDR (based on perltype IPADDR) |
| 358 |
* The net-snmp type is ASN_IPADDRESS. The C type decl is u_long (u_long) |
| 359 |
*/ |
| 360 |
/** |
| 361 |
* check validity of ipCidrRouteDest index portion |
| 362 |
* |
| 363 |
* @retval MFD_SUCCESS : the incoming value is legal |
| 364 |
* @retval MFD_ERROR : the incoming value is NOT legal |
| 365 |
* |
| 366 |
* @note this is not the place to do any checks for the sanity |
| 367 |
* of multiple indexes. Those types of checks should be done in the |
| 368 |
* ipCidrRouteTable_validate_index() function. |
| 369 |
* |
| 370 |
* @note Also keep in mind that if the index refers to a row in this or |
| 371 |
* some other table, you can't check for that row here to make |
| 372 |
* decisions, since that row might not be created yet, but may |
| 373 |
* be created during the processing this request. If you have |
| 374 |
* such checks, they should be done in the check_dependencies |
| 375 |
* function, because any new/deleted/changed rows should be |
| 376 |
* available then. |
| 377 |
* |
| 378 |
* The following checks have already been done for you: |
| 379 |
* |
| 380 |
* If there a no other checks you need to do, simply return MFD_SUCCESS. |
| 381 |
*/ |
| 382 |
int |
| 383 |
ipCidrRouteDest_check_index(ipCidrRouteTable_rowreq_ctx * rowreq_ctx) |
| 384 |
{ |
| 385 |
DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteDest_check_index", |
| 386 |
"called\n")); |
| 387 |
|
| 388 |
netsnmp_assert(NULL != rowreq_ctx); |
| 389 |
|
| 390 |
/* |
| 391 |
* TODO:426:M: |-> Check ipCidrRouteTable index ipCidrRouteDest. |
| 392 |
* check that index value in the table context is legal. |
| 393 |
* (rowreq_ctx->tbl_index.ipCidrRouteDest) |
| 394 |
*/ |
| 395 |
|
| 396 |
return MFD_SUCCESS; /* ipCidrRouteDest index ok */ |
| 397 |
} /* ipCidrRouteDest_check_index */ |
| 398 |
|
| 399 |
/*--------------------------------------------------------------------- |
| 400 |
* IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteMask |
| 401 |
* ipCidrRouteMask is subid 2 of ipCidrRouteEntry. |
| 402 |
* Its status is Deprecated, and its access level is ReadOnly. |
| 403 |
* OID: .1.3.6.1.2.1.4.24.4.1.2 |
| 404 |
* Description: |
| 405 |
Indicate the mask to be logical-ANDed with the |
| 406 |
destination address before being compared to the value |
| 407 |
in the ipCidrRouteDest field. For those systems that |
| 408 |
do not support arbitrary subnet masks, an agent |
| 409 |
constructs the value of the ipCidrRouteMask by |
| 410 |
reference to the IP Address Class. |
| 411 |
|
| 412 |
Any assignment (implicit or otherwise) of an instance |
| 413 |
of this object to a value x must be rejected if the |
| 414 |
bitwise logical-AND of x with the value of the |
| 415 |
corresponding instance of the ipCidrRouteDest object is |
| 416 |
|
| 417 |
|
| 418 |
not equal to ipCidrRouteDest. |
| 419 |
* |
| 420 |
* Attributes: |
| 421 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 422 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 423 |
* settable 0 |
| 424 |
* |
| 425 |
* |
| 426 |
* Its syntax is IPADDR (based on perltype IPADDR) |
| 427 |
* The net-snmp type is ASN_IPADDRESS. The C type decl is u_long (u_long) |
| 428 |
*/ |
| 429 |
/** |
| 430 |
* check validity of ipCidrRouteMask index portion |
| 431 |
* |
| 432 |
* @retval MFD_SUCCESS : the incoming value is legal |
| 433 |
* @retval MFD_ERROR : the incoming value is NOT legal |
| 434 |
* |
| 435 |
* @note this is not the place to do any checks for the sanity |
| 436 |
* of multiple indexes. Those types of checks should be done in the |
| 437 |
* ipCidrRouteTable_validate_index() function. |
| 438 |
* |
| 439 |
* @note Also keep in mind that if the index refers to a row in this or |
| 440 |
* some other table, you can't check for that row here to make |
| 441 |
* decisions, since that row might not be created yet, but may |
| 442 |
* be created during the processing this request. If you have |
| 443 |
* such checks, they should be done in the check_dependencies |
| 444 |
* function, because any new/deleted/changed rows should be |
| 445 |
* available then. |
| 446 |
* |
| 447 |
* The following checks have already been done for you: |
| 448 |
* |
| 449 |
* If there a no other checks you need to do, simply return MFD_SUCCESS. |
| 450 |
*/ |
| 451 |
int |
| 452 |
ipCidrRouteMask_check_index(ipCidrRouteTable_rowreq_ctx * rowreq_ctx) |
| 453 |
{ |
| 454 |
DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMask_check_index", |
| 455 |
"called\n")); |
| 456 |
|
| 457 |
netsnmp_assert(NULL != rowreq_ctx); |
| 458 |
|
| 459 |
/* |
| 460 |
* TODO:426:M: |-> Check ipCidrRouteTable index ipCidrRouteMask. |
| 461 |
* check that index value in the table context is legal. |
| 462 |
* (rowreq_ctx->tbl_index.ipCidrRouteMask) |
| 463 |
*/ |
| 464 |
|
| 465 |
return MFD_SUCCESS; /* ipCidrRouteMask index ok */ |
| 466 |
} /* ipCidrRouteMask_check_index */ |
| 467 |
|
| 468 |
/*--------------------------------------------------------------------- |
| 469 |
* IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteTos |
| 470 |
* ipCidrRouteTos is subid 3 of ipCidrRouteEntry. |
| 471 |
* Its status is Deprecated, and its access level is ReadOnly. |
| 472 |
* OID: .1.3.6.1.2.1.4.24.4.1.3 |
| 473 |
* Description: |
| 474 |
The policy specifier is the IP TOS Field. The encoding |
| 475 |
of IP TOS is as specified by the following convention. |
| 476 |
Zero indicates the default path if no more specific |
| 477 |
policy applies. |
| 478 |
|
| 479 |
+-----+-----+-----+-----+-----+-----+-----+-----+ |
| 480 |
| | | | |
| 481 |
| PRECEDENCE | TYPE OF SERVICE | 0 | |
| 482 |
| | | | |
| 483 |
+-----+-----+-----+-----+-----+-----+-----+-----+ |
| 484 |
|
| 485 |
IP TOS IP TOS |
| 486 |
Field Policy Field Policy |
| 487 |
Contents Code Contents Code |
| 488 |
0 0 0 0 ==> 0 0 0 0 1 ==> 2 |
| 489 |
0 0 1 0 ==> 4 0 0 1 1 ==> 6 |
| 490 |
0 1 0 0 ==> 8 0 1 0 1 ==> 10 |
| 491 |
0 1 1 0 ==> 12 0 1 1 1 ==> 14 |
| 492 |
1 0 0 0 ==> 16 1 0 0 1 ==> 18 |
| 493 |
1 0 1 0 ==> 20 1 0 1 1 ==> 22 |
| 494 |
1 1 0 0 ==> 24 1 1 0 1 ==> 26 |
| 495 |
1 1 1 0 ==> 28 1 1 1 1 ==> 30 |
| 496 |
* |
| 497 |
* Attributes: |
| 498 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 499 |
* readable 1 iscolumn 1 ranges 1 hashint 0 |
| 500 |
* settable 0 |
| 501 |
* |
| 502 |
* Ranges: 0 - 2147483647; |
| 503 |
* |
| 504 |
* Its syntax is INTEGER32 (based on perltype INTEGER32) |
| 505 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (long) |
| 506 |
*/ |
| 507 |
/** |
| 508 |
* check validity of ipCidrRouteTos index portion |
| 509 |
* |
| 510 |
* @retval MFD_SUCCESS : the incoming value is legal |
| 511 |
* @retval MFD_ERROR : the incoming value is NOT legal |
| 512 |
* |
| 513 |
* @note this is not the place to do any checks for the sanity |
| 514 |
* of multiple indexes. Those types of checks should be done in the |
| 515 |
* ipCidrRouteTable_validate_index() function. |
| 516 |
* |
| 517 |
* @note Also keep in mind that if the index refers to a row in this or |
| 518 |
* some other table, you can't check for that row here to make |
| 519 |
* decisions, since that row might not be created yet, but may |
| 520 |
* be created during the processing this request. If you have |
| 521 |
* such checks, they should be done in the check_dependencies |
| 522 |
* function, because any new/deleted/changed rows should be |
| 523 |
* available then. |
| 524 |
* |
| 525 |
* The following checks have already been done for you: |
| 526 |
* The value is in (one of) the range set(s): 0 - 2147483647 |
| 527 |
* |
| 528 |
* If there a no other checks you need to do, simply return MFD_SUCCESS. |
| 529 |
*/ |
| 530 |
int |
| 531 |
ipCidrRouteTos_check_index(ipCidrRouteTable_rowreq_ctx * rowreq_ctx) |
| 532 |
{ |
| 533 |
DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTos_check_index", |
| 534 |
"called\n")); |
| 535 |
|
| 536 |
netsnmp_assert(NULL != rowreq_ctx); |
| 537 |
|
| 538 |
/* |
| 539 |
* TODO:426:M: |-> Check ipCidrRouteTable index ipCidrRouteTos. |
| 540 |
* check that index value in the table context is legal. |
| 541 |
* (rowreq_ctx->tbl_index.ipCidrRouteTos) |
| 542 |
*/ |
| 543 |
|
| 544 |
return MFD_SUCCESS; /* ipCidrRouteTos index ok */ |
| 545 |
} /* ipCidrRouteTos_check_index */ |
| 546 |
|
| 547 |
/*--------------------------------------------------------------------- |
| 548 |
* IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteNextHop |
| 549 |
* ipCidrRouteNextHop is subid 4 of ipCidrRouteEntry. |
| 550 |
* Its status is Deprecated, and its access level is ReadOnly. |
| 551 |
* OID: .1.3.6.1.2.1.4.24.4.1.4 |
| 552 |
* Description: |
| 553 |
On remote routes, the address of the next system en |
| 554 |
route; Otherwise, 0.0.0.0. |
| 555 |
* |
| 556 |
* Attributes: |
| 557 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 558 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 559 |
* settable 0 |
| 560 |
* |
| 561 |
* |
| 562 |
* Its syntax is IPADDR (based on perltype IPADDR) |
| 563 |
* The net-snmp type is ASN_IPADDRESS. The C type decl is u_long (u_long) |
| 564 |
*/ |
| 565 |
/** |
| 566 |
* check validity of ipCidrRouteNextHop index portion |
| 567 |
* |
| 568 |
* @retval MFD_SUCCESS : the incoming value is legal |
| 569 |
* @retval MFD_ERROR : the incoming value is NOT legal |
| 570 |
* |
| 571 |
* @note this is not the place to do any checks for the sanity |
| 572 |
* of multiple indexes. Those types of checks should be done in the |
| 573 |
* ipCidrRouteTable_validate_index() function. |
| 574 |
* |
| 575 |
* @note Also keep in mind that if the index refers to a row in this or |
| 576 |
* some other table, you can't check for that row here to make |
| 577 |
* decisions, since that row might not be created yet, but may |
| 578 |
* be created during the processing this request. If you have |
| 579 |
* such checks, they should be done in the check_dependencies |
| 580 |
* function, because any new/deleted/changed rows should be |
| 581 |
* available then. |
| 582 |
* |
| 583 |
* The following checks have already been done for you: |
| 584 |
* |
| 585 |
* If there a no other checks you need to do, simply return MFD_SUCCESS. |
| 586 |
*/ |
| 587 |
int |
| 588 |
ipCidrRouteNextHop_check_index(ipCidrRouteTable_rowreq_ctx * rowreq_ctx) |
| 589 |
{ |
| 590 |
DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteNextHop_check_index", |
| 591 |
"called\n")); |
| 592 |
|
| 593 |
netsnmp_assert(NULL != rowreq_ctx); |
| 594 |
|
| 595 |
/* |
| 596 |
* TODO:426:M: |-> Check ipCidrRouteTable index ipCidrRouteNextHop. |
| 597 |
* check that index value in the table context is legal. |
| 598 |
* (rowreq_ctx->tbl_index.ipCidrRouteNextHop) |
| 599 |
*/ |
| 600 |
|
| 601 |
return MFD_SUCCESS; /* ipCidrRouteNextHop index ok */ |
| 602 |
} /* ipCidrRouteNextHop_check_index */ |
| 603 |
|
| 604 |
/** |
| 605 |
* verify specified index is valid. |
| 606 |
* |
| 607 |
* This check is independent of whether or not the values specified for |
| 608 |
* the columns of the new row are valid. Column values and row consistency |
| 609 |
* will be checked later. At this point, only the index values should be |
| 610 |
* checked. |
| 611 |
* |
| 612 |
* All of the individual index validation functions have been called, so this |
| 613 |
* is the place to make sure they are valid as a whole when combined. If |
| 614 |
* you only have one index, then you probably don't need to do anything else |
| 615 |
* here. |
| 616 |
* |
| 617 |
* @note Keep in mind that if the indexes refer to a row in this or |
| 618 |
* some other table, you can't check for that row here to make |
| 619 |
* decisions, since that row might not be created yet, but may |
| 620 |
* be created during the processing this request. If you have |
| 621 |
* such checks, they should be done in the check_dependencies |
| 622 |
* function, because any new/deleted/changed rows should be |
| 623 |
* available then. |
| 624 |
* |
| 625 |
* |
| 626 |
* @param ipCidrRouteTable_reg |
| 627 |
* Pointer to the user registration data |
| 628 |
* @param rowreq_ctx |
| 629 |
* Pointer to the users context. |
| 630 |
* @retval MFD_SUCCESS : success |
| 631 |
* @retval MFD_CANNOT_CREATE_NOW : index not valid right now |
| 632 |
* @retval MFD_CANNOT_CREATE_EVER : index never valid |
| 633 |
*/ |
| 634 |
int |
| 635 |
ipCidrRouteTable_validate_index(ipCidrRouteTable_registration * |
| 636 |
ipCidrRouteTable_reg, |
| 637 |
ipCidrRouteTable_rowreq_ctx * rowreq_ctx) |
| 638 |
{ |
| 639 |
int rc = MFD_SUCCESS; |
| 640 |
|
| 641 |
DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_validate_index", |
| 642 |
"called\n")); |
| 643 |
|
| 644 |
/** we should have a non-NULL pointer */ |
| 645 |
netsnmp_assert(NULL != rowreq_ctx); |
| 646 |
|
| 647 |
/* |
| 648 |
* TODO:430:M: |-> Validate potential ipCidrRouteTable index. |
| 649 |
*/ |
| 650 |
if (1) { |
| 651 |
snmp_log(LOG_WARNING, "invalid index for a new row in the " |
| 652 |
"ipCidrRouteTable table.\n"); |
| 653 |
/* |
| 654 |
* determine failure type. |
| 655 |
* |
| 656 |
* If the index could not ever be created, return MFD_NOT_EVER |
| 657 |
* If the index can not be created under the present circumstances |
| 658 |
* (even though it could be created under other circumstances), |
| 659 |
* return MFD_NOT_NOW. |
| 660 |
*/ |
| 661 |
if (0) { |
| 662 |
return MFD_CANNOT_CREATE_EVER; |
| 663 |
} else { |
| 664 |
return MFD_CANNOT_CREATE_NOW; |
| 665 |
} |
| 666 |
} |
| 667 |
|
| 668 |
return rc; |
| 669 |
} /* ipCidrRouteTable_validate_index */ |
| 670 |
|
| 671 |
/** @} */ |