summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarrie Hazewinkel <harrie@php.net>2002-11-11 21:37:19 +0000
committerHarrie Hazewinkel <harrie@php.net>2002-11-11 21:37:19 +0000
commit6a14b16e3411c5edd865fbcc550e2e129e7714db (patch)
tree696cca764419ace6f6ba06284146f6ac45013495
parent957f651708f42a2583560f60d8686d5f6ebfb90c (diff)
downloadphp-git-6a14b16e3411c5edd865fbcc550e2e129e7714db.tar.gz
Adding a more detail print functions, that assist/make it easier for
creating SNMP scripts. They are only supported when you have NET-SNMP. Need to be documented still though.
-rw-r--r--ext/snmp/php_snmp.h2
-rw-r--r--ext/snmp/snmp.c38
2 files changed, 40 insertions, 0 deletions
diff --git a/ext/snmp/php_snmp.h b/ext/snmp/php_snmp.h
index af73faa766..138948c624 100644
--- a/ext/snmp/php_snmp.h
+++ b/ext/snmp/php_snmp.h
@@ -37,6 +37,8 @@ PHP_FUNCTION(snmpwalk);
PHP_FUNCTION(snmprealwalk);
PHP_FUNCTION(snmp_get_quick_print);
PHP_FUNCTION(snmp_set_quick_print);
+PHP_FUNCTION(snmp_set_enum_print);
+PHP_FUNCTION(snmp_set_oid_numeric_print);
PHP_FUNCTION(snmpset);
PHP_FUNCTION(snmpv3get);
PHP_FUNCTION(snmpv3getnext);
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 97623f5759..75fdf0a973 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -120,6 +120,10 @@ function_entry snmp_functions[] = {
PHP_FALIAS(snmpwalkoid, snmprealwalk, NULL)
PHP_FE(snmp_get_quick_print, NULL)
PHP_FE(snmp_set_quick_print, NULL)
+#ifdef HAVE_NET_SNMP
+ PHP_FE(snmp_set_enum_print, NULL)
+ PHP_FE(snmp_set_oid_numeric_print, NULL)
+#endif
PHP_FE(snmpset, NULL)
PHP_FE(snmpv3get, NULL)
PHP_FE(snmpv3walk, NULL)
@@ -525,6 +529,40 @@ PHP_FUNCTION(snmp_set_quick_print)
}
/* }}} */
+#ifdef HAVE_NET_SNMP
+/* {{{ proto void snmp_set_enum_print(int enum_print)
+ Return all values that are enums with their enum value instead of the raw integer */
+PHP_FUNCTION(snmp_set_enum_print)
+{
+ int argc = ZEND_NUM_ARGS();
+ long a1;
+
+ if (zend_parse_parameters(argc TSRMLS_CC, "l", &a1) == FAILURE) {
+ return;
+ }
+
+ netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM, (int) a1);
+}
+/* }}} */
+
+/* {{{ proto void snmp_set_oid_numeric_print(int oid_numeric_print)
+ Return all objects including their respective object id withing the specified one */
+PHP_FUNCTION(snmp_set_oid_numeric_print)
+{
+ int argc = ZEND_NUM_ARGS();
+ long a1;
+
+ if (zend_parse_parameters(argc TSRMLS_CC, "l", &a1) == FAILURE) {
+ return;
+ }
+ if ((int) a1 != 0) {
+ netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
+ NETSNMP_OID_OUTPUT_NUMERIC);
+ }
+}
+/* }}} */
+#endif
+
/* {{{ proto int snmpset(string host, string community, string object_id, string type, mixed value [, int timeout [, int retries]])
Set the value of a SNMP object */
PHP_FUNCTION(snmpset)