summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/EoCCommon.h9
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects/eocExtOcnBcmpGlobalObjects.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects/eocExtOcnBcmpGlobalObjects/eocExtOcnBcmpGlobalObjects.c234
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects/eocExtOcnBcmpGlobalObjects/eocExtOcnBcmpGlobalObjects.h3
6 files changed, 183 insertions, 69 deletions
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/EoCCommon.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/EoCCommon.h
index ace504dcc8..3a05a95cb9 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/EoCCommon.h
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/EoCCommon.h
@@ -71,6 +71,12 @@ typedef enum
SPC300_MASTER_CONFIG_RESULT_SYSTEM_ERR = 5
} spc300_master_config_result_t;
+typedef enum
+{
+ BCMP_ENABLE_YES = 1,
+ BCMP_ENABLE_NO = 2
+}bcmp_enable_t;
+
/*
* common SNMP defines
*/
@@ -212,4 +218,7 @@ typedef enum
#define EOCCBATADMIN_DEFINE_COMMUNITY_ALL "mstar"
#define EOCCBATADMIN_VLANID_MAX 4095
+/* eocExtOcnBcmpGroup*/
+#define EOC_BCMP_VERSION "1.0"
+
#endif /* EOCCOMMON_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects.h
index a0bdd884e2..cb95b07bf3 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects.h
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects.h
@@ -1,2 +1,2 @@
config_require(mstar-eoc-mib/eocExtObjects/eocExtCnuObjects)
-//config_require(mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects)
+config_require(mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects.h
index 9b7b50dddf..af9212d0d5 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects.h
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects.h
@@ -1 +1 @@
-//config_require(mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects/eocExtOcnBcmpGlobalObjects)
+config_require(mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects/eocExtOcnBcmpGlobalObjects)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects/eocExtOcnBcmpGlobalObjects.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects/eocExtOcnBcmpGlobalObjects.h
index 244df0b238..0ee71ba99d 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects/eocExtOcnBcmpGlobalObjects.h
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects/eocExtOcnBcmpGlobalObjects.h
@@ -1 +1 @@
-//config_require(mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects/eocExtOcnBcmpGlobalObjects/eocExtOcnBcmpGlobalObjects)
+config_require(mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects/eocExtOcnBcmpGlobalObjects/eocExtOcnBcmpGlobalObjects)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects/eocExtOcnBcmpGlobalObjects/eocExtOcnBcmpGlobalObjects.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects/eocExtOcnBcmpGlobalObjects/eocExtOcnBcmpGlobalObjects.c
index b40af70621..f921eec728 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects/eocExtOcnBcmpGlobalObjects/eocExtOcnBcmpGlobalObjects.c
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects/eocExtOcnBcmpGlobalObjects/eocExtOcnBcmpGlobalObjects.c
@@ -36,74 +36,175 @@ handle_eocExtOcnBcmpEnable(netsnmp_mib_handler *handler,
netsnmp_request_info *requests)
{
int ret;
+ bcmp_enable_t bcmp_enable;
+ int *bcmp_enable_save = NULL;
+ char buffer[LIBSPID_LINE_MAX_LEN];
+ long value;
/* 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 );
+ switch (reqinfo->mode)
+ {
+ case MODE_GET:
+ ret = libspid_config_read_item (
+ LIBSPID_SYSTEM_CONF_PATH,
+ LIBSPID_SYSTEM_CONF_LABEL_BCMP_ENABLE,
+ buffer, LIBSPID_LINE_MAX_LEN);
+
+ if (LIBSPID_SUCCESS != ret)
+ {
+ snmp_log (LOG_ERR, "libspid_config_read_item error\n");
+ bcmp_enable = BCMP_ENABLE_NO;
+ }
+ else
+ {
+ if (!strncmp (buffer, LIBSPID_SYSTEM_CONF_VALUE_YES,
+ strlen (LIBSPID_SYSTEM_CONF_VALUE_YES)))
+ {
+ bcmp_enable = BCMP_ENABLE_YES;
}
- 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);
+ else
+ {
+ bcmp_enable = BCMP_ENABLE_NO;
}
+ }
+ snmp_set_var_typed_value (requests->requestvb, ASN_INTEGER,
+ (u_char *) &bcmp_enable,
+ sizeof (bcmp_enable));
+ break;
+ case MODE_SET_RESERVE1:
+ 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,
+ BCMP_ENABLE_YES,
+ BCMP_ENABLE_NO);
+ if (ret != SNMP_ERR_NOERROR)
+ {
+ netsnmp_set_request_error (reqinfo, requests, ret);
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+ ret = libspid_config_read_item (
+ LIBSPID_SYSTEM_CONF_PATH,
+ LIBSPID_SYSTEM_CONF_LABEL_BCMP_ENABLE,
+ buffer, LIBSPID_LINE_MAX_LEN);
+ if (LIBSPID_SUCCESS != ret)
+ {
+ snmp_log (LOG_ERR, "libspid_config_read_item error\n");
+ bcmp_enable = BCMP_ENABLE_NO;
+ }
+ else
+ {
+ if (!strncmp (buffer, LIBSPID_SYSTEM_CONF_VALUE_YES,
+ strlen (LIBSPID_SYSTEM_CONF_VALUE_YES)))
+ {
+ bcmp_enable = BCMP_ENABLE_YES;
+ }
+ else
+ {
+ bcmp_enable = BCMP_ENABLE_NO;
+ }
+ }
+
+ memdup ((u_char **) &bcmp_enable_save,
+ (u_char *) &bcmp_enable,
+ sizeof (bcmp_enable));
+
+ if ( NULL == bcmp_enable_save)
+ {
+ netsnmp_set_request_error (reqinfo, requests,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ }
+ else
+ {
+ netsnmp_request_add_list_data (requests,
+ netsnmp_create_data_list
+ ("bcmp", bcmp_enable_save,
+ free));
+ }
+ break;
+
+ case MODE_SET_FREE:
+ /* free resources allocated in RESERVE1 and/or
+ RESERVE2. Something failed somewhere, and the states
+ below won't be called. */
+ break;
+
+ case MODE_SET_ACTION:
+ value = *(requests->requestvb->val.integer);
+ switch (value)
+ {
+ case BCMP_ENABLE_YES:
+ ret = libspid_config_write_item (
+ LIBSPID_SYSTEM_CONF_PATH,
+ LIBSPID_SYSTEM_CONF_LABEL_BCMP_ENABLE,
+ LIBSPID_SYSTEM_CONF_VALUE_YES);
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. */
+ case BCMP_ENABLE_NO:
+ ret = libspid_config_write_item (
+ LIBSPID_SYSTEM_CONF_PATH,
+ LIBSPID_SYSTEM_CONF_LABEL_BCMP_ENABLE,
+ LIBSPID_SYSTEM_CONF_VALUE_NO);
break;
-
- case MODE_SET_ACTION:
- /* XXX: perform the value change here */
- if (/* XXX: error? */) {
- netsnmp_set_request_error(reqinfo, requests, /* some error */);
- }
+ default:
+ ret = LIBSPID_ERROR_CHECK;
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;
+ if (LIBSPID_SUCCESS != ret)
+ {
+ netsnmp_set_request_error (reqinfo, requests,
+ SNMP_ERR_COMMITFAILED);
+ }
- 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;
+ break;
+
+ case MODE_SET_COMMIT:
+ break;
+ case MODE_SET_UNDO:
+ value = *((long *) netsnmp_request_get_list_data (requests, "bcmp"));
+
+ switch (value)
+ {
+ case BCMP_ENABLE_YES:
+ ret = libspid_config_write_item (
+ LIBSPID_SYSTEM_CONF_PATH,
+ LIBSPID_SYSTEM_CONF_LABEL_BCMP_ENABLE,
+ LIBSPID_SYSTEM_CONF_VALUE_YES);
+ break;
+ case BCMP_ENABLE_NO:
+ ret = libspid_config_write_item (
+ LIBSPID_SYSTEM_CONF_PATH,
+ LIBSPID_SYSTEM_CONF_LABEL_BCMP_ENABLE,
+ LIBSPID_SYSTEM_CONF_VALUE_NO);
+ break;
default:
- /* we should never get here, so this is a really bad error */
- snmp_log(LOG_ERR, "unknown mode (%d) in handle_eocExtOcnBcmpEnable\n", reqinfo->mode );
- return SNMP_ERR_GENERR;
+ ret = LIBSPID_ERROR_CHECK;
+ break;
+ }
+
+ if (LIBSPID_SUCCESS != ret)
+ {
+ netsnmp_set_request_error (reqinfo, requests,
+ SNMP_ERR_UNDOFAILED);
+ }
+
+ break;
+
+ default:
+ snmp_log (LOG_ERR,
+ "unknown mode (%d) in handle_eocExtOcnBcmpEnable\n",
+ reqinfo->mode );
+ return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
@@ -114,25 +215,26 @@ handle_eocExtOcnBcmpVersion(netsnmp_mib_handler *handler,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
+ char * bcmp_version = EOC_BCMP_VERSION;
/* 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_OCTET_STR,
- (u_char *) /* XXX: a pointer to the scalar's data */,
- /* XXX: the length of the data in bytes */);
- break;
-
- default:
- /* we should never get here, so this is a really bad error */
- snmp_log(LOG_ERR, "unknown mode (%d) in handle_eocExtOcnBcmpVersion\n", reqinfo->mode );
- return SNMP_ERR_GENERR;
+ switch (reqinfo->mode)
+ {
+ case MODE_GET:
+ snmp_set_var_typed_value (requests->requestvb, ASN_OCTET_STR,
+ (u_char *) bcmp_version,
+ sizeof (bcmp_version));
+ break;
+ default:
+ /* we should never get here, so this is a really bad error */
+ snmp_log (LOG_ERR,
+ "unknown mode (%d) in handle_eocExtOcnBcmpVersion\n",
+ reqinfo->mode );
+ return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects/eocExtOcnBcmpGlobalObjects/eocExtOcnBcmpGlobalObjects.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects/eocExtOcnBcmpGlobalObjects/eocExtOcnBcmpGlobalObjects.h
index a8344c5499..52fcde587c 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects/eocExtOcnBcmpGlobalObjects/eocExtOcnBcmpGlobalObjects.h
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocExtObjects/eocExtBcmpObjects/eocExtOcnBcmpGlobalObjects/eocExtOcnBcmpGlobalObjects.h
@@ -5,6 +5,9 @@
#ifndef EOCEXTOCNBCMPGLOBALOBJECTS_H
#define EOCEXTOCNBCMPGLOBALOBJECTS_H
+/* include common header */
+#include "EoCCommon.h"
+
/* function declarations */
void init_eocExtOcnBcmpGlobalObjects(void);
Netsnmp_Node_Handler handle_eocExtOcnBcmpEnable;