| 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 tcpConnectionTable |
| 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 "tcpConnectionTable.h" |
| 24 |
|
| 25 |
#include <net-snmp/agent/mib_modules.h> |
| 26 |
|
| 27 |
#include "tcpConnectionTable_interface.h" |
| 28 |
|
| 29 |
const oid tcpConnectionTable_oid[] = { TCPCONNECTIONTABLE_OID }; |
| 30 |
const int tcpConnectionTable_oid_size = |
| 31 |
OID_LENGTH(tcpConnectionTable_oid); |
| 32 |
|
| 33 |
tcpConnectionTable_registration tcpConnectionTable_user_context; |
| 34 |
|
| 35 |
void initialize_table_tcpConnectionTable(void); |
| 36 |
void shutdown_table_tcpConnectionTable(void); |
| 37 |
|
| 38 |
|
| 39 |
/** |
| 40 |
* Initializes the tcpConnectionTable module |
| 41 |
*/ |
| 42 |
void |
| 43 |
init_tcpConnectionTable(void) |
| 44 |
{ |
| 45 |
DEBUGMSGTL(("verbose:tcpConnectionTable:init_tcpConnectionTable", |
| 46 |
"called\n")); |
| 47 |
|
| 48 |
/* |
| 49 |
* TODO:300:o: Perform tcpConnectionTable one-time module initialization. |
| 50 |
*/ |
| 51 |
|
| 52 |
/* |
| 53 |
* here we initialize all the tables we're planning on supporting |
| 54 |
*/ |
| 55 |
if (should_init("tcpConnectionTable")) |
| 56 |
initialize_table_tcpConnectionTable(); |
| 57 |
|
| 58 |
} /* init_tcpConnectionTable */ |
| 59 |
|
| 60 |
/** |
| 61 |
* Shut-down the tcpConnectionTable module (agent is exiting) |
| 62 |
*/ |
| 63 |
void |
| 64 |
shutdown_tcpConnectionTable(void) |
| 65 |
{ |
| 66 |
if (should_init("tcpConnectionTable")) |
| 67 |
shutdown_table_tcpConnectionTable(); |
| 68 |
|
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* Initialize the table tcpConnectionTable |
| 73 |
* (Define its contents and how it's structured) |
| 74 |
*/ |
| 75 |
void |
| 76 |
initialize_table_tcpConnectionTable(void) |
| 77 |
{ |
| 78 |
tcpConnectionTable_registration *user_context; |
| 79 |
u_long flags; |
| 80 |
|
| 81 |
DEBUGMSGTL(("verbose:tcpConnectionTable:initialize_table_tcpConnectionTable", "called\n")); |
| 82 |
|
| 83 |
/* |
| 84 |
* TODO:301:o: Perform tcpConnectionTable one-time table initialization. |
| 85 |
*/ |
| 86 |
|
| 87 |
/* |
| 88 |
* TODO:302:o: |->Initialize tcpConnectionTable 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 |
user_context = &tcpConnectionTable_user_context; |
| 93 |
|
| 94 |
/* |
| 95 |
* No support for any flags yet, but in the future you would |
| 96 |
* set any flags here. |
| 97 |
*/ |
| 98 |
flags = 0; |
| 99 |
|
| 100 |
/* |
| 101 |
* call interface initialization code |
| 102 |
*/ |
| 103 |
_tcpConnectionTable_initialize_interface(user_context, flags); |
| 104 |
} /* initialize_table_tcpConnectionTable */ |
| 105 |
|
| 106 |
/** |
| 107 |
* Shutdown the table tcpConnectionTable |
| 108 |
*/ |
| 109 |
void |
| 110 |
shutdown_table_tcpConnectionTable(void) |
| 111 |
{ |
| 112 |
/* |
| 113 |
* call interface shutdown code |
| 114 |
*/ |
| 115 |
_tcpConnectionTable_shutdown_interface |
| 116 |
(&tcpConnectionTable_user_context); |
| 117 |
} |
| 118 |
|
| 119 |
/** |
| 120 |
* extra context initialization (eg default values) |
| 121 |
* |
| 122 |
* @param rowreq_ctx : row request context |
| 123 |
* @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate) |
| 124 |
* |
| 125 |
* @retval MFD_SUCCESS : no errors |
| 126 |
* @retval MFD_ERROR : error (context allocate will fail) |
| 127 |
*/ |
| 128 |
int |
| 129 |
tcpConnectionTable_rowreq_ctx_init(tcpConnectionTable_rowreq_ctx * |
| 130 |
rowreq_ctx, void *user_init_ctx) |
| 131 |
{ |
| 132 |
DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_rowreq_ctx_init", "called\n")); |
| 133 |
|
| 134 |
netsnmp_assert(NULL != rowreq_ctx); |
| 135 |
|
| 136 |
/* |
| 137 |
* TODO:210:o: |-> Perform extra tcpConnectionTable rowreq initialization. (eg DEFVALS) |
| 138 |
*/ |
| 139 |
|
| 140 |
return MFD_SUCCESS; |
| 141 |
} /* tcpConnectionTable_rowreq_ctx_init */ |
| 142 |
|
| 143 |
/** |
| 144 |
* extra context cleanup |
| 145 |
* |
| 146 |
*/ |
| 147 |
void |
| 148 |
tcpConnectionTable_rowreq_ctx_cleanup(tcpConnectionTable_rowreq_ctx * |
| 149 |
rowreq_ctx) |
| 150 |
{ |
| 151 |
DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_rowreq_ctx_cleanup", "called\n")); |
| 152 |
|
| 153 |
netsnmp_assert(NULL != rowreq_ctx); |
| 154 |
|
| 155 |
/* |
| 156 |
* TODO:211:o: |-> Perform extra tcpConnectionTable rowreq cleanup. |
| 157 |
*/ |
| 158 |
netsnmp_access_tcpconn_entry_free(rowreq_ctx->data); |
| 159 |
rowreq_ctx->data = NULL; |
| 160 |
} /* tcpConnectionTable_rowreq_ctx_cleanup */ |
| 161 |
|
| 162 |
/** |
| 163 |
* pre-request callback |
| 164 |
* |
| 165 |
* @param user_context |
| 166 |
* @retval MFD_SUCCESS : success. |
| 167 |
* @retval MFD_ERROR : other error |
| 168 |
*/ |
| 169 |
int |
| 170 |
tcpConnectionTable_pre_request(tcpConnectionTable_registration * |
| 171 |
user_context) |
| 172 |
{ |
| 173 |
DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_pre_request", "called\n")); |
| 174 |
|
| 175 |
/* |
| 176 |
* TODO:510:o: Perform tcpConnectionTable pre-request actions. |
| 177 |
*/ |
| 178 |
|
| 179 |
return MFD_SUCCESS; |
| 180 |
} /* tcpConnectionTable_pre_request */ |
| 181 |
|
| 182 |
/** |
| 183 |
* post-request callback |
| 184 |
* |
| 185 |
* Note: |
| 186 |
* New rows have been inserted into the container, and |
| 187 |
* deleted rows have been removed from the container and |
| 188 |
* released. |
| 189 |
* @param user_context |
| 190 |
* @param rc : MFD_SUCCESS if all requests succeeded |
| 191 |
* |
| 192 |
* @retval MFD_SUCCESS : success. |
| 193 |
* @retval MFD_ERROR : other error (ignored) |
| 194 |
*/ |
| 195 |
int |
| 196 |
tcpConnectionTable_post_request(tcpConnectionTable_registration * |
| 197 |
user_context, int rc) |
| 198 |
{ |
| 199 |
DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_post_request", "called\n")); |
| 200 |
|
| 201 |
/* |
| 202 |
* TODO:511:o: Perform tcpConnectionTable post-request actions. |
| 203 |
*/ |
| 204 |
|
| 205 |
/* |
| 206 |
* check to set if any rows were changed. |
| 207 |
*/ |
| 208 |
if (tcpConnectionTable_dirty_get()) { |
| 209 |
/* |
| 210 |
* check if request was successful. If so, this would be |
| 211 |
* a good place to save data to its persistent store. |
| 212 |
*/ |
| 213 |
if (MFD_SUCCESS == rc) { |
| 214 |
/* |
| 215 |
* save changed rows, if you haven't already |
| 216 |
*/ |
| 217 |
} |
| 218 |
|
| 219 |
tcpConnectionTable_dirty_set(0); /* clear table dirty flag */ |
| 220 |
} |
| 221 |
|
| 222 |
return MFD_SUCCESS; |
| 223 |
} /* tcpConnectionTable_post_request */ |
| 224 |
|
| 225 |
|
| 226 |
/********************************************************************** |
| 227 |
********************************************************************** |
| 228 |
*** |
| 229 |
*** Table tcpConnectionTable |
| 230 |
*** |
| 231 |
********************************************************************** |
| 232 |
**********************************************************************/ |
| 233 |
/* |
| 234 |
* TCP-MIB::tcpConnectionTable is subid 19 of tcp. |
| 235 |
* Its status is Current. |
| 236 |
* OID: .1.3.6.1.2.1.6.19, length: 8 |
| 237 |
*/ |
| 238 |
|
| 239 |
/* |
| 240 |
* --------------------------------------------------------------------- |
| 241 |
* * TODO:200:r: Implement tcpConnectionTable data context functions. |
| 242 |
*/ |
| 243 |
/* |
| 244 |
* tcpConnectionTable_allocate_data |
| 245 |
* |
| 246 |
* Purpose: create new tcpConnectionTable_data. |
| 247 |
*/ |
| 248 |
tcpConnectionTable_data * |
| 249 |
tcpConnectionTable_allocate_data(void) |
| 250 |
{ |
| 251 |
/* |
| 252 |
* TODO:201:r: |-> allocate memory for the tcpConnectionTable data context. |
| 253 |
*/ |
| 254 |
tcpConnectionTable_data *rtn = |
| 255 |
SNMP_MALLOC_TYPEDEF(tcpConnectionTable_data); |
| 256 |
|
| 257 |
DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_allocate_data", "called\n")); |
| 258 |
|
| 259 |
if (NULL == rtn) { |
| 260 |
snmp_log(LOG_ERR, "unable to malloc memory for new " |
| 261 |
"tcpConnectionTable_data.\n"); |
| 262 |
} |
| 263 |
|
| 264 |
return rtn; |
| 265 |
} /* tcpConnectionTable_allocate_data */ |
| 266 |
|
| 267 |
/* |
| 268 |
* tcpConnectionTable_release_data |
| 269 |
* |
| 270 |
* Purpose: release tcpConnectionTable data. |
| 271 |
*/ |
| 272 |
void |
| 273 |
tcpConnectionTable_release_data(tcpConnectionTable_data * data) |
| 274 |
{ |
| 275 |
DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_release_data", "called\n")); |
| 276 |
|
| 277 |
/* |
| 278 |
* TODO:202:r: |-> release memory for the tcpConnectionTable data context. |
| 279 |
*/ |
| 280 |
free(data); |
| 281 |
} /* tcpConnectionTable_release_data */ |
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
/** |
| 286 |
* set mib index(es) |
| 287 |
* |
| 288 |
* @param tbl_idx mib index structure |
| 289 |
* @param tcpConnectionLocalAddressType_val |
| 290 |
* @param tcpConnectionLocalAddress_val_ptr |
| 291 |
* @param tcpConnectionLocalAddress_val_ptr_len |
| 292 |
* @param tcpConnectionLocalPort_val |
| 293 |
* @param tcpConnectionRemAddressType_val |
| 294 |
* @param tcpConnectionRemAddress_val_ptr |
| 295 |
* @param tcpConnectionRemAddress_val_ptr_len |
| 296 |
* @param tcpConnectionRemPort_val |
| 297 |
* |
| 298 |
* @retval MFD_SUCCESS : success. |
| 299 |
* @retval MFD_ERROR : other error. |
| 300 |
* |
| 301 |
* @remark |
| 302 |
* This convenience function is useful for setting all the MIB index |
| 303 |
* components with a single function call. It is assume that the C values |
| 304 |
* have already been mapped from their native/rawformat to the MIB format. |
| 305 |
*/ |
| 306 |
int |
| 307 |
tcpConnectionTable_indexes_set_tbl_idx(tcpConnectionTable_mib_index * |
| 308 |
tbl_idx, |
| 309 |
u_long |
| 310 |
tcpConnectionLocalAddressType_val, |
| 311 |
const void |
| 312 |
*tcpConnectionLocalAddress_val_ptr, |
| 313 |
size_t |
| 314 |
tcpConnectionLocalAddress_val_ptr_len, |
| 315 |
u_long tcpConnectionLocalPort_val, |
| 316 |
u_long |
| 317 |
tcpConnectionRemAddressType_val, |
| 318 |
const void |
| 319 |
*tcpConnectionRemAddress_val_ptr, |
| 320 |
size_t |
| 321 |
tcpConnectionRemAddress_val_ptr_len, |
| 322 |
u_long tcpConnectionRemPort_val) |
| 323 |
{ |
| 324 |
DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_indexes_set_tbl_idx", "called\n")); |
| 325 |
|
| 326 |
/* |
| 327 |
* tcpConnectionLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h |
| 328 |
*/ |
| 329 |
/** WARNING: this code might not work for netsnmp_tcpconn_entry */ |
| 330 |
/** are cross protocol connections allowed? */ |
| 331 |
netsnmp_assert(tbl_idx->tcpConnectionRemAddressType == |
| 332 |
tbl_idx->tcpConnectionLocalAddressType); |
| 333 |
if (4 == tcpConnectionLocalAddressType_val) |
| 334 |
tbl_idx->tcpConnectionLocalAddressType = INETADDRESSTYPE_IPV4; |
| 335 |
else if (16 == tcpConnectionLocalAddressType_val) |
| 336 |
tbl_idx->tcpConnectionLocalAddressType = INETADDRESSTYPE_IPV6; |
| 337 |
else |
| 338 |
tbl_idx->tcpConnectionLocalAddressType = INETADDRESSTYPE_UNKNOWN; |
| 339 |
|
| 340 |
/* |
| 341 |
* tcpConnectionLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h |
| 342 |
*/ |
| 343 |
tbl_idx->tcpConnectionLocalAddress_len = sizeof(tbl_idx->tcpConnectionLocalAddress) / sizeof(tbl_idx->tcpConnectionLocalAddress[0]); /* max length */ |
| 344 |
/** WARNING: this code might not work for netsnmp_tcpconn_entry */ |
| 345 |
/* |
| 346 |
* make sure there is enough space for tcpConnectionLocalAddress data |
| 347 |
*/ |
| 348 |
if (tbl_idx->tcpConnectionLocalAddress_len < |
| 349 |
tcpConnectionLocalAddress_val_ptr_len) { |
| 350 |
snmp_log(LOG_ERR, "not enough space for value\n"); |
| 351 |
return MFD_ERROR; |
| 352 |
} |
| 353 |
tbl_idx->tcpConnectionLocalAddress_len = |
| 354 |
tcpConnectionLocalAddress_val_ptr_len; |
| 355 |
memcpy(tbl_idx->tcpConnectionLocalAddress, |
| 356 |
tcpConnectionLocalAddress_val_ptr, |
| 357 |
tcpConnectionLocalAddress_val_ptr_len); |
| 358 |
|
| 359 |
/* |
| 360 |
* tcpConnectionLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H |
| 361 |
*/ |
| 362 |
/** WARNING: this code might not work for netsnmp_tcpconn_entry */ |
| 363 |
tbl_idx->tcpConnectionLocalPort = tcpConnectionLocalPort_val; |
| 364 |
|
| 365 |
/* |
| 366 |
* tcpConnectionRemAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h |
| 367 |
*/ |
| 368 |
/** WARNING: this code might not work for netsnmp_tcpconn_entry */ |
| 369 |
tbl_idx->tcpConnectionRemAddressType = |
| 370 |
tbl_idx->tcpConnectionLocalAddressType; |
| 371 |
|
| 372 |
/* |
| 373 |
* tcpConnectionRemAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h |
| 374 |
*/ |
| 375 |
tbl_idx->tcpConnectionRemAddress_len = sizeof(tbl_idx->tcpConnectionRemAddress) / sizeof(tbl_idx->tcpConnectionRemAddress[0]); /* max length */ |
| 376 |
/** WARNING: this code might not work for netsnmp_tcpconn_entry */ |
| 377 |
/* |
| 378 |
* make sure there is enough space for tcpConnectionRemAddress data |
| 379 |
*/ |
| 380 |
if (tbl_idx->tcpConnectionRemAddress_len < |
| 381 |
tcpConnectionRemAddress_val_ptr_len) { |
| 382 |
snmp_log(LOG_ERR, "not enough space for value\n"); |
| 383 |
return MFD_ERROR; |
| 384 |
} |
| 385 |
tbl_idx->tcpConnectionRemAddress_len = |
| 386 |
tcpConnectionRemAddress_val_ptr_len; |
| 387 |
memcpy(tbl_idx->tcpConnectionRemAddress, |
| 388 |
tcpConnectionRemAddress_val_ptr, |
| 389 |
tcpConnectionRemAddress_val_ptr_len); |
| 390 |
|
| 391 |
/* |
| 392 |
* tcpConnectionRemPort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H |
| 393 |
*/ |
| 394 |
/** WARNING: this code might not work for netsnmp_tcpconn_entry */ |
| 395 |
tbl_idx->tcpConnectionRemPort = tcpConnectionRemPort_val; |
| 396 |
|
| 397 |
|
| 398 |
return MFD_SUCCESS; |
| 399 |
} /* tcpConnectionTable_indexes_set_tbl_idx */ |
| 400 |
|
| 401 |
/** |
| 402 |
* @internal |
| 403 |
* set row context indexes |
| 404 |
* |
| 405 |
* @param rowreq_ctx the row context that needs updated indexes |
| 406 |
* |
| 407 |
* @retval MFD_SUCCESS : success. |
| 408 |
* @retval MFD_ERROR : other error. |
| 409 |
* |
| 410 |
* @remark |
| 411 |
* This function sets the mib indexs, then updates the oid indexs |
| 412 |
* from the mib index. |
| 413 |
*/ |
| 414 |
int |
| 415 |
tcpConnectionTable_indexes_set(tcpConnectionTable_rowreq_ctx * rowreq_ctx, |
| 416 |
u_long tcpConnectionLocalAddressType_val, |
| 417 |
const void *tcpConnectionLocalAddress_val_ptr, |
| 418 |
size_t |
| 419 |
tcpConnectionLocalAddress_val_ptr_len, |
| 420 |
u_long tcpConnectionLocalPort_val, |
| 421 |
u_long tcpConnectionRemAddressType_val, |
| 422 |
const void *tcpConnectionRemAddress_val_ptr, |
| 423 |
size_t tcpConnectionRemAddress_val_ptr_len, |
| 424 |
u_long tcpConnectionRemPort_val) |
| 425 |
{ |
| 426 |
DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_indexes_set", "called\n")); |
| 427 |
|
| 428 |
if (MFD_SUCCESS != |
| 429 |
tcpConnectionTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx, |
| 430 |
tcpConnectionLocalAddressType_val, |
| 431 |
tcpConnectionLocalAddress_val_ptr, |
| 432 |
tcpConnectionLocalAddress_val_ptr_len, |
| 433 |
tcpConnectionLocalPort_val, |
| 434 |
tcpConnectionRemAddressType_val, |
| 435 |
tcpConnectionRemAddress_val_ptr, |
| 436 |
tcpConnectionRemAddress_val_ptr_len, |
| 437 |
tcpConnectionRemPort_val)) |
| 438 |
return MFD_ERROR; |
| 439 |
|
| 440 |
/* |
| 441 |
* convert mib index to oid index |
| 442 |
*/ |
| 443 |
rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid); |
| 444 |
if (0 != tcpConnectionTable_index_to_oid(&rowreq_ctx->oid_idx, |
| 445 |
&rowreq_ctx->tbl_idx)) { |
| 446 |
return MFD_ERROR; |
| 447 |
} |
| 448 |
|
| 449 |
return MFD_SUCCESS; |
| 450 |
} /* tcpConnectionTable_indexes_set */ |
| 451 |
|
| 452 |
|
| 453 |
/*--------------------------------------------------------------------- |
| 454 |
* TCP-MIB::tcpConnectionEntry.tcpConnectionState |
| 455 |
* tcpConnectionState is subid 7 of tcpConnectionEntry. |
| 456 |
* Its status is Current, and its access level is ReadWrite. |
| 457 |
* OID: .1.3.6.1.2.1.6.19.1.7 |
| 458 |
* Description: |
| 459 |
The state of this TCP connection. |
| 460 |
|
| 461 |
The value listen(2) is included only for parallelism to the |
| 462 |
old tcpConnTable, and should not be used. A connection in |
| 463 |
LISTEN state should be present in the tcpListenerTable. |
| 464 |
|
| 465 |
The only value which may be set by a management station is |
| 466 |
deleteTCB(12). Accordingly, it is appropriate for an agent |
| 467 |
to return a `badValue' response if a management station |
| 468 |
attempts to set this object to any other value. |
| 469 |
|
| 470 |
If a management station sets this object to the value |
| 471 |
deleteTCB(12), then this has the effect of deleting the TCB |
| 472 |
(as defined in RFC 793) of the corresponding connection on |
| 473 |
the managed node, resulting in immediate termination of the |
| 474 |
connection. |
| 475 |
|
| 476 |
As an implementation-specific option, a RST segment may be |
| 477 |
sent from the managed node to the other TCP endpoint (note |
| 478 |
however that RST segments are not sent reliably). |
| 479 |
* |
| 480 |
* Attributes: |
| 481 |
* accessible 1 isscalar 0 enums 1 hasdefval 0 |
| 482 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 483 |
* settable 1 |
| 484 |
* |
| 485 |
* Enum range: 9/16. Values: closed(1), listen(2), synSent(3), synReceived(4), established(5), finWait1(6), finWait2(7), closeWait(8), lastAck(9), closing(10), timeWait(11), deleteTCB(12) |
| 486 |
* |
| 487 |
* Its syntax is INTEGER (based on perltype INTEGER) |
| 488 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 489 |
*/ |
| 490 |
/** |
| 491 |
* Extract the current value of the tcpConnectionState data. |
| 492 |
* |
| 493 |
* Set a value using the data context for the row. |
| 494 |
* |
| 495 |
* @param rowreq_ctx |
| 496 |
* Pointer to the row request context. |
| 497 |
* @param tcpConnectionState_val_ptr |
| 498 |
* Pointer to storage for a long variable |
| 499 |
* |
| 500 |
* @retval MFD_SUCCESS : success |
| 501 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 502 |
* @retval MFD_ERROR : Any other error |
| 503 |
*/ |
| 504 |
int |
| 505 |
tcpConnectionState_get(tcpConnectionTable_rowreq_ctx * rowreq_ctx, |
| 506 |
u_long * tcpConnectionState_val_ptr) |
| 507 |
{ |
| 508 |
/** we should have a non-NULL pointer */ |
| 509 |
netsnmp_assert(NULL != tcpConnectionState_val_ptr); |
| 510 |
|
| 511 |
|
| 512 |
DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionState_get", |
| 513 |
"called\n")); |
| 514 |
|
| 515 |
netsnmp_assert(NULL != rowreq_ctx); |
| 516 |
|
| 517 |
/* |
| 518 |
* TODO:231:o: |-> Extract the current value of the tcpConnectionState data. |
| 519 |
* copy (* tcpConnectionState_val_ptr ) from rowreq_ctx->data |
| 520 |
*/ |
| 521 |
(*tcpConnectionState_val_ptr) = rowreq_ctx->data->tcpConnState; |
| 522 |
|
| 523 |
return MFD_SUCCESS; |
| 524 |
} /* tcpConnectionState_get */ |
| 525 |
|
| 526 |
/*--------------------------------------------------------------------- |
| 527 |
* TCP-MIB::tcpConnectionEntry.tcpConnectionProcess |
| 528 |
* tcpConnectionProcess is subid 8 of tcpConnectionEntry. |
| 529 |
* Its status is Current, and its access level is ReadOnly. |
| 530 |
* OID: .1.3.6.1.2.1.6.19.1.8 |
| 531 |
* Description: |
| 532 |
The system's process ID for the process associated with |
| 533 |
this connection, or zero if there is no such process. This |
| 534 |
value is expected to be the same as HOST-RESOURCES-MIB:: |
| 535 |
hrSWRunIndex or SYSAPPL-MIB::sysApplElmtRunIndex for some |
| 536 |
row in the appropriate tables. |
| 537 |
* |
| 538 |
* Attributes: |
| 539 |
* accessible 1 isscalar 0 enums 0 hasdefval 0 |
| 540 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 541 |
* settable 0 |
| 542 |
* |
| 543 |
* |
| 544 |
* Its syntax is UNSIGNED32 (based on perltype UNSIGNED32) |
| 545 |
* The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) |
| 546 |
*/ |
| 547 |
/** |
| 548 |
* Extract the current value of the tcpConnectionProcess data. |
| 549 |
* |
| 550 |
* Set a value using the data context for the row. |
| 551 |
* |
| 552 |
* @param rowreq_ctx |
| 553 |
* Pointer to the row request context. |
| 554 |
* @param tcpConnectionProcess_val_ptr |
| 555 |
* Pointer to storage for a u_long variable |
| 556 |
* |
| 557 |
* @retval MFD_SUCCESS : success |
| 558 |
* @retval MFD_SKIP : skip this node (no value for now) |
| 559 |
* @retval MFD_ERROR : Any other error |
| 560 |
*/ |
| 561 |
int |
| 562 |
tcpConnectionProcess_get(tcpConnectionTable_rowreq_ctx * rowreq_ctx, |
| 563 |
u_long * tcpConnectionProcess_val_ptr) |
| 564 |
{ |
| 565 |
/** we should have a non-NULL pointer */ |
| 566 |
netsnmp_assert(NULL != tcpConnectionProcess_val_ptr); |
| 567 |
|
| 568 |
|
| 569 |
DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionProcess_get", |
| 570 |
"called\n")); |
| 571 |
|
| 572 |
netsnmp_assert(NULL != rowreq_ctx); |
| 573 |
|
| 574 |
/* |
| 575 |
* TODO:231:o: |-> Extract the current value of the tcpConnectionProcess data. |
| 576 |
* copy (* tcpConnectionProcess_val_ptr ) from rowreq_ctx->data |
| 577 |
*/ |
| 578 |
(*tcpConnectionProcess_val_ptr) = rowreq_ctx->data->pid; |
| 579 |
|
| 580 |
return MFD_SUCCESS; |
| 581 |
} /* tcpConnectionProcess_get */ |
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
/** @} */ |
| 586 |
/********************************************************************** |
| 587 |
********************************************************************** |
| 588 |
*** |
| 589 |
*** Table tcpConnectionTable |
| 590 |
*** |
| 591 |
********************************************************************** |
| 592 |
**********************************************************************/ |
| 593 |
/* |
| 594 |
* TCP-MIB::tcpConnectionTable is subid 19 of tcp. |
| 595 |
* Its status is Current. |
| 596 |
* OID: .1.3.6.1.2.1.6.19, length: 8 |
| 597 |
*/ |
| 598 |
/* |
| 599 |
* NOTE: if you update this chart, please update the versions in |
| 600 |
* local/mib2c-conf.d/parent-set.m2i |
| 601 |
* agent/mibgroup/helpers/baby_steps.c |
| 602 |
* while you're at it. |
| 603 |
*/ |
| 604 |
/* |
| 605 |
*********************************************************************** |
| 606 |
* Baby Steps Flow Chart (2004.06.05) * |
| 607 |
* * |
| 608 |
* +--------------+ +================+ U = unconditional path * |
| 609 |
* |optional state| ||required state|| S = path for success * |
| 610 |
* +--------------+ +================+ E = path for error * |
| 611 |
*********************************************************************** |
| 612 |
* |
| 613 |
* +--------------+ |
| 614 |
* | pre | |
| 615 |
* | request | |
| 616 |
* +--------------+ |
| 617 |
* | U |
| 618 |
* +==============+ |
| 619 |
* +----------------|| object || |
| 620 |
* | E || lookup || |
| 621 |
* | +==============+ |
| 622 |
* | | S |
| 623 |
* | +==============+ |
| 624 |
* | E || check || |
| 625 |
* |<---------------|| values || |
| 626 |
* | +==============+ |
| 627 |
* | | S |
| 628 |
* | +==============+ |
| 629 |
* | +<-------|| undo || |
| 630 |
* | | E || setup || |
| 631 |
* | | +==============+ |
| 632 |
* | | | S |
| 633 |
* | | +==============+ |
| 634 |
* | | || set ||-------------------------->+ |
| 635 |
* | | || value || E | |
| 636 |
* | | +==============+ | |
| 637 |
* | | | S | |
| 638 |
* | | +--------------+ | |
| 639 |
* | | | check |-------------------------->| |
| 640 |
* | | | consistency | E | |
| 641 |
* | | +--------------+ | |
| 642 |
* | | | S | |
| 643 |
* | | +==============+ +==============+ | |
| 644 |
* | | || commit ||-------->|| undo || | |
| 645 |
* | | || || E || commit || | |
| 646 |
* | | +==============+ +==============+ | |
| 647 |
* | | | S U |<--------+ |
| 648 |
* | | +--------------+ +==============+ |
| 649 |
* | | | irreversible | || undo || |
| 650 |
* | | | commit | || set || |
| 651 |
* | | +--------------+ +==============+ |
| 652 |
* | | | U U | |
| 653 |
* | +-------------->|<------------------------+ |
| 654 |
* | +==============+ |
| 655 |
* | || undo || |
| 656 |
* | || cleanup || |
| 657 |
* | +==============+ |
| 658 |
* +---------------------->| U |
| 659 |
* +--------------+ |
| 660 |
* | post | |
| 661 |
* | request | |
| 662 |
* +--------------+ |
| 663 |
* |
| 664 |
*/ |
| 665 |
|
| 666 |
/** |
| 667 |
* Setup up context with information needed to undo a set request. |
| 668 |
* |
| 669 |
* This function will be called before the individual node undo setup |
| 670 |
* functions are called. If you need to do any undo setup that is not |
| 671 |
* related to a specific column, you can do it here. |
| 672 |
* |
| 673 |
* Note that the undo context has been allocated with |
| 674 |
* tcpConnectionTable_allocate_data(), but may need extra |
| 675 |
* initialization similar to what you may have done in |
| 676 |
* tcpConnectionTable_rowreq_ctx_init(). |
| 677 |
* Note that an individual node's undo_setup function will only be called |
| 678 |
* if that node is being set to a new value. |
| 679 |
* |
| 680 |
* If there is any setup specific to a particular column (e.g. allocating |
| 681 |
* memory for a string), you should do that setup in the node's undo_setup |
| 682 |
* function, so it won't be done unless it is necessary. |
| 683 |
* |
| 684 |
* @param rowreq_ctx |
| 685 |
* Pointer to the table context (tcpConnectionTable_rowreq_ctx) |
| 686 |
* |
| 687 |
* @retval MFD_SUCCESS : success |
| 688 |
* @retval MFD_ERROR : error. set will fail. |
| 689 |
*/ |
| 690 |
int |
| 691 |
tcpConnectionTable_undo_setup(tcpConnectionTable_rowreq_ctx * rowreq_ctx) |
| 692 |
{ |
| 693 |
int rc = MFD_SUCCESS; |
| 694 |
|
| 695 |
DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_undo_setup", |
| 696 |
"called\n")); |
| 697 |
|
| 698 |
/** we should have a non-NULL pointer */ |
| 699 |
netsnmp_assert(NULL != rowreq_ctx); |
| 700 |
|
| 701 |
/* |
| 702 |
* TODO:451:M: |-> Setup tcpConnectionTable undo. |
| 703 |
* set up tcpConnectionTable undo information, in preparation for a set. |
| 704 |
* Undo storage is in (* tcpConnectionProcess_val_ptr )* |
| 705 |
*/ |
| 706 |
|
| 707 |
return rc; |
| 708 |
} /* tcpConnectionTable_undo_setup */ |
| 709 |
|
| 710 |
/** |
| 711 |
* Undo a set request. |
| 712 |
* |
| 713 |
* This function will be called before the individual node undo |
| 714 |
* functions are called. If you need to do any undo that is not |
| 715 |
* related to a specific column, you can do it here. |
| 716 |
* |
| 717 |
* Note that an individual node's undo function will only be called |
| 718 |
* if that node is being set to a new value. |
| 719 |
* |
| 720 |
* If there is anything specific to a particular column (e.g. releasing |
| 721 |
* memory for a string), you should do that setup in the node's undo |
| 722 |
* function, so it won't be done unless it is necessary. |
| 723 |
* |
| 724 |
* @param rowreq_ctx |
| 725 |
* Pointer to the table context (tcpConnectionTable_rowreq_ctx) |
| 726 |
* |
| 727 |
* @retval MFD_SUCCESS : success |
| 728 |
* @retval MFD_ERROR : error. set will fail. |
| 729 |
*/ |
| 730 |
int |
| 731 |
tcpConnectionTable_undo(tcpConnectionTable_rowreq_ctx * rowreq_ctx) |
| 732 |
{ |
| 733 |
int rc = MFD_SUCCESS; |
| 734 |
|
| 735 |
DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_undo", |
| 736 |
"called\n")); |
| 737 |
|
| 738 |
/** we should have a non-NULL pointer */ |
| 739 |
netsnmp_assert(NULL != rowreq_ctx); |
| 740 |
|
| 741 |
/* |
| 742 |
* TODO:451:M: |-> tcpConnectionTable undo. |
| 743 |
* tcpConnectionTable undo information, in response to a failed set. |
| 744 |
* Undo storage is in (* tcpConnectionProcess_val_ptr )* |
| 745 |
*/ |
| 746 |
|
| 747 |
return rc; |
| 748 |
} /* tcpConnectionTable_undo_setup */ |
| 749 |
|
| 750 |
/** |
| 751 |
* Cleanup up context undo information. |
| 752 |
* |
| 753 |
* This function will be called after set/commit processing. If you |
| 754 |
* allocated any resources in undo_setup, this is the place to release |
| 755 |
* those resources. |
| 756 |
* |
| 757 |
* This function is called regardless of the success or failure of the set |
| 758 |
* request. If you need to perform different steps for cleanup depending |
| 759 |
* on success or failure, you can add a flag to the rowreq_ctx. |
| 760 |
* |
| 761 |
* @param rowreq_ctx |
| 762 |
* Pointer to the table context (tcpConnectionTable_rowreq_ctx) |
| 763 |
* |
| 764 |
* @retval MFD_SUCCESS : success |
| 765 |
* @retval MFD_ERROR : error |
| 766 |
*/ |
| 767 |
int |
| 768 |
tcpConnectionTable_undo_cleanup(tcpConnectionTable_rowreq_ctx * rowreq_ctx) |
| 769 |
{ |
| 770 |
int rc = MFD_SUCCESS; |
| 771 |
|
| 772 |
DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_undo_cleanup", "called\n")); |
| 773 |
|
| 774 |
/** we should have a non-NULL pointer */ |
| 775 |
netsnmp_assert(NULL != rowreq_ctx); |
| 776 |
|
| 777 |
/* |
| 778 |
* TODO:452:M: |-> Cleanup tcpConnectionTable undo. |
| 779 |
* Undo storage is in (* tcpConnectionProcess_val_ptr )* |
| 780 |
*/ |
| 781 |
|
| 782 |
return rc; |
| 783 |
} /* tcpConnectionTable_undo_cleanup */ |
| 784 |
|
| 785 |
/** |
| 786 |
* commit new values. |
| 787 |
* |
| 788 |
* At this point, you should have done everything you can to ensure that |
| 789 |
* this commit will not fail. |
| 790 |
* |
| 791 |
* Should you need different behavior depending on which columns were |
| 792 |
* set, rowreq_ctx->column_set_flags will indicate which writeable columns were |
| 793 |
* set. The definitions for the COLUMN_*_FLAG bits can be found in |
| 794 |
* tcpConnectionTable.h. |
| 795 |
* A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. |
| 796 |
* |
| 797 |
* @param rowreq_ctx |
| 798 |
* Pointer to the users context. |
| 799 |
* |
| 800 |
* @retval MFD_SUCCESS : success |
| 801 |
* @retval MFD_ERROR : error |
| 802 |
*/ |
| 803 |
int |
| 804 |
tcpConnectionTable_commit(tcpConnectionTable_rowreq_ctx * rowreq_ctx) |
| 805 |
{ |
| 806 |
int rc = MFD_SUCCESS; |
| 807 |
int save_flags; |
| 808 |
|
| 809 |
DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_commit", |
| 810 |
"called\n")); |
| 811 |
|
| 812 |
/** we should have a non-NULL pointer */ |
| 813 |
netsnmp_assert(NULL != rowreq_ctx); |
| 814 |
|
| 815 |
/* |
| 816 |
* save flags, then clear until we actually do something |
| 817 |
*/ |
| 818 |
save_flags = rowreq_ctx->column_set_flags; |
| 819 |
rowreq_ctx->column_set_flags = 0; |
| 820 |
|
| 821 |
/* |
| 822 |
* commit tcpConnectionTable data |
| 823 |
* 1) check the column's flag in save_flags to see if it was set. |
| 824 |
* 2) clear the flag when you handle that column |
| 825 |
* 3) set the column's flag in column_set_flags if it needs undo |
| 826 |
* processing in case of a failure. |
| 827 |
*/ |
| 828 |
if (save_flags & COLUMN_TCPCONNECTIONSTATE_FLAG) { |
| 829 |
save_flags &= ~COLUMN_TCPCONNECTIONSTATE_FLAG; /* clear tcpConnectionState */ |
| 830 |
/* |
| 831 |
* TODO:482:o: |-> commit column tcpConnectionState. |
| 832 |
*/ |
| 833 |
rc = -1; |
| 834 |
if (-1 == rc) { |
| 835 |
snmp_log(LOG_ERR, |
| 836 |
"tcpConnectionTable column tcpConnectionState commit failed\n"); |
| 837 |
} else { |
| 838 |
/* |
| 839 |
* set flag, in case we need to undo tcpConnectionState |
| 840 |
*/ |
| 841 |
rowreq_ctx->column_set_flags |= COLUMN_TCPCONNECTIONSTATE_FLAG; |
| 842 |
} |
| 843 |
} |
| 844 |
|
| 845 |
/* |
| 846 |
* if we successfully committed this row, set the dirty flag. |
| 847 |
*/ |
| 848 |
if (MFD_SUCCESS == rc) { |
| 849 |
rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY; |
| 850 |
} |
| 851 |
|
| 852 |
if (save_flags) { |
| 853 |
snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n", |
| 854 |
save_flags); |
| 855 |
return MFD_ERROR; |
| 856 |
} |
| 857 |
|
| 858 |
return rc; |
| 859 |
} /* tcpConnectionTable_commit */ |
| 860 |
|
| 861 |
/** |
| 862 |
* undo commit new values. |
| 863 |
* |
| 864 |
* Should you need different behavior depending on which columns were |
| 865 |
* set, rowreq_ctx->column_set_flags will indicate which writeable columns were |
| 866 |
* set. The definitions for the COLUMN_*_FLAG bits can be found in |
| 867 |
* tcpConnectionTable.h. |
| 868 |
* A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. |
| 869 |
* |
| 870 |
* @param rowreq_ctx |
| 871 |
* Pointer to the users context. |
| 872 |
* |
| 873 |
* @retval MFD_SUCCESS : success |
| 874 |
* @retval MFD_ERROR : error |
| 875 |
*/ |
| 876 |
int |
| 877 |
tcpConnectionTable_undo_commit(tcpConnectionTable_rowreq_ctx * rowreq_ctx) |
| 878 |
{ |
| 879 |
int rc = MFD_SUCCESS; |
| 880 |
|
| 881 |
DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_undo_commit", "called\n")); |
| 882 |
|
| 883 |
/** we should have a non-NULL pointer */ |
| 884 |
netsnmp_assert(NULL != rowreq_ctx); |
| 885 |
|
| 886 |
/* |
| 887 |
* TODO:485:M: |-> Undo tcpConnectionTable commit. |
| 888 |
* check the column's flag in rowreq_ctx->column_set_flags to see |
| 889 |
* if it was set during commit, then undo it. |
| 890 |
* |
| 891 |
* eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {} |
| 892 |
*/ |
| 893 |
|
| 894 |
|
| 895 |
/* |
| 896 |
* if we successfully un-committed this row, clear the dirty flag. |
| 897 |
*/ |
| 898 |
if (MFD_SUCCESS == rc) { |
| 899 |
rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY; |
| 900 |
} |
| 901 |
|
| 902 |
return rc; |
| 903 |
} /* tcpConnectionTable_undo_commit */ |
| 904 |
|
| 905 |
/* |
| 906 |
* TODO:440:M: Implement tcpConnectionTable node value checks. |
| 907 |
* TODO:450:M: Implement tcpConnectionTable undo functions. |
| 908 |
* TODO:460:M: Implement tcpConnectionTable set functions. |
| 909 |
* TODO:480:M: Implement tcpConnectionTable commit functions. |
| 910 |
*/ |
| 911 |
/*--------------------------------------------------------------------- |
| 912 |
* TCP-MIB::tcpConnectionEntry.tcpConnectionState |
| 913 |
* tcpConnectionState is subid 7 of tcpConnectionEntry. |
| 914 |
* Its status is Current, and its access level is ReadWrite. |
| 915 |
* OID: .1.3.6.1.2.1.6.19.1.7 |
| 916 |
* Description: |
| 917 |
The state of this TCP connection. |
| 918 |
|
| 919 |
The value listen(2) is included only for parallelism to the |
| 920 |
old tcpConnTable, and should not be used. A connection in |
| 921 |
LISTEN state should be present in the tcpListenerTable. |
| 922 |
|
| 923 |
The only value which may be set by a management station is |
| 924 |
deleteTCB(12). Accordingly, it is appropriate for an agent |
| 925 |
to return a `badValue' response if a management station |
| 926 |
attempts to set this object to any other value. |
| 927 |
|
| 928 |
If a management station sets this object to the value |
| 929 |
deleteTCB(12), then this has the effect of deleting the TCB |
| 930 |
(as defined in RFC 793) of the corresponding connection on |
| 931 |
the managed node, resulting in immediate termination of the |
| 932 |
connection. |
| 933 |
|
| 934 |
As an implementation-specific option, a RST segment may be |
| 935 |
sent from the managed node to the other TCP endpoint (note |
| 936 |
however that RST segments are not sent reliably). |
| 937 |
* |
| 938 |
* Attributes: |
| 939 |
* accessible 1 isscalar 0 enums 1 hasdefval 0 |
| 940 |
* readable 1 iscolumn 1 ranges 0 hashint 0 |
| 941 |
* settable 1 |
| 942 |
* |
| 943 |
* Enum range: 9/16. Values: closed(1), listen(2), synSent(3), synReceived(4), established(5), finWait1(6), finWait2(7), closeWait(8), lastAck(9), closing(10), timeWait(11), deleteTCB(12) |
| 944 |
* |
| 945 |
* Its syntax is INTEGER (based on perltype INTEGER) |
| 946 |
* The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) |
| 947 |
*/ |
| 948 |
/** |
| 949 |
* Check that the proposed new value is potentially valid. |
| 950 |
* |
| 951 |
* @param rowreq_ctx |
| 952 |
* Pointer to the row request context. |
| 953 |
* @param tcpConnectionState_val |
| 954 |
* A long containing the new value. |
| 955 |
* |
| 956 |
* @retval MFD_SUCCESS : incoming value is legal |
| 957 |
* @retval MFD_NOT_VALID_NOW : incoming value is not valid now |
| 958 |
* @retval MFD_NOT_VALID_EVER : incoming value is never valid |
| 959 |
* |
| 960 |
* This is the place to check for requirements that are not |
| 961 |
* expressed in the mib syntax (for example, a requirement that |
| 962 |
* is detailed in the description for an object). |
| 963 |
* |
| 964 |
* You should check that the requested change between the undo value and the |
| 965 |
* new value is legal (ie, the transistion from one value to another |
| 966 |
* is legal). |
| 967 |
* |
| 968 |
*@note |
| 969 |
* This check is only to determine if the new value |
| 970 |
* is \b potentially valid. This is the first check of many, and |
| 971 |
* is one of the simplest ones. |
| 972 |
* |
| 973 |
*@note |
| 974 |
* this is not the place to do any checks for values |
| 975 |
* which depend on some other value in the mib. Those |
| 976 |
* types of checks should be done in the |
| 977 |
* tcpConnectionTable_check_dependencies() function. |
| 978 |
* |
| 979 |
* The following checks have already been done for you: |
| 980 |
* The syntax is ASN_INTEGER |
| 981 |
* The value is one of closed(1), listen(2), synSent(3), synReceived(4), established(5), finWait1(6), finWait2(7), closeWait(8), lastAck(9), closing(10), timeWait(11), deleteTCB(12) |
| 982 |
* |
| 983 |
* If there a no other checks you need to do, simply return MFD_SUCCESS. |
| 984 |
* |
| 985 |
*/ |
| 986 |
int |
| 987 |
tcpConnectionState_check_value(tcpConnectionTable_rowreq_ctx * rowreq_ctx, |
| 988 |
u_long tcpConnectionState_val) |
| 989 |
{ |
| 990 |
DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionState_check_value", "called\n")); |
| 991 |
|
| 992 |
/** should never get a NULL pointer */ |
| 993 |
netsnmp_assert(NULL != rowreq_ctx); |
| 994 |
|
| 995 |
/* |
| 996 |
* TODO:441:o: |-> Check for valid tcpConnectionState value. |
| 997 |
*/ |
| 998 |
|
| 999 |
return MFD_SUCCESS; /* tcpConnectionState value not illegal */ |
| 1000 |
} /* tcpConnectionState_check_value */ |
| 1001 |
|
| 1002 |
/** |
| 1003 |
* Save old value information |
| 1004 |
* |
| 1005 |
* @param rowreq_ctx |
| 1006 |
* Pointer to the table context (tcpConnectionTable_rowreq_ctx) |
| 1007 |
* |
| 1008 |
* @retval MFD_SUCCESS : success |
| 1009 |
* @retval MFD_ERROR : error. set will fail. |
| 1010 |
* |
| 1011 |
* This function will be called after the table level undo setup function |
| 1012 |
* tcpConnectionTable_undo_setup has been called. |
| 1013 |
* |
| 1014 |
*@note |
| 1015 |
* this function will only be called if a new value is set for this column. |
| 1016 |
* |
| 1017 |
* If there is any setup specific to a particular column (e.g. allocating |
| 1018 |
* memory for a string), you should do that setup in this function, so it |
| 1019 |
* won't be done unless it is necessary. |
| 1020 |
*/ |
| 1021 |
int |
| 1022 |
tcpConnectionState_undo_setup(tcpConnectionTable_rowreq_ctx * rowreq_ctx) |
| 1023 |
{ |
| 1024 |
DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionState_undo_setup", |
| 1025 |
"called\n")); |
| 1026 |
|
| 1027 |
/** should never get a NULL pointer */ |
| 1028 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1029 |
|
| 1030 |
/* |
| 1031 |
* TODO:455:o: |-> Setup tcpConnectionState undo. |
| 1032 |
*/ |
| 1033 |
/* |
| 1034 |
* copy tcpConnectionState data |
| 1035 |
* set rowreq_ctx->undo->tcpConnectionState from rowreq_ctx->data->tcpConnectionState |
| 1036 |
*/ |
| 1037 |
|
| 1038 |
|
| 1039 |
return MFD_SUCCESS; |
| 1040 |
} /* tcpConnectionState_undo_setup */ |
| 1041 |
|
| 1042 |
/** |
| 1043 |
* Set the new value. |
| 1044 |
* |
| 1045 |
* @param rowreq_ctx |
| 1046 |
* Pointer to the users context. You should know how to |
| 1047 |
* manipulate the value from this object. |
| 1048 |
* @param tcpConnectionState_val |
| 1049 |
* A long containing the new value. |
| 1050 |
*/ |
| 1051 |
int |
| 1052 |
tcpConnectionState_set(tcpConnectionTable_rowreq_ctx * rowreq_ctx, |
| 1053 |
u_long tcpConnectionState_val) |
| 1054 |
{ |
| 1055 |
|
| 1056 |
DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionState_set", |
| 1057 |
"called\n")); |
| 1058 |
|
| 1059 |
/** should never get a NULL pointer */ |
| 1060 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1061 |
|
| 1062 |
/* |
| 1063 |
* TODO:461:M: |-> Set tcpConnectionState value. |
| 1064 |
* set tcpConnectionState value in rowreq_ctx->data |
| 1065 |
*/ |
| 1066 |
|
| 1067 |
return MFD_SUCCESS; |
| 1068 |
} /* tcpConnectionState_set */ |
| 1069 |
|
| 1070 |
/** |
| 1071 |
* undo the previous set. |
| 1072 |
* |
| 1073 |
* @param rowreq_ctx |
| 1074 |
* Pointer to the users context. |
| 1075 |
*/ |
| 1076 |
int |
| 1077 |
tcpConnectionState_undo(tcpConnectionTable_rowreq_ctx * rowreq_ctx) |
| 1078 |
{ |
| 1079 |
|
| 1080 |
DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionState_undo", |
| 1081 |
"called\n")); |
| 1082 |
|
| 1083 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1084 |
|
| 1085 |
/* |
| 1086 |
* TODO:456:o: |-> Clean up tcpConnectionState undo. |
| 1087 |
*/ |
| 1088 |
/* |
| 1089 |
* copy tcpConnectionState data |
| 1090 |
* set rowreq_ctx->data->tcpConnectionState from rowreq_ctx->undo->tcpConnectionState |
| 1091 |
*/ |
| 1092 |
|
| 1093 |
|
| 1094 |
return MFD_SUCCESS; |
| 1095 |
} /* tcpConnectionState_undo */ |
| 1096 |
|
| 1097 |
/** |
| 1098 |
* check dependencies |
| 1099 |
* |
| 1100 |
* This is useful for for tables which have dependencies between columns |
| 1101 |
* (or rows, or tables). For example, two columns allocating a percentage |
| 1102 |
* of something add up 100%. |
| 1103 |
* |
| 1104 |
* Should you need different behavior depending on which columns were |
| 1105 |
* set, rowreq_ctx->column_set_flags will indicate which writeable columns were |
| 1106 |
* set. The definitions for the COLUMN_*_FLAG bits can be found in |
| 1107 |
* tcpConnectionTable.h. |
| 1108 |
* A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. |
| 1109 |
* |
| 1110 |
* @retval MFD_SUCCESS all the changes to the row are legal |
| 1111 |
* @retval MFD_ERROR one or more changes are not legal |
| 1112 |
* |
| 1113 |
* (see README-table-tcpConnectionTable if you don't have dependencies) |
| 1114 |
*/ |
| 1115 |
int |
| 1116 |
tcpConnectionTable_check_dependencies(tcpConnectionTable_rowreq_ctx * |
| 1117 |
rowreq_ctx) |
| 1118 |
{ |
| 1119 |
int rc = MFD_SUCCESS; |
| 1120 |
|
| 1121 |
DEBUGMSGTL(("internal:tcpConnectionTable:tcpConnectionTable_check_dependencies", "called\n")); |
| 1122 |
|
| 1123 |
netsnmp_assert(NULL != rowreq_ctx); |
| 1124 |
|
| 1125 |
/* |
| 1126 |
* TODO:470:o: Check tcpConnectionTable row dependencies. |
| 1127 |
* check that all new value are legal and consistent with each other |
| 1128 |
*/ |
| 1129 |
return rc; |
| 1130 |
} /* tcpConnectionTable_check_dependencies */ |
| 1131 |
|
| 1132 |
/** @} */ |
| 1133 |
/** @{ */ |