summaryrefslogtreecommitdiff
path: root/cleopatre/application/spidnetsnmp/agent/mibgroup
diff options
context:
space:
mode:
authorLysin Miao2012-05-12 13:58:41 +0800
committerLysin Miao2012-05-25 22:27:43 +0800
commitb4fd5e77e7a23e0fc0a8f620777c66227a13fdae (patch)
tree05f02bd2e6567c64460a24d53cb687c317b0e143 /cleopatre/application/spidnetsnmp/agent/mibgroup
parentc1cae39d7de7993990a7bf970790bc05d171d779 (diff)
cleo/app/spidnetsnmp[eoc]: implement the eocCNU of the NSCRTV-EPONEOC-MOD-EOC-MIB, closes #3019
Diffstat (limited to 'cleopatre/application/spidnetsnmp/agent/mibgroup')
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU.h6
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNU.c233
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNU.h4
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable.h10
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable.c37
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable.h21
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_access.c140
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_get.c4
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_set.c116
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_enums.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_interface.c80
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable.h10
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable.c197
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable.h58
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_access.c693
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_get.c78
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_set.c310
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_interface.c80
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_oids.h46
20 files changed, 1346 insertions, 781 deletions
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup.h
index accbebdaa8..fa28ffc2a7 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup.h
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup.h
@@ -1,5 +1,5 @@
config_require(mstar-eoc-mib/eocCNUGroup/eocCNUService)
config_require(mstar-eoc-mib/eocCNUGroup/eocCNUPort)
-//config_require(mstar-eoc-mib/eocCNUGroup/eocCNU)
+config_require(mstar-eoc-mib/eocCNUGroup/eocCNU)
config_require(mstar-eoc-mib/eocCNUGroup/eocCNUUnauthList)
config_require(mstar-eoc-mib/eocCNUGroup/eocCNUWhiteList)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU.h
index 7468398231..1671e7dc53 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU.h
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU.h
@@ -1,3 +1,3 @@
-//config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable)
-//config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNU)
-//config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable)
+config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable)
+config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNU)
+config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNU.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNU.c
index 3387f1ef02..12e6660cca 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNU.c
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNU.c
@@ -13,8 +13,7 @@ void
init_eocCNU(void)
{
static oid eocCNUAllReset_oid[] = { 1,3,6,1,4,1,17409,2,4,5,2,1 };
- static oid eocCNUCurrentAmount_oid[] = { 1,3,6,1,4,1,17409,2,4,5,2,2 };
- static oid eocCNUAmountLimitation_oid[] = { 1,3,6,1,4,1,17409,2,4,5,2,3 };
+
DEBUGMSGTL(("eocCNU", "Initializing\n"));
@@ -23,16 +22,6 @@ init_eocCNU(void)
eocCNUAllReset_oid, OID_LENGTH(eocCNUAllReset_oid),
HANDLER_CAN_RWRITE
));
- netsnmp_register_scalar(
- netsnmp_create_handler_registration("eocCNUCurrentAmount", handle_eocCNUCurrentAmount,
- eocCNUCurrentAmount_oid, OID_LENGTH(eocCNUCurrentAmount_oid),
- HANDLER_CAN_RONLY
- ));
- netsnmp_register_scalar(
- netsnmp_create_handler_registration("eocCNUAmountLimitation", handle_eocCNUAmountLimitation,
- eocCNUAmountLimitation_oid, OID_LENGTH(eocCNUAmountLimitation_oid),
- HANDLER_CAN_RWRITE
- ));
}
int
@@ -42,181 +31,109 @@ handle_eocCNUAllReset(netsnmp_mib_handler *handler,
netsnmp_request_info *requests)
{
int ret;
- /* We are never called for a GETNEXT if it's registered as a
- "instance", as it's "magically" handled for us. */
-
- /* a instance handler also only hands us one request at a time, so
- we don't need to loop over a list of requests; we'll only get one. */
-
- switch(reqinfo->mode) {
-
- case MODE_GET:
- snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
- (u_char *) /* XXX: a pointer to the scalar's data */,
- /* XXX: the length of the data in bytes */);
- break;
-
- /*
- * SET REQUEST
- *
- * multiple states in the transaction. See:
- * http://www.net-snmp.org/tutorial-5/toolkit/mib_module/set-actions.jpg
- */
- case MODE_SET_RESERVE1:
- /* or you could use netsnmp_check_vb_type_and_size instead */
- ret = netsnmp_check_vb_type(requests->requestvb, ASN_INTEGER);
- if ( ret != SNMP_ERR_NOERROR ) {
- netsnmp_set_request_error(reqinfo, requests, ret );
- }
- break;
-
- case MODE_SET_RESERVE2:
- /* XXX malloc "undo" storage buffer */
- if (/* XXX if malloc, or whatever, failed: */) {
- netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_RESOURCEUNAVAILABLE);
- }
- break;
-
- case MODE_SET_FREE:
- /* XXX: free resources allocated in RESERVE1 and/or
- RESERVE2. Something failed somewhere, and the states
- below won't be called. */
- break;
-
- case MODE_SET_ACTION:
- /* XXX: perform the value change here */
- if (/* XXX: error? */) {
- netsnmp_set_request_error(reqinfo, requests, /* some error */);
- }
- break;
+ int all_reset = 0;
- case MODE_SET_COMMIT:
- /* XXX: delete temporary storage */
- if (/* XXX: error? */) {
- /* try _really_really_ hard to never get to this point */
- netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_COMMITFAILED);
- }
- break;
+ /* list of MAC addresses currently online */
+ char mac_address_list[LIBSPID_ONLINE_INFO_LINE_MAX_NB][6];
+ /* number of currently online stations */
+ int mac_count = 0;
+ int i;
+ char mac_str[LIBSPID_MAC_STR_LEN];
- case MODE_SET_UNDO:
- /* XXX: UNDO and return to previous value for the object */
- if (/* XXX: error? */) {
- /* try _really_really_ hard to never get to this point */
- netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_UNDOFAILED);
- }
- break;
-
- default:
- /* we should never get here, so this is a really bad error */
- snmp_log(LOG_ERR, "unknown mode (%d) in handle_eocCNUAllReset\n", reqinfo->mode );
- return SNMP_ERR_GENERR;
- }
-
- return SNMP_ERR_NOERROR;
-}
-int
-handle_eocCNUCurrentAmount(netsnmp_mib_handler *handler,
- netsnmp_handler_registration *reginfo,
- netsnmp_agent_request_info *reqinfo,
- netsnmp_request_info *requests)
-{
- /* We are never called for a GETNEXT if it's registered as a
- "instance", as it's "magically" handled for us. */
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
/* a instance handler also only hands us one request at a time, so
- we don't need to loop over a list of requests; we'll only get one. */
-
- switch(reqinfo->mode) {
+ * we don't need to loop over a list of requests; we'll only get one. */
+ switch (reqinfo->mode)
+ {
case MODE_GET:
- snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
- (u_char *) /* XXX: a pointer to the scalar's data */,
- /* XXX: the length of the data in bytes */);
+ snmp_set_var_typed_value (requests->requestvb, ASN_INTEGER,
+ (u_char *) &all_reset,
+ sizeof (all_reset));
break;
-
-
- default:
- /* we should never get here, so this is a really bad error */
- snmp_log(LOG_ERR, "unknown mode (%d) in handle_eocCNUCurrentAmount\n", reqinfo->mode );
- return SNMP_ERR_GENERR;
- }
-
- return SNMP_ERR_NOERROR;
-}
-int
-handle_eocCNUAmountLimitation(netsnmp_mib_handler *handler,
- netsnmp_handler_registration *reginfo,
- netsnmp_agent_request_info *reqinfo,
- netsnmp_request_info *requests)
-{
- int ret;
- /* We are never called for a GETNEXT if it's registered as a
- "instance", as it's "magically" handled for us. */
-
- /* a instance handler also only hands us one request at a time, so
- we don't need to loop over a list of requests; we'll only get one. */
-
- switch(reqinfo->mode) {
-
- case MODE_GET:
- snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
- (u_char *) /* XXX: a pointer to the scalar's data */,
- /* XXX: the length of the data in bytes */);
- break;
-
- /*
- * SET REQUEST
- *
- * multiple states in the transaction. See:
- * http://www.net-snmp.org/tutorial-5/toolkit/mib_module/set-actions.jpg
- */
case MODE_SET_RESERVE1:
/* or you could use netsnmp_check_vb_type_and_size instead */
- ret = netsnmp_check_vb_type(requests->requestvb, ASN_INTEGER);
- if ( ret != SNMP_ERR_NOERROR ) {
- netsnmp_set_request_error(reqinfo, requests, ret );
+ ret = netsnmp_check_vb_type (requests->requestvb, ASN_INTEGER);
+ if ( ret != SNMP_ERR_NOERROR )
+ {
+ netsnmp_set_request_error (reqinfo, requests, ret );
+ }
+ ret = netsnmp_check_vb_range (requests->requestvb,
+ ONLINE_CNU_ALL_RESET,
+ ONLINE_CNU_ALL_RESET);
+ if (ret != SNMP_ERR_NOERROR)
+ {
+ netsnmp_set_request_error (reqinfo, requests, ret);
}
break;
case MODE_SET_RESERVE2:
- /* XXX malloc "undo" storage buffer */
- if (/* XXX if malloc, or whatever, failed: */) {
- netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_RESOURCEUNAVAILABLE);
- }
break;
case MODE_SET_FREE:
- /* XXX: free resources allocated in RESERVE1 and/or
- RESERVE2. Something failed somewhere, and the states
- below won't be called. */
break;
case MODE_SET_ACTION:
- /* XXX: perform the value change here */
- if (/* XXX: error? */) {
- netsnmp_set_request_error(reqinfo, requests, /* some error */);
+ /* get current network topology state */
+ ret = libspid_eoc_get_topo (mac_address_list[0], &mac_count);
+ if (LIBSPID_SUCCESS != ret)
+ {
+ snmp_log (LOG_ERR, "libspid_eoc_get_topo error\n");
+ }
+ else
+ {
+ for (i = 0; i < mac_count; i++)
+ {
+ if (LIBSPID_SUCCESS !=
+ libspid_mac_bin_to_str (mac_address_list[i], mac_str))
+ {
+ snmp_log (LOG_ERR, "libspid_mac_bin_to_str error\n");
+ continue;
+ }
+
+ /* attempt to reboot only authorized slaves */
+ if (LIBSPID_SUCCESS !=
+ libspid_eoc_wl_authorization (mac_str))
+ continue;
+
+ DEBUGMSGTL (("eocCNU",
+ "attempt to reboot MAC address: %s\n",
+ mac_str));
+
+ if (LIBSPID_SUCCESS != libspid_eoc_reboot (mac_str))
+ {
+ snmp_log (LOG_ERR,
+ "Couldn't reboot slave for MAC address: %s\n",
+ mac_str);
+ }
+ else
+ {
+ DEBUGMSGTL (("eocCNU",
+ "succesfully rebooted MAC address: %s\n",
+ mac_str));
+ }
+ }
}
break;
case MODE_SET_COMMIT:
- /* XXX: delete temporary storage */
- if (/* XXX: error? */) {
- /* try _really_really_ hard to never get to this point */
- netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_COMMITFAILED);
- }
break;
case MODE_SET_UNDO:
- /* XXX: UNDO and return to previous value for the object */
- if (/* XXX: error? */) {
- /* try _really_really_ hard to never get to this point */
- netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_UNDOFAILED);
- }
break;
+
default:
- /* we should never get here, so this is a really bad error */
- snmp_log(LOG_ERR, "unknown mode (%d) in handle_eocCNUAmountLimitation\n", reqinfo->mode );
+ /*
+ * we should never get here, so this is a really bad error
+ */
+ snmp_log (LOG_ERR,
+ "unknown mode (%d) in handle_modEoCOnlineCNUAllReset\n",
+ reqinfo->mode);
return SNMP_ERR_GENERR;
}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNU.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNU.h
index 240bbde242..289527f302 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNU.h
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNU.h
@@ -4,11 +4,11 @@
*/
#ifndef EOCCNU_H
#define EOCCNU_H
+/* include common header */
+#include "EoCCommon.h"
/* function declarations */
void init_eocCNU(void);
Netsnmp_Node_Handler handle_eocCNUAllReset;
-Netsnmp_Node_Handler handle_eocCNUCurrentAmount;
-Netsnmp_Node_Handler handle_eocCNUAmountLimitation;
#endif /* EOCCNU_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable.h
index 803d6cd2f4..1f7003c1e1 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable.h
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable.h
@@ -1,5 +1,5 @@
-//config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_get)
-//config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_set)
-//config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_access)
-//config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_interface)
-//config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable)
+config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_get)
+config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_set)
+config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_access)
+config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_interface)
+config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable.c
index 2c44a10b1a..89f68f7a7d 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable.c
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable.c
@@ -1,6 +1,6 @@
/*
* Note: this file originally auto-generated by mib2c using
- * version : 14170 $ of $
+ * version : 14170 $ of $
*
* $Id:$
*/
@@ -35,21 +35,30 @@ void shutdown_table_eocCNUControlTable(void);
* Initializes the eocCNUControlTable module
*/
void
-init_eocCNUControlTable(void)
+init_eocCNUControlTable (void)
{
- DEBUGMSGTL(("verbose:eocCNUControlTable:init_eocCNUControlTable","called\n"));
+ DEBUGMSGTL (("verbose:eocCNUControlTable:init_eocCNUControlTable",
+ "called\n"));
/*
* TODO:300:o: Perform eocCNUControlTable one-time module initialization.
*/
-
+ static int eocCNUControlTable_did_init = 0;
+
+ if (++eocCNUControlTable_did_init != 1)
+ {
+ DEBUGMSGTL (("eocCNUControlTable:init_eocCNUControlTable",
+ "ignoring duplicate call\n"));
+ return;
+ }
+
/*
* here we initialize all the tables we're planning on supporting
*/
- if (should_init("eocCNUControlTable"))
- initialize_table_eocCNUControlTable();
+ if (should_init ("eocCNUControlTable"))
+ initialize_table_eocCNUControlTable ();
-} /* init_eocCNUControlTable */
+}
/**
* Shut-down the eocCNUControlTable module (agent is exiting)
@@ -63,7 +72,7 @@ shutdown_eocCNUControlTable(void)
}
/**
- * Initialize the table eocCNUControlTable
+ * Initialize the table eocCNUControlTable
* (Define its contents and how it's structured)
*/
void
@@ -88,13 +97,13 @@ initialize_table_eocCNUControlTable(void)
* string token is used to add, find or remove pointers.
*/
user_context = netsnmp_create_data_list("eocCNUControlTable", NULL, NULL);
-
+
/*
* No support for any flags yet, but in the future you would
* set any flags here.
*/
flags = 0;
-
+
/*
* call interface initialization code
*/
@@ -102,7 +111,7 @@ initialize_table_eocCNUControlTable(void)
} /* initialize_table_eocCNUControlTable */
/**
- * Shutdown the table eocCNUControlTable
+ * Shutdown the table eocCNUControlTable
*/
void
shutdown_table_eocCNUControlTable(void)
@@ -129,7 +138,7 @@ eocCNUControlTable_rowreq_ctx_init(eocCNUControlTable_rowreq_ctx *rowreq_ctx,
DEBUGMSGTL(("verbose:eocCNUControlTable:eocCNUControlTable_rowreq_ctx_init","called\n"));
netsnmp_assert(NULL != rowreq_ctx);
-
+
/*
* TODO:210:o: |-> Perform extra eocCNUControlTable rowreq initialization. (eg DEFVALS)
*/
@@ -146,7 +155,7 @@ void eocCNUControlTable_rowreq_ctx_cleanup(eocCNUControlTable_rowreq_ctx *rowreq
DEBUGMSGTL(("verbose:eocCNUControlTable:eocCNUControlTable_rowreq_ctx_cleanup","called\n"));
netsnmp_assert(NULL != rowreq_ctx);
-
+
/*
* TODO:211:o: |-> Perform extra eocCNUControlTable rowreq cleanup.
*/
@@ -207,7 +216,7 @@ eocCNUControlTable_post_request(eocCNUControlTable_registration * user_context,
* save changed rows, if you haven't already
*/
}
-
+
eocCNUControlTable_dirty_set(0); /* clear table dirty flag */
}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable.h
index 13bf31972c..fba9273bfe 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable.h
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable.h
@@ -11,6 +11,8 @@
extern "C" {
#endif
+/* include common header */
+#include "EoCCommon.h"
/** @addtogroup misc misc: Miscellaneous routines
*
@@ -20,11 +22,6 @@ extern "C" {
/* other required module components */
/* *INDENT-OFF* */
-config_add_mib(NSCRTV-EPONEOC-MOD-EOC-MIB)
-config_require(NSCRTV-EPONEOC-MOD-EOC-MIB/eocCNUControlTable/eocCNUControlTable_interface)
-config_require(NSCRTV-EPONEOC-MOD-EOC-MIB/eocCNUControlTable/eocCNUControlTable_data_access)
-config_require(NSCRTV-EPONEOC-MOD-EOC-MIB/eocCNUControlTable/eocCNUControlTable_data_get)
-config_require(NSCRTV-EPONEOC-MOD-EOC-MIB/eocCNUControlTable/eocCNUControlTable_data_set)
/* *INDENT-ON* */
/* OID and column number definitions for eocCNUControlTable */
@@ -76,22 +73,22 @@ typedef netsnmp_data_list eocCNUControlTable_registration;
* eocCNUControlTable.
*/
typedef struct eocCNUControlTable_data_s {
-
+
/*
* eocCNUControlAllReset(2)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
*/
u_long eocCNUControlAllReset;
-
+
/*
* eocCNUControlCurrentAmount(3)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
*/
long eocCNUControlCurrentAmount;
-
+
/*
* eocCNUControlAmountLimitation(4)/INTEGER/ASN_INTEGER/long(long)//l/A/W/e/r/d/h
*/
long eocCNUControlAmountLimitation;
-
+
} eocCNUControlTable_data;
@@ -135,9 +132,9 @@ typedef struct eocCNUControlTable_rowreq_ctx_s {
/** this must be first for container compare to work */
netsnmp_index oid_idx;
oid oid_tmp[MAX_eocCNUControlTable_IDX_LEN];
-
+
eocCNUControlTable_mib_index tbl_idx;
-
+
eocCNUControlTable_data data;
eocCNUControlTable_undo_data * undo;
unsigned int column_set_flags; /* flags for set columns */
@@ -152,7 +149,7 @@ typedef struct eocCNUControlTable_rowreq_ctx_s {
/*
* TODO:131:o: | |-> Add useful data to eocCNUControlTable rowreq context.
*/
-
+
/*
* storage for future expansion
*/
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_access.c
index 7efa401d7d..bf1e4fc8a6 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_access.c
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_access.c
@@ -1,6 +1,6 @@
/*
* Note: this file originally auto-generated by mib2c using
- * version : 14170 $ of $
+ * version : 14170 $ of $
*
* $Id:$
*/
@@ -14,13 +14,14 @@
#include "eocCNUControlTable_data_access.h"
+extern int eocCNUTable_RegisteredAmount_get(void);
/** @ingroup interface
* @addtogroup data_access data_access: Routines to access data
*
* These routines are used to locate the data used to satisfy
* requests.
- *
+ *
* @{
*/
/**********************************************************************
@@ -96,7 +97,7 @@ eocCNUControlTable_container_init(netsnmp_container **container_ptr_ptr,
netsnmp_cache *cache)
{
DEBUGMSGTL(("verbose:eocCNUControlTable:eocCNUControlTable_container_init","called\n"));
-
+
if (NULL == container_ptr_ptr) {
snmp_log(LOG_ERR,"bad container param to eocCNUControlTable_container_init\n");
return;
@@ -144,7 +145,7 @@ void
eocCNUControlTable_container_shutdown(netsnmp_container *container_ptr)
{
DEBUGMSGTL(("verbose:eocCNUControlTable:eocCNUControlTable_container_shutdown","called\n"));
-
+
if (NULL == container_ptr) {
snmp_log(LOG_ERR,"bad params to eocCNUControlTable_container_shutdown\n");
return;
@@ -186,21 +187,27 @@ eocCNUControlTable_container_shutdown(netsnmp_container *container_ptr)
*
*/
int
-eocCNUControlTable_container_load(netsnmp_container *container)
+eocCNUControlTable_container_load (netsnmp_container *container)
{
eocCNUControlTable_rowreq_ctx *rowreq_ctx;
- size_t count = 0;
+ size_t count = 0;
+
+ int all_reset = 0;
+ int amount_limit = LIBSPID_ONLINE_INFO_LINE_MAX_NB;
+ int curr_amount = 0;
/*
* temporary storage for index values
*/
- /*
- * eocCNUControlCBATCardIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
- */
- long eocCNUControlCBATCardIndex;
+ /*
+ * eocCNUControlCBATCardIndex(1)/
+ * INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
+ */
+ long eocCNUControlCBATCardIndex = 0;
- DEBUGMSGTL(("verbose:eocCNUControlTable:eocCNUControlTable_container_load","called\n"));
+ DEBUGMSGTL (("verbose:eocCNUControlTable:"
+ "eocCNUControlTable_container_load","called\n"));
/*
* TODO:351:M: |-> Load/update data in the eocCNUControlTable container.
@@ -208,74 +215,81 @@ eocCNUControlTable_container_load(netsnmp_container *container)
* 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 eocCNUControlTable rowreq context.
- * data context will be set from the param (unless NULL,
- * in which case a new data context will be allocated)
- */
- rowreq_ctx = eocCNUControlTable_allocate_rowreq_ctx(NULL);
- if (NULL == rowreq_ctx) {
- snmp_log(LOG_ERR, "memory allocation failed\n");
- return MFD_RESOURCE_UNAVAILABLE;
- }
- if(MFD_SUCCESS != eocCNUControlTable_indexes_set(rowreq_ctx
- , eocCNUControlCBATCardIndex
- )) {
- snmp_log(LOG_ERR,"error setting index while loading "
- "eocCNUControlTable data.\n");
- eocCNUControlTable_release_rowreq_ctx(rowreq_ctx);
- continue;
- }
-
- /*
- * TODO:352:r: | |-> populate eocCNUControlTable data context.
- * Populate data context here. (optionally, delay until row prep)
- */
+
+
+ /*
+ * TODO:352:M: | |-> set indexes in new
+ * eocCNUControlTable rowreq context.
+ * data context will be set from the param (unless NULL,
+ * in which case a new data context will be allocated)
+ */
+ rowreq_ctx = eocCNUControlTable_allocate_rowreq_ctx (NULL);
+ if (NULL == rowreq_ctx)
+ {
+ snmp_log (LOG_ERR, "memory allocation failed\n");
+ return MFD_RESOURCE_UNAVAILABLE;
+ }
+
+ if (MFD_SUCCESS != eocCNUControlTable_indexes_set (
+ rowreq_ctx, eocCNUControlCBATCardIndex))
+ {
+ snmp_log (LOG_ERR,"error setting index while loading "
+ "eocCNUControlTable data.\n");
+ eocCNUControlTable_release_rowreq_ctx (rowreq_ctx);
+ return MFD_RESOURCE_UNAVAILABLE;
+ }
+
+ /*
+ * TODO:352:r: | |-> populate eocCNUControlTable data context.
+ * Populate data context here. (optionally, delay until row prep)
+ */
/*
* TRANSIENT or semi-TRANSIENT data:
* copy data or save any info needed to do it in row_prep.
*/
/*
* setup/save data for eocCNUControlAllReset
- * eocCNUControlAllReset(2)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ * eocCNUControlAllReset(2)/
+ * INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
*/
- /** no mapping */
- rowreq_ctx->data.eocCNUControlAllReset = eocCNUControlAllReset;
-
+
+ rowreq_ctx->data.eocCNUControlAllReset = all_reset;
+
/*
* setup/save data for eocCNUControlCurrentAmount
- * eocCNUControlCurrentAmount(3)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
+ * eocCNUControlCurrentAmount(3)/
+ * INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
*/
- /** no mapping */
- rowreq_ctx->data.eocCNUControlCurrentAmount = eocCNUControlCurrentAmount;
-
+
+ curr_amount = eocCNUTable_RegisteredAmount_get ();
+ if (curr_amount < 0)
+ {
+ snmp_log (LOG_ERR, "error getting Registered Amount\n");
+ /* registered amount is set to -1 to permit walk requests */
+ curr_amount = 0;
+ }
+ rowreq_ctx->data.eocCNUControlCurrentAmount = curr_amount;
+
/*
* setup/save data for eocCNUControlAmountLimitation
- * eocCNUControlAmountLimitation(4)/INTEGER/ASN_INTEGER/long(long)//l/A/W/e/r/d/h
+ * eocCNUControlAmountLimitation(4)/
+ * INTEGER/ASN_INTEGER/long(long)//l/A/W/e/r/d/h
*/
- /** no mapping */
- rowreq_ctx->data.eocCNUControlAmountLimitation = eocCNUControlAmountLimitation;
-
-
- /*
- * insert into table container
- */
- CONTAINER_INSERT(container, rowreq_ctx);
- ++count;
- }
+ rowreq_ctx->data.eocCNUControlAmountLimitation = amount_limit;
+
+
+ /*
+ * insert into table container
+ */
+ CONTAINER_INSERT (container, rowreq_ctx);
+ ++count;
- DEBUGMSGT(("verbose:eocCNUControlTable:eocCNUControlTable_container_load",
- "inserted %d records\n", count));
+ DEBUGMSGT (("verbose:eocCNUControlTable:"
+ "eocCNUControlTable_container_load",
+ "inserted %d records\n", count));
return MFD_SUCCESS;
-} /* eocCNUControlTable_container_load */
+}
/**
* container clean up
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_get.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_get.c
index ac90a2e906..aea1455e44 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_get.c
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_get.c
@@ -1,6 +1,6 @@
/*
* Note: this file originally auto-generated by mib2c using
- * version : 12088 $ of $
+ * version : 12088 $ of $
*
* $Id:$
*/
@@ -63,7 +63,7 @@ eocCNUControlTable_indexes_set_tbl_idx(eocCNUControlTable_mib_index *tbl_idx, lo
/* eocCNUControlCBATCardIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */
tbl_idx->eocCNUControlCBATCardIndex = eocCNUControlCBATCardIndex_val;
-
+
return MFD_SUCCESS;
} /* eocCNUControlTable_indexes_set_tbl_idx */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_set.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_set.c
index 73c61cc2a6..601fdd8ac1 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_set.c
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_data_set.c
@@ -18,7 +18,7 @@
*
* These routines are used to set the value for individual objects. The
* row context is passed, along with the new value.
- *
+ *
* @{
*/
/**********************************************************************
@@ -265,16 +265,11 @@ eocCNUControlTable_commit( eocCNUControlTable_rowreq_ctx *rowreq_ctx)
/*
* TODO:482:o: |-> commit column eocCNUControlAllReset.
*/
- rc = -1;
- if(-1 == rc) {
- snmp_log(LOG_ERR,"eocCNUControlTable column eocCNUControlAllReset commit failed\n");
- }
- else {
+
/*
* set flag, in case we need to undo eocCNUControlAllReset
*/
rowreq_ctx->column_set_flags |= COLUMN_EOCCNUCONTROLALLRESET_FLAG;
- }
}
if (save_flags & COLUMN_EOCCNUCONTROLAMOUNTLIMITATION_FLAG) {
@@ -282,16 +277,10 @@ eocCNUControlTable_commit( eocCNUControlTable_rowreq_ctx *rowreq_ctx)
/*
* TODO:482:o: |-> commit column eocCNUControlAmountLimitation.
*/
- rc = -1;
- if(-1 == rc) {
- snmp_log(LOG_ERR,"eocCNUControlTable column eocCNUControlAmountLimitation commit failed\n");
- }
- else {
/*
* set flag, in case we need to undo eocCNUControlAmountLimitation
*/
rowreq_ctx->column_set_flags |= COLUMN_EOCCNUCONTROLAMOUNTLIMITATION_FLAG;
- }
}
/*
@@ -342,7 +331,7 @@ eocCNUControlTable_undo_commit( eocCNUControlTable_rowreq_ctx *rowreq_ctx)
* eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {}
*/
-
+
/*
* if we successfully un-commited this row, clear the dirty flag.
*/
@@ -396,12 +385,12 @@ eocCNUControlTable_undo_commit( eocCNUControlTable_rowreq_ctx *rowreq_ctx)
* 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
@@ -418,17 +407,23 @@ eocCNUControlTable_undo_commit( eocCNUControlTable_rowreq_ctx *rowreq_ctx)
int
eocCNUControlAllReset_check_value( eocCNUControlTable_rowreq_ctx *rowreq_ctx, u_long eocCNUControlAllReset_val)
{
- DEBUGMSGTL(("verbose:eocCNUControlTable:eocCNUControlAllReset_check_value","called\n"));
+ DEBUGMSGTL (("verbose:eocCNUControlTable:\
+ eocCNUControlAllReset_check_value","called\n"));
/** should never get a NULL pointer */
- netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert (NULL != rowreq_ctx);
/*
* TODO:441:o: |-> Check for valid eocCNUControlAllReset value.
*/
+ if ((eocCNUControlAllReset_val != 0) &&
+ (eocCNUControlAllReset_val != 1))
+ {
+ return SNMP_ERR_WRONGVALUE;
+ }
return MFD_SUCCESS; /* eocCNUControlAllReset value not illegal */
-} /* eocCNUControlAllReset_check_value */
+}
/**
* Save old value information
@@ -483,16 +478,72 @@ int
eocCNUControlAllReset_set( eocCNUControlTable_rowreq_ctx *rowreq_ctx, u_long eocCNUControlAllReset_val )
{
- DEBUGMSGTL(("verbose:eocCNUControlTable:eocCNUControlAllReset_set","called\n"));
+ DEBUGMSGTL (("verbose:eocCNUControlTable:eocCNUControlAllReset_set",
+ "called\n"));
+ char mac_address_list[LIBSPID_ONLINE_INFO_LINE_MAX_NB][6];
+ int mac_count = 0;
+ int i;
+ int ret;
+ char mac_str[LIBSPID_MAC_STR_LEN];
/** should never get a NULL pointer */
- netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert (NULL != rowreq_ctx);
/*
- * TODO:461:M: |-> Set eocCNUControlAllReset value.
- * set eocCNUControlAllReset value in rowreq_ctx->data
+ * TODO:245:o: |-> Implement eocCNUControlAllReset reverse mapping.
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them here.
*/
- rowreq_ctx->data.eocCNUControlAllReset = eocCNUControlAllReset_val;
+ switch (eocCNUControlAllReset_val)
+ {
+ case EOCCNUCONTROLALLRESET_RESET:
+ /* get current network topology state */
+ ret = libspid_eoc_get_topo (mac_address_list[0], &mac_count);
+ if (LIBSPID_SUCCESS != ret)
+ {
+ snmp_log (LOG_ERR, "libspid_eoc_get_topo error\n");
+ }
+ else
+ {
+ for (i = 0; i < mac_count; i++)
+ {
+ if (LIBSPID_SUCCESS !=
+ libspid_mac_bin_to_str (mac_address_list[i], mac_str))
+ {
+ snmp_log (LOG_ERR, "libspid_mac_bin_to_str error\n");
+ continue;
+ }
+
+ /* attempt to reboot only authorized slaves */
+ if (LIBSPID_SUCCESS != libspid_eoc_wl_authorization (mac_str))
+ continue;
+
+ DEBUGMSGTL (("eocCNUControlTable",
+ "attempt to reboot MAC address: %s\n", mac_str));
+
+ if (LIBSPID_SUCCESS != libspid_eoc_reboot (mac_str))
+ {
+ snmp_log (LOG_ERR,
+ "Couldn't reboot slave for MAC address: %s\n",
+ mac_str);
+ }
+ else
+ {
+ DEBUGMSGTL (("eocCNUControlTable",
+ "succesfully rebooted MAC address: %s\n",
+ mac_str));
+ }
+ }
+ }
+ rowreq_ctx->data.eocCNUControlAllReset =
+ EOCCNUCONTROLALLRESET_RESET;
+ break;
+ default:
+ snmp_log (LOG_ERR,
+ "couldn't reverse map value %ld for eocCNUControlAllReset\n",
+ eocCNUControlAllReset_val );
+ return SNMP_ERR_GENERR;
+ }
return MFD_SUCCESS;
} /* eocCNUControlAllReset_set */
@@ -520,7 +571,7 @@ eocCNUControlAllReset_undo( eocCNUControlTable_rowreq_ctx *rowreq_ctx)
*/
rowreq_ctx->data.eocCNUControlAllReset = rowreq_ctx->undo->eocCNUControlAllReset;
-
+
return MFD_SUCCESS;
} /* eocCNUControlAllReset_undo */
@@ -560,12 +611,12 @@ eocCNUControlAllReset_undo( eocCNUControlTable_rowreq_ctx *rowreq_ctx)
* 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
@@ -650,14 +701,7 @@ eocCNUControlAmountLimitation_set( eocCNUControlTable_rowreq_ctx *rowreq_ctx, lo
/** should never get a NULL pointer */
netsnmp_assert(NULL != rowreq_ctx);
-
- /*
- * TODO:461:M: |-> Set eocCNUControlAmountLimitation value.
- * set eocCNUControlAmountLimitation value in rowreq_ctx->data
- */
- rowreq_ctx->data.eocCNUControlAmountLimitation = eocCNUControlAmountLimitation_val;
-
- return MFD_SUCCESS;
+ return SNMP_ERR_NOTWRITABLE;
} /* eocCNUControlAmountLimitation_set */
/**
@@ -683,7 +727,7 @@ eocCNUControlAmountLimitation_undo( eocCNUControlTable_rowreq_ctx *rowreq_ctx)
*/
rowreq_ctx->data.eocCNUControlAmountLimitation = rowreq_ctx->undo->eocCNUControlAmountLimitation;
-
+
return MFD_SUCCESS;
} /* eocCNUControlAmountLimitation_undo */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_enums.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_enums.h
index 1a0a3bd6ff..6d5fbfb72f 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_enums.h
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_enums.h
@@ -41,7 +41,7 @@ extern "C" {
#ifndef EOCCNUCONTROLALLRESET_ENUMS
#define EOCCNUCONTROLALLRESET_ENUMS
-#define EOCCNUCONTROLALLRESET_RESET 1
+#define EOCCNUCONTROLALLRESET_RESET 1
#endif /* EOCCNUCONTROLALLRESET_ENUMS */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_interface.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_interface.c
index 96e0d1c262..69af28bc4d 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_interface.c
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUControlTable/eocCNUControlTable_interface.c
@@ -1,6 +1,6 @@
/*
* Note: this file originally auto-generated by mib2c using
- * version : 15899 $ of $
+ * version : 15899 $ of $
*
* $Id:$
*/
@@ -60,7 +60,7 @@ typedef struct eocCNUControlTable_interface_ctx_s {
netsnmp_cache *cache;
eocCNUControlTable_registration * user_ctx;
-
+
netsnmp_table_registration_info tbl_info;
netsnmp_baby_steps_access_methods access_multiplexer;
@@ -141,7 +141,7 @@ eocCNUControlTable_data *eocCNUControlTable_allocate_data(void);
/**
* @internal
- * Initialize the table eocCNUControlTable
+ * Initialize the table eocCNUControlTable
* (Define its contents and how it's structured)
*/
void
@@ -191,7 +191,7 @@ _eocCNUControlTable_initialize_interface(eocCNUControlTable_registration * reg_p
snmp_log(LOG_ERR,"could not initialize container for eocCNUControlTable\n");
return;
}
-
+
/*
* access_multiplexer: REQUIRED wrapper for get request handling
*/
@@ -226,7 +226,7 @@ _eocCNUControlTable_initialize_interface(eocCNUControlTable_registration * reg_p
* Create a registration, save our reg data, register table.
*/
DEBUGMSGTL(("eocCNUControlTable:init_eocCNUControlTable",
- "Registering eocCNUControlTable as a mibs-for-dummies table.\n"));
+ "Registering eocCNUControlTable as a mibs-for-dummies table.\n"));
handler = netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
reginfo = netsnmp_handler_registration_create("eocCNUControlTable", handler,
eocCNUControlTable_oid,
@@ -257,14 +257,14 @@ _eocCNUControlTable_initialize_interface(eocCNUControlTable_registration * reg_p
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 )
@@ -273,7 +273,7 @@ _eocCNUControlTable_initialize_interface(eocCNUControlTable_registration * reg_p
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);
@@ -338,7 +338,7 @@ eocCNUControlTable_index_to_oid(netsnmp_index *oid_idx,
eocCNUControlTable_mib_index *mib_idx)
{
int err = SNMP_ERR_NOERROR;
-
+
/*
* temp storage for parsing indexes
*/
@@ -390,7 +390,7 @@ eocCNUControlTable_index_from_oid(netsnmp_index *oid_idx,
eocCNUControlTable_mib_index *mib_idx)
{
int err = SNMP_ERR_NOERROR;
-
+
/*
* temp storage for parsing indexes
*/
@@ -515,12 +515,12 @@ eocCNUControlTable_release_rowreq_ctx(eocCNUControlTable_rowreq_ctx *rowreq_ctx)
DEBUGMSGTL(("internal:eocCNUControlTable:eocCNUControlTable_release_rowreq_ctx","called\n"));
netsnmp_assert(NULL != rowreq_ctx);
-
+
eocCNUControlTable_rowreq_ctx_cleanup(rowreq_ctx);
if(rowreq_ctx->undo)
eocCNUControlTable_release_data(rowreq_ctx->undo);
-
+
/*
* free index oid pointer
*/
@@ -544,13 +544,13 @@ _mfd_eocCNUControlTable_pre_request(netsnmp_mib_handler *handler,
DEBUGMSGTL(("internal:eocCNUControlTable:_mfd_eocCNUControlTable_pre_request",
"called\n"));
-
+
if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
DEBUGMSGTL(("internal:eocCNUControlTable",
"skipping additional pre_request\n"));
return SNMP_ERR_NOERROR;
}
-
+
rc = eocCNUControlTable_pre_request(eocCNUControlTable_if_ctx.user_ctx);
if (MFD_SUCCESS != rc) {
/*
@@ -560,7 +560,7 @@ _mfd_eocCNUControlTable_pre_request(netsnmp_mib_handler *handler,
"eocCNUControlTable_pre_request\n", rc));
netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
}
-
+
return SNMP_ERR_NOERROR;
} /* _mfd_eocCNUControlTable_pre_request */
@@ -595,7 +595,7 @@ _mfd_eocCNUControlTable_post_request(netsnmp_mib_handler *handler,
"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) && eocCNUControlTable_dirty_get()) {
/*
@@ -614,7 +614,7 @@ _mfd_eocCNUControlTable_post_request(netsnmp_mib_handler *handler,
DEBUGMSGTL(("eocCNUControlTable","error %d from "
"eocCNUControlTable_post_request\n", rc));
}
-
+
return SNMP_ERR_NOERROR;
} /* _mfd_eocCNUControlTable_post_request */
@@ -631,7 +631,7 @@ _mfd_eocCNUControlTable_object_lookup(netsnmp_mib_handler *handler,
int rc = SNMP_ERR_NOERROR;
eocCNUControlTable_rowreq_ctx *rowreq_ctx =
netsnmp_container_table_row_extract(requests);
-
+
DEBUGMSGTL(("internal:eocCNUControlTable:_mfd_eocCNUControlTable_object_lookup","called\n"));
/*
@@ -666,7 +666,7 @@ _eocCNUControlTable_get_column( eocCNUControlTable_rowreq_ctx *rowreq_ctx,
netsnmp_variable_list *var, int column )
{
int rc = SNMPERR_SUCCESS;
-
+
DEBUGMSGTL(("internal:eocCNUControlTable:_mfd_eocCNUControlTable_get_column",
"called for %d\n", column));
@@ -734,7 +734,7 @@ _mfd_eocCNUControlTable_get_values(netsnmp_mib_handler *handler,
DEBUGMSGTL(("internal:eocCNUControlTable:_mfd_eocCNUControlTable_get_values","called\n"));
netsnmp_assert(NULL != rowreq_ctx);
-
+
for(;requests; requests = requests->next) {
/*
* save old pointer, so we can free it if replaced
@@ -756,7 +756,7 @@ _mfd_eocCNUControlTable_get_values(netsnmp_mib_handler *handler,
tri = netsnmp_extract_table_info(requests);
if(NULL == tri)
continue;
-
+
rc = _eocCNUControlTable_get_column(rowreq_ctx, requests->requestvb, tri->colnum);
if(rc) {
if(MFD_SKIP == rc) {
@@ -809,7 +809,7 @@ _eocCNUControlTable_check_column( eocCNUControlTable_rowreq_ctx *rowreq_ctx,
netsnmp_variable_list *var, int column )
{
int rc = SNMPERR_SUCCESS;
-
+
DEBUGMSGTL(("internal:eocCNUControlTable:_eocCNUControlTable_check_column",
"called for %d\n", column));
@@ -890,7 +890,7 @@ _mfd_eocCNUControlTable_check_objects(netsnmp_mib_handler *handler,
DEBUGMSGTL(("internal:eocCNUControlTable:_mfd_eocCNUControlTable_check_objects","called\n"));
netsnmp_assert(NULL != rowreq_ctx);
-
+
for(;requests; requests = requests->next) {
/*
@@ -925,7 +925,7 @@ NETSNMP_STATIC_INLINE int
_eocCNUControlTable_undo_setup_column( eocCNUControlTable_rowreq_ctx *rowreq_ctx, int column )
{
int rc = SNMPERR_SUCCESS;
-
+
DEBUGMSGTL(("internal:eocCNUControlTable:_eocCNUControlTable_undo_setup_column",
"called for %d\n", column));
@@ -1004,7 +1004,7 @@ _mfd_eocCNUControlTable_undo_setup(netsnmp_mib_handler *handler,
tri = netsnmp_extract_table_info(requests);
if(NULL == tri)
continue;
-
+
rc = _eocCNUControlTable_undo_setup_column(rowreq_ctx, tri->colnum);
if(MFD_SUCCESS != rc) {
DEBUGMSGTL(("eocCNUControlTable:mfd","error %d from "
@@ -1013,7 +1013,7 @@ _mfd_eocCNUControlTable_undo_setup(netsnmp_mib_handler *handler,
}
} /* for results */
}
-
+
return SNMP_ERR_NOERROR;
} /* _mfd_eocCNUControlTable_undo_setup */
@@ -1077,7 +1077,7 @@ _eocCNUControlTable_set_column( eocCNUControlTable_rowreq_ctx *rowreq_ctx,
netsnmp_variable_list *var, int column )
{
int rc = SNMPERR_SUCCESS;
-
+
DEBUGMSGTL(("internal:eocCNUControlTable:_eocCNUControlTable_set_column",
"called for %d\n", column));
@@ -1102,7 +1102,7 @@ _eocCNUControlTable_set_column( eocCNUControlTable_rowreq_ctx *rowreq_ctx,
rc = SNMP_ERR_GENERR;
break;
}
-
+
return rc;
} /* _eocCNUControlTable_set_column */
@@ -1120,7 +1120,7 @@ _mfd_eocCNUControlTable_set_values(netsnmp_mib_handler *handler,
DEBUGMSGTL(("internal:eocCNUControlTable:_mfd_eocCNUControlTable_set_values","called\n"));
netsnmp_assert(NULL != rowreq_ctx);
-
+
rowreq_ctx->column_set_flags = 0;
for(;requests; requests = requests->next) {
/*
@@ -1129,7 +1129,7 @@ _mfd_eocCNUControlTable_set_values(netsnmp_mib_handler *handler,
tri = netsnmp_extract_table_info(requests);
if(NULL == tri)
continue;
-
+
rc = _eocCNUControlTable_set_column(rowreq_ctx,
requests->requestvb, tri->colnum);
if(MFD_SUCCESS != rc) {
@@ -1164,7 +1164,7 @@ _mfd_eocCNUControlTable_commit(netsnmp_mib_handler *handler,
DEBUGMSGTL(("internal:eocCNUControlTable:_mfd_eocCNUControlTable_commit","called\n"));
netsnmp_assert(NULL != rowreq_ctx);
-
+
rc = eocCNUControlTable_commit(rowreq_ctx);
if (MFD_SUCCESS != rc) {
DEBUGMSGTL(("eocCNUControlTable:mfd","error %d from "
@@ -1237,7 +1237,7 @@ _eocCNUControlTable_undo_column( eocCNUControlTable_rowreq_ctx *rowreq_ctx,
netsnmp_variable_list *var, int column )
{
int rc = SNMPERR_SUCCESS;
-
+
DEBUGMSGTL(("internal:eocCNUControlTable:_eocCNUControlTable_undo_column",
"called for %d\n", column));
@@ -1277,7 +1277,7 @@ _mfd_eocCNUControlTable_undo_values(netsnmp_mib_handler *handler,
DEBUGMSGTL(("internal:eocCNUControlTable:_mfd_eocCNUControlTable_undo_values","called\n"));
netsnmp_assert(NULL != rowreq_ctx);
-
+
rc = eocCNUControlTable_undo(rowreq_ctx);
if (MFD_SUCCESS != rc) {
/*
@@ -1286,7 +1286,7 @@ _mfd_eocCNUControlTable_undo_values(netsnmp_mib_handler *handler,
DEBUGMSGTL(("eocCNUControlTable:mfd","error %d from "
"eocCNUControlTable_undo\n", rc));
}
-
+
for(;requests; requests = requests->next) {
/*
* set column data
@@ -1294,7 +1294,7 @@ _mfd_eocCNUControlTable_undo_values(netsnmp_mib_handler *handler,
tri = netsnmp_extract_table_info(requests);
if(NULL == tri)
continue;
-
+
rc = _eocCNUControlTable_undo_column(rowreq_ctx, requests->requestvb,
tri->colnum);
if (MFD_SUCCESS != rc) {
@@ -1326,11 +1326,11 @@ _mfd_eocCNUControlTable_irreversible_commit(netsnmp_mib_handler *handler,
{
eocCNUControlTable_rowreq_ctx *rowreq_ctx =
netsnmp_container_table_row_extract(requests);
-
+
DEBUGMSGTL(("internal:eocCNUControlTable:_mfd_eocCNUControlTable_irreversible:commit","called\n"));
-
+
netsnmp_assert(NULL != rowreq_ctx);
-
+
/*
* check for and handle row creation/deletion
* and update column exist flags...
@@ -1370,7 +1370,7 @@ _cache_load(netsnmp_cache *cache, void *vmagic)
/** should only be called for an invalid or expired cache */
netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
-
+
/*
* call user code
*/
@@ -1428,7 +1428,7 @@ _container_free(netsnmp_container *container)
* call user code
*/
eocCNUControlTable_container_free(container);
-
+
/*
* free all items. inefficient, but easy.
*/
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable.h
index 04c813c29f..372963f85d 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable.h
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable.h
@@ -1,5 +1,5 @@
-//config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_set)
-//config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable)
-//config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_interface)
-//config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_get)
-//config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_access)
+config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_set)
+config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable)
+config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_interface)
+config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_get)
+config_require(mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_access)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable.c
index 6e8fbc58f4..801b63cc7b 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable.c
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable.c
@@ -1,6 +1,6 @@
/*
* Note: this file originally auto-generated by mib2c using
- * version : 14170 $ of $
+ * version : 14170 $ of $
*
* $Id:$
*/
@@ -30,6 +30,18 @@ int eocCNUTable_oid_size = OID_LENGTH(eocCNUTable_oid);
void initialize_table_eocCNUTable(void);
void shutdown_table_eocCNUTable(void);
+int
+handle_eocCNUCurrentAmount (netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests);
+
+int
+handle_eocCNUAmountLimitation (netsnmp_mib_handler *handler,
+ netsnmp_handler_registration
+ *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests);
/**
* Initializes the eocCNUTable module
@@ -42,7 +54,7 @@ init_eocCNUTable(void)
/*
* TODO:300:o: Perform eocCNUTable one-time module initialization.
*/
-
+
/*
* here we initialize all the tables we're planning on supporting
*/
@@ -63,16 +75,17 @@ shutdown_eocCNUTable(void)
}
/**
- * Initialize the table eocCNUTable
+ * Initialize the table eocCNUTable
* (Define its contents and how it's structured)
*/
void
-initialize_table_eocCNUTable(void)
+initialize_table_eocCNUTable (void)
{
eocCNUTable_registration * user_context;
u_long flags;
- DEBUGMSGTL(("verbose:eocCNUTable:initialize_table_eocCNUTable","called\n"));
+ DEBUGMSGTL (("verbose:eocCNUTable:initialize_table_eocCNUTable",
+ "called\n"));
/*
* TODO:301:o: Perform eocCNUTable one-time table initialization.
@@ -87,22 +100,56 @@ initialize_table_eocCNUTable(void)
* 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("eocCNUTable", NULL, NULL);
-
+ user_context = netsnmp_create_data_list ("eocCNUTable", NULL, NULL);
+
/*
* No support for any flags yet, but in the future you would
* set any flags here.
*/
flags = 0;
-
+
/*
* call interface initialization code
*/
- _eocCNUTable_initialize_interface(user_context, flags);
-} /* initialize_table_eocCNUTable */
+ _eocCNUTable_initialize_interface (user_context, flags);
+
+
+
+ /*
+ * register scalar for eocCNUCurrentAmount
+ */
+ {
+ static oid eocCNUCurrentAmount_oid[] =
+ { EOCCNUCURRENTAMOUNT_OID };
+
+ netsnmp_register_scalar (netsnmp_create_handler_registration (
+ "eocCNUCurrentAmount",
+ handle_eocCNUCurrentAmount,
+ eocCNUCurrentAmount_oid,
+ OID_LENGTH (eocCNUCurrentAmount_oid),
+ HANDLER_CAN_RONLY));
+
+ }
+ /*
+ * register scalar for eocCNUAmountLimitation
+ */
+ {
+
+ static oid eocCNUAmountLimitation_oid[] =
+ { EOCCNUAMOUNTLIMITATION_OID };
+
+ netsnmp_register_scalar (netsnmp_create_handler_registration (
+ "eocCNUAmountLimitation",
+ handle_eocCNUAmountLimitation,
+ eocCNUAmountLimitation_oid,
+ OID_LENGTH
+ (eocCNUAmountLimitation_oid),
+ HANDLER_CAN_RWRITE));
+ }
+}
/**
- * Shutdown the table eocCNUTable
+ * Shutdown the table eocCNUTable
*/
void
shutdown_table_eocCNUTable(void)
@@ -129,7 +176,7 @@ eocCNUTable_rowreq_ctx_init(eocCNUTable_rowreq_ctx *rowreq_ctx,
DEBUGMSGTL(("verbose:eocCNUTable:eocCNUTable_rowreq_ctx_init","called\n"));
netsnmp_assert(NULL != rowreq_ctx);
-
+
/*
* TODO:210:o: |-> Perform extra eocCNUTable rowreq initialization. (eg DEFVALS)
*/
@@ -146,7 +193,7 @@ void eocCNUTable_rowreq_ctx_cleanup(eocCNUTable_rowreq_ctx *rowreq_ctx)
DEBUGMSGTL(("verbose:eocCNUTable:eocCNUTable_rowreq_ctx_cleanup","called\n"));
netsnmp_assert(NULL != rowreq_ctx);
-
+
/*
* TODO:211:o: |-> Perform extra eocCNUTable rowreq cleanup.
*/
@@ -207,7 +254,7 @@ eocCNUTable_post_request(eocCNUTable_registration * user_context, int rc)
* save changed rows, if you haven't already
*/
}
-
+
eocCNUTable_dirty_set(0); /* clear table dirty flag */
}
@@ -215,4 +262,126 @@ eocCNUTable_post_request(eocCNUTable_registration * user_context, int rc)
} /* eocCNUTable_post_request */
+int
+handle_eocCNUCurrentAmount (netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ netsnmp_container * online_container;
+ int curr_amount = 0;
+ int rc;
+
+ DEBUGMSGTL (("verbose:eocCNUTable:handle_eocCNUCurrentAmount",
+ "called\n"));
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode)
+ {
+
+ case MODE_GET:
+ curr_amount = eocCNUTable_RegisteredAmount_get ();
+ if (curr_amount < 0)
+ {
+ snmp_log (LOG_ERR, "error getting Registered Amount\n");
+ /* registered amount is set to -1 to permit walk requests */
+ curr_amount = -1;
+ }
+
+ snmp_set_var_typed_value (requests->requestvb, ASN_INTEGER,
+ (u_char *) &curr_amount,
+ sizeof (curr_amount));
+ break;
+
+ default:
+ /*
+ * we should never get here, so this is a really bad error
+ */
+ snmp_log (LOG_ERR,
+ "unknown mode (%d) in handle_modEoCOnlineCNUCurrentAmount\n",
+ reqinfo->mode);
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+int
+handle_eocCNUAmountLimitation (netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ int ret;
+ int amount_limit = LIBSPID_ONLINE_INFO_LINE_MAX_NB;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode)
+ {
+ case MODE_GET:
+ snmp_set_var_typed_value (requests->requestvb, ASN_INTEGER,
+ (u_char *) &amount_limit,
+ sizeof (amount_limit));
+ break;
+
+ /*
+ * SET REQUEST
+ *
+ * multiple states in the transaction. See:
+ * http://www.net-snmp.org/tutorial-5/toolkit/mib_module/set-actions.jpg
+ */
+ case MODE_SET_RESERVE1:
+ break;
+
+ case MODE_SET_RESERVE2:
+ break;
+
+ case MODE_SET_FREE:
+ break;
+
+ case MODE_SET_ACTION:
+ /* SET request is not supported */
+ netsnmp_set_request_error (reqinfo, requests,
+ SNMP_ERR_NOTWRITABLE);
+ break;
+
+ case MODE_SET_COMMIT:
+ break;
+
+ case MODE_SET_UNDO:
+ break;
+
+ default:
+ /*
+ * we should never get here, so this is a really bad error
+ */
+ snmp_log (LOG_ERR,
+ "unknown mode (%d) in \
+ handle_modEoCOnlineCNUAmountLimitation\n",
+ reqinfo->mode);
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
/** @{ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable.h
index 7ef32944d9..e38b2b0404 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable.h
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable.h
@@ -20,11 +20,6 @@ extern "C" {
/* other required module components */
/* *INDENT-OFF* */
-config_add_mib(NSCRTV-EPONEOC-MOD-EOC-MIB)
-config_require(NSCRTV-EPONEOC-MOD-EOC-MIB/eocCNUTable/eocCNUTable_interface)
-config_require(NSCRTV-EPONEOC-MOD-EOC-MIB/eocCNUTable/eocCNUTable_data_access)
-config_require(NSCRTV-EPONEOC-MOD-EOC-MIB/eocCNUTable/eocCNUTable_data_get)
-config_require(NSCRTV-EPONEOC-MOD-EOC-MIB/eocCNUTable/eocCNUTable_data_set)
/* *INDENT-ON* */
/* OID and column number definitions for eocCNUTable */
@@ -33,6 +28,10 @@ config_require(NSCRTV-EPONEOC-MOD-EOC-MIB/eocCNUTable/eocCNUTable_data_set)
/* enum definions */
#include "eocCNUTable_enums.h"
+/* include common header */
+#include "EoCCommon.h"
+
+
/* *********************************************************************
* function declarations
*/
@@ -76,100 +75,101 @@ typedef netsnmp_data_list eocCNUTable_registration;
* eocCNUTable.
*/
typedef struct eocCNUTable_data_s {
-
+
/*
* eocCNUMACAddress(3)/MacAddress/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H
*/
char eocCNUMACAddress[6];
size_t eocCNUMACAddress_len; /* # of char elements, not bytes */
-
+
/*
* eocCNUOnlineStatus(4)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
*/
u_long eocCNUOnlineStatus;
-
+
/*
* eocCNUModelNumber(5)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/h
*/
char eocCNUModelNumber[255];
size_t eocCNUModelNumber_len; /* # of char elements, not bytes */
-
+
/*
* eocCNUPortAmount(6)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
*/
long eocCNUPortAmount;
-
+
/*
* eocCNUAuthorizationState(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
*/
u_long eocCNUAuthorizationState;
-
+
/*
* eocCNUSoftwareVersion(8)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/h
*/
- char eocCNUSoftwareVersion[255];
-size_t eocCNUSoftwareVersion_len; /* # of char elements, not bytes */
-
+ char eocCNUSoftwareVersion[128];
+
+ size_t eocCNUSoftwareVersion_len; /* # of char elements, not bytes */
+
/*
* eocCNUReset(9)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
*/
u_long eocCNUReset;
-
+
/*
* eocCNURFAttenuation(10)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
*/
long eocCNURFAttenuation;
-
+
/*
* eocCNURFDownstreamQuality(11)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
*/
long eocCNURFDownstreamQuality;
-
+
/*
* eocCNURFUpstreamQuality(12)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
*/
long eocCNURFUpstreamQuality;
-
+
/*
* eocCNUPhyDownstreamRate(13)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
*/
long eocCNUPhyDownstreamRate;
-
+
/*
* eocCNUPhyUpstreamRate(14)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
*/
long eocCNUPhyUpstreamRate;
-
+
/*
* eocCNUConfigurationSaving(15)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
*/
u_long eocCNUConfigurationSaving;
-
+
/*
* eocCNUConfigurationResult(16)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
*/
u_long eocCNUConfigurationResult;
-
+
/*
* eocCNUAction(17)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
*/
u_long eocCNUAction;
-
+
/*
* eocCNUAdminStatus(18)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
*/
u_long eocCNUAdminStatus;
-
+
/*
* eocCNUDownstreamPIR(19)/INTEGER/ASN_INTEGER/long(long)//l/A/W/e/r/d/h
*/
long eocCNUDownstreamPIR;
-
+
/*
* eocCNUUpstreamPIR(20)/INTEGER/ASN_INTEGER/long(long)//l/A/W/e/r/d/h
*/
long eocCNUUpstreamPIR;
-
+
} eocCNUTable_data;
@@ -218,9 +218,9 @@ typedef struct eocCNUTable_rowreq_ctx_s {
/** this must be first for container compare to work */
netsnmp_index oid_idx;
oid oid_tmp[MAX_eocCNUTable_IDX_LEN];
-
+
eocCNUTable_mib_index tbl_idx;
-
+
eocCNUTable_data data;
eocCNUTable_undo_data * undo;
unsigned int column_set_flags; /* flags for set columns */
@@ -235,7 +235,7 @@ typedef struct eocCNUTable_rowreq_ctx_s {
/*
* TODO:131:o: | |-> Add useful data to eocCNUTable rowreq context.
*/
-
+
/*
* storage for future expansion
*/
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_access.c
index 6ef351cd6b..698e1445d0 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_access.c
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_access.c
@@ -1,6 +1,6 @@
/*
* Note: this file originally auto-generated by mib2c using
- * version : 14170 $ of $
+ * version : 14170 $ of $
*
* $Id:$
*/
@@ -14,13 +14,14 @@
#include "eocCNUTable_data_access.h"
+#define DEMO_PATH "/onlinedemo.info"
/** @ingroup interface
* @addtogroup data_access data_access: Routines to access data
*
* These routines are used to locate the data used to satisfy
* requests.
- *
+ *
* @{
*/
/**********************************************************************
@@ -96,7 +97,7 @@ eocCNUTable_container_init(netsnmp_container **container_ptr_ptr,
netsnmp_cache *cache)
{
DEBUGMSGTL(("verbose:eocCNUTable:eocCNUTable_container_init","called\n"));
-
+
if (NULL == container_ptr_ptr) {
snmp_log(LOG_ERR,"bad container param to eocCNUTable_container_init\n");
return;
@@ -122,6 +123,8 @@ eocCNUTable_container_init(netsnmp_container **container_ptr_ptr,
* cache->enabled to 0.
*/
cache->timeout = EOCCNUTABLE_CACHE_TIMEOUT; /* seconds */
+ /* adjust cache flags */
+ cache->flags |= ( NETSNMP_CACHE_PRELOAD );
} /* eocCNUTable_container_init */
/**
@@ -144,7 +147,7 @@ void
eocCNUTable_container_shutdown(netsnmp_container *container_ptr)
{
DEBUGMSGTL(("verbose:eocCNUTable:eocCNUTable_container_shutdown","called\n"));
-
+
if (NULL == container_ptr) {
snmp_log(LOG_ERR,"bad params to eocCNUTable_container_shutdown\n");
return;
@@ -189,22 +192,39 @@ int
eocCNUTable_container_load(netsnmp_container *container)
{
eocCNUTable_rowreq_ctx *rowreq_ctx;
- size_t count = 0;
+ int rc = MFD_SUCCESS;
/*
* temporary storage for index values
*/
- /*
- * eocCNUCBATCardIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
- */
- long eocCNUCBATCardIndex;
- /*
- * eocCNUIndex(2)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
- */
- long eocCNUIndex;
+ /*
+ * eocCNUCBATCardIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
+ */
+ long eocCNUCBATCardIndex = 0;
+ /*
+ * eocCNUIndex(2)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
+ */
+ long eocCNUIndex;
+ int tmp_index;
+
+ char mac_str[LIBSPID_MAC_STR_LEN];
+ int wl_count;
+ int i;
+
+ wl_count = 128;
+ libspid_eoc_wl_entry_t eoc_wl_entry[LIBSPID_WHITE_LIST_MAX_STA_NUM];
+ if (LIBSPID_SUCCESS !=
+ libspid_eoc_wl_get_list (eoc_wl_entry, &wl_count))
+ {
+ snmp_log (LOG_ERR,
+ "eocCNUTable_container_load:\
+ CNUlibspid_eoc_wl_get_list error\n");
+ return MFD_ERROR;
+ }
- DEBUGMSGTL(("verbose:eocCNUTable:eocCNUTable_container_load","called\n"));
+ DEBUGMSGTL (("verbose:eocCNUTable:eocCNUTable_container_load",
+ "called\n"));
/*
* TODO:351:M: |-> Load/update data in the eocCNUTable container.
@@ -212,37 +232,226 @@ eocCNUTable_container_load(netsnmp_container *container)
* 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 )
+
+ /* check if the MAC address exists in the list
+ * if it exists, update corresponding data structure
+ * if it doesn't exist, create corresponding data structure
+ */
+ for (i = 0; i < wl_count; i++)
+ {
+ memset (mac_str, 0x0, LIBSPID_MAC_STR_LEN);
+ strcpy (mac_str,eoc_wl_entry[i].mac_addr);
+
+ eocCNUIndex = se_find_value_in_slist ("eoc_online_table", mac_str);
+
+ if (eocCNUIndex == SE_DNE)
+ {
+ if (1 != sscanf (eoc_wl_entry[i].tei, "%ld", &tmp_index))
+ {
+ snmp_log (LOG_ERR, "error parsing tei value\n");
+ return MFD_ERROR;
+ }
+
+ eocCNUIndex = tmp_index - 2;
+ se_add_pair_to_slist ("eoc_online_table",
+ strdup (mac_str), eocCNUIndex);
+ DEBUGMSGTL (("eocCNUTable:eocCNUIndex",
+ "new eocCNUIndex %d for %s \n",
+ eocCNUIndex, mac_str));
+ }
+
+
+ if ((NULL == mac_str) || (0 == eocCNUIndex))
+ {
+ rc = MFD_END_OF_DATA;
break;
+ }
/*
* TODO:352:M: | |-> set indexes in new eocCNUTable rowreq context.
* data context will be set from the param (unless NULL,
* in which case a new data context will be allocated)
*/
- rowreq_ctx = eocCNUTable_allocate_rowreq_ctx(NULL);
- if (NULL == rowreq_ctx) {
- snmp_log(LOG_ERR, "memory allocation failed\n");
+ rowreq_ctx = eocCNUTable_allocate_rowreq_ctx (NULL);
+ if (NULL == rowreq_ctx)
+ {
+ snmp_log (LOG_ERR, "memory allocation failed\n");
return MFD_RESOURCE_UNAVAILABLE;
}
- if(MFD_SUCCESS != eocCNUTable_indexes_set(rowreq_ctx
- , eocCNUCBATCardIndex
- , eocCNUIndex
- )) {
- snmp_log(LOG_ERR,"error setting index while loading "
- "eocCNUTable data.\n");
- eocCNUTable_release_rowreq_ctx(rowreq_ctx);
+ if (MFD_SUCCESS !=
+ eocCNUTable_indexes_set (rowreq_ctx,
+ eocCNUCBATCardIndex,
+ eocCNUIndex))
+ {
+ snmp_log (LOG_ERR,
+ "error setting index while loading "
+ "eocCNUTable data.\n");
+ eocCNUTable_release_rowreq_ctx (rowreq_ctx);
continue;
}
- /*
- * TODO:352:r: | |-> populate eocCNUTable data context.
- * Populate data context here. (optionally, delay until row prep)
- */
+
+ CONTAINER_INSERT (container, rowreq_ctx);
+
+ }
+ return MFD_SUCCESS;
+} /* eocCNUTable_container_load */
+
+/* manually free row request context (as an item in online table container) */
+void
+_eoc_online_container_item_free (eocCNUTable_rowreq_ctx * rowreq_ctx,
+ void *context)
+{
+ DEBUGMSGTL (("internal:eocCNUTable_data_access:\
+ _online_container_item_free",
+ "called\n"));
+
+ if (NULL == rowreq_ctx)
+ return;
+
+ eocCNUTable_release_rowreq_ctx (rowreq_ctx);
+}
+
+
+/**
+ * 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
+eocCNUTable_container_free (netsnmp_container *container)
+{
+ DEBUGMSGTL (("verbose:eocCNUTable:eocCNUTable_container_free",
+ "called\n"));
+
+ /*
+ * TODO:380:M: Free eocCNUTable container data.
+ */
+ if (NULL == container)
+ {
+ snmp_log (LOG_ERR,
+ "eocCNUTable_container_free: invalid container\n");
+ return;
+ }
+
+ /*
+ * TODO:380:M: Free eocCNUTable container data.
+ */
+
+ /* make sure row request contexts are really released */
+ CONTAINER_CLEAR (container,
+ (netsnmp_container_obj_func *)
+ _eoc_online_container_item_free,
+ NULL);
+
+}
+
+/**
+ * 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
+eocCNUTable_row_prep (eocCNUTable_rowreq_ctx *rowreq_ctx)
+{
+ char eocCNUMACAddress[6];
+ size_t eocCNUMACAddress_len = 6;
+ int eocCNUOnlineStatus = 0;
+ char eocCNUModelNumber[DEFAULT_SNMP_STRING_MAX_LENGTH];
+ size_t eocCNUModelNumber_len = 0;
+ long eocCNUPortAmount = 0;
+ u_long eocCNUAuthorizationState = 0;
+ char eocCNUSoftwareVersion[DEFAULT_SNMP_STRING_MAX_LENGTH];
+ size_t eocCNUSoftwareVersion_len = 0;
+ long eocCNURFAttenuation = 0;
+ long eocCNURFDownstreamQuality = 0;
+ long eocCNURFUpstreamQuality = 0;
+ u_long eocCNUReset = 0;
+ long eocCNUPhyDownstreamRate = 0;
+ long eocCNUPhyUpstreamRate = 0;
+
+ /* values for columns that are not supported are set to 0 */
+ u_long eocCNUConfigurationSaving = 0;
+ u_long eocCNUConfigurationResult = 0;
+
+ /* declarations for calls to libspid */
+ const char delimiters[2] = LIBSPID_ONLINE_INFO_DELIMITER "\0";
+ unsigned int elt_number = LIBSPID_ELT_MAX_NB;
+ char *elt_buffer[LIBSPID_ELT_MAX_NB] = {0};
+ char buffer[LIBSPID_LINE_MAX_LEN] = {0};
+
+
+ char *mac_slist;
+ char mac_str[LIBSPID_KEY_MAX_LEN];
+ int rc;
+
+ DEBUGMSGTL (("verbose:eocCNUTable:eocCNUTable_row_prep",
+ "called\n"));
+
+ netsnmp_assert (NULL != rowreq_ctx);
+
+
+ DEBUGMSGTL (("verbose:eocCNUTable:eocCNUTable_row_prep",
+ "current index: %d\n",
+ rowreq_ctx->tbl_idx.eocCNUIndex));
+
+ mac_slist = se_find_label_in_slist ("eoc_online_table",
+ rowreq_ctx->tbl_idx.eocCNUIndex);
+
+
+ if (NULL == mac_slist)
+ {
+ snmp_log (LOG_ERR,
+ "eocCNUTable: error retrieving \
+ MAC address from slave index\n");
+ return MFD_ERROR;
+ }
+
+ /* copy MAC address string to use for calls to libspid */
+ strcpy (mac_str, mac_slist);
+
+
+ DEBUGMSGTL (("verbose:eocCNUTable:eocCNUTable_row_prep",
+ "current MAC string: |%s|\n", mac_str));
+
+ /*LIBSPID_ONLINE_INFO_PATH*/
+ rc = libspid_config_read_line (
+ LIBSPID_ONLINE_INFO_PATH,
+ delimiters, mac_str, &elt_number, elt_buffer, buffer,
+ LIBSPID_LINE_MAX_LEN);
+
+ if (rc != LIBSPID_SUCCESS && rc != LIBSPID_ERROR_NOT_FOUND)
+ {
+ snmp_log (LOG_ERR, "libspid_config_read_line error=%d\n",rc);
+ return MFD_ERROR;
+ }
+
+ /*
+ * 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.
+ */
+
+ /*
+ * TODO:352:r: | |-> populate eocCNUTable data context.
+ * Populate data context here. (optionally, delay until row prep)
+ */
/*
* TRANSIENT or semi-TRANSIENT data:
* copy data or save any info needed to do it in row_prep.
@@ -251,222 +460,344 @@ eocCNUTable_container_load(netsnmp_container *container)
* setup/save data for eocCNUMACAddress
* eocCNUMACAddress(3)/MacAddress/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H
*/
- /** no mapping */
+
+ /* convert MAC address from string to char array */
+ if (LIBSPID_SUCCESS !=
+ libspid_mac_str_to_bin (mac_slist, eocCNUMACAddress))
+ {
+ snmp_log (LOG_ERR, "libspid_mac_str_to_bin error\n");
+ return MFD_ERROR;
+ }
+
+ rowreq_ctx->data.eocCNUMACAddress_len = 6;
+
+
/*
* make sure there is enough space for eocCNUMACAddress data
*/
+
+
if ((NULL == rowreq_ctx->data.eocCNUMACAddress) ||
(rowreq_ctx->data.eocCNUMACAddress_len <
- (eocCNUMACAddress_len* sizeof(eocCNUMACAddress[0])))) {
- snmp_log(LOG_ERR,"not enough space for value\n");
+ (eocCNUMACAddress_len * sizeof (eocCNUMACAddress[0]))))
+ {
+ snmp_log (LOG_ERR,
+ "eocCNUTable: eocCNUMACAddress: \
+ not enough space for value\n");
return MFD_ERROR;
}
- rowreq_ctx->data.eocCNUMACAddress_len = eocCNUMACAddress_len* sizeof(eocCNUMACAddress[0]);
- memcpy( rowreq_ctx->data.eocCNUMACAddress, eocCNUMACAddress, eocCNUMACAddress_len* sizeof(eocCNUMACAddress[0]) );
-
- /*
- * setup/save data for eocCNUOnlineStatus
- * eocCNUOnlineStatus(4)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
- */
- /** no mapping */
- rowreq_ctx->data.eocCNUOnlineStatus = eocCNUOnlineStatus;
-
+ rowreq_ctx->data.eocCNUMACAddress_len =
+ eocCNUMACAddress_len * sizeof (eocCNUMACAddress[0]);
+
+ memcpy (rowreq_ctx->data.eocCNUMACAddress,
+ eocCNUMACAddress,
+ eocCNUMACAddress_len * sizeof (eocCNUMACAddress[0]));
+
+ rowreq_ctx->data.eocCNUOnlineStatus = (rc == LIBSPID_SUCCESS) ? 1 : 0;
+
/*
* setup/save data for eocCNUModelNumber
- * eocCNUModelNumber(5)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/h
+ * eocCNUModelNumber(4)/DisplayString/
+ * ASN_OCTET_STR/char(char)//L/A/w/e/R/d/h
*/
- /** no mapping */
+ if (rc == LIBSPID_ERROR_NOT_FOUND)
+ {
+ strncpy (eocCNUModelNumber, "NOT_ONLINE",
+ DEFAULT_SNMP_STRING_MAX_LENGTH - 1);
+ eocCNUModelNumber[DEFAULT_SNMP_STRING_MAX_LENGTH - 1] = '\0';
+ eocCNUModelNumber_len = strlen (eocCNUModelNumber) + 1;
+ rowreq_ctx->data.eocCNUModelNumber_len = eocCNUModelNumber_len;
+ }
+ else
+ {
+ strncpy (eocCNUModelNumber, elt_buffer[0],
+ DEFAULT_SNMP_STRING_MAX_LENGTH - 1);
+ eocCNUModelNumber[DEFAULT_SNMP_STRING_MAX_LENGTH - 1] = '\0';
+ eocCNUModelNumber_len = strlen (eocCNUModelNumber) + 1;
+ rowreq_ctx->data.eocCNUModelNumber_len = eocCNUModelNumber_len;
+ }
/*
* make sure there is enough space for eocCNUModelNumber data
*/
if ((NULL == rowreq_ctx->data.eocCNUModelNumber) ||
(rowreq_ctx->data.eocCNUModelNumber_len <
- (eocCNUModelNumber_len* sizeof(eocCNUModelNumber[0])))) {
- snmp_log(LOG_ERR,"not enough space for value\n");
+ (eocCNUModelNumber_len * sizeof (eocCNUModelNumber[0]))))
+ {
+ snmp_log (LOG_ERR,
+ "eocCNUTable: eocCNUModelNumber: \
+ not enough space for value\n");
return MFD_ERROR;
}
- rowreq_ctx->data.eocCNUModelNumber_len = eocCNUModelNumber_len* sizeof(eocCNUModelNumber[0]);
- memcpy( rowreq_ctx->data.eocCNUModelNumber, eocCNUModelNumber, eocCNUModelNumber_len* sizeof(eocCNUModelNumber[0]) );
-
+
+ rowreq_ctx->data.eocCNUModelNumber_len =
+ eocCNUModelNumber_len * sizeof (eocCNUModelNumber[0]);
+
+ memcpy (rowreq_ctx->data.eocCNUModelNumber,
+ eocCNUModelNumber,
+ eocCNUModelNumber_len * sizeof (eocCNUModelNumber[0]));
+
+ if (rc == LIBSPID_ERROR_NOT_FOUND)
+ {
+ eocCNUPortAmount = 0;
+ }
+ else
+ {
+
+ if (1 != sscanf (elt_buffer[1], "%ld", &eocCNUPortAmount))
+ {
+ snmp_log (LOG_ERR, "error parsing port amount\n");
+ return MFD_ERROR;
+ }
+ }
/*
* setup/save data for eocCNUPortAmount
- * eocCNUPortAmount(6)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
+ * eocCNUPortAmount(5)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
+ */
+ /*
+ * TODO:246:r: |-> Define eocCNUPortAmount mapping.
+ * Map values between raw/native values and MIB values
+ *
+ * Integer based value can usually just do a direct copy.
*/
- /** no mapping */
rowreq_ctx->data.eocCNUPortAmount = eocCNUPortAmount;
-
+
+ if (rc == LIBSPID_ERROR_NOT_FOUND)
+ {
+ eocCNUAuthorizationState = EOCCNUAUTHORIZATIONSTATE_AUTHORIZED;
+ }
+ else
+ {
+
+ if (1 != sscanf (elt_buffer[2], "%ld", &eocCNUAuthorizationState))
+ {
+ snmp_log (LOG_ERR, "error parsing authorization state\n");
+ return MFD_ERROR;
+ }
+ }
+
/*
* setup/save data for eocCNUAuthorizationState
- * eocCNUAuthorizationState(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ * eocCNUAuthorizationState(6)/
+ * INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ /*
+ * TODO:246:r: |-> Define eocCNUAuthorizationState mapping.
+ * Map values between raw/native values and MIB values
+ *
+ * enums usually need mapping.
*/
- /** no mapping */
+
rowreq_ctx->data.eocCNUAuthorizationState = eocCNUAuthorizationState;
-
+
/*
* setup/save data for eocCNUSoftwareVersion
- * eocCNUSoftwareVersion(8)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/h
+ * eocCNUSoftwareVersion(7)/DisplayString/
+ * ASN_OCTET_STR/char(char)//L/A/w/e/R/d/h
*/
- /** no mapping */
+
+ if (rc == LIBSPID_ERROR_NOT_FOUND)
+ {
+ strncpy (eocCNUSoftwareVersion, "NOT_ONLINE",
+ DEFAULT_SNMP_STRING_MAX_LENGTH - 1);
+ eocCNUSoftwareVersion[DEFAULT_SNMP_STRING_MAX_LENGTH - 1] = '\0';
+ eocCNUSoftwareVersion_len = strlen (eocCNUSoftwareVersion) + 1;
+ rowreq_ctx->data.eocCNUSoftwareVersion_len =
+ eocCNUSoftwareVersion_len;
+ }
+ else
+ {
+ strncpy (eocCNUSoftwareVersion, elt_buffer[3],
+ DEFAULT_SNMP_STRING_MAX_LENGTH-1);
+ eocCNUSoftwareVersion[DEFAULT_SNMP_STRING_MAX_LENGTH-1] = '\0';
+ eocCNUSoftwareVersion_len = strlen (eocCNUSoftwareVersion) + 1;
+ rowreq_ctx->data.eocCNUSoftwareVersion_len =
+ eocCNUSoftwareVersion_len;
+ }
/*
* make sure there is enough space for eocCNUSoftwareVersion data
*/
if ((NULL == rowreq_ctx->data.eocCNUSoftwareVersion) ||
(rowreq_ctx->data.eocCNUSoftwareVersion_len <
- (eocCNUSoftwareVersion_len* sizeof(eocCNUSoftwareVersion[0])))) {
- snmp_log(LOG_ERR,"not enough space for value\n");
+ (eocCNUSoftwareVersion_len * sizeof (eocCNUSoftwareVersion[0]))))
+ {
+ snmp_log (LOG_ERR,
+ "eocCNUTable: eocCNUSoftwareVersion:"
+ "not enough space for value\n");
return MFD_ERROR;
}
- rowreq_ctx->data.eocCNUSoftwareVersion_len = eocCNUSoftwareVersion_len* sizeof(eocCNUSoftwareVersion[0]);
- memcpy( rowreq_ctx->data.eocCNUSoftwareVersion, eocCNUSoftwareVersion, eocCNUSoftwareVersion_len* sizeof(eocCNUSoftwareVersion[0]) );
-
+
+ rowreq_ctx->data.eocCNUSoftwareVersion_len =
+ eocCNUSoftwareVersion_len * sizeof (eocCNUSoftwareVersion[0]);
+ memcpy (rowreq_ctx->data.eocCNUSoftwareVersion,
+ eocCNUSoftwareVersion,
+ eocCNUSoftwareVersion_len * sizeof (eocCNUSoftwareVersion[0]));
+
/*
* setup/save data for eocCNUReset
- * eocCNUReset(9)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ * eocCNUReset(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
*/
- /** no mapping */
+ /*
+ * TODO:246:r: |-> Define eocCNUReset mapping.
+ * Map values between raw/native values and MIB values
+ *
+ * enums usually need mapping.
+ */
+
rowreq_ctx->data.eocCNUReset = eocCNUReset;
-
+
+ /*
+ * setup/save data for eocCNURFDownstreamAttenuation
+ * eocCNURFDownstreamAttenuation(9)/
+ * INTEGER/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
+ */
+
+ if (rc == LIBSPID_ERROR_NOT_FOUND)
+ {
+ eocCNURFAttenuation = 0;
+ }
+ else
+ {
+ if (1 != sscanf (elt_buffer[5], "%ld", &eocCNURFAttenuation))
+ {
+ snmp_log (LOG_ERR, "error parsing downstream attenuation\n");
+ return MFD_ERROR;
+ }
+ }
/*
- * setup/save data for eocCNURFAttenuation
- * eocCNURFAttenuation(10)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
+ * TODO:246:r: |-> Define eocCNURFDownstreamAttenuation mapping.
+ * Map values between raw/native values and MIB values
+ *
+ * Integer based value can usually just do a direct copy.
*/
- /** no mapping */
rowreq_ctx->data.eocCNURFAttenuation = eocCNURFAttenuation;
-
+
/*
* setup/save data for eocCNURFDownstreamQuality
- * eocCNURFDownstreamQuality(11)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
+ * eocCNURFDownstreamQuality(11)/
+ * INTEGER/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
+ */
+ /*
+ * TODO:246:r: |-> Define eocCNURFDownstreamQuality mapping.
+ * Map values between raw/native values and MIB values
+ *
+ * Integer based value can usually just do a direct copy.
*/
- /** no mapping */
- rowreq_ctx->data.eocCNURFDownstreamQuality = eocCNURFDownstreamQuality;
-
+
+ if (rc == LIBSPID_ERROR_NOT_FOUND)
+ {
+ eocCNURFDownstreamQuality = 0;
+ }
+ else
+ {
+
+ if (1 != sscanf (elt_buffer[6], "%ld", &eocCNURFDownstreamQuality))
+ {
+ snmp_log (LOG_ERR, "error parsing downstream quality\n");
+ return MFD_ERROR;
+ }
+ }
+ rowreq_ctx->data.eocCNURFDownstreamQuality =
+ (eocCNURFDownstreamQuality > 100 ) ? 100 : eocCNURFDownstreamQuality;
+
/*
* setup/save data for eocCNURFUpstreamQuality
- * eocCNURFUpstreamQuality(12)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
+ * eocCNURFUpstreamQuality(12)/
+ * INTEGER/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
+ */
+ /*
+ * TODO:246:r: |-> Define eocCNURFUpstreamQuality mapping.
+ * Map values between raw/native values and MIB values
+ *
+ * Integer based value can usually just do a direct copy.
*/
- /** no mapping */
- rowreq_ctx->data.eocCNURFUpstreamQuality = eocCNURFUpstreamQuality;
-
+
+ if (rc == LIBSPID_ERROR_NOT_FOUND)
+ {
+ eocCNURFUpstreamQuality = 0;
+ }
+ else
+ {
+ if (1 != sscanf (elt_buffer[7], "%ld", &eocCNURFUpstreamQuality))
+ {
+ snmp_log (LOG_ERR, "error parsing upstream quality\n");
+ return MFD_ERROR;
+ }
+ }
+
+ rowreq_ctx->data.eocCNURFUpstreamQuality =
+ (eocCNURFUpstreamQuality > 100 ) ? 100 : eocCNURFUpstreamQuality;
+
/*
* setup/save data for eocCNUPhyDownstreamRate
- * eocCNUPhyDownstreamRate(13)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
+ * eocCNUPhyDownstreamRate(13)/
+ * INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
*/
- /** no mapping */
+ if (rc == LIBSPID_ERROR_NOT_FOUND)
+ {
+ eocCNUPhyDownstreamRate = 0;
+ }
+ else
+ {
+
+ if (1 != sscanf (elt_buffer[8], "%ld", &eocCNUPhyDownstreamRate))
+ {
+ snmp_log (LOG_ERR, "error parsing downstream rate\n");
+ return MFD_ERROR;
+ }
+ }
rowreq_ctx->data.eocCNUPhyDownstreamRate = eocCNUPhyDownstreamRate;
-
+
/*
* setup/save data for eocCNUPhyUpstreamRate
* eocCNUPhyUpstreamRate(14)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
+ * TODO:246:r: |-> Define eocCNUPhyUpstreamRate mapping.
+ * Map values between raw/native values and MIB values
+ *
+ * Integer based value can usually just do a direct copy.
*/
- /** no mapping */
+ if (rc == LIBSPID_ERROR_NOT_FOUND)
+ {
+ eocCNUPhyUpstreamRate = 0;
+ }
+ else
+ {
+ if (1 != sscanf (elt_buffer[9], "%ld", &eocCNUPhyUpstreamRate))
+ {
+ snmp_log (LOG_ERR, "error parsing upstream rate\n");
+ return MFD_ERROR;
+ }
+ }
rowreq_ctx->data.eocCNUPhyUpstreamRate = eocCNUPhyUpstreamRate;
-
+
/*
* setup/save data for eocCNUConfigurationSaving
- * eocCNUConfigurationSaving(15)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
- */
- /** no mapping */
- rowreq_ctx->data.eocCNUConfigurationSaving = eocCNUConfigurationSaving;
-
- /*
- * setup/save data for eocCNUConfigurationResult
- * eocCNUConfigurationResult(16)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
- */
- /** no mapping */
- rowreq_ctx->data.eocCNUConfigurationResult = eocCNUConfigurationResult;
-
- /*
- * setup/save data for eocCNUAction
- * eocCNUAction(17)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ * eocCNUConfigurationSaving(15)/
+ * INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
*/
- /** no mapping */
- rowreq_ctx->data.eocCNUAction = eocCNUAction;
-
/*
- * setup/save data for eocCNUAdminStatus
- * eocCNUAdminStatus(18)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
- */
- /** no mapping */
- rowreq_ctx->data.eocCNUAdminStatus = eocCNUAdminStatus;
-
- /*
- * setup/save data for eocCNUDownstreamPIR
- * eocCNUDownstreamPIR(19)/INTEGER/ASN_INTEGER/long(long)//l/A/W/e/r/d/h
- */
- /** no mapping */
- rowreq_ctx->data.eocCNUDownstreamPIR = eocCNUDownstreamPIR;
-
- /*
- * setup/save data for eocCNUUpstreamPIR
- * eocCNUUpstreamPIR(20)/INTEGER/ASN_INTEGER/long(long)//l/A/W/e/r/d/h
+ * TODO:246:r: |-> Define eocCNUConfigurationSaving mapping.
+ * Map values between raw/native values and MIB values
+ *
+ * enums usually need mapping.
*/
- /** no mapping */
- rowreq_ctx->data.eocCNUUpstreamPIR = eocCNUUpstreamPIR;
-
-
- /*
- * insert into table container
- */
- CONTAINER_INSERT(container, rowreq_ctx);
- ++count;
- }
- DEBUGMSGT(("verbose:eocCNUTable:eocCNUTable_container_load",
- "inserted %d records\n", count));
-
- return MFD_SUCCESS;
-} /* eocCNUTable_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
-eocCNUTable_container_free(netsnmp_container *container)
-{
- DEBUGMSGTL(("verbose:eocCNUTable:eocCNUTable_container_free","called\n"));
+ rowreq_ctx->data.eocCNUConfigurationSaving = eocCNUConfigurationSaving;
/*
- * TODO:380:M: Free eocCNUTable container data.
+ * setup/save data for eocCNUConfigurationResult
+ * eocCNUConfigurationResult(16)/
+ * INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
*/
-} /* eocCNUTable_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
-eocCNUTable_row_prep( eocCNUTable_rowreq_ctx *rowreq_ctx)
-{
- DEBUGMSGTL(("verbose:eocCNUTable:eocCNUTable_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.
+ * TODO:246:r: |-> Define eocCNUConfigurationResult mapping.
+ * Map values between raw/native values and MIB values
+ *
+ * enums usually need mapping.
*/
- return MFD_SUCCESS;
-} /* eocCNUTable_row_prep */
+ rowreq_ctx->data.eocCNUConfigurationResult = eocCNUConfigurationResult;
+
+ return MFD_SUCCESS;
+}
/** @} */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_get.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_get.c
index c821d8fe07..afff25dc5e 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_get.c
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_get.c
@@ -1,6 +1,6 @@
/*
* Note: this file originally auto-generated by mib2c using
- * version : 12088 $ of $
+ * version : 12088 $ of $
*
* $Id:$
*/
@@ -64,10 +64,10 @@ eocCNUTable_indexes_set_tbl_idx(eocCNUTable_mib_index *tbl_idx, long eocCNUCBATC
/* eocCNUCBATCardIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */
tbl_idx->eocCNUCBATCardIndex = eocCNUCBATCardIndex_val;
-
+
/* eocCNUIndex(2)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */
tbl_idx->eocCNUIndex = eocCNUIndex_val;
-
+
return MFD_SUCCESS;
} /* eocCNUTable_indexes_set_tbl_idx */
@@ -201,9 +201,9 @@ eocCNUMACAddress_get( eocCNUTable_rowreq_ctx *rowreq_ctx, char **eocCNUMACAddres
* OID: .1.3.6.1.4.1.17409.2.4.5.2.4.1.4
* Description:
CNU在线状态:
- 0- 不在线;
- 1- 在线。
- 此对象要求在属性MIB中登记一个条目。
+ 0- 不在线;
+ 1- 在线。
+ 此对象要求在属性MIB中登记一个条目。
*
* Attributes:
* accessible 1 isscalar 0 enums 1 hasdefval 0
@@ -391,8 +391,8 @@ eocCNUPortAmount_get( eocCNUTable_rowreq_ctx *rowreq_ctx, long * eocCNUPortAmoun
* OID: .1.3.6.1.4.1.17409.2.4.5.2.4.1.7
* Description:
在线CNU的授权状态。
- 0- 非授权使用设备;
- 1- 合法授权设备。
+ 0- 非授权使用设备;
+ 1- 合法授权设备。
*
* Attributes:
* accessible 1 isscalar 0 enums 1 hasdefval 0
@@ -581,7 +581,7 @@ eocCNUReset_get( eocCNUTable_rowreq_ctx *rowreq_ctx, u_long * eocCNUReset_val_pt
* OID: .1.3.6.1.4.1.17409.2.4.5.2.4.1.10
* Description:
射频信道链路衰减,单位为dB。
- 此对象要求在属性MIB中登记一个条目。
+ 此对象要求在属性MIB中登记一个条目。
*
* Attributes:
* accessible 1 isscalar 0 enums 0 hasdefval 0
@@ -634,9 +634,9 @@ eocCNURFAttenuation_get( eocCNUTable_rowreq_ctx *rowreq_ctx, long * eocCNURFAtte
* OID: .1.3.6.1.4.1.17409.2.4.5.2.4.1.11
* Description:
射频下行信道链路质量。
- 以百分制表示,100表示最佳质量,0表示最差质量;评价方式由设备厂
- 商决定。
- 此对象要求在属性MIB中登记一个条目。
+ 以百分制表示,100表示最佳质量,0表示最差质量;评价方式由设备厂
+ 商决定。
+ 此对象要求在属性MIB中登记一个条目。
*
* Attributes:
* accessible 1 isscalar 0 enums 0 hasdefval 0
@@ -689,8 +689,8 @@ eocCNURFDownstreamQuality_get( eocCNUTable_rowreq_ctx *rowreq_ctx, long * eocCNU
* OID: .1.3.6.1.4.1.17409.2.4.5.2.4.1.12
* Description:
射频上行信道链路质量。
- 以百分制表示,100表示最佳质量,0表示最差质量,评价方式由设备厂商决定。
- 此对象要求在属性MIB中登记一个条目。
+ 以百分制表示,100表示最佳质量,0表示最差质量,评价方式由设备厂商决定。
+ 此对象要求在属性MIB中登记一个条目。
*
* Attributes:
* accessible 1 isscalar 0 enums 0 hasdefval 0
@@ -743,7 +743,7 @@ eocCNURFUpstreamQuality_get( eocCNUTable_rowreq_ctx *rowreq_ctx, long * eocCNURF
* OID: .1.3.6.1.4.1.17409.2.4.5.2.4.1.13
* Description:
CNU下行物理层速率。单位kbps
- 此对象要求在属性MIB中登记一个条目。
+ 此对象要求在属性MIB中登记一个条目。
*
* Attributes:
* accessible 1 isscalar 0 enums 0 hasdefval 0
@@ -794,8 +794,8 @@ eocCNUPhyDownstreamRate_get( eocCNUTable_rowreq_ctx *rowreq_ctx, long * eocCNUPh
* Its status is Current, and its access level is ReadOnly.
* OID: .1.3.6.1.4.1.17409.2.4.5.2.4.1.14
* Description:
-CNU上行物理层速率。单位kbps
- 此对象要求在属性MIB中登记一个条目。
+CNU上行物理层速率。单位kbps
+ 此对象要求在属性MIB中登记一个条目。
*
* Attributes:
* accessible 1 isscalar 0 enums 0 hasdefval 0
@@ -899,9 +899,9 @@ eocCNUConfigurationSaving_get( eocCNUTable_rowreq_ctx *rowreq_ctx, u_long * eocC
* OID: .1.3.6.1.4.1.17409.2.4.5.2.4.1.16
* Description:
保存EoC CNU设备当前配置的结果:
- success(0)- 保存当前配成功,
- running(1)- 正在保存当前配置,
- failed(2)- 保存当前配置失败。
+ success(0)- 保存当前配成功,
+ running(1)- 正在保存当前配置,
+ failed(2)- 保存当前配置失败。
*
* Attributes:
* accessible 1 isscalar 0 enums 1 hasdefval 0
@@ -954,7 +954,7 @@ eocCNUConfigurationResult_get( eocCNUTable_rowreq_ctx *rowreq_ctx, u_long * eocC
* OID: .1.3.6.1.4.1.17409.2.4.5.2.4.1.17
* Description:
对CNU进行的操作。
- delete(1)- 从CNU表中删除CNU, 只能删除不在线的CNU。
+ delete(1)- 从CNU表中删除CNU, 只能删除不在线的CNU。
*
* Attributes:
* accessible 1 isscalar 0 enums 1 hasdefval 0
@@ -1155,5 +1155,41 @@ eocCNUUpstreamPIR_get( eocCNUTable_rowreq_ctx *rowreq_ctx, long * eocCNUUpstream
} /* eocCNUUpstreamPIR_get */
+int
+eocCNUTable_RegisteredAmount_get (void)
+{
+ netsnmp_container * online_container;
+ int rc;
+ int reg_amount = 0;
+
+ DEBUGMSGTL (("verbose:eocCNUTable:eocCNUTable_RegisteredAmount_get",
+ "called!\n"));
+
+ online_container =
+ netsnmp_container_find ("eocCNUTable:table_container");
+ if (NULL == online_container)
+ {
+ snmp_log (LOG_ERR, "online table temp container not found\n");
+ return SNMP_ERR_GENERR;
+ }
+
+
+ /* free container before loading */
+ eocCNUTable_container_free (online_container);
+
+
+ /* load fresh container contents */
+ rc = eocCNUTable_container_load (online_container);
+ if (MFD_ERROR == rc)
+ {
+ snmp_log (LOG_ERR, "online table container load error\n");
+ return SNMP_ERR_GENERR;
+ }
+
+ /* get current container size */
+ reg_amount = CONTAINER_SIZE (online_container);
+
+ return reg_amount;
+}
/** @} */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_set.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_set.c
index b70047c196..4c6d9aa40f 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_set.c
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_data_set.c
@@ -18,7 +18,7 @@
*
* These routines are used to set the value for individual objects. The
* row context is passed, along with the new value.
- *
+ *
* @{
*/
/**********************************************************************
@@ -240,12 +240,12 @@ int
eocCNUTable_commit( eocCNUTable_rowreq_ctx *rowreq_ctx)
{
int rc = MFD_SUCCESS;
- int save_flags;
+ int save_flags;
- DEBUGMSGTL(("verbose:eocCNUTable:eocCNUTable_commit","called\n"));
+ DEBUGMSGTL (("verbose:eocCNUTable:eocCNUTable_commit","called\n"));
/** we should have a non-NULL pointer */
- netsnmp_assert( NULL != rowreq_ctx );
+ netsnmp_assert (NULL != rowreq_ctx );
/*
* save flags, then clear until we actually do something
@@ -260,118 +260,122 @@ eocCNUTable_commit( eocCNUTable_rowreq_ctx *rowreq_ctx)
* 3) set the column's flag in column_set_flags if it needs undo
* processing in case of a failure.
*/
- if (save_flags & COLUMN_EOCCNURESET_FLAG) {
- save_flags &= ~COLUMN_EOCCNURESET_FLAG; /* clear eocCNUReset */
- /*
- * TODO:482:o: |-> commit column eocCNUReset.
- */
- rc = -1;
- if(-1 == rc) {
- snmp_log(LOG_ERR,"eocCNUTable column eocCNUReset commit failed\n");
- }
- else {
- /*
- * set flag, in case we need to undo eocCNUReset
- */
- rowreq_ctx->column_set_flags |= COLUMN_EOCCNURESET_FLAG;
- }
+ if (save_flags & COLUMN_EOCCNURESET_FLAG)
+ {
+ save_flags &= ~COLUMN_EOCCNURESET_FLAG; /* clear eocCNUReset */
+ char cmd_str[32], mac_str[24];
+ /*
+ * TODO:482:o: |-> commit column eocCNUReset.
+ */
+
+ /*
+ * set flag, in case we need to undo eocCNUReset
+ */
+
+ if (LIBSPID_SUCCESS !=
+ libspid_mac_bin_to_str (rowreq_ctx->data.eocCNUMACAddress,
+ mac_str))
+ {
+ snmp_log (LOG_ERR, "libspid_mac_bin_to_str error\n");
+ return MFD_ERROR;
+ }
+ sprintf (cmd_str, "mme reboot %s", mac_str);
+
+ rc = system (cmd_str);
+ if (rc != 0)
+ {
+ snmp_log (LOG_ERR, "reboot %s failed\n",
+ rowreq_ctx->data.eocCNUMACAddress);
+ return MFD_ERROR;
+ }
+
+ rowreq_ctx->column_set_flags |= COLUMN_EOCCNURESET_FLAG;
+ rc = 0;
}
- if (save_flags & COLUMN_EOCCNUCONFIGURATIONSAVING_FLAG) {
- save_flags &= ~COLUMN_EOCCNUCONFIGURATIONSAVING_FLAG; /* clear eocCNUConfigurationSaving */
- /*
- * TODO:482:o: |-> commit column eocCNUConfigurationSaving.
- */
- rc = -1;
- if(-1 == rc) {
- snmp_log(LOG_ERR,"eocCNUTable column eocCNUConfigurationSaving commit failed\n");
- }
- else {
- /*
- * set flag, in case we need to undo eocCNUConfigurationSaving
- */
- rowreq_ctx->column_set_flags |= COLUMN_EOCCNUCONFIGURATIONSAVING_FLAG;
- }
+ if (save_flags & COLUMN_EOCCNUCONFIGURATIONSAVING_FLAG)
+ {
+ /* clear eocCNUConfigurationSaving */
+ save_flags &= ~COLUMN_EOCCNUCONFIGURATIONSAVING_FLAG;
+ /*
+ * TODO:482:o: |-> commit column eocCNUConfigurationSaving.
+ */
+
+ /*
+ * set flag, in case we need to undo eocCNUConfigurationSaving
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_EOCCNUCONFIGURATIONSAVING_FLAG;
+
}
- if (save_flags & COLUMN_EOCCNUACTION_FLAG) {
- save_flags &= ~COLUMN_EOCCNUACTION_FLAG; /* clear eocCNUAction */
- /*
- * TODO:482:o: |-> commit column eocCNUAction.
- */
- rc = -1;
- if(-1 == rc) {
- snmp_log(LOG_ERR,"eocCNUTable column eocCNUAction commit failed\n");
- }
- else {
- /*
- * set flag, in case we need to undo eocCNUAction
- */
- rowreq_ctx->column_set_flags |= COLUMN_EOCCNUACTION_FLAG;
- }
+ if (save_flags & COLUMN_EOCCNUACTION_FLAG)
+ {
+ save_flags &= ~COLUMN_EOCCNUACTION_FLAG; /* clear eocCNUAction */
+ /*
+ * TODO:482:o: |-> commit column eocCNUAction.
+ */
+
+ /*
+ * set flag, in case we need to undo eocCNUAction
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_EOCCNUACTION_FLAG;
}
- if (save_flags & COLUMN_EOCCNUADMINSTATUS_FLAG) {
- save_flags &= ~COLUMN_EOCCNUADMINSTATUS_FLAG; /* clear eocCNUAdminStatus */
- /*
- * TODO:482:o: |-> commit column eocCNUAdminStatus.
- */
- rc = -1;
- if(-1 == rc) {
- snmp_log(LOG_ERR,"eocCNUTable column eocCNUAdminStatus commit failed\n");
- }
- else {
- /*
- * set flag, in case we need to undo eocCNUAdminStatus
- */
- rowreq_ctx->column_set_flags |= COLUMN_EOCCNUADMINSTATUS_FLAG;
- }
+ if (save_flags & COLUMN_EOCCNUADMINSTATUS_FLAG)
+ {
+ /* clear eocCNUAdminStatus */
+ save_flags &= ~COLUMN_EOCCNUADMINSTATUS_FLAG;
+ /*
+ * TODO:482:o: |-> commit column eocCNUAdminStatus.
+ */
+
+ /*
+ * set flag, in case we need to undo eocCNUAdminStatus
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_EOCCNUADMINSTATUS_FLAG;
}
- if (save_flags & COLUMN_EOCCNUDOWNSTREAMPIR_FLAG) {
- save_flags &= ~COLUMN_EOCCNUDOWNSTREAMPIR_FLAG; /* clear eocCNUDownstreamPIR */
- /*
- * TODO:482:o: |-> commit column eocCNUDownstreamPIR.
- */
- rc = -1;
- if(-1 == rc) {
- snmp_log(LOG_ERR,"eocCNUTable column eocCNUDownstreamPIR commit failed\n");
- }
- else {
- /*
- * set flag, in case we need to undo eocCNUDownstreamPIR
- */
- rowreq_ctx->column_set_flags |= COLUMN_EOCCNUDOWNSTREAMPIR_FLAG;
- }
+ if (save_flags & COLUMN_EOCCNUDOWNSTREAMPIR_FLAG)
+ {
+ /* clear eocCNUDownstreamPIR */
+ save_flags &= ~COLUMN_EOCCNUDOWNSTREAMPIR_FLAG;
+ /*
+ * TODO:482:o: |-> commit column eocCNUDownstreamPIR.
+ */
+
+ /*
+ * set flag, in case we need to undo eocCNUDownstreamPIR
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_EOCCNUDOWNSTREAMPIR_FLAG;
}
- if (save_flags & COLUMN_EOCCNUUPSTREAMPIR_FLAG) {
- save_flags &= ~COLUMN_EOCCNUUPSTREAMPIR_FLAG; /* clear eocCNUUpstreamPIR */
- /*
- * TODO:482:o: |-> commit column eocCNUUpstreamPIR.
- */
- rc = -1;
- if(-1 == rc) {
- snmp_log(LOG_ERR,"eocCNUTable column eocCNUUpstreamPIR commit failed\n");
- }
- else {
- /*
- * set flag, in case we need to undo eocCNUUpstreamPIR
- */
- rowreq_ctx->column_set_flags |= COLUMN_EOCCNUUPSTREAMPIR_FLAG;
- }
+ if (save_flags & COLUMN_EOCCNUUPSTREAMPIR_FLAG)
+ {
+ /* clear eocCNUUpstreamPIR */
+ save_flags &= ~COLUMN_EOCCNUUPSTREAMPIR_FLAG;
+ /*
+ * TODO:482:o: |-> commit column eocCNUUpstreamPIR.
+ */
+
+ /*
+ * set flag, in case we need to undo eocCNUUpstreamPIR
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_EOCCNUUPSTREAMPIR_FLAG;
}
/*
* if we successfully commited this row, set the dirty flag.
*/
- if (MFD_SUCCESS == rc) {
+ 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;
+ if (save_flags)
+ {
+ snmp_log (LOG_ERR, "unhandled columns (0x%x) in commit\n",
+ save_flags);
+ return MFD_ERROR;
}
return rc;
@@ -410,7 +414,7 @@ eocCNUTable_undo_commit( eocCNUTable_rowreq_ctx *rowreq_ctx)
* eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {}
*/
-
+
/*
* if we successfully un-commited this row, clear the dirty flag.
*/
@@ -464,12 +468,12 @@ eocCNUTable_undo_commit( eocCNUTable_rowreq_ctx *rowreq_ctx)
* 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
@@ -550,17 +554,57 @@ eocCNUReset_undo_setup( eocCNUTable_rowreq_ctx *rowreq_ctx)
int
eocCNUReset_set( eocCNUTable_rowreq_ctx *rowreq_ctx, u_long eocCNUReset_val )
{
-
- DEBUGMSGTL(("verbose:eocCNUTable:eocCNUReset_set","called\n"));
+ char mac_str[LIBSPID_MAC_STR_LEN];
+ DEBUGMSGTL (("verbose:eocCNUTable:eocCNUReset_set","called\n"));
/** should never get a NULL pointer */
- netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert (NULL != rowreq_ctx);
+
+ /* check if current MAC address is valid */
+ netsnmp_assert (NULL != rowreq_ctx->data.eocCNUMACAddress);
/*
- * TODO:461:M: |-> Set eocCNUReset value.
- * set eocCNUReset value in rowreq_ctx->data
+ * TODO:245:o: |-> Implement eocCNUReset reverse mapping.
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them here.
*/
- rowreq_ctx->data.eocCNUReset = eocCNUReset_val;
+ switch (eocCNUReset_val)
+ {
+ case EOCCNURESET_RESET:
+ /* if reset value is given, call libspid function for rebooting
+ * slave with MAC address corresponding to current row */
+ /* if reboot succeeds, update current table node */
+
+ /* convert MAC address from char array to string */
+ if (LIBSPID_SUCCESS !=
+ libspid_mac_bin_to_str (rowreq_ctx->data.eocCNUMACAddress,
+ mac_str))
+ {
+ snmp_log (LOG_ERR, "libspid_mac_bin_to_str error\n");
+ return MFD_ERROR;
+ }
+
+ /* check if slave is authorized before attempting reset */
+ if (LIBSPID_SUCCESS != libspid_eoc_wl_authorization (mac_str))
+ return SNMP_ERR_AUTHORIZATIONERROR;
+
+ if (LIBSPID_SUCCESS == libspid_eoc_reboot (mac_str))
+ rowreq_ctx->data.eocCNUReset = EOCCNURESET_RESET;
+ else
+ {
+ snmp_log (LOG_ERR,
+ "Couldn't reboot slave for MAC address: %s \n",
+ mac_str);
+ return MFD_ERROR;
+ }
+ break;
+
+ default:
+ snmp_log (LOG_ERR,
+ "couldn't reverse map value %ld for eocCNUReset\n",
+ eocCNUReset_val);
+ return SNMP_ERR_GENERR;
+ }
return MFD_SUCCESS;
} /* eocCNUReset_set */
@@ -588,7 +632,7 @@ eocCNUReset_undo( eocCNUTable_rowreq_ctx *rowreq_ctx)
*/
rowreq_ctx->data.eocCNUReset = rowreq_ctx->undo->eocCNUReset;
-
+
return MFD_SUCCESS;
} /* eocCNUReset_undo */
@@ -629,12 +673,12 @@ eocCNUReset_undo( eocCNUTable_rowreq_ctx *rowreq_ctx)
* 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
@@ -719,7 +763,7 @@ eocCNUConfigurationSaving_set( eocCNUTable_rowreq_ctx *rowreq_ctx, u_long eocCNU
DEBUGMSGTL(("verbose:eocCNUTable:eocCNUConfigurationSaving_set","called\n"));
/** should never get a NULL pointer */
- netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert (NULL != rowreq_ctx);
/*
* TODO:461:M: |-> Set eocCNUConfigurationSaving value.
@@ -728,7 +772,7 @@ eocCNUConfigurationSaving_set( eocCNUTable_rowreq_ctx *rowreq_ctx, u_long eocCNU
rowreq_ctx->data.eocCNUConfigurationSaving = eocCNUConfigurationSaving_val;
return MFD_SUCCESS;
-} /* eocCNUConfigurationSaving_set */
+}
/**
* undo the previous set.
@@ -737,10 +781,10 @@ eocCNUConfigurationSaving_set( eocCNUTable_rowreq_ctx *rowreq_ctx, u_long eocCNU
* Pointer to the users context.
*/
int
-eocCNUConfigurationSaving_undo( eocCNUTable_rowreq_ctx *rowreq_ctx)
+eocCNUConfigurationSaving_undo (eocCNUTable_rowreq_ctx *rowreq_ctx)
{
- DEBUGMSGTL(("verbose:eocCNUTable:eocCNUConfigurationSaving_undo","called\n"));
+ DEBUGMSGTL (("verbose:eocCNUTable:eocCNUConfigurationSaving_undo","called\n"));
netsnmp_assert(NULL != rowreq_ctx);
@@ -753,7 +797,7 @@ eocCNUConfigurationSaving_undo( eocCNUTable_rowreq_ctx *rowreq_ctx)
*/
rowreq_ctx->data.eocCNUConfigurationSaving = rowreq_ctx->undo->eocCNUConfigurationSaving;
-
+
return MFD_SUCCESS;
} /* eocCNUConfigurationSaving_undo */
@@ -764,7 +808,7 @@ eocCNUConfigurationSaving_undo( eocCNUTable_rowreq_ctx *rowreq_ctx)
* OID: .1.3.6.1.4.1.17409.2.4.5.2.4.1.17
* Description:
对CNU进行的操作。
- delete(1)- 从CNU表中删除CNU, 只能删除不在线的CNU。
+ delete(1)- 从CNU表中删除CNU, 只能删除不在线的CNU。
*
* Attributes:
* accessible 1 isscalar 0 enums 1 hasdefval 0
@@ -795,12 +839,12 @@ eocCNUConfigurationSaving_undo( eocCNUTable_rowreq_ctx *rowreq_ctx)
* 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
@@ -882,10 +926,10 @@ int
eocCNUAction_set( eocCNUTable_rowreq_ctx *rowreq_ctx, u_long eocCNUAction_val )
{
- DEBUGMSGTL(("verbose:eocCNUTable:eocCNUAction_set","called\n"));
+ DEBUGMSGTL (("verbose:eocCNUTable:eocCNUAction_set","called\n"));
/** should never get a NULL pointer */
- netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert (NULL != rowreq_ctx);
/*
* TODO:461:M: |-> Set eocCNUAction value.
@@ -894,7 +938,7 @@ eocCNUAction_set( eocCNUTable_rowreq_ctx *rowreq_ctx, u_long eocCNUAction_val )
rowreq_ctx->data.eocCNUAction = eocCNUAction_val;
return MFD_SUCCESS;
-} /* eocCNUAction_set */
+}
/**
* undo the previous set.
@@ -919,7 +963,7 @@ eocCNUAction_undo( eocCNUTable_rowreq_ctx *rowreq_ctx)
*/
rowreq_ctx->data.eocCNUAction = rowreq_ctx->undo->eocCNUAction;
-
+
return MFD_SUCCESS;
} /* eocCNUAction_undo */
@@ -960,12 +1004,12 @@ CNU管理状态
* 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
@@ -1047,10 +1091,10 @@ int
eocCNUAdminStatus_set( eocCNUTable_rowreq_ctx *rowreq_ctx, u_long eocCNUAdminStatus_val )
{
- DEBUGMSGTL(("verbose:eocCNUTable:eocCNUAdminStatus_set","called\n"));
+ DEBUGMSGTL (("verbose:eocCNUTable:eocCNUAdminStatus_set","called\n"));
/** should never get a NULL pointer */
- netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert (NULL != rowreq_ctx);
/*
* TODO:461:M: |-> Set eocCNUAdminStatus value.
@@ -1084,7 +1128,7 @@ eocCNUAdminStatus_undo( eocCNUTable_rowreq_ctx *rowreq_ctx)
*/
rowreq_ctx->data.eocCNUAdminStatus = rowreq_ctx->undo->eocCNUAdminStatus;
-
+
return MFD_SUCCESS;
} /* eocCNUAdminStatus_undo */
@@ -1124,12 +1168,12 @@ unit: kkbps
* 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
@@ -1247,7 +1291,7 @@ eocCNUDownstreamPIR_undo( eocCNUTable_rowreq_ctx *rowreq_ctx)
*/
rowreq_ctx->data.eocCNUDownstreamPIR = rowreq_ctx->undo->eocCNUDownstreamPIR;
-
+
return MFD_SUCCESS;
} /* eocCNUDownstreamPIR_undo */
@@ -1287,12 +1331,12 @@ eocCNUDownstreamPIR_undo( eocCNUTable_rowreq_ctx *rowreq_ctx)
* 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
@@ -1410,7 +1454,7 @@ eocCNUUpstreamPIR_undo( eocCNUTable_rowreq_ctx *rowreq_ctx)
*/
rowreq_ctx->data.eocCNUUpstreamPIR = rowreq_ctx->undo->eocCNUUpstreamPIR;
-
+
return MFD_SUCCESS;
} /* eocCNUUpstreamPIR_undo */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_interface.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_interface.c
index 7bd3ce0914..f50b61b43f 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_interface.c
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_interface.c
@@ -1,6 +1,6 @@
/*
* Note: this file originally auto-generated by mib2c using
- * version : 15899 $ of $
+ * version : 15899 $ of $
*
* $Id:$
*/
@@ -60,7 +60,7 @@ typedef struct eocCNUTable_interface_ctx_s {
netsnmp_cache *cache;
eocCNUTable_registration * user_ctx;
-
+
netsnmp_table_registration_info tbl_info;
netsnmp_baby_steps_access_methods access_multiplexer;
@@ -141,7 +141,7 @@ eocCNUTable_data *eocCNUTable_allocate_data(void);
/**
* @internal
- * Initialize the table eocCNUTable
+ * Initialize the table eocCNUTable
* (Define its contents and how it's structured)
*/
void
@@ -192,7 +192,7 @@ _eocCNUTable_initialize_interface(eocCNUTable_registration * reg_ptr, u_long fl
snmp_log(LOG_ERR,"could not initialize container for eocCNUTable\n");
return;
}
-
+
/*
* access_multiplexer: REQUIRED wrapper for get request handling
*/
@@ -227,7 +227,7 @@ _eocCNUTable_initialize_interface(eocCNUTable_registration * reg_ptr, u_long fl
* Create a registration, save our reg data, register table.
*/
DEBUGMSGTL(("eocCNUTable:init_eocCNUTable",
- "Registering eocCNUTable as a mibs-for-dummies table.\n"));
+ "Registering eocCNUTable as a mibs-for-dummies table.\n"));
handler = netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
reginfo = netsnmp_handler_registration_create("eocCNUTable", handler,
eocCNUTable_oid,
@@ -258,14 +258,14 @@ _eocCNUTable_initialize_interface(eocCNUTable_registration * reg_ptr, u_long fl
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 )
@@ -274,7 +274,7 @@ _eocCNUTable_initialize_interface(eocCNUTable_registration * reg_ptr, u_long fl
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);
@@ -339,7 +339,7 @@ eocCNUTable_index_to_oid(netsnmp_index *oid_idx,
eocCNUTable_mib_index *mib_idx)
{
int err = SNMP_ERR_NOERROR;
-
+
/*
* temp storage for parsing indexes
*/
@@ -401,7 +401,7 @@ eocCNUTable_index_from_oid(netsnmp_index *oid_idx,
eocCNUTable_mib_index *mib_idx)
{
int err = SNMP_ERR_NOERROR;
-
+
/*
* temp storage for parsing indexes
*/
@@ -533,12 +533,12 @@ eocCNUTable_release_rowreq_ctx(eocCNUTable_rowreq_ctx *rowreq_ctx)
DEBUGMSGTL(("internal:eocCNUTable:eocCNUTable_release_rowreq_ctx","called\n"));
netsnmp_assert(NULL != rowreq_ctx);
-
+
eocCNUTable_rowreq_ctx_cleanup(rowreq_ctx);
if(rowreq_ctx->undo)
eocCNUTable_release_data(rowreq_ctx->undo);
-
+
/*
* free index oid pointer
*/
@@ -562,13 +562,13 @@ _mfd_eocCNUTable_pre_request(netsnmp_mib_handler *handler,
DEBUGMSGTL(("internal:eocCNUTable:_mfd_eocCNUTable_pre_request",
"called\n"));
-
+
if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
DEBUGMSGTL(("internal:eocCNUTable",
"skipping additional pre_request\n"));
return SNMP_ERR_NOERROR;
}
-
+
rc = eocCNUTable_pre_request(eocCNUTable_if_ctx.user_ctx);
if (MFD_SUCCESS != rc) {
/*
@@ -578,7 +578,7 @@ _mfd_eocCNUTable_pre_request(netsnmp_mib_handler *handler,
"eocCNUTable_pre_request\n", rc));
netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
}
-
+
return SNMP_ERR_NOERROR;
} /* _mfd_eocCNUTable_pre_request */
@@ -613,7 +613,7 @@ _mfd_eocCNUTable_post_request(netsnmp_mib_handler *handler,
"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) && eocCNUTable_dirty_get()) {
/*
@@ -632,7 +632,7 @@ _mfd_eocCNUTable_post_request(netsnmp_mib_handler *handler,
DEBUGMSGTL(("eocCNUTable","error %d from "
"eocCNUTable_post_request\n", rc));
}
-
+
return SNMP_ERR_NOERROR;
} /* _mfd_eocCNUTable_post_request */
@@ -649,7 +649,7 @@ _mfd_eocCNUTable_object_lookup(netsnmp_mib_handler *handler,
int rc = SNMP_ERR_NOERROR;
eocCNUTable_rowreq_ctx *rowreq_ctx =
netsnmp_container_table_row_extract(requests);
-
+
DEBUGMSGTL(("internal:eocCNUTable:_mfd_eocCNUTable_object_lookup","called\n"));
/*
@@ -684,7 +684,7 @@ _eocCNUTable_get_column( eocCNUTable_rowreq_ctx *rowreq_ctx,
netsnmp_variable_list *var, int column )
{
int rc = SNMPERR_SUCCESS;
-
+
DEBUGMSGTL(("internal:eocCNUTable:_mfd_eocCNUTable_get_column",
"called for %d\n", column));
@@ -861,7 +861,7 @@ _mfd_eocCNUTable_get_values(netsnmp_mib_handler *handler,
DEBUGMSGTL(("internal:eocCNUTable:_mfd_eocCNUTable_get_values","called\n"));
netsnmp_assert(NULL != rowreq_ctx);
-
+
for(;requests; requests = requests->next) {
/*
* save old pointer, so we can free it if replaced
@@ -883,7 +883,7 @@ _mfd_eocCNUTable_get_values(netsnmp_mib_handler *handler,
tri = netsnmp_extract_table_info(requests);
if(NULL == tri)
continue;
-
+
rc = _eocCNUTable_get_column(rowreq_ctx, requests->requestvb, tri->colnum);
if(rc) {
if(MFD_SKIP == rc) {
@@ -936,7 +936,7 @@ _eocCNUTable_check_column( eocCNUTable_rowreq_ctx *rowreq_ctx,
netsnmp_variable_list *var, int column )
{
int rc = SNMPERR_SUCCESS;
-
+
DEBUGMSGTL(("internal:eocCNUTable:_eocCNUTable_check_column",
"called for %d\n", column));
@@ -1167,7 +1167,7 @@ _mfd_eocCNUTable_check_objects(netsnmp_mib_handler *handler,
DEBUGMSGTL(("internal:eocCNUTable:_mfd_eocCNUTable_check_objects","called\n"));
netsnmp_assert(NULL != rowreq_ctx);
-
+
for(;requests; requests = requests->next) {
/*
@@ -1202,7 +1202,7 @@ NETSNMP_STATIC_INLINE int
_eocCNUTable_undo_setup_column( eocCNUTable_rowreq_ctx *rowreq_ctx, int column )
{
int rc = SNMPERR_SUCCESS;
-
+
DEBUGMSGTL(("internal:eocCNUTable:_eocCNUTable_undo_setup_column",
"called for %d\n", column));
@@ -1305,7 +1305,7 @@ _mfd_eocCNUTable_undo_setup(netsnmp_mib_handler *handler,
tri = netsnmp_extract_table_info(requests);
if(NULL == tri)
continue;
-
+
rc = _eocCNUTable_undo_setup_column(rowreq_ctx, tri->colnum);
if(MFD_SUCCESS != rc) {
DEBUGMSGTL(("eocCNUTable:mfd","error %d from "
@@ -1314,7 +1314,7 @@ _mfd_eocCNUTable_undo_setup(netsnmp_mib_handler *handler,
}
} /* for results */
}
-
+
return SNMP_ERR_NOERROR;
} /* _mfd_eocCNUTable_undo_setup */
@@ -1378,7 +1378,7 @@ _eocCNUTable_set_column( eocCNUTable_rowreq_ctx *rowreq_ctx,
netsnmp_variable_list *var, int column )
{
int rc = SNMPERR_SUCCESS;
-
+
DEBUGMSGTL(("internal:eocCNUTable:_eocCNUTable_set_column",
"called for %d\n", column));
@@ -1427,7 +1427,7 @@ _eocCNUTable_set_column( eocCNUTable_rowreq_ctx *rowreq_ctx,
rc = SNMP_ERR_GENERR;
break;
}
-
+
return rc;
} /* _eocCNUTable_set_column */
@@ -1445,7 +1445,7 @@ _mfd_eocCNUTable_set_values(netsnmp_mib_handler *handler,
DEBUGMSGTL(("internal:eocCNUTable:_mfd_eocCNUTable_set_values","called\n"));
netsnmp_assert(NULL != rowreq_ctx);
-
+
rowreq_ctx->column_set_flags = 0;
for(;requests; requests = requests->next) {
/*
@@ -1454,7 +1454,7 @@ _mfd_eocCNUTable_set_values(netsnmp_mib_handler *handler,
tri = netsnmp_extract_table_info(requests);
if(NULL == tri)
continue;
-
+
rc = _eocCNUTable_set_column(rowreq_ctx,
requests->requestvb, tri->colnum);
if(MFD_SUCCESS != rc) {
@@ -1489,7 +1489,7 @@ _mfd_eocCNUTable_commit(netsnmp_mib_handler *handler,
DEBUGMSGTL(("internal:eocCNUTable:_mfd_eocCNUTable_commit","called\n"));
netsnmp_assert(NULL != rowreq_ctx);
-
+
rc = eocCNUTable_commit(rowreq_ctx);
if (MFD_SUCCESS != rc) {
DEBUGMSGTL(("eocCNUTable:mfd","error %d from "
@@ -1562,7 +1562,7 @@ _eocCNUTable_undo_column( eocCNUTable_rowreq_ctx *rowreq_ctx,
netsnmp_variable_list *var, int column )
{
int rc = SNMPERR_SUCCESS;
-
+
DEBUGMSGTL(("internal:eocCNUTable:_eocCNUTable_undo_column",
"called for %d\n", column));
@@ -1622,7 +1622,7 @@ _mfd_eocCNUTable_undo_values(netsnmp_mib_handler *handler,
DEBUGMSGTL(("internal:eocCNUTable:_mfd_eocCNUTable_undo_values","called\n"));
netsnmp_assert(NULL != rowreq_ctx);
-
+
rc = eocCNUTable_undo(rowreq_ctx);
if (MFD_SUCCESS != rc) {
/*
@@ -1631,7 +1631,7 @@ _mfd_eocCNUTable_undo_values(netsnmp_mib_handler *handler,
DEBUGMSGTL(("eocCNUTable:mfd","error %d from "
"eocCNUTable_undo\n", rc));
}
-
+
for(;requests; requests = requests->next) {
/*
* set column data
@@ -1639,7 +1639,7 @@ _mfd_eocCNUTable_undo_values(netsnmp_mib_handler *handler,
tri = netsnmp_extract_table_info(requests);
if(NULL == tri)
continue;
-
+
rc = _eocCNUTable_undo_column(rowreq_ctx, requests->requestvb,
tri->colnum);
if (MFD_SUCCESS != rc) {
@@ -1671,11 +1671,11 @@ _mfd_eocCNUTable_irreversible_commit(netsnmp_mib_handler *handler,
{
eocCNUTable_rowreq_ctx *rowreq_ctx =
netsnmp_container_table_row_extract(requests);
-
+
DEBUGMSGTL(("internal:eocCNUTable:_mfd_eocCNUTable_irreversible:commit","called\n"));
-
+
netsnmp_assert(NULL != rowreq_ctx);
-
+
/*
* check for and handle row creation/deletion
* and update column exist flags...
@@ -1715,7 +1715,7 @@ _cache_load(netsnmp_cache *cache, void *vmagic)
/** should only be called for an invalid or expired cache */
netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
-
+
/*
* call user code
*/
@@ -1773,7 +1773,7 @@ _container_free(netsnmp_container *container)
* call user code
*/
eocCNUTable_container_free(container);
-
+
/*
* free all items. inefficient, but easy.
*/
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_oids.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_oids.h
index 261682ffc8..d06c02e013 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_oids.h
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCNUGroup/eocCNU/eocCNUTable/eocCNUTable_oids.h
@@ -12,60 +12,64 @@ extern "C" {
#endif
+/* definitions for scalars added to table modEoCOnlineCNUTable */
+#define EOCCNUCURRENTAMOUNT_OID 1,3,6,1,4,1,17409,2,4,5,2,2
+#define EOCCNUAMOUNTLIMITATION_OID 1,3,6,1,4,1,17409,2,4,5,2,3
+
/* column number definitions for table eocCNUTable */
#define EOCCNUTABLE_OID 1,3,6,1,4,1,17409,2,4,5,2,4
#define COLUMN_EOCCNUCBATCARDINDEX 1
-
+
#define COLUMN_EOCCNUINDEX 2
-
+
#define COLUMN_EOCCNUMACADDRESS 3
-
+
#define COLUMN_EOCCNUONLINESTATUS 4
-
+
#define COLUMN_EOCCNUMODELNUMBER 5
-
+
#define COLUMN_EOCCNUPORTAMOUNT 6
-
+
#define COLUMN_EOCCNUAUTHORIZATIONSTATE 7
-
+
#define COLUMN_EOCCNUSOFTWAREVERSION 8
-
+
#define COLUMN_EOCCNURESET 9
#define COLUMN_EOCCNURESET_FLAG (0x1 << 0)
-
+
#define COLUMN_EOCCNURFATTENUATION 10
-
+
#define COLUMN_EOCCNURFDOWNSTREAMQUALITY 11
-
+
#define COLUMN_EOCCNURFUPSTREAMQUALITY 12
-
+
#define COLUMN_EOCCNUPHYDOWNSTREAMRATE 13
-
+
#define COLUMN_EOCCNUPHYUPSTREAMRATE 14
-
+
#define COLUMN_EOCCNUCONFIGURATIONSAVING 15
#define COLUMN_EOCCNUCONFIGURATIONSAVING_FLAG (0x1 << 1)
-
+
#define COLUMN_EOCCNUCONFIGURATIONRESULT 16
-
+
#define COLUMN_EOCCNUACTION 17
#define COLUMN_EOCCNUACTION_FLAG (0x1 << 2)
-
+
#define COLUMN_EOCCNUADMINSTATUS 18
#define COLUMN_EOCCNUADMINSTATUS_FLAG (0x1 << 3)
-
+
#define COLUMN_EOCCNUDOWNSTREAMPIR 19
#define COLUMN_EOCCNUDOWNSTREAMPIR_FLAG (0x1 << 4)
-
+
#define COLUMN_EOCCNUUPSTREAMPIR 20
#define COLUMN_EOCCNUUPSTREAMPIR_FLAG (0x1 << 5)
-
+
#define EOCCNUTABLE_MIN_COL COLUMN_EOCCNUCBATCARDINDEX
#define EOCCNUTABLE_MAX_COL COLUMN_EOCCNUUPSTREAMPIR
-
+
/*
* TODO:405:r: Review EOCCNUTABLE_SETTABLE_COLS macro.