]> granicus.if.org Git - php/commitdiff
Adding a more detail print functions, that assist/make it easier for
authorHarrie Hazewinkel <harrie@php.net>
Mon, 11 Nov 2002 21:37:19 +0000 (21:37 +0000)
committerHarrie Hazewinkel <harrie@php.net>
Mon, 11 Nov 2002 21:37:19 +0000 (21:37 +0000)
creating SNMP scripts.
They are only supported when you have NET-SNMP.
Need to be documented still though.

ext/snmp/php_snmp.h
ext/snmp/snmp.c

index af73faa7661ead4477819f090bc444079000a573..138948c62427900453c44c1e78cadd04d83aa979 100644 (file)
@@ -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);
index 97623f57592e06681d3a81803a952fb48cbbce1b..75fdf0a9731654dc8b8fd83a5abdaf94f3f75b90 100644 (file)
@@ -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)