cvs: php4 /ext/snmp php_snmp.h snmp.c

From: Date: Mon, 11 Nov 2002 21:37:19 +0000
Subject: cvs: php4 /ext/snmp php_snmp.h snmp.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-16004@lists.php.net to get a copy of this message
harrie Mon Nov 11 16:37:19 2002 EDT Modified files: /php4/ext/snmp php_snmp.h snmp.c Log: 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. Index: php4/ext/snmp/php_snmp.h diff -u php4/ext/snmp/php_snmp.h:1.13 php4/ext/snmp/php_snmp.h:1.14 --- php4/ext/snmp/php_snmp.h:1.13 Mon Nov 11 16:09:19 2002 +++ php4/ext/snmp/php_snmp.h Mon Nov 11 16:37:19 2002 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_snmp.h,v 1.13 2002/11/11 21:09:19 harrie Exp $ */ +/* $Id: php_snmp.h,v 1.14 2002/11/11 21:37:19 harrie Exp $ */ #ifndef PHP_SNMP_H #define PHP_SNMP_H @@ -37,6 +37,8 @@ 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: php4/ext/snmp/snmp.c diff -u php4/ext/snmp/snmp.c:1.69 php4/ext/snmp/snmp.c:1.70 --- php4/ext/snmp/snmp.c:1.69 Mon Nov 11 16:09:19 2002 +++ php4/ext/snmp/snmp.c Mon Nov 11 16:37:19 2002 @@ -18,7 +18,7 @@ | Harrie Hazewinkel <harrie@lisanza.net> | +----------------------------------------------------------------------+ */ -/* $Id: snmp.c,v 1.69 2002/11/11 21:09:19 harrie Exp $ */ +/* $Id: snmp.c,v 1.70 2002/11/11 21:37:19 harrie Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -120,6 +120,10 @@ 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) @@ -524,6 +528,40 @@ #endif } /* }}} */ + +#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 */

« previous php.cvs (#16004) next »