From: Harrie Hazewinkel Date: Mon, 11 Nov 2002 21:37:19 +0000 (+0000) Subject: Adding a more detail print functions, that assist/make it easier for X-Git-Tag: php-4.3.0RC1~98 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6a14b16e3411c5edd865fbcc550e2e129e7714db;p=php 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. --- 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)