diff options
author | Hideki Yamane <henrich@debian.org> | 2013-04-11 10:21:22 +0900 |
---|---|---|
committer | Hideki Yamane <henrich@debian.org> | 2013-04-11 10:21:22 +0900 |
commit | e30beeedd5cbe6f72008c32122b3b8b617fd5ab2 (patch) | |
tree | 8bd5c28fc77a5a80d65cf70e2fd330b8af448c73 /agent/mibgroup/ip-mib/ipv6InterfaceTable | |
parent | 2ebfa94e6e1fe2b88bb061d26f20fef9c0b78536 (diff) | |
download | pkg-net-snmp-e30beeedd5cbe6f72008c32122b3b8b617fd5ab2.tar.gz |
Imported Upstream version 5.4.3~dfsgupstream/5.4.3_dfsg
Diffstat (limited to 'agent/mibgroup/ip-mib/ipv6InterfaceTable')
7 files changed, 4542 insertions, 0 deletions
diff --git a/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable.c b/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable.c new file mode 100644 index 0000000..abc08ad --- /dev/null +++ b/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable.c @@ -0,0 +1,1418 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.48 $ of : mfd-top.m2c,v $ + * + * $Id: ipv6InterfaceTable.c 15946 2007-03-12 21:28:23Z dts12 $ + */ +/** \page MFD helper for ipv6InterfaceTable + * + * \section intro Introduction + * Introductory text. + * + */ +/* + * standard Net-SNMP includes + */ +#include <net-snmp/net-snmp-config.h> +#include <net-snmp/net-snmp-includes.h> +#include <net-snmp/agent/net-snmp-agent-includes.h> + +/* + * include our parent header + */ +#include "ipv6InterfaceTable.h" + +#include <net-snmp/agent/mib_modules.h> + +#include "ipv6InterfaceTable_interface.h" + +oid ipv6InterfaceTable_oid[] = { IPV6INTERFACETABLE_OID }; +int ipv6InterfaceTable_oid_size = +OID_LENGTH(ipv6InterfaceTable_oid); + +ipv6InterfaceTable_registration ipv6InterfaceTable_user_context; + +void initialize_table_ipv6InterfaceTable(void); +void shutdown_table_ipv6InterfaceTable(void); + + +/** + * Initializes the ipv6InterfaceTable module + */ +void +init_ipv6InterfaceTable(void) +{ + DEBUGMSGTL(("verbose:ipv6InterfaceTable:init_ipv6InterfaceTable", + "called\n")); + + /* + * TODO:300:o: Perform ipv6InterfaceTable one-time module initialization. + */ + + /* + * we depend on the ifTable, so we put our init in with it + * to guarantee order of execution. + */ + init_ifTable(); + + /* + * last changed should be 0 at startup + */ + ipv6InterfaceTable_lastChange_set(0); + +} /* init_ipv6InterfaceTable */ + +/** + * Shut-down the ipv6InterfaceTable module (agent is exiting) + */ +void +shutdown_ipv6InterfaceTable(void) +{ + if (should_init("ipv6InterfaceTable")) + shutdown_table_ipv6InterfaceTable(); + +} + +/** + * Initialize the table ipv6InterfaceTable + * (Define its contents and how it's structured) + */ +void +initialize_table_ipv6InterfaceTable(void) +{ + ipv6InterfaceTable_registration *user_context; + u_long flags; + + DEBUGMSGTL(("verbose:ipv6InterfaceTable:initialize_table_ipv6InterfaceTable", "called\n")); + + /* + * TODO:301:o: Perform ipv6InterfaceTable one-time table initialization. + */ + + /* + * TODO:302:o: |->Initialize ipv6InterfaceTable user context + * if you'd like to pass in a pointer to some data for this + * table, allocate or set it up here. + */ + /* + * a netsnmp_data_list is a simple way to store void pointers. A simple + * string token is used to add, find or remove pointers. + */ + user_context = + netsnmp_create_data_list("ipv6InterfaceTable", NULL, NULL); + + /* + * No support for any flags yet, but in the future you would + * set any flags here. + */ + flags = 0; + + /* + * call interface initialization code + */ + _ipv6InterfaceTable_initialize_interface(user_context, flags); +} /* initialize_table_ipv6InterfaceTable */ + +/** + * Shutdown the table ipv6InterfaceTable + */ +void +shutdown_table_ipv6InterfaceTable(void) +{ + /* + * call interface shutdown code + */ + _ipv6InterfaceTable_shutdown_interface + (&ipv6InterfaceTable_user_context); +} + +/** + * extra context initialization (eg default values) + * + * @param rowreq_ctx : row request context + * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate) + * + * @retval MFD_SUCCESS : no errors + * @retval MFD_ERROR : error (context allocate will fail) + */ +int +ipv6InterfaceTable_rowreq_ctx_init(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, void *user_init_ctx) +{ + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_rowreq_ctx_init", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:210:o: |-> Perform extra ipv6InterfaceTable rowreq initialization. (eg DEFVALS) + */ + + return MFD_SUCCESS; +} /* ipv6InterfaceTable_rowreq_ctx_init */ + +/** + * extra context cleanup + * @param rowreq_ctx + */ +void +ipv6InterfaceTable_rowreq_ctx_cleanup(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx) +{ + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_rowreq_ctx_cleanup", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:211:o: |-> Perform extra ipv6InterfaceTable rowreq cleanup. + */ +} /* ipv6InterfaceTable_rowreq_ctx_cleanup */ + +/** + * pre-request callback + * + * @param user_context + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : other error + */ +int +ipv6InterfaceTable_pre_request(ipv6InterfaceTable_registration * + user_context) +{ + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_pre_request", "called\n")); + + /* + * TODO:510:o: Perform ipv6InterfaceTable pre-request actions. + */ + + return MFD_SUCCESS; +} /* ipv6InterfaceTable_pre_request */ + +/** + * post-request callback + * + * Note: + * New rows have been inserted into the container, and + * deleted rows have been removed from the container and + * released. + * @param user_context + * @param rc : MFD_SUCCESS if all requests succeeded + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : other error (ignored) + */ +int +ipv6InterfaceTable_post_request(ipv6InterfaceTable_registration * + user_context, int rc) +{ + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_post_request", "called\n")); + + /* + * TODO:511:o: Perform ipv6InterfaceTable post-request actions. + */ + + /* + * check to set if any rows were changed. + */ + if (ipv6InterfaceTable_dirty_get()) { + /* + * check if request was successful. If so, this would be + * a good place to save data to its persistent store. + */ + if (MFD_SUCCESS == rc) { + /* + * save changed rows, if you haven't already + */ + } + + ipv6InterfaceTable_dirty_set(0); /* clear table dirty flag */ + } + + return MFD_SUCCESS; +} /* ipv6InterfaceTable_post_request */ + + +/********************************************************************** + ********************************************************************** + *** + *** Table ipv6InterfaceTable + *** + ********************************************************************** + **********************************************************************/ +/* + * IP-MIB::ipv6InterfaceTable is subid 30 of ip. + * Its status is Current. + * OID: .1.3.6.1.2.1.4.30, length: 8 + */ + +/* + * --------------------------------------------------------------------- + * * TODO:200:r: Implement ipv6InterfaceTable data context functions. + */ + + + +/*--------------------------------------------------------------------- + * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceReasmMaxSize + * ipv6InterfaceReasmMaxSize is subid 2 of ipv6InterfaceEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.2.1.4.30.1.2 + * Description: +The size of the largest IPv6 datagram which this entity can + re-assemble from incoming IPv6 fragmented datagrams received + on this interface. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 1 hashint 0 + * settable 0 + * + * Ranges: 1500 - 65535; + * + * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32) + * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) + */ +/** + * Extract the current value of the ipv6InterfaceReasmMaxSize data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param ipv6InterfaceReasmMaxSize_val_ptr + * Pointer to storage for a u_long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +ipv6InterfaceReasmMaxSize_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, + u_long * ipv6InterfaceReasmMaxSize_val_ptr) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != ipv6InterfaceReasmMaxSize_val_ptr); + + + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceReasmMaxSize_get", + "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + if (! + (rowreq_ctx->data.ifentry-> + ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_REASMMAX)) + return MFD_SKIP; + + /* + * TODO:231:o: |-> Extract the current value of the ipv6InterfaceReasmMaxSize data. + * copy (* ipv6InterfaceReasmMaxSize_val_ptr ) from rowreq_ctx->data + */ + (*ipv6InterfaceReasmMaxSize_val_ptr) = + rowreq_ctx->data.ipv6InterfaceReasmMaxSize; + + return MFD_SUCCESS; +} /* ipv6InterfaceReasmMaxSize_get */ + +/*--------------------------------------------------------------------- + * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceIdentifier + * ipv6InterfaceIdentifier is subid 3 of ipv6InterfaceEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.2.1.4.30.1.3 + * Description: +The Interface Identifier for this interface. The Interface + Identifier is combined with an address prefix to form an + interface address. + + + By default, the Interface Identifier is auto-configured + according to the rules of the link type this interface is + attached to. + + + A zero length identifier may be used where appropriate. One + possible example is a loopback interface. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 1 hashint 1 + * settable 0 + * hint: 2x: + * + * Ranges: 0 - 8; + * + * Its syntax is Ipv6AddressIfIdentifierTC (based on perltype OCTETSTR) + * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char) + * This data type requires a length. (Max 8) + */ +/** + * Extract the current value of the ipv6InterfaceIdentifier data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param ipv6InterfaceIdentifier_val_ptr_ptr + * Pointer to storage for a char variable + * @param ipv6InterfaceIdentifier_val_ptr_len_ptr + * Pointer to a size_t. On entry, it will contain the size (in bytes) + * pointed to by ipv6InterfaceIdentifier. + * On exit, this value should contain the data size (in bytes). + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error +* + * @note If you need more than (*ipv6InterfaceIdentifier_val_ptr_len_ptr) bytes of memory, + * allocate it using malloc() and update ipv6InterfaceIdentifier_val_ptr_ptr. + * <b>DO NOT</b> free the previous pointer. + * The MFD helper will release the memory you allocate. + * + * @remark If you call this function yourself, you are responsible + * for checking if the pointer changed, and freeing any + * previously allocated memory. (Not necessary if you pass + * in a pointer to static memory, obviously.) + */ +int +ipv6InterfaceIdentifier_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, + char **ipv6InterfaceIdentifier_val_ptr_ptr, + size_t + * ipv6InterfaceIdentifier_val_ptr_len_ptr) +{ + /** we should have a non-NULL pointer and enough storage */ + netsnmp_assert((NULL != ipv6InterfaceIdentifier_val_ptr_ptr) + && (NULL != *ipv6InterfaceIdentifier_val_ptr_ptr)); + netsnmp_assert(NULL != ipv6InterfaceIdentifier_val_ptr_len_ptr); + + + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceIdentifier_get", + "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + if (! + (rowreq_ctx->data.ifentry-> + ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_IFID)) + return MFD_SKIP; + + /* + * TODO:231:o: |-> Extract the current value of the ipv6InterfaceIdentifier data. + * copy (* ipv6InterfaceIdentifier_val_ptr_ptr ) data and (* ipv6InterfaceIdentifier_val_ptr_len_ptr ) from rowreq_ctx->data + */ + /* + * make sure there is enough space for ipv6InterfaceIdentifier data + */ + if ((NULL == (*ipv6InterfaceIdentifier_val_ptr_ptr)) || + ((*ipv6InterfaceIdentifier_val_ptr_len_ptr) < + (rowreq_ctx->data.ipv6InterfaceIdentifier_len * + sizeof(rowreq_ctx->data.ipv6InterfaceIdentifier[0])))) { + /* + * allocate space for ipv6InterfaceIdentifier data + */ + (*ipv6InterfaceIdentifier_val_ptr_ptr) = + malloc(rowreq_ctx->data.ipv6InterfaceIdentifier_len * + sizeof(rowreq_ctx->data.ipv6InterfaceIdentifier[0])); + if (NULL == (*ipv6InterfaceIdentifier_val_ptr_ptr)) { + snmp_log(LOG_ERR, "could not allocate memory\n"); + return MFD_ERROR; + } + } + (*ipv6InterfaceIdentifier_val_ptr_len_ptr) = + rowreq_ctx->data.ipv6InterfaceIdentifier_len * + sizeof(rowreq_ctx->data.ipv6InterfaceIdentifier[0]); + memcpy((*ipv6InterfaceIdentifier_val_ptr_ptr), + rowreq_ctx->data.ipv6InterfaceIdentifier, + rowreq_ctx->data.ipv6InterfaceIdentifier_len * + sizeof(rowreq_ctx->data.ipv6InterfaceIdentifier[0])); + + return MFD_SUCCESS; +} /* ipv6InterfaceIdentifier_get */ + +/*--------------------------------------------------------------------- + * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceEnableStatus + * ipv6InterfaceEnableStatus is subid 5 of ipv6InterfaceEntry. + * Its status is Current, and its access level is ReadWrite. + * OID: .1.3.6.1.2.1.4.30.1.5 + * Description: +The indication of whether IPv6 is enabled (up) or disabled + (down) on this interface. This object does not affect the + state of the interface itself, only its connection to an + IPv6 stack. The IF-MIB should be used to control the state + of the interface. + + + When this object is written the entity SHOULD save the + change to non-volatile storage and restore the object from + non-volatile storage upon re-initialization of the system. + * + * Attributes: + * accessible 1 isscalar 0 enums 1 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 1 + * + * Enum range: 1/8. Values: up(1), down(2) + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) + */ +/** + * Extract the current value of the ipv6InterfaceEnableStatus data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param ipv6InterfaceEnableStatus_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +ipv6InterfaceEnableStatus_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, + u_long * ipv6InterfaceEnableStatus_val_ptr) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != ipv6InterfaceEnableStatus_val_ptr); + + + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceEnableStatus_get", + "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:231:o: |-> Extract the current value of the ipv6InterfaceEnableStatus data. + * copy (* ipv6InterfaceEnableStatus_val_ptr ) from rowreq_ctx->data + */ + (*ipv6InterfaceEnableStatus_val_ptr) = + rowreq_ctx->data.ipv6InterfaceEnableStatus; + + return MFD_SUCCESS; +} /* ipv6InterfaceEnableStatus_get */ + +/*--------------------------------------------------------------------- + * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceReachableTime + * ipv6InterfaceReachableTime is subid 6 of ipv6InterfaceEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.2.1.4.30.1.6 + * Description: +The time a neighbor is considered reachable after receiving + a reachability confirmation. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32) + * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) + */ +/** + * Extract the current value of the ipv6InterfaceReachableTime data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param ipv6InterfaceReachableTime_val_ptr + * Pointer to storage for a u_long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +ipv6InterfaceReachableTime_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, + u_long * ipv6InterfaceReachableTime_val_ptr) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != ipv6InterfaceReachableTime_val_ptr); + + + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceReachableTime_get", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + if (! + (rowreq_ctx->data.ifentry-> + ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_REACHABLE)) + return MFD_SKIP; + + /* + * TODO:231:o: |-> Extract the current value of the ipv6InterfaceReachableTime data. + * copy (* ipv6InterfaceReachableTime_val_ptr ) from rowreq_ctx->data + */ + (*ipv6InterfaceReachableTime_val_ptr) = + rowreq_ctx->data.ipv6InterfaceReachableTime; + + return MFD_SUCCESS; +} /* ipv6InterfaceReachableTime_get */ + +/*--------------------------------------------------------------------- + * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceRetransmitTime + * ipv6InterfaceRetransmitTime is subid 7 of ipv6InterfaceEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.2.1.4.30.1.7 + * Description: +The time between retransmissions of Neighbor Solicitation + messages to a neighbor when resolving the address or when + probing the reachability of a neighbor. + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32) + * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) + */ +/** + * Extract the current value of the ipv6InterfaceRetransmitTime data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param ipv6InterfaceRetransmitTime_val_ptr + * Pointer to storage for a u_long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +ipv6InterfaceRetransmitTime_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, + u_long * + ipv6InterfaceRetransmitTime_val_ptr) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != ipv6InterfaceRetransmitTime_val_ptr); + + + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceRetransmitTime_get", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + if (! + (rowreq_ctx->data.ifentry-> + ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_RETRANSMIT)) + return MFD_SKIP; + + /* + * TODO:231:o: |-> Extract the current value of the ipv6InterfaceRetransmitTime data. + * copy (* ipv6InterfaceRetransmitTime_val_ptr ) from rowreq_ctx->data + */ + (*ipv6InterfaceRetransmitTime_val_ptr) = + rowreq_ctx->data.ipv6InterfaceRetransmitTime; + + return MFD_SUCCESS; +} /* ipv6InterfaceRetransmitTime_get */ + +/*--------------------------------------------------------------------- + * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceForwarding + * ipv6InterfaceForwarding is subid 8 of ipv6InterfaceEntry. + * Its status is Current, and its access level is ReadWrite. + * OID: .1.3.6.1.2.1.4.30.1.8 + * Description: +The indication of whether this entity is acting as an IPv6 + router on this interface with respect to the forwarding of + datagrams received by, but not addressed to, this entity. + IPv6 routers forward datagrams. IPv6 hosts do not (except + those source-routed via the host). + + + + + + This object is constrained by ipv6IpForwarding and is + ignored if ipv6IpForwarding is set to notForwarding. Those + systems that do not provide per-interface control of the + forwarding function should set this object to forwarding for + all interfaces and allow the ipv6IpForwarding object to + control the forwarding capability. + + + When this object is written the entity SHOULD save the + change to non-volatile storage and restore the object from + non-volatile storage upon re-initialization of the system. + * + * Attributes: + * accessible 1 isscalar 0 enums 1 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 1 + * + * Enum range: 2/8. Values: forwarding(1), notForwarding(2) + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) + */ +/** + * Extract the current value of the ipv6InterfaceForwarding data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param ipv6InterfaceForwarding_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +ipv6InterfaceForwarding_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, + u_long * ipv6InterfaceForwarding_val_ptr) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != ipv6InterfaceForwarding_val_ptr); + + + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceForwarding_get", + "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + if (! + (rowreq_ctx->data.ifentry-> + ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_FORWARDING)) + return MFD_SKIP; + + /* + * TODO:231:o: |-> Extract the current value of the ipv6InterfaceForwarding data. + * copy (* ipv6InterfaceForwarding_val_ptr ) from rowreq_ctx->data + */ + (*ipv6InterfaceForwarding_val_ptr) = + rowreq_ctx->data.ipv6InterfaceForwarding; + + return MFD_SUCCESS; +} /* ipv6InterfaceForwarding_get */ + + + +/** @} */ +/********************************************************************** + ********************************************************************** + *** + *** Table ipv6InterfaceTable + *** + ********************************************************************** + **********************************************************************/ +/* + * IP-MIB::ipv6InterfaceTable is subid 30 of ip. + * Its status is Current. + * OID: .1.3.6.1.2.1.4.30, length: 8 + */ + /* + * NOTE: if you update this chart, please update the versions in + * local/mib2c-conf.d/parent-set.m2i + * agent/mibgroup/helpers/baby_steps.c + * while you're at it. + */ + /* + *********************************************************************** + * Baby Steps Flow Chart (2004.06.05) * + * * + * +--------------+ +================+ U = unconditional path * + * |optional state| ||required state|| S = path for success * + * +--------------+ +================+ E = path for error * + *********************************************************************** + * + * +--------------+ + * | pre | + * | request | + * +--------------+ + * | U + * +==============+ + * +----------------|| object || + * | E || lookup || + * | +==============+ + * | | S + * | +==============+ + * | E || check || + * |<---------------|| values || + * | +==============+ + * | | S + * | +==============+ + * | +<-------|| undo || + * | | E || setup || + * | | +==============+ + * | | | S + * | | +==============+ + * | | || set ||-------------------------->+ + * | | || value || E | + * | | +==============+ | + * | | | S | + * | | +--------------+ | + * | | | check |-------------------------->| + * | | | consistency | E | + * | | +--------------+ | + * | | | S | + * | | +==============+ +==============+ | + * | | || commit ||-------->|| undo || | + * | | || || E || commit || | + * | | +==============+ +==============+ | + * | | | S U |<--------+ + * | | +--------------+ +==============+ + * | | | irreversible | || undo || + * | | | commit | || set || + * | | +--------------+ +==============+ + * | | | U U | + * | +-------------->|<------------------------+ + * | +==============+ + * | || undo || + * | || cleanup || + * | +==============+ + * +---------------------->| U + * +--------------+ + * | post | + * | request | + * +--------------+ + * + */ + +/** + * Setup up context with information needed to undo a set request. + * + * This function will be called before the individual node undo setup + * functions are called. If you need to do any undo setup that is not + * related to a specific column, you can do it here. + * + * Note that the undo context has been allocated with + * ipv6InterfaceTable_allocate_data(), but may need extra + * initialization similar to what you may have done in + * ipv6InterfaceTable_rowreq_ctx_init(). + * Note that an individual node's undo_setup function will only be called + * if that node is being set to a new value. + * + * If there is any setup specific to a particular column (e.g. allocating + * memory for a string), you should do that setup in the node's undo_setup + * function, so it won't be done unless it is necessary. + * + * @param rowreq_ctx + * Pointer to the table context (ipv6InterfaceTable_rowreq_ctx) + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : error. set will fail. + */ +int +ipv6InterfaceTable_undo_setup(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx) +{ + int rc = MFD_SUCCESS; + + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_undo_setup", + "called\n")); + + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:451:M: |-> Setup ipv6InterfaceTable undo. + * set up ipv6InterfaceTable undo information, in preparation for a set. + * Undo storage is in (* ipv6InterfaceForwarding_val_ptr )* + */ + + return rc; +} /* ipv6InterfaceTable_undo_setup */ + +/** + * Undo a set request. + * + * This function will be called before the individual node undo + * functions are called. If you need to do any undo that is not + * related to a specific column, you can do it here. + * + * Note that an individual node's undo function will only be called + * if that node is being set to a new value. + * + * If there is anything specific to a particular column (e.g. releasing + * memory for a string), you should do that setup in the node's undo + * function, so it won't be done unless it is necessary. + * + * @param rowreq_ctx + * Pointer to the table context (ipv6InterfaceTable_rowreq_ctx) + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : error. set will fail. + */ +int +ipv6InterfaceTable_undo(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx) +{ + int rc = MFD_SUCCESS; + + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_undo", + "called\n")); + + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:451:M: |-> ipv6InterfaceTable undo. + * ipv6InterfaceTable undo information, in response to a failed set. + * Undo storage is in (* ipv6InterfaceForwarding_val_ptr )* + */ + + return rc; +} /* ipv6InterfaceTable_undo_setup */ + +/** + * Cleanup up context undo information. + * + * This function will be called after set/commit processing. If you + * allocated any resources in undo_setup, this is the place to release + * those resources. + * + * This function is called regardless of the success or failure of the set + * request. If you need to perform different steps for cleanup depending + * on success or failure, you can add a flag to the rowreq_ctx. + * + * @param rowreq_ctx + * Pointer to the table context (ipv6InterfaceTable_rowreq_ctx) + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : error + */ +int +ipv6InterfaceTable_undo_cleanup(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx) +{ + int rc = MFD_SUCCESS; + + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_undo_cleanup", "called\n")); + + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:452:M: |-> Cleanup ipv6InterfaceTable undo. + * Undo storage is in (* ipv6InterfaceForwarding_val_ptr )* + */ + + return rc; +} /* ipv6InterfaceTable_undo_cleanup */ + +/** + * commit new values. + * + * At this point, you should have done everything you can to ensure that + * this commit will not fail. + * + * Should you need different behavior depending on which columns were + * set, rowreq_ctx->column_set_flags will indicate which writeable columns were + * set. The definitions for the COLUMN_*_FLAG bits can be found in + * ipv6InterfaceTable.h. + * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. + * + * @param rowreq_ctx + * Pointer to the users context. + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : error + */ +int +ipv6InterfaceTable_commit(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx) +{ + int rc = MFD_SUCCESS; + int save_flags; + + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_commit", + "called\n")); + + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * save flags, then clear until we actually do something + */ + save_flags = rowreq_ctx->column_set_flags; + rowreq_ctx->column_set_flags = 0; + + /* + * commit ipv6InterfaceTable data + * 1) check the column's flag in save_flags to see if it was set. + * 2) clear the flag when you handle that column + * 3) set the column's flag in column_set_flags if it needs undo + * processing in case of a failure. + */ + if (save_flags & COLUMN_IPV6INTERFACEENABLESTATUS_FLAG) { + save_flags &= ~COLUMN_IPV6INTERFACEENABLESTATUS_FLAG; /* clear ipv6InterfaceEnableStatus */ + /* + * TODO:482:o: |-> commit column ipv6InterfaceEnableStatus. + */ + rc = -1; + if (-1 == rc) { + snmp_log(LOG_ERR, + "ipv6InterfaceTable column ipv6InterfaceEnableStatus commit failed\n"); + } else { + /* + * set flag, in case we need to undo ipv6InterfaceEnableStatus + */ + rowreq_ctx->column_set_flags |= + COLUMN_IPV6INTERFACEENABLESTATUS_FLAG; + } + } + + if (save_flags & COLUMN_IPV6INTERFACEFORWARDING_FLAG) { + save_flags &= ~COLUMN_IPV6INTERFACEFORWARDING_FLAG; /* clear ipv6InterfaceForwarding */ + /* + * TODO:482:o: |-> commit column ipv6InterfaceForwarding. + */ + rc = -1; + if (-1 == rc) { + snmp_log(LOG_ERR, + "ipv6InterfaceTable column ipv6InterfaceForwarding commit failed\n"); + } else { + /* + * set flag, in case we need to undo ipv6InterfaceForwarding + */ + rowreq_ctx->column_set_flags |= + COLUMN_IPV6INTERFACEFORWARDING_FLAG; + } + } + + /* + * if we successfully commited this row, set the dirty flag. + */ + if (MFD_SUCCESS == rc) { + rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY; + } + + if (save_flags) { + snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n", + save_flags); + return MFD_ERROR; + } + + return rc; +} /* ipv6InterfaceTable_commit */ + +/** + * undo commit new values. + * + * Should you need different behavior depending on which columns were + * set, rowreq_ctx->column_set_flags will indicate which writeable columns were + * set. The definitions for the COLUMN_*_FLAG bits can be found in + * ipv6InterfaceTable.h. + * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags. + * + * @param rowreq_ctx + * Pointer to the users context. + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : error + */ +int +ipv6InterfaceTable_undo_commit(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx) +{ + int rc = MFD_SUCCESS; + + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_undo_commit", "called\n")); + + /** we should have a non-NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:485:M: |-> Undo ipv6InterfaceTable commit. + * check the column's flag in rowreq_ctx->column_set_flags to see + * if it was set during commit, then undo it. + * + * eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {} + */ + + + /* + * if we successfully un-commited this row, clear the dirty flag. + */ + if (MFD_SUCCESS == rc) { + rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY; + } + + return rc; +} /* ipv6InterfaceTable_undo_commit */ + +/* + * TODO:440:M: Implement ipv6InterfaceTable node value checks. + * TODO:450:M: Implement ipv6InterfaceTable undo functions. + * TODO:460:M: Implement ipv6InterfaceTable set functions. + * TODO:480:M: Implement ipv6InterfaceTable commit functions. + */ +/*--------------------------------------------------------------------- + * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceEnableStatus + * ipv6InterfaceEnableStatus is subid 5 of ipv6InterfaceEntry. + * Its status is Current, and its access level is ReadWrite. + * OID: .1.3.6.1.2.1.4.30.1.5 + * Description: +The indication of whether IPv6 is enabled (up) or disabled + (down) on this interface. This object does not affect the + state of the interface itself, only its connection to an + IPv6 stack. The IF-MIB should be used to control the state + of the interface. + + + When this object is written the entity SHOULD save the + change to non-volatile storage and restore the object from + non-volatile storage upon re-initialization of the system. + * + * Attributes: + * accessible 1 isscalar 0 enums 1 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 1 + * + * Enum range: 1/8. Values: up(1), down(2) + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) + */ +/** + * Check that the proposed new value is potentially valid. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param ipv6InterfaceEnableStatus_val + * A long containing the new value. + * + * @retval MFD_SUCCESS : incoming value is legal + * @retval MFD_NOT_VALID_NOW : incoming value is not valid now + * @retval MFD_NOT_VALID_EVER : incoming value is never valid + * + * This is the place to check for requirements that are not + * expressed in the mib syntax (for example, a requirement that + * is detailed in the description for an object). + * + * You should check that the requested change between the undo value and the + * new value is legal (ie, the transistion from one value to another + * is legal). + * + *@note + * This check is only to determine if the new value + * is \b potentially valid. This is the first check of many, and + * is one of the simplest ones. + * + *@note + * this is not the place to do any checks for values + * which depend on some other value in the mib. Those + * types of checks should be done in the + * ipv6InterfaceTable_check_dependencies() function. + * + * The following checks have already been done for you: + * The syntax is ASN_INTEGER + * The value is one of up(1), down(2) + * + * If there a no other checks you need to do, simply return MFD_SUCCESS. + * + */ +int +ipv6InterfaceEnableStatus_check_value(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, + u_long ipv6InterfaceEnableStatus_val) +{ + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceEnableStatus_check_value", "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:441:o: |-> Check for valid ipv6InterfaceEnableStatus value. + */ + + return MFD_SUCCESS; /* ipv6InterfaceEnableStatus value not illegal */ +} /* ipv6InterfaceEnableStatus_check_value */ + +/** + * Save old value information + * + * @param rowreq_ctx + * Pointer to the table context (ipv6InterfaceTable_rowreq_ctx) + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : error. set will fail. + * + * This function will be called after the table level undo setup function + * ipv6InterfaceTable_undo_setup has been called. + * + *@note + * this function will only be called if a new value is set for this column. + * + * If there is any setup specific to a particular column (e.g. allocating + * memory for a string), you should do that setup in this function, so it + * won't be done unless it is necessary. + */ +int +ipv6InterfaceEnableStatus_undo_setup(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx) +{ + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceEnableStatus_undo_setup", "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:455:o: |-> Setup ipv6InterfaceEnableStatus undo. + */ + /* + * copy ipv6InterfaceEnableStatus data + * set rowreq_ctx->undo->ipv6InterfaceEnableStatus from rowreq_ctx->data.ipv6InterfaceEnableStatus + */ + rowreq_ctx->undo->ipv6InterfaceEnableStatus = + rowreq_ctx->data.ipv6InterfaceEnableStatus; + + + return MFD_SUCCESS; +} /* ipv6InterfaceEnableStatus_undo_setup */ + +/** + * Set the new value. + * + * @param rowreq_ctx + * Pointer to the users context. You should know how to + * manipulate the value from this object. + * @param ipv6InterfaceEnableStatus_val + * A long containing the new value. + */ +int +ipv6InterfaceEnableStatus_set(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, + u_long ipv6InterfaceEnableStatus_val) +{ + + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceEnableStatus_set", + "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:461:M: |-> Set ipv6InterfaceEnableStatus value. + * set ipv6InterfaceEnableStatus value in rowreq_ctx->data + */ + rowreq_ctx->data.ipv6InterfaceEnableStatus = + ipv6InterfaceEnableStatus_val; + + return MFD_SUCCESS; +} /* ipv6InterfaceEnableStatus_set */ + +/** + * undo the previous set. + * + * @param rowreq_ctx + * Pointer to the users context. + */ +int +ipv6InterfaceEnableStatus_undo(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx) +{ + + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceEnableStatus_undo", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:456:o: |-> Clean up ipv6InterfaceEnableStatus undo. + */ + /* + * copy ipv6InterfaceEnableStatus data + * set rowreq_ctx->data.ipv6InterfaceEnableStatus from rowreq_ctx->undo->ipv6InterfaceEnableStatus + */ + rowreq_ctx->data.ipv6InterfaceEnableStatus = + rowreq_ctx->undo->ipv6InterfaceEnableStatus; + + + return MFD_SUCCESS; +} /* ipv6InterfaceEnableStatus_undo */ + +/*--------------------------------------------------------------------- + * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceForwarding + * ipv6InterfaceForwarding is subid 8 of ipv6InterfaceEntry. + * Its status is Current, and its access level is ReadWrite. + * OID: .1.3.6.1.2.1.4.30.1.8 + * Description: +The indication of whether this entity is acting as an IPv6 + router on this interface with respect to the forwarding of + datagrams received by, but not addressed to, this entity. + IPv6 routers forward datagrams. IPv6 hosts do not (except + those source-routed via the host). + + + + + + This object is constrained by ipv6IpForwarding and is + ignored if ipv6IpForwarding is set to notForwarding. Those + systems that do not provide per-interface control of the + forwarding function should set this object to forwarding for + all interfaces and allow the ipv6IpForwarding object to + control the forwarding capability. + + + When this object is written the entity SHOULD save the + change to non-volatile storage and restore the object from + non-volatile storage upon re-initialization of the system. + * + * Attributes: + * accessible 1 isscalar 0 enums 1 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 1 + * + * Enum range: 2/8. Values: forwarding(1), notForwarding(2) + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) + */ +/** + * Check that the proposed new value is potentially valid. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param ipv6InterfaceForwarding_val + * A long containing the new value. + * + * @retval MFD_SUCCESS : incoming value is legal + * @retval MFD_NOT_VALID_NOW : incoming value is not valid now + * @retval MFD_NOT_VALID_EVER : incoming value is never valid + * + * This is the place to check for requirements that are not + * expressed in the mib syntax (for example, a requirement that + * is detailed in the description for an object). + * + * You should check that the requested change between the undo value and the + * new value is legal (ie, the transistion from one value to another + * is legal). + * + *@note + * This check is only to determine if the new value + * is \b potentially valid. This is the first check of many, and + * is one of the simplest ones. + * + *@note + * this is not the place to do any checks for values + * which depend on some other value in the mib. Those + * types of checks should be done in the + * ipv6InterfaceTable_check_dependencies() function. + * + * The following checks have already been done for you: + * The syntax is ASN_INTEGER + * The value is one of forwarding(1), notForwarding(2) + * + * If there a no other checks you need to do, simply return MFD_SUCCESS. + * + */ +int +ipv6InterfaceForwarding_check_value(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, + u_long ipv6InterfaceForwarding_val) +{ + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceForwarding_check_value", "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:441:o: |-> Check for valid ipv6InterfaceForwarding value. + */ + + return MFD_SUCCESS; /* ipv6InterfaceForwarding value not illegal */ +} /* ipv6InterfaceForwarding_check_value */ + +/** + * Save old value information + * + * @param rowreq_ctx + * Pointer to the table context (ipv6InterfaceTable_rowreq_ctx) + * + * @retval MFD_SUCCESS : success + * @retval MFD_ERROR : error. set will fail. + * + * This function will be called after the table level undo setup function + * ipv6InterfaceTable_undo_setup has been called. + * + *@note + * this function will only be called if a new value is set for this column. + * + * If there is any setup specific to a particular column (e.g. allocating + * memory for a string), you should do that setup in this function, so it + * won't be done unless it is necessary. + */ +int +ipv6InterfaceForwarding_undo_setup(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx) +{ + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceForwarding_undo_setup", "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:455:o: |-> Setup ipv6InterfaceForwarding undo. + */ + /* + * copy ipv6InterfaceForwarding data + * set rowreq_ctx->undo->ipv6InterfaceForwarding from rowreq_ctx->data.ipv6InterfaceForwarding + */ + rowreq_ctx->undo->ipv6InterfaceForwarding = + rowreq_ctx->data.ipv6InterfaceForwarding; + + + return MFD_SUCCESS; +} /* ipv6InterfaceForwarding_undo_setup */ + +/** + * Set the new value. + * + * @param rowreq_ctx + * Pointer to the users context. You should know how to + * manipulate the value from this object. + * @param ipv6InterfaceForwarding_val + * A long containing the new value. + */ +int +ipv6InterfaceForwarding_set(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, + u_long ipv6InterfaceForwarding_val) +{ + + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceForwarding_set", + "called\n")); + + /** should never get a NULL pointer */ + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:461:M: |-> Set ipv6InterfaceForwarding value. + * set ipv6InterfaceForwarding value in rowreq_ctx->data + */ + rowreq_ctx->data.ipv6InterfaceForwarding = ipv6InterfaceForwarding_val; + + return MFD_SUCCESS; +} /* ipv6InterfaceForwarding_set */ + +/** + * undo the previous set. + * + * @param rowreq_ctx + * Pointer to the users context. + */ +int +ipv6InterfaceForwarding_undo(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx) +{ + + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceForwarding_undo", + "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:456:o: |-> Clean up ipv6InterfaceForwarding undo. + */ + /* + * copy ipv6InterfaceForwarding data + * set rowreq_ctx->data.ipv6InterfaceForwarding from rowreq_ctx->undo->ipv6InterfaceForwarding + */ + rowreq_ctx->data.ipv6InterfaceForwarding = + rowreq_ctx->undo->ipv6InterfaceForwarding; + + + return MFD_SUCCESS; +} /* ipv6InterfaceForwarding_undo */ + +/** @} */ +/** @{ */ diff --git a/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable.h b/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable.h new file mode 100644 index 0000000..3b2ef5c --- /dev/null +++ b/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable.h @@ -0,0 +1,970 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.48 $ of : mfd-top.m2c,v $ + * + * $Id: ipv6InterfaceTable.h 15205 2006-09-14 17:15:32Z rstory $ + */ +#ifndef IPV6INTERFACETABLE_H +#define IPV6INTERFACETABLE_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/** @addtogroup misc misc: Miscellaneous routines + * + * @{ + */ +#include <net-snmp/library/asn1.h> +#include <net-snmp/data_access/interface.h> + +#include "if-mib/ifTable/ifTable.h" + + /* + * other required module components + */ + /* *INDENT-OFF* */ +config_require(if-mib/ifTable/ifTable) +config_require(ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_interface) +config_require(ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_data_access) + /* *INDENT-ON* */ + + /* + * OID, column number and enum definions for ipv6InterfaceTable + */ +#include "ipv6InterfaceTable_constants.h" + + /* + ********************************************************************* + * function declarations + */ + void init_ipv6InterfaceTable(void); + void shutdown_ipv6InterfaceTable(void); + + /* + ********************************************************************* + * Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table ipv6InterfaceTable + *** + ********************************************************************** + **********************************************************************/ + /* + * IP-MIB::ipv6InterfaceTable is subid 30 of ip. + * Its status is Current. + * OID: .1.3.6.1.2.1.4.30, length: 8 + * + * we share data structures (data too, in fact) with ifTable + */ + typedef ifTable_registration ipv6InterfaceTable_registration; + typedef ifTable_data ipv6InterfaceTable_data; + typedef ifTable_undo_data ipv6InterfaceTable_undo_data; + typedef ifTable_mib_index ipv6InterfaceTable_mib_index; + typedef ifTable_rowreq_ctx ipv6InterfaceTable_rowreq_ctx; + + /* + * ipv6InterfaceReasmMaxSize(2)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/R/d/h + */ +#define ipv6InterfaceReasmMaxSize ifentry->reasm_max_v6 + + /* + * ipv6InterfaceIdentifier(3)/Ipv6AddressIfIdentifierTC/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H + */ + +#define ipv6InterfaceIdentifier ifentry->v6_if_id +#define ipv6InterfaceIdentifier_len ifentry->v6_if_id_len + + /* + * ipv6InterfaceEnableStatus(5)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ +#define ipv6InterfaceEnableStatus ifentry->admin_status + + /* + * ipv6InterfaceReachableTime(6)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h + */ +#define ipv6InterfaceReachableTime ifentry->reachable_time + + /* + * ipv6InterfaceRetransmitTime(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h + */ +#define ipv6InterfaceRetransmitTime ifentry->retransmit_v6 + + /* + * ipv6InterfaceForwarding(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ +#define ipv6InterfaceForwarding ifentry->forwarding_v6 + + + /* + ********************************************************************* + * function prototypes + */ + int + + + + + + + + + + + + + + + + ipv6InterfaceTable_pre_request(ipv6InterfaceTable_registration * + user_context); + int + + + + + + + + + + + + + + + + ipv6InterfaceTable_post_request(ipv6InterfaceTable_registration * + user_context, int rc); + + int + + + + + + + + + + + + + + + + ipv6InterfaceTable_rowreq_ctx_init(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, + void *user_init_ctx); + void + + + + + + + + + + + + + + + + ipv6InterfaceTable_rowreq_ctx_cleanup(ipv6InterfaceTable_rowreq_ctx + * rowreq_ctx); + + int ipv6InterfaceTable_commit(ipv6InterfaceTable_rowreq_ctx + * rowreq_ctx); + + + + + + + + ipv6InterfaceTable_rowreq_ctx + * ipv6InterfaceTable_row_find_by_mib_index + (ipv6InterfaceTable_mib_index * mib_idx); + + extern oid ipv6InterfaceTable_oid[]; + extern int ipv6InterfaceTable_oid_size; + + +#include "ipv6InterfaceTable_interface.h" +#include "ipv6InterfaceTable_data_access.h" + /* + ********************************************************************* + * GET function declarations + */ + + /* + ********************************************************************* + * GET Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table ipv6InterfaceTable + *** + ********************************************************************** + **********************************************************************/ + /* + * IP-MIB::ipv6InterfaceTable is subid 30 of ip. + * Its status is Current. + * OID: .1.3.6.1.2.1.4.30, length: 8 + */ + /* + * indexes + */ + + int + + + + + + + + + + + + + + + + ipv6InterfaceReasmMaxSize_get(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, + u_long * + ipv6InterfaceReasmMaxSize_val_ptr); + int + + + + + + + + + + + + + + + + ipv6InterfaceIdentifier_get(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, char + **ipv6InterfaceIdentifier_val_ptr_ptr, + size_t + * + ipv6InterfaceIdentifier_val_ptr_len_ptr); + int + + + + + + + + + + + + + + + + ipv6InterfaceEnableStatus_get(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, + u_long * + ipv6InterfaceEnableStatus_val_ptr); + int + + + + + + + + + + + + + + + + ipv6InterfaceReachableTime_get(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, + u_long * + ipv6InterfaceReachableTime_val_ptr); + int + + + + + + + + + + + + + + + + ipv6InterfaceRetransmitTime_get(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, + u_long * + ipv6InterfaceRetransmitTime_val_ptr); + int + + + + + + + + + + + + + + + + ipv6InterfaceForwarding_get(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, + u_long * + ipv6InterfaceForwarding_val_ptr); + + + int + + + + + + + + + + + + + + + + ipv6InterfaceTable_indexes_set_tbl_idx(ipv6InterfaceTable_mib_index + * tbl_idx, long + ipv6InterfaceIfIndex_val); + int + + + + + + + + + + + + + + + + ipv6InterfaceTable_indexes_set(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, + long ipv6InterfaceIfIndex_val); + + + + /* + ********************************************************************* + * SET function declarations + */ + + /* + ********************************************************************* + * SET Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table ipv6InterfaceTable + *** + ********************************************************************** + **********************************************************************/ + /* + * IP-MIB::ipv6InterfaceTable is subid 30 of ip. + * Its status is Current. + * OID: .1.3.6.1.2.1.4.30, length: 8 + */ + + + int + + + + + + + + + + + + + + + + ipv6InterfaceTable_undo_setup(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx); + int + + + + + + + + + + + + + + + + ipv6InterfaceTable_undo_cleanup(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx); + int ipv6InterfaceTable_undo(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx); + int ipv6InterfaceTable_commit(ipv6InterfaceTable_rowreq_ctx + * rowreq_ctx); + int + + + + + + + + + + + + + + + + ipv6InterfaceTable_undo_commit(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx); + + + int + + + + + + + + + + + + + + + + ipv6InterfaceReasmMaxSize_check_value(ipv6InterfaceTable_rowreq_ctx + * rowreq_ctx, + u_long + ipv6InterfaceReasmMaxSize_val); + int + + + + + + + + + + + + + + + + ipv6InterfaceReasmMaxSize_undo_setup(ipv6InterfaceTable_rowreq_ctx + * rowreq_ctx); + int + + + + + + + + + + + + + + + + ipv6InterfaceReasmMaxSize_set(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, + u_long + ipv6InterfaceReasmMaxSize_val); + int + + + + + + + + + + + + + + + + ipv6InterfaceReasmMaxSize_undo(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx); + + int + + + + + + + + + + + + + + + + ipv6InterfaceIdentifier_check_value(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, char + *ipv6InterfaceIdentifier_val_ptr, + size_t + ipv6InterfaceIdentifier_val_ptr_len); + int + + + + + + + + + + + + + + + + ipv6InterfaceIdentifier_undo_setup(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx); + int + + + + + + + + + + + + + + + + ipv6InterfaceIdentifier_set(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, + char *ipv6InterfaceIdentifier_val_ptr, + size_t + ipv6InterfaceIdentifier_val_ptr_len); + int + + + + + + + + + + + + + + + + ipv6InterfaceIdentifier_undo(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx); + + int + + + + + + + + + + + + + + + + ipv6InterfaceEnableStatus_check_value(ipv6InterfaceTable_rowreq_ctx + * rowreq_ctx, + u_long + ipv6InterfaceEnableStatus_val); + int + + + + + + + + + + + + + + + + ipv6InterfaceEnableStatus_undo_setup(ipv6InterfaceTable_rowreq_ctx + * rowreq_ctx); + int + + + + + + + + + + + + + + + + ipv6InterfaceEnableStatus_set(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, + u_long + ipv6InterfaceEnableStatus_val); + int + + + + + + + + + + + + + + + + ipv6InterfaceEnableStatus_undo(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx); + + int + + + + + + + + + + + + + + + + ipv6InterfaceReachableTime_check_value + (ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, + u_long ipv6InterfaceReachableTime_val); + int + + + + + + + + + + + + + + + + ipv6InterfaceReachableTime_undo_setup(ipv6InterfaceTable_rowreq_ctx + * rowreq_ctx); + int + + + + + + + + + + + + + + + + ipv6InterfaceReachableTime_set(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, + u_long + ipv6InterfaceReachableTime_val); + int + + + + + + + + + + + + + + + + ipv6InterfaceReachableTime_undo(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx); + + int + + + + + + + + + + + + + + + + ipv6InterfaceRetransmitTime_check_value + (ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, + u_long ipv6InterfaceRetransmitTime_val); + int + + + + + + + + + + + + + + + + ipv6InterfaceRetransmitTime_undo_setup + (ipv6InterfaceTable_rowreq_ctx * rowreq_ctx); + int + + + + + + + + + + + + + + + + ipv6InterfaceRetransmitTime_set(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, + u_long + ipv6InterfaceRetransmitTime_val); + int + + + + + + + + + + + + + + + + ipv6InterfaceRetransmitTime_undo(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx); + + int + + + + + + + + + + + + + + + + ipv6InterfaceForwarding_check_value(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, + u_long + ipv6InterfaceForwarding_val); + int + + + + + + + + + + + + + + + + ipv6InterfaceForwarding_undo_setup(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx); + int + + + + + + + + + + + + + + + + ipv6InterfaceForwarding_set(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, + u_long ipv6InterfaceForwarding_val); + int + + + + + + + + + + + + + + + + ipv6InterfaceForwarding_undo(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx); + + + int + + + + + + + + + + + + + + + + ipv6InterfaceTable_check_dependencies(ipv6InterfaceTable_rowreq_ctx + * ctx); + + + /* + * DUMMY markers, ignore + * + * TODO:099:x: ************************************************************* + * TODO:199:x: ************************************************************* + * TODO:299:x: ************************************************************* + * TODO:399:x: ************************************************************* + * TODO:499:x: ************************************************************* + */ + +#ifdef __cplusplus +} +#endif +#endif /* IPV6INTERFACETABLE_H */ +/** @} */ + diff --git a/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_constants.h b/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_constants.h new file mode 100644 index 0000000..bee70bd --- /dev/null +++ b/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_constants.h @@ -0,0 +1,104 @@ +/* + * Note: this file originally auto-generated by mib2c using + * : generic-table-constants.m2c,v 1.5 2005/07/15 22:41:16 rstory Exp $ + * + * $Id: ipv6InterfaceTable_constants.h 13897 2005-12-10 01:56:01Z rstory $ + */ +#ifndef IPV6INTERFACETABLE_CONSTANTS_H +#define IPV6INTERFACETABLE_CONSTANTS_H + +#ifdef __cplusplus +extern "C" { +#endif + + + /* + * column number definitions for table ipv6InterfaceTable + */ +#define IPV6INTERFACETABLELASTCHANGE_OID 1,3,6,1,2,1,4,29 +#define IPV6INTERFACETABLE_OID 1,3,6,1,2,1,4,30 + +#define COLUMN_IPV6INTERFACEIFINDEX 1 + +#define COLUMN_IPV6INTERFACEREASMMAXSIZE 2 + +#define COLUMN_IPV6INTERFACEIDENTIFIER 3 + +#define COLUMN_IPV6INTERFACEENABLESTATUS 5 +#define COLUMN_IPV6INTERFACEENABLESTATUS_FLAG (0x1 << 4) + +#define COLUMN_IPV6INTERFACEREACHABLETIME 6 + +#define COLUMN_IPV6INTERFACERETRANSMITTIME 7 + +#define COLUMN_IPV6INTERFACEFORWARDING 8 +#define COLUMN_IPV6INTERFACEFORWARDING_FLAG (0x1 << 7) + + +#define IPV6INTERFACETABLE_MIN_COL COLUMN_IPV6INTERFACEREASMMAXSIZE +#define IPV6INTERFACETABLE_MAX_COL COLUMN_IPV6INTERFACEFORWARDING + + + /* + * TODO:405:r: Review IPV6INTERFACETABLE_SETTABLE_COLS macro. + * OR together all the writable cols. + */ +#define IPV6INTERFACETABLE_SETTABLE_COLS (COLUMN_IPV6INTERFACEENABLESTATUS_FLAG | COLUMN_IPV6INTERFACEFORWARDING_FLAG) + /* + * NOTES on enums + * ============== + * + * Value Mapping + * ------------- + * If the values for your data type don't exactly match the + * possible values defined by the mib, you should map them + * below. For example, a boolean flag (1/0) is usually represented + * as a TruthValue in a MIB, which maps to the values (1/2). + * + */ +/************************************************************************* + ************************************************************************* + * + * enum definitions for table ipv6InterfaceTable + * + ************************************************************************* + *************************************************************************/ + +/************************************************************* + * constants for enums for the MIB node + * ipv6InterfaceEnableStatus (INTEGER / ASN_INTEGER) + * + * since a Textual Convention may be referenced more than once in a + * MIB, protect againt redefinitions of the enum values. + */ +#ifndef IPV6INTERFACEENABLESTATUS_ENUMS +#define IPV6INTERFACEENABLESTATUS_ENUMS + +#define IPV6INTERFACEENABLESTATUS_UP 1 +#define IPV6INTERFACEENABLESTATUS_DOWN 2 + +#endif /* IPV6INTERFACEENABLESTATUS_ENUMS */ + + +/************************************************************* + * constants for enums for the MIB node + * ipv6InterfaceForwarding (INTEGER / ASN_INTEGER) + * + * since a Textual Convention may be referenced more than once in a + * MIB, protect againt redefinitions of the enum values. + */ +#ifndef IPV6INTERFACEFORWARDING_ENUMS +#define IPV6INTERFACEFORWARDING_ENUMS + +#define IPV6INTERFACEFORWARDING_FORWARDING 1 +#define IPV6INTERFACEFORWARDING_NOTFORWARDING 2 + +#endif /* IPV6INTERFACEFORWARDING_ENUMS */ + + + + +#ifdef __cplusplus +} +#endif +#endif /* IPV6INTERFACETABLE_OIDS_H */ diff --git a/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_data_access.c b/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_data_access.c new file mode 100644 index 0000000..cf4568e --- /dev/null +++ b/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_data_access.c @@ -0,0 +1,390 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.17 $ of : mfd-data-access.m2c,v $ + * + * $Id: ipv6InterfaceTable_data_access.c 15205 2006-09-14 17:15:32Z rstory $ + */ +/* + * standard Net-SNMP includes + */ +#include <net-snmp/net-snmp-config.h> +#include <net-snmp/net-snmp-includes.h> +#include <net-snmp/agent/net-snmp-agent-includes.h> + +/* + * include our parent header + */ +#include "ipv6InterfaceTable.h" + + +#include "ipv6InterfaceTable_data_access.h" + +/** @ingroup interface + * @addtogroup data_access data_access: Routines to access data + * + * These routines are used to locate the data used to satisfy + * requests. + * + * @{ + */ +/********************************************************************** + ********************************************************************** + *** + *** Table ipv6InterfaceTable + *** + ********************************************************************** + **********************************************************************/ +/* + * IP-MIB::ipv6InterfaceTable is subid 30 of ip. + * Its status is Current. + * OID: .1.3.6.1.2.1.4.30, length: 8 + */ + +/** + * initialization for ipv6InterfaceTable data access + * + * This function is called during startup to allow you to + * allocate any resources you need for the data table. + * + * @param ipv6InterfaceTable_reg + * Pointer to ipv6InterfaceTable_registration + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : unrecoverable error. + */ +int +ipv6InterfaceTable_init_data(ipv6InterfaceTable_registration * + ipv6InterfaceTable_reg) +{ + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_init_data", + "called\n")); + + /* + * TODO:303:o: Initialize ipv6InterfaceTable data. + */ + + return MFD_SUCCESS; +} /* ipv6InterfaceTable_init_data */ + +/** + * container overview + * + */ + +/** + * container initialization + * + * @param container_ptr_ptr A pointer to a container pointer. If you + * create a custom container, use this parameter to return it + * to the MFD helper. If set to NULL, the MFD helper will + * allocate a container for you. + * + * This function is called at startup to allow you to customize certain + * aspects of the access method. For the most part, it is for advanced + * users. The default code should suffice for most cases. If no custom + * container is allocated, the MFD code will create one for your. + * + * @remark + * This would also be a good place to do any initialization needed + * for you data source. For example, opening a connection to another + * process that will supply the data, opening a database, etc. + */ +void +ipv6InterfaceTable_container_init(netsnmp_container **container_ptr_ptr) +{ + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_container_init", "called\n")); + + if (NULL == container_ptr_ptr) { + snmp_log(LOG_ERR, + "bad container param to ipv6InterfaceTable_container_init\n"); + return; + } + + /* + * For advanced users, you can use a custom container. If you + * do not create one, one will be created for you. + */ + *container_ptr_ptr = NULL; + +} /* ipv6InterfaceTable_container_init */ + +/** + * @internal + * determine if we want a ifTable row in our container + */ +void +ipv6InterfaceTable_check_entry_for_updates(const ifTable_rowreq_ctx * + ift_rrc, + netsnmp_interface_entry *entry) +{ + netsnmp_container *c = ipv6InterfaceTable_container_get(); + ifTable_rowreq_ctx *ip6if_rrc; + int changed = 0; + + DEBUGMSGTL(("verbose:ipv6InterfaceTable:check_entry_for_updates", + "called\n")); + + /* + * do we have a corresponding row? + */ + ip6if_rrc = CONTAINER_FIND(c, ift_rrc); + if (NULL == ip6if_rrc) { + /* + * no corresponding row. should we have one? + */ + if ((NULL != entry) && + (entry->ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_IPV6)) { + /* + * yes. + */ + DEBUGMSGTL(("ipv6InterfaceTable:check_entry_for_updates", + "inserted row for index %d\n", entry->index)); + CONTAINER_INSERT(c, ift_rrc); + changed = 1; + } + } else { + /* + * found corresponding row. is it still applicable? + */ + if ((NULL == entry) || + (0 == (entry->ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_IPV6))) { + /* + * no + */ + DEBUGMSGTL(("ipv6InterfaceTable:check_entry_for_updates", + "removed row for index %d\n", + ift_rrc->data.ifentry->index)); + CONTAINER_REMOVE(c, ift_rrc); + changed = 1; + } else { + /* + * still applicable. anything changed? + */ + if (/** retransmit */ + ((entry-> + ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_RETRANSMIT) + && (entry->retransmit_v6 != + ift_rrc->data.ifentry->retransmit_v6)) || + /** reasm */ + ((entry-> + ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_REASMMAX) + && (entry->reasm_max_v6 != + ift_rrc->data.ifentry->reasm_max_v6)) || + /** reachable time */ + ((entry-> + ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_REACHABLE) + && (entry->reachable_time != + ift_rrc->data.ifentry->reachable_time)) || + /** if id */ + ((entry->ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_IFID) + && + ((entry->v6_if_id_len != + ift_rrc->data.ifentry->v6_if_id_len) + || (0 != + memcmp(entry->v6_if_id, + ift_rrc->data.ifentry->v6_if_id, + entry->v6_if_id_len)))) || + /** forwarding */ + ((entry-> + ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_FORWARDING) + && (entry->forwarding_v6 != + ift_rrc->data.ifentry->forwarding_v6))) { + DEBUGMSGTL(("ipv6InterfaceTable:check_entry_for_updates", + "row changed for index %d\n", + ift_rrc->data.ifentry->index)); + changed = 1; + } + } + } + + /* + * if something changed, update table last changed + */ + if (changed) + ipv6InterfaceTable_lastChange_set(netsnmp_get_agent_uptime()); +} + + +/** + * container shutdown + * + * @param container_ptr A pointer to the container. + * + * This function is called at shutdown to allow you to customize certain + * aspects of the access method. For the most part, it is for advanced + * users. The default code should suffice for most cases. + * + * This function is called before ipv6InterfaceTable_container_free(). + * + * @remark + * This would also be a good place to do any cleanup needed + * for you data source. For example, closing a connection to another + * process that supplied the data, closing a database, etc. + */ +void +ipv6InterfaceTable_container_shutdown(netsnmp_container *container_ptr) +{ + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_container_shutdown", "called\n")); + + if (NULL == container_ptr) { + snmp_log(LOG_ERR, + "bad params to ipv6InterfaceTable_container_shutdown\n"); + return; + } + +} /* ipv6InterfaceTable_container_shutdown */ + +/** + * load initial data + * + * TODO:350:M: Implement ipv6InterfaceTable data load + * + * @param container container to which items should be inserted + * + * @retval MFD_SUCCESS : success. + * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source + * @retval MFD_ERROR : other error. + * + * This function is called to load the index(es) (and data, optionally) + * for the every row in the data set. + * + * @remark + * While loading the data, the only important thing is the indexes. + * If access to your data is cheap/fast (e.g. you have a pointer to a + * structure in memory), it would make sense to update the data here. + * If, however, the accessing the data invovles more work (e.g. parsing + * some other existing data, or peforming calculations to derive the data), + * then you can limit yourself to setting the indexes and saving any + * information you will need later. Then use the saved information in + * ipv6InterfaceTable_row_prep() for populating data. + * + * @note + * If you need consistency between rows (like you want statistics + * for each row to be from the same time frame), you should set all + * data here. + * + */ +int +ipv6InterfaceTable_container_load(netsnmp_container *container) +{ + ipv6InterfaceTable_rowreq_ctx *rowreq_ctx; + size_t count = 0; + + /* + * temporary storage for index values + */ + /* + * ipv6InterfaceIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H + */ + long ipv6InterfaceIfIndex; + + + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_container_load", "called\n")); + + /* + * TODO:351:M: |-> Load/update data in the ipv6InterfaceTable container. + * loop over your ipv6InterfaceTable data, allocate a rowreq context, + * set the index(es) [and data, optionally] and insert into + * the container. + */ + while (1) { + /* + * check for end of data; bail out if there is no more data + */ + if (1) + break; + + /* + * TODO:352:M: | |-> set indexes in new ipv6InterfaceTable rowreq context. + * data context will be set from the param (unless NULL, + * in which case a new data context will be allocated) + */ + rowreq_ctx = ipv6InterfaceTable_allocate_rowreq_ctx(NULL); + if (NULL == rowreq_ctx) { + snmp_log(LOG_ERR, "memory allocation failed\n"); + return MFD_RESOURCE_UNAVAILABLE; + } + if (MFD_SUCCESS != + ipv6InterfaceTable_indexes_set(rowreq_ctx, + ipv6InterfaceIfIndex)) { + snmp_log(LOG_ERR, + "error setting index while loading " + "ipv6InterfaceTable data.\n"); + ipv6InterfaceTable_release_rowreq_ctx(rowreq_ctx); + continue; + } + + /* + * TODO:352:r: | |-> populate ipv6InterfaceTable data context. + * Populate data context here. (optionally, delay until row prep) + */ + /* + * non-TRANSIENT data: no need to copy. set pointer to data + */ + + /* + * insert into table container + */ + CONTAINER_INSERT(container, rowreq_ctx); + ++count; + } + + DEBUGMSGT(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_container_load", "inserted %d records\n", count)); + + return MFD_SUCCESS; +} /* ipv6InterfaceTable_container_load */ + +/** + * container clean up + * + * @param container container with all current items + * + * This optional callback is called prior to all + * item's being removed from the container. If you + * need to do any processing before that, do it here. + * + * @note + * The MFD helper will take care of releasing all the row contexts. + * + */ +void +ipv6InterfaceTable_container_free(netsnmp_container *container) +{ + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_container_free", "called\n")); + + /* + * TODO:380:M: Free ipv6InterfaceTable container data. + */ +} /* ipv6InterfaceTable_container_free */ + +/** + * prepare row for processing. + * + * When the agent has located the row for a request, this function is + * called to prepare the row for processing. If you fully populated + * the data context during the index setup phase, you may not need to + * do anything. + * + * @param rowreq_ctx pointer to a context. + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : other error. + */ +int +ipv6InterfaceTable_row_prep(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx) +{ + DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_row_prep", + "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * TODO:390:o: Prepare row for request. + * If populating row data was delayed, this is the place to + * fill in the row for this request. + */ + + return MFD_SUCCESS; +} /* ipv6InterfaceTable_row_prep */ + +/** @} */ diff --git a/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_data_access.h b/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_data_access.h new file mode 100644 index 0000000..4ff94dc --- /dev/null +++ b/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_data_access.h @@ -0,0 +1,92 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.17 $ of : mfd-data-access.m2c,v $ + * + * $Id: ipv6InterfaceTable_data_access.h 13770 2005-12-01 20:54:19Z rstory $ + */ +#ifndef IPV6INTERFACETABLE_DATA_ACCESS_H +#define IPV6INTERFACETABLE_DATA_ACCESS_H + +#ifdef __cplusplus +extern "C" { +#endif + + + /* + ********************************************************************* + * function declarations + */ + + /* + ********************************************************************* + * Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table ipv6InterfaceTable + *** + ********************************************************************** + **********************************************************************/ + /* + * IP-MIB::ipv6InterfaceTable is subid 30 of ip. + * Its status is Current. + * OID: .1.3.6.1.2.1.4.30, length: 8 + */ + + + int + + + + + + + + + + + + + + + + ipv6InterfaceTable_init_data(ipv6InterfaceTable_registration * + ipv6InterfaceTable_reg); + + + void ipv6InterfaceTable_container_init(netsnmp_container + **container_ptr_ptr); + void ipv6InterfaceTable_container_shutdown(netsnmp_container + *container_ptr); + + int ipv6InterfaceTable_container_load(netsnmp_container + *container); + void ipv6InterfaceTable_container_free(netsnmp_container + *container); + + int + + + + + + + + + + + + + + + + ipv6InterfaceTable_row_prep(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx); + + + +#ifdef __cplusplus +} +#endif +#endif /* IPV6INTERFACETABLE_DATA_ACCESS_H */ diff --git a/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_interface.c b/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_interface.c new file mode 100644 index 0000000..41a95f8 --- /dev/null +++ b/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_interface.c @@ -0,0 +1,1390 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.67 $ of : mfd-interface.m2c,v $ + * + * $Id: ipv6InterfaceTable_interface.c 15902 2007-02-27 13:36:15Z rstory $ + */ +/* + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + * *** *** + * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** + * *** *** + * *** *** + * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** + * *** *** + * *** *** + * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** + * *** *** + * *** *** + * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** + * *** *** + * *** *** + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + */ + +/* + * standard Net-SNMP includes + */ +#include <net-snmp/net-snmp-config.h> +#include <net-snmp/net-snmp-includes.h> +#include <net-snmp/agent/net-snmp-agent-includes.h> + +/* + * include our parent header + */ +#include "ipv6InterfaceTable.h" + + +#include <net-snmp/agent/table_container.h> +#include <net-snmp/library/container.h> + +#include "ipv6InterfaceTable_interface.h" + +#include "if-mib/ifTable/ifTable.h" + +#include <ctype.h> + +/********************************************************************** + ********************************************************************** + *** + *** Table ipv6InterfaceTable + *** + ********************************************************************** + **********************************************************************/ +/* + * IP-MIB::ipv6InterfaceTable is subid 30 of ip. + * Its status is Current. + * OID: .1.3.6.1.2.1.4.30, length: 8 + */ +typedef struct ipv6InterfaceTable_interface_ctx_s { + + netsnmp_container *container; + + ipv6InterfaceTable_registration *user_ctx; + + netsnmp_table_registration_info tbl_info; + + netsnmp_baby_steps_access_methods access_multiplexer; + + u_long last_changed; + +} ipv6InterfaceTable_interface_ctx; + +static ipv6InterfaceTable_interface_ctx ipv6InterfaceTable_if_ctx; + +static void + _ipv6InterfaceTable_container_init(ipv6InterfaceTable_interface_ctx * + if_ctx); +static void + _ipv6InterfaceTable_container_shutdown(ipv6InterfaceTable_interface_ctx * + if_ctx); + + +netsnmp_container * +ipv6InterfaceTable_container_get(void) +{ + return ipv6InterfaceTable_if_ctx.container; +} + +ipv6InterfaceTable_registration * +ipv6InterfaceTable_registration_get(void) +{ + return ipv6InterfaceTable_if_ctx.user_ctx; +} + +ipv6InterfaceTable_registration * +ipv6InterfaceTable_registration_set(ipv6InterfaceTable_registration * + newreg) +{ + ipv6InterfaceTable_registration *old = + ipv6InterfaceTable_if_ctx.user_ctx; + ipv6InterfaceTable_if_ctx.user_ctx = newreg; + return old; +} + +int +ipv6InterfaceTable_container_size(void) +{ + return CONTAINER_SIZE(ipv6InterfaceTable_if_ctx.container); +} + +u_int +ipv6InterfaceTable_dirty_get(void) +{ + return ifTable_dirty_get(); +} + +void +ipv6InterfaceTable_dirty_set(u_int status) +{ + ifTable_dirty_set(status); +} + +/* + * ipv6InterfaceTableLastChanged, which is the last time that a row in + * the table was changed or the last time a row was added/deleted from the + * table. + */ +void +ipv6InterfaceTable_lastChange_set(u_long table_changed) +{ + DEBUGMSGTL(("ipv6InterfaceTable:lastChanged_set", + "called. was %ld, now %ld\n", + ipv6InterfaceTable_if_ctx.last_changed, table_changed)); + ipv6InterfaceTable_if_ctx.last_changed = table_changed; +} + +/* + * mfd multiplexer modes + */ +static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_pre_request; +static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_post_request; +static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_object_lookup; +static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_get_values; +static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_check_objects; +static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_undo_setup; +static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_set_values; +static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_undo_cleanup; +static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_undo_values; +static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_commit; +static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_undo_commit; +static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_irreversible_commit; + +NETSNMP_STATIC_INLINE int + _ipv6InterfaceTable_undo_column(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, + netsnmp_variable_list * + var, int column); + +/** + * @internal + * Initialize the table ipv6InterfaceTable + * (Define its contents and how it's structured) + */ +void +_ipv6InterfaceTable_initialize_interface(ipv6InterfaceTable_registration * + reg_ptr, u_long flags) +{ + netsnmp_baby_steps_access_methods *access_multiplexer = + &ipv6InterfaceTable_if_ctx.access_multiplexer; + netsnmp_table_registration_info *tbl_info = + &ipv6InterfaceTable_if_ctx.tbl_info; + netsnmp_handler_registration *reginfo; + netsnmp_mib_handler *handler; + int mfd_modes = 0; + + DEBUGMSGTL(("internal:ipv6InterfaceTable:_ipv6InterfaceTable_initialize_interface", "called\n")); + + + /************************************************* + * + * save interface context for ipv6InterfaceTable + */ + /* + * Setting up the table's definition + */ + netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER, + /** index: ipv6InterfaceIfIndex */ + 0); + + /* + * Define the minimum and maximum accessible columns. This + * optimizes retrival. + */ + tbl_info->min_column = IPV6INTERFACETABLE_MIN_COL; + tbl_info->max_column = IPV6INTERFACETABLE_MAX_COL; + + /* + * save users context + */ + ipv6InterfaceTable_if_ctx.user_ctx = reg_ptr; + + /* + * call data access initialization code + */ + ipv6InterfaceTable_init_data(reg_ptr); + + /* + * set up the container + */ + _ipv6InterfaceTable_container_init(&ipv6InterfaceTable_if_ctx); + if (NULL == ipv6InterfaceTable_if_ctx.container) { + snmp_log(LOG_ERR, + "could not initialize container for ipv6InterfaceTable\n"); + return; + } + + /* + * access_multiplexer: REQUIRED wrapper for get request handling + */ + access_multiplexer->object_lookup = + _mfd_ipv6InterfaceTable_object_lookup; + access_multiplexer->get_values = _mfd_ipv6InterfaceTable_get_values; + + /* + * no wrappers yet + */ + access_multiplexer->pre_request = _mfd_ipv6InterfaceTable_pre_request; + access_multiplexer->post_request = + _mfd_ipv6InterfaceTable_post_request; + + + /* + * REQUIRED wrappers for set request handling + */ + access_multiplexer->object_syntax_checks = + _mfd_ipv6InterfaceTable_check_objects; + access_multiplexer->undo_setup = _mfd_ipv6InterfaceTable_undo_setup; + access_multiplexer->undo_cleanup = + _mfd_ipv6InterfaceTable_undo_cleanup; + access_multiplexer->set_values = _mfd_ipv6InterfaceTable_set_values; + access_multiplexer->undo_sets = _mfd_ipv6InterfaceTable_undo_values; + + /* + * no wrappers yet + */ + access_multiplexer->commit = _mfd_ipv6InterfaceTable_commit; + access_multiplexer->undo_commit = _mfd_ipv6InterfaceTable_undo_commit; + access_multiplexer->irreversible_commit = + _mfd_ipv6InterfaceTable_irreversible_commit; + + /************************************************* + * + * Create a registration, save our reg data, register table. + */ + DEBUGMSGTL(("ipv6InterfaceTable:init_ipv6InterfaceTable", + "Registering ipv6InterfaceTable as a mibs-for-dummies table.\n")); + handler = + netsnmp_baby_steps_access_multiplexer_get(access_multiplexer); + reginfo = + netsnmp_handler_registration_create("ipv6InterfaceTable", handler, + ipv6InterfaceTable_oid, + ipv6InterfaceTable_oid_size, + HANDLER_CAN_BABY_STEP | + HANDLER_CAN_RWRITE); + if (NULL == reginfo) { + snmp_log(LOG_ERR, "error registering table ipv6InterfaceTable\n"); + return; + } + reginfo->my_reg_void = &ipv6InterfaceTable_if_ctx; + + /************************************************* + * + * set up baby steps handler, create it and inject it + */ + if (access_multiplexer->object_lookup) + mfd_modes |= BABY_STEP_OBJECT_LOOKUP; + if (access_multiplexer->set_values) + mfd_modes |= BABY_STEP_SET_VALUES; + if (access_multiplexer->irreversible_commit) + mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT; + if (access_multiplexer->object_syntax_checks) + mfd_modes |= BABY_STEP_CHECK_OBJECT; + + if (access_multiplexer->pre_request) + mfd_modes |= BABY_STEP_PRE_REQUEST; + if (access_multiplexer->post_request) + mfd_modes |= BABY_STEP_POST_REQUEST; + + if (access_multiplexer->undo_setup) + mfd_modes |= BABY_STEP_UNDO_SETUP; + if (access_multiplexer->undo_cleanup) + mfd_modes |= BABY_STEP_UNDO_CLEANUP; + if (access_multiplexer->undo_sets) + mfd_modes |= BABY_STEP_UNDO_SETS; + + if (access_multiplexer->row_creation) + mfd_modes |= BABY_STEP_ROW_CREATE; + if (access_multiplexer->consistency_checks) + mfd_modes |= BABY_STEP_CHECK_CONSISTENCY; + if (access_multiplexer->commit) + mfd_modes |= BABY_STEP_COMMIT; + if (access_multiplexer->undo_commit) + mfd_modes |= BABY_STEP_UNDO_COMMIT; + + handler = netsnmp_baby_steps_handler_get(mfd_modes); + netsnmp_inject_handler(reginfo, handler); + + /************************************************* + * + * inject row_merge helper with prefix rootoid_len + 2 (entry.col) + */ + handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2); + netsnmp_inject_handler(reginfo, handler); + + /************************************************* + * + * inject container_table helper + */ + handler = + netsnmp_container_table_handler_get(tbl_info, + ipv6InterfaceTable_if_ctx. + container, + TABLE_CONTAINER_KEY_NETSNMP_INDEX); + netsnmp_inject_handler(reginfo, handler); + + /* + * register table + */ + netsnmp_register_table(reginfo, tbl_info); + + /* + * register LastChanged + */ + { + oid lc_oid[] = { IPV6INTERFACETABLELASTCHANGE_OID }; + netsnmp_register_watched_scalar(netsnmp_create_handler_registration + ("ipv6TableLastChanged", NULL, + lc_oid, OID_LENGTH(lc_oid), + HANDLER_CAN_RONLY), + netsnmp_create_watcher_info((void + *) + &ipv6InterfaceTable_if_ctx. + last_changed, + sizeof + (u_long), + ASN_TIMETICKS, + WATCHER_FIXED_SIZE)); + } +} /* _ipv6InterfaceTable_initialize_interface */ + +/** + * @internal + * Shutdown the table ipv6InterfaceTable + */ +void +_ipv6InterfaceTable_shutdown_interface(ipv6InterfaceTable_registration * + reg_ptr) +{ + /* + * shutdown the container + */ + _ipv6InterfaceTable_container_shutdown(&ipv6InterfaceTable_if_ctx); +} + +void +ipv6InterfaceTable_valid_columns_set(netsnmp_column_info *vc) +{ + ipv6InterfaceTable_if_ctx.tbl_info.valid_columns = vc; +} /* ipv6InterfaceTable_valid_columns_set */ + +/** + * @internal + * wrapper + */ +static int +_mfd_ipv6InterfaceTable_pre_request(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + int rc; + + DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_pre_request", "called\n")); + + if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) { + DEBUGMSGTL(("internal:ipv6InterfaceTable", + "skipping additional pre_request\n")); + return SNMP_ERR_NOERROR; + } + + rc = ipv6InterfaceTable_pre_request(ipv6InterfaceTable_if_ctx. + user_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("ipv6InterfaceTable", "error %d from " + "ipv6InterfaceTable_pre_request\n", rc)); + netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); + } + + return SNMP_ERR_NOERROR; +} /* _mfd_ipv6InterfaceTable_pre_request */ + +/** + * @internal + * wrapper + */ +static int +_mfd_ipv6InterfaceTable_post_request(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + int rc, packet_rc; + + DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_post_request", "called\n")); + + /* + * wait for last call before calling user + */ + if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) { + DEBUGMSGTL(("internal:ipv6InterfaceTable", + "waiting for last post_request\n")); + return SNMP_ERR_NOERROR; + } + + packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0); + if ((MFD_SUCCESS != packet_rc) && ipv6InterfaceTable_dirty_get()) { + /* + * we shouldn't get here. the undo steps should also clear + * the dirty flags. + */ + snmp_log(LOG_WARNING, + "ipv6InterfaceTable dirty flag set in post_request " + "but status != SUCCESS.\n"); + } + + rc = ipv6InterfaceTable_post_request(ipv6InterfaceTable_if_ctx. + user_ctx, packet_rc); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("ipv6InterfaceTable", "error %d from " + "ipv6InterfaceTable_post_request\n", rc)); + } + + return SNMP_ERR_NOERROR; +} /* _mfd_ipv6InterfaceTable_post_request */ + +/** + * @internal + * wrapper + */ +static int +_mfd_ipv6InterfaceTable_object_lookup(netsnmp_mib_handler *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + int rc = SNMP_ERR_NOERROR; + ipv6InterfaceTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + + DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_object_lookup", "called\n")); + + /* + * get our context from mfd + * ipv6InterfaceTable_interface_ctx *if_ctx = + * (ipv6InterfaceTable_interface_ctx *)reginfo->my_reg_void; + */ + + if (NULL == rowreq_ctx) { + rc = SNMP_ERR_NOCREATION; + } + + if (MFD_SUCCESS != rc) + netsnmp_request_set_error_all(requests, rc); + else + ipv6InterfaceTable_row_prep(rowreq_ctx); + + return SNMP_VALIDATE_ERR(rc); +} /* _mfd_ipv6InterfaceTable_object_lookup */ + +/*********************************************************************** + * + * GET processing + * + ***********************************************************************/ +/* + * @internal + * Retrieve the value for a particular column + */ +NETSNMP_STATIC_INLINE int +_ipv6InterfaceTable_get_column(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, + netsnmp_variable_list * var, int column) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_get_column", "called for %d\n", column)); + + + netsnmp_assert(NULL != rowreq_ctx); + + switch (column) { + + /* + * ipv6InterfaceReasmMaxSize(2)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/R/d/h + */ + case COLUMN_IPV6INTERFACEREASMMAXSIZE: + var->val_len = sizeof(u_long); + var->type = ASN_UNSIGNED; + rc = ipv6InterfaceReasmMaxSize_get(rowreq_ctx, + (u_long *) var->val.string); + break; + + /* + * ipv6InterfaceIdentifier(3)/Ipv6AddressIfIdentifierTC/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H + */ + case COLUMN_IPV6INTERFACEIDENTIFIER: + var->type = ASN_OCTET_STR; + rc = ipv6InterfaceIdentifier_get(rowreq_ctx, + (char **) &var->val.string, + &var->val_len); + break; + + /* + * ipv6InterfaceEnableStatus(5)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_IPV6INTERFACEENABLESTATUS: + var->val_len = sizeof(u_long); + var->type = ASN_INTEGER; + rc = ipv6InterfaceEnableStatus_get(rowreq_ctx, + (u_long *) var->val.string); + break; + + /* + * ipv6InterfaceReachableTime(6)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h + */ + case COLUMN_IPV6INTERFACEREACHABLETIME: + var->val_len = sizeof(u_long); + var->type = ASN_UNSIGNED; + rc = ipv6InterfaceReachableTime_get(rowreq_ctx, + (u_long *) var->val.string); + break; + + /* + * ipv6InterfaceRetransmitTime(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h + */ + case COLUMN_IPV6INTERFACERETRANSMITTIME: + var->val_len = sizeof(u_long); + var->type = ASN_UNSIGNED; + rc = ipv6InterfaceRetransmitTime_get(rowreq_ctx, + (u_long *) var->val.string); + break; + + /* + * ipv6InterfaceForwarding(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_IPV6INTERFACEFORWARDING: + var->val_len = sizeof(u_long); + var->type = ASN_INTEGER; + rc = ipv6InterfaceForwarding_get(rowreq_ctx, + (u_long *) var->val.string); + break; + + default: + if (COLUMN_IPV6INTERFACEREASMMAXSIZE <= column && column <= COLUMN_IPV6INTERFACEFORWARDING) { + DEBUGMSGTL(("internal:${context}:_ipv6InterfaceTable_get_column", + "assume column %d is reserved\n", column)); + rc = MFD_SKIP; + } else { + snmp_log(LOG_ERR, + "unknown column %d in _ipv6InterfaceTable_get_column\n", + column); + } + break; + } + + return rc; +} /* _ipv6InterfaceTable_get_column */ + +int +_mfd_ipv6InterfaceTable_get_values(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + ipv6InterfaceTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + netsnmp_table_request_info *tri; + u_char *old_string; + void (*dataFreeHook) (void *); + int rc; + + DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_get_values", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + for (; requests; requests = requests->next) { + /* + * save old pointer, so we can free it if replaced + */ + old_string = requests->requestvb->val.string; + dataFreeHook = requests->requestvb->dataFreeHook; + if (NULL == requests->requestvb->val.string) { + requests->requestvb->val.string = requests->requestvb->buf; + requests->requestvb->val_len = + sizeof(requests->requestvb->buf); + } else if (requests->requestvb->buf == + requests->requestvb->val.string) { + if (requests->requestvb->val_len != + sizeof(requests->requestvb->buf)) + requests->requestvb->val_len = + sizeof(requests->requestvb->buf); + } + + /* + * get column data + */ + tri = netsnmp_extract_table_info(requests); + if (NULL == tri) + continue; + + rc = _ipv6InterfaceTable_get_column(rowreq_ctx, + requests->requestvb, + tri->colnum); + if (rc) { + if (MFD_SKIP == rc) { + requests->requestvb->type = SNMP_NOSUCHINSTANCE; + rc = SNMP_ERR_NOERROR; + } + } else if (NULL == requests->requestvb->val.string) { + snmp_log(LOG_ERR, "NULL varbind data pointer!\n"); + rc = SNMP_ERR_GENERR; + } + if (rc) + netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc)); + + /* + * if the buffer wasn't used previously for the old data (i.e. it + * was allcoated memory) and the get routine replaced the pointer, + * we need to free the previous pointer. + */ + if (old_string && (old_string != requests->requestvb->buf) && + (requests->requestvb->val.string != old_string)) { + if (dataFreeHook) + (*dataFreeHook) (old_string); + else + free(old_string); + } + } /* for results */ + + return SNMP_ERR_NOERROR; +} /* _mfd_ipv6InterfaceTable_get_values */ + + +/*********************************************************************** + * + * SET processing + * + ***********************************************************************/ + +/*---------------------------------------------------------------------- + * + * SET: Syntax checks + * + *---------------------------------------------------------------------*/ +/* + * @internal + * Check the syntax for a particular column + */ +NETSNMP_STATIC_INLINE int +_ipv6InterfaceTable_check_column(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, netsnmp_variable_list * var, + int column) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:ipv6InterfaceTable:_ipv6InterfaceTable_check_column", "called for %d\n", column)); + + netsnmp_assert(NULL != rowreq_ctx); + + switch (column) { + /* + * (INDEX) ipv6InterfaceIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H + */ + case COLUMN_IPV6INTERFACEIFINDEX: + rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */ + break; + + /* + * ipv6InterfaceReasmMaxSize(2)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/R/d/h + */ + case COLUMN_IPV6INTERFACEREASMMAXSIZE: + rc = SNMP_ERR_NOTWRITABLE; + break; + + /* + * ipv6InterfaceIdentifier(3)/Ipv6AddressIfIdentifierTC/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H + */ + case COLUMN_IPV6INTERFACEIDENTIFIER: + rc = SNMP_ERR_NOTWRITABLE; + break; + + /* + * ipv6InterfaceEnableStatus(5)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_IPV6INTERFACEENABLESTATUS: + rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER, + sizeof(rowreq_ctx->data. + ipv6InterfaceEnableStatus)); + /* + * check that the value is one of defined enums + */ + if ((SNMPERR_SUCCESS == rc) + && (*var->val.integer != IPV6INTERFACEENABLESTATUS_UP) + && (*var->val.integer != IPV6INTERFACEENABLESTATUS_DOWN) + ) { + rc = SNMP_ERR_WRONGVALUE; + } + if (SNMPERR_SUCCESS != rc) { + DEBUGMSGTL(("ipv6InterfaceTable:_ipv6InterfaceTable_check_column:ipv6InterfaceEnableStatus", "varbind validation failed (eg bad type or size)\n")); + } else { + rc = ipv6InterfaceEnableStatus_check_value(rowreq_ctx, + *((u_long *) var-> + val.string)); + if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc) + && (MFD_NOT_VALID_NOW != rc)) { + snmp_log(LOG_ERR, + "bad rc %d from ipv6InterfaceEnableStatus_check_value\n", + rc); + rc = SNMP_ERR_GENERR; + } + } + break; + + /* + * ipv6InterfaceReachableTime(6)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h + */ + case COLUMN_IPV6INTERFACEREACHABLETIME: + rc = SNMP_ERR_NOTWRITABLE; + break; + + /* + * ipv6InterfaceRetransmitTime(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h + */ + case COLUMN_IPV6INTERFACERETRANSMITTIME: + rc = SNMP_ERR_NOTWRITABLE; + break; + + /* + * ipv6InterfaceForwarding(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_IPV6INTERFACEFORWARDING: + rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER, + sizeof(rowreq_ctx->data. + ipv6InterfaceForwarding)); + /* + * check that the value is one of defined enums + */ + if ((SNMPERR_SUCCESS == rc) + && (*var->val.integer != IPV6INTERFACEFORWARDING_FORWARDING) + && (*var->val.integer != IPV6INTERFACEFORWARDING_NOTFORWARDING) + ) { + rc = SNMP_ERR_WRONGVALUE; + } + if (SNMPERR_SUCCESS != rc) { + DEBUGMSGTL(("ipv6InterfaceTable:_ipv6InterfaceTable_check_column:ipv6InterfaceForwarding", "varbind validation failed (eg bad type or size)\n")); + } else { + rc = ipv6InterfaceForwarding_check_value(rowreq_ctx, + *((u_long *) var->val. + string)); + if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc) + && (MFD_NOT_VALID_NOW != rc)) { + snmp_log(LOG_ERR, + "bad rc %d from ipv6InterfaceForwarding_check_value\n", + rc); + rc = SNMP_ERR_GENERR; + } + } + break; + + default: /** We shouldn't get here */ + rc = SNMP_ERR_GENERR; + snmp_log(LOG_ERR, + "unknown column %d in _ipv6InterfaceTable_check_column\n", + column); + } + + return rc; +} /* _ipv6InterfaceTable_check_column */ + +int +_mfd_ipv6InterfaceTable_check_objects(netsnmp_mib_handler *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + ipv6InterfaceTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + netsnmp_table_request_info *tri; + int rc; + + DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_check_objects", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + for (; requests; requests = requests->next) { + + /* + * get column number from table request info, and check that column + */ + tri = netsnmp_extract_table_info(requests); + if (NULL == tri) + continue; + + rc = _ipv6InterfaceTable_check_column(rowreq_ctx, + requests->requestvb, + tri->colnum); + if (rc) { + netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc)); + break; + } + + } /* for results */ + + return SNMP_ERR_NOERROR; +} /* _mfd_ipv6InterfaceTable_check_objects */ + + +/*---------------------------------------------------------------------- + * + * SET: Undo setup + * + *---------------------------------------------------------------------*/ +/* + * @internal + * Set the value for a particular column + */ +NETSNMP_STATIC_INLINE int +_ipv6InterfaceTable_undo_setup_column(ipv6InterfaceTable_rowreq_ctx * + rowreq_ctx, int column) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:ipv6InterfaceTable:_ipv6InterfaceTable_undo_setup_column", "called for %d\n", column)); + + netsnmp_assert(NULL != rowreq_ctx); + + switch (column) { + + /* + * ipv6InterfaceEnableStatus(5)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_IPV6INTERFACEENABLESTATUS: + rowreq_ctx->column_set_flags |= + COLUMN_IPV6INTERFACEENABLESTATUS_FLAG; + rc = ipv6InterfaceEnableStatus_undo_setup(rowreq_ctx); + break; + + /* + * ipv6InterfaceForwarding(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_IPV6INTERFACEFORWARDING: + rowreq_ctx->column_set_flags |= + COLUMN_IPV6INTERFACEFORWARDING_FLAG; + rc = ipv6InterfaceForwarding_undo_setup(rowreq_ctx); + break; + + default: + snmp_log(LOG_ERR, + "unknown column %d in _ipv6InterfaceTable_undo_setup_column\n", + column); + break; + } + + return rc; +} /* _ipv6InterfaceTable_undo_setup_column */ + + +/** + * @internal + * undo setup + */ +int +_mfd_ipv6InterfaceTable_undo_setup(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + int rc; + ipv6InterfaceTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + + DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_undo_setup", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * allocate undo context + */ + rc = _mfd_ifTable_undo_setup_allocate(rowreq_ctx); + if (MFD_SUCCESS != rc) { + netsnmp_request_set_error_all(requests,rc); + return SNMP_ERR_NOERROR; + } + + /* + * row undo setup + */ + rc = ipv6InterfaceTable_undo_setup(rowreq_ctx); + if (MFD_SUCCESS != rc) { + DEBUGMSGTL(("ipv6InterfaceTable:mfd", "error %d from " + "ipv6InterfaceTable_undo_setup\n", rc)); + netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); + } else { + /* + * column undo setup + */ + netsnmp_table_request_info *tri; + for (; requests; requests = requests->next) { + /* + * set column data + */ + tri = netsnmp_extract_table_info(requests); + if (NULL == tri) + continue; + + rc = _ipv6InterfaceTable_undo_setup_column(rowreq_ctx, + tri->colnum); + if (MFD_SUCCESS != rc) { + DEBUGMSGTL(("ipv6InterfaceTable:mfd", "error %d from " + "ipv6InterfaceTable_undo_setup_column\n", rc)); + netsnmp_set_request_error(agtreq_info, requests, + SNMP_VALIDATE_ERR(rc)); + } + } /* for results */ + } + + return SNMP_ERR_NOERROR; +} /* _mfd_ipv6InterfaceTable_undo_setup */ + +/** + * @internal + * undo setup + */ +int +_mfd_ipv6InterfaceTable_undo_cleanup(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + ipv6InterfaceTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + int rc; + + DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_undo_cleanup", "called\n")); + + /* + * failed row create in early stages has no rowreq_ctx + */ + if (NULL == rowreq_ctx) + return MFD_SUCCESS; + + /* + * call user cleanup + */ + rc = ipv6InterfaceTable_undo_cleanup(rowreq_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("ipv6InterfaceTable:mfd", "error %d from " + "ipv6InterfaceTable_undo_cleanup\n", rc)); + } + + /* + * release undo context, if needed + */ + _mfd_ifTable_undo_setup_release(rowreq_ctx); + + return SNMP_ERR_NOERROR; +} /* _mfd_ipv6InterfaceTable_undo_cleanup */ + +/*---------------------------------------------------------------------- + * + * SET: Set values + * + *---------------------------------------------------------------------*/ +/* + * @internal + * Set the value for a particular column + */ +NETSNMP_STATIC_INLINE int +_ipv6InterfaceTable_set_column(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, + netsnmp_variable_list * var, int column) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:ipv6InterfaceTable:_ipv6InterfaceTable_set_column", "called for %d\n", column)); + + netsnmp_assert(NULL != rowreq_ctx); + + switch (column) { + + /* + * ipv6InterfaceEnableStatus(5)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_IPV6INTERFACEENABLESTATUS: + rowreq_ctx->column_set_flags |= + COLUMN_IPV6INTERFACEENABLESTATUS_FLAG; + rc = ipv6InterfaceEnableStatus_set(rowreq_ctx, + *((u_long *) var->val.string)); + break; + + /* + * ipv6InterfaceForwarding(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_IPV6INTERFACEFORWARDING: + rowreq_ctx->column_set_flags |= + COLUMN_IPV6INTERFACEFORWARDING_FLAG; + rc = ipv6InterfaceForwarding_set(rowreq_ctx, + *((u_long *) var->val.string)); + break; + + default: + snmp_log(LOG_ERR, + "unknown column %d in _ipv6InterfaceTable_set_column\n", + column); + rc = SNMP_ERR_GENERR; + break; + } + + return rc; +} /* _ipv6InterfaceTable_set_column */ + +int +_mfd_ipv6InterfaceTable_set_values(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + ipv6InterfaceTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + netsnmp_table_request_info *tri; + int rc = SNMP_ERR_NOERROR; + + DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_set_values", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + rowreq_ctx->column_set_flags = 0; + for (; requests; requests = requests->next) { + /* + * set column data + */ + tri = netsnmp_extract_table_info(requests); + if (NULL == tri) + continue; + + rc = _ipv6InterfaceTable_set_column(rowreq_ctx, + requests->requestvb, + tri->colnum); + if (MFD_SUCCESS != rc) { + DEBUGMSGTL(("ipv6InterfaceTable:mfd", "error %d from " + "ipv6InterfaceTable_set_column\n", rc)); + netsnmp_set_request_error(agtreq_info, requests, + SNMP_VALIDATE_ERR(rc)); + } + } /* for results */ + + return SNMP_ERR_NOERROR; +} /* _mfd_ipv6InterfaceTable_set_values */ + +/*---------------------------------------------------------------------- + * + * SET: commit + * + *---------------------------------------------------------------------*/ +/** + * @internal + * commit the values + */ +int +_mfd_ipv6InterfaceTable_commit(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + int rc; + ipv6InterfaceTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + + DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_commit", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + rc = ipv6InterfaceTable_commit(rowreq_ctx); + if (MFD_SUCCESS != rc) { + DEBUGMSGTL(("ipv6InterfaceTable:mfd", "error %d from " + "ipv6InterfaceTable_commit\n", rc)); + netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); + } + + if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) { + /* + * if we successfully commited this row, set the dirty flag. Use the + * current value + 1 (i.e. dirty = # rows changed). + * this is checked in post_request... + */ + ipv6InterfaceTable_dirty_set(ipv6InterfaceTable_dirty_get() + 1); /* set table dirty flag */ + } + + return SNMP_ERR_NOERROR; +} + +int +_mfd_ipv6InterfaceTable_undo_commit(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + int rc; + ipv6InterfaceTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + + DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_undo_commit", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) { + u_int d = ipv6InterfaceTable_dirty_get(); + + netsnmp_assert(d != 0); + if (d) + ipv6InterfaceTable_dirty_set(d - 1); + } + + rc = ipv6InterfaceTable_undo_commit(rowreq_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("ipv6InterfaceTable:mfd", "error %d from " + "ipv6InterfaceTable_undo_commit\n", rc)); + } + + if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) { + snmp_log(LOG_WARNING, + "ipv6InterfaceTable row dirty flag still set after undo_commit\n"); + rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY; + } + + return SNMP_ERR_NOERROR; +} /* _mfd_ipv6InterfaceTable_commit */ + +/*---------------------------------------------------------------------- + * + * SET: Undo + * + *---------------------------------------------------------------------*/ +/** + * @internal + * undo the value for a particular column + */ +NETSNMP_STATIC_INLINE int +_ipv6InterfaceTable_undo_column(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, + netsnmp_variable_list * var, int column) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:ipv6InterfaceTable:_ipv6InterfaceTable_undo_column", "called for %d\n", column)); + + netsnmp_assert(NULL != rowreq_ctx); + + switch (column) { + + /* + * ipv6InterfaceEnableStatus(5)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_IPV6INTERFACEENABLESTATUS: + rc = ipv6InterfaceEnableStatus_undo(rowreq_ctx); + break; + + /* + * ipv6InterfaceForwarding(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h + */ + case COLUMN_IPV6INTERFACEFORWARDING: + rc = ipv6InterfaceForwarding_undo(rowreq_ctx); + break; + + default: + snmp_log(LOG_ERR, + "unknown column %d in _ipv6InterfaceTable_undo_column\n", + column); + break; + } + + return rc; +} /* _ipv6InterfaceTable_undo_column */ + +int +_mfd_ipv6InterfaceTable_undo_values(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + int rc; + ipv6InterfaceTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + netsnmp_table_request_info *tri; + + DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_undo_values", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + rc = ipv6InterfaceTable_undo(rowreq_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("ipv6InterfaceTable:mfd", "error %d from " + "ipv6InterfaceTable_undo\n", rc)); + } + + for (; requests; requests = requests->next) { + /* + * set column data + */ + tri = netsnmp_extract_table_info(requests); + if (NULL == tri) + continue; + + rc = _ipv6InterfaceTable_undo_column(rowreq_ctx, + requests->requestvb, + tri->colnum); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("ipv6InterfaceTable:mfd", "error %d from " + "ipv6InterfaceTable_undo_column\n", rc)); + } + } /* for results */ + + return SNMP_ERR_NOERROR; +} /* _mfd_ipv6InterfaceTable_undo_values */ + +/*---------------------------------------------------------------------- + * + * SET: irreversible commit + * + *---------------------------------------------------------------------*/ +/** + * @internal + * commit irreversible actions + */ +int +_mfd_ipv6InterfaceTable_irreversible_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration + *reginfo, netsnmp_agent_request_info + *agtreq_info, + netsnmp_request_info *requests) +{ + ipv6InterfaceTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + + DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_irreversible:commit", "called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + /* + * check for and handle row creation/deletion + * and update column exist flags... + */ + if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) { + CONTAINER_REMOVE(ipv6InterfaceTable_if_ctx.container, rowreq_ctx); + } else { + if (rowreq_ctx->column_set_flags) { + rowreq_ctx->column_set_flags = 0; + } + } + + return SNMP_ERR_NOERROR; +} /* _mfd_ipv6InterfaceTable_irreversible_commit */ + +/*********************************************************************** + * + * DATA ACCESS + * + ***********************************************************************/ +/** + * @internal + */ +static void +_container_free(netsnmp_container *container) +{ + DEBUGMSGTL(("internal:ipv6InterfaceTable:_container_free", + "called\n")); + + if (NULL == container) { + snmp_log(LOG_ERR, + "invalid container in ipv6InterfaceTable_container_free\n"); + return; + } + + /* + * call user code + */ + ipv6InterfaceTable_container_free(container); +} /* _container_free */ + +/** + * @internal + * initialize the container with functions or wrappers + */ +void +_ipv6InterfaceTable_container_init(ipv6InterfaceTable_interface_ctx * + if_ctx) +{ + DEBUGMSGTL(("internal:ipv6InterfaceTable:_ipv6InterfaceTable_container_init", "called\n")); + + /* + * container init + */ + ipv6InterfaceTable_container_init(&if_ctx->container); + if (NULL == if_ctx->container) + if_ctx->container = + netsnmp_container_find("ipv6InterfaceTable:table_container"); + if (NULL == if_ctx->container) { + snmp_log(LOG_ERR, "error creating container in " + "ipv6InterfaceTable_container_init\n"); + return; + } + +} /* _ipv6InterfaceTable_container_init */ + +/** + * @internal + * shutdown the container with functions or wrappers + */ +void +_ipv6InterfaceTable_container_shutdown(ipv6InterfaceTable_interface_ctx * + if_ctx) +{ + DEBUGMSGTL(("internal:ipv6InterfaceTable:_ipv6InterfaceTable_container_shutdown", "called\n")); + + ipv6InterfaceTable_container_shutdown(if_ctx->container); + + _container_free(if_ctx->container); + +} /* _ipv6InterfaceTable_container_shutdown */ + + +ipv6InterfaceTable_rowreq_ctx * +ipv6InterfaceTable_row_find_by_mib_index(ipv6InterfaceTable_mib_index * + mib_idx) +{ + ipv6InterfaceTable_rowreq_ctx *rowreq_ctx; + oid oid_tmp[MAX_OID_LEN]; + netsnmp_index oid_idx; + int rc; + + /* + * set up storage for OID + */ + oid_idx.oids = oid_tmp; + oid_idx.len = sizeof(oid_tmp) / sizeof(oid); + + /* + * convert + */ + rc = ifTable_index_to_oid(&oid_idx, mib_idx); + if (MFD_SUCCESS != rc) + return NULL; + + rowreq_ctx = + CONTAINER_FIND(ipv6InterfaceTable_if_ctx.container, &oid_idx); + + return rowreq_ctx; +} diff --git a/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_interface.h b/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_interface.h new file mode 100644 index 0000000..1e91466 --- /dev/null +++ b/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_interface.h @@ -0,0 +1,178 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.67 $ of : mfd-interface.m2c,v $ + * + * $Id: ipv6InterfaceTable_interface.h 14169 2006-01-25 16:28:12Z dts12 $ + */ +/** @ingroup interface Routines to interface to Net-SNMP + * + * \warning This code should not be modified, called directly, + * or used to interpret functionality. It is subject to + * change at any time. + * + * @{ + */ +/* + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + * *** *** + * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** + * *** *** + * *** *** + * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** + * *** *** + * *** *** + * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** + * *** *** + * *** *** + * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** + * *** *** + * *** *** + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + */ +#ifndef IPV6INTERFACETABLE_INTERFACE_H +#define IPV6INTERFACETABLE_INTERFACE_H + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "ipv6InterfaceTable.h" + + + /* + ******************************************************************** + * Table declarations + */ + + /* + * PUBLIC interface initialization routine + */ + void + + + + + + + + + + + + + + + + _ipv6InterfaceTable_initialize_interface + (ipv6InterfaceTable_registration * user_ctx, u_long flags); + void + + + + + + + + + + + + + + + + _ipv6InterfaceTable_shutdown_interface + (ipv6InterfaceTable_registration * user_ctx); + + + + + + + + ipv6InterfaceTable_registration + * ipv6InterfaceTable_registration_get(void); + + + + + + + + ipv6InterfaceTable_registration + * ipv6InterfaceTable_registration_set + (ipv6InterfaceTable_registration * newreg); + + netsnmp_container *ipv6InterfaceTable_container_get(void); + int ipv6InterfaceTable_container_size(void); + + u_int ipv6InterfaceTable_dirty_get(void); + void ipv6InterfaceTable_dirty_set(u_int status); + + + + + + + + ipv6InterfaceTable_rowreq_ctx + * ipv6InterfaceTable_allocate_rowreq_ctx(void *); + void + + + + + + + + + + + + + + + + ipv6InterfaceTable_release_rowreq_ctx(ipv6InterfaceTable_rowreq_ctx + * rowreq_ctx); + + int ipv6InterfaceTable_index_to_oid(netsnmp_index * + oid_idx, + ipv6InterfaceTable_mib_index + * mib_idx); + int ipv6InterfaceTable_index_from_oid(netsnmp_index * + oid_idx, + ipv6InterfaceTable_mib_index + * mib_idx); + + /* + * access to certain internals. use with caution! + */ + void + + + + + + + + + + + ipv6InterfaceTable_valid_columns_set(netsnmp_column_info *vc); + + /* + */ + void ipv6InterfaceTable_lastChange_set(u_long uptime); + +#ifdef __cplusplus +} +#endif +#endif /* IPV6INTERFACETABLE_INTERFACE_H */ +/** @} */ + |