Index: php_snmp.h =================================================================== RCS file: /repository/php-src/ext/snmp/php_snmp.h,v retrieving revision 1.23 diff -u -r1.23 php_snmp.h --- php_snmp.h 8 Jan 2005 12:02:22 -0000 1.23 +++ php_snmp.h 8 Feb 2005 04:14:04 -0000 @@ -52,6 +52,11 @@ PHP_FUNCTION(snmp_set_oid_numeric_print); PHP_FUNCTION(snmpset); +PHP_FUNCTION(snmp2_get); +PHP_FUNCTION(snmp2_walk); +PHP_FUNCTION(snmp2_real_walk); +PHP_FUNCTION(snmp2_set); + PHP_FUNCTION(snmp3_get); PHP_FUNCTION(snmp3_getnext); PHP_FUNCTION(snmp3_walk); Index: snmp.c =================================================================== RCS file: /repository/php-src/ext/snmp/snmp.c,v retrieving revision 1.95 diff -u -r1.95 snmp.c --- snmp.c 8 Jan 2005 12:02:22 -0000 1.95 +++ snmp.c 8 Feb 2005 04:14:04 -0000 @@ -127,6 +127,11 @@ #endif PHP_FE(snmpset, NULL) + PHP_FE(snmp2_get, NULL) + PHP_FE(snmp2_walk, NULL) + PHP_FE(snmp2_real_walk, NULL) + PHP_FE(snmp2_set, NULL) + PHP_FE(snmp3_get, NULL) PHP_FE(snmp3_getnext, NULL) PHP_FE(snmp3_walk, NULL) @@ -532,7 +537,7 @@ * st=11 snmpset() - query an agent and set a single value * */ -static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) +static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, long snmp_version ) { zval **a1, **a2, **a3, **a4, **a5, **a6, **a7; struct snmp_session session; @@ -594,7 +599,7 @@ session.peername = hostname; session.remote_port = remote_port; - session.version = SNMP_VERSION_1; + session.version = snmp_version; /* * FIXME: potential memory leak * This is a workaround for an "artifact" (Mike Slifcak) @@ -620,7 +625,7 @@ Fetch a SNMP object */ PHP_FUNCTION(snmpget) { - php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,1); + php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,1,SNMP_VERSION_1); } /* }}} */ @@ -628,7 +633,7 @@ Fetch a SNMP object */ PHP_FUNCTION(snmpgetnext) { - php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,2); + php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,2,SNMP_VERSION_1); } /* }}} */ @@ -636,7 +641,7 @@ Return all objects under the specified object id */ PHP_FUNCTION(snmpwalk) { - php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,3); + php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,3,SNMP_VERSION_1); } /* }}} */ @@ -722,7 +727,7 @@ Set the value of a SNMP object */ PHP_FUNCTION(snmpset) { - php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,11); + php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,11,SNMP_VERSION_1); } /* }}} */ @@ -888,6 +893,37 @@ } /* }}} */ +/* {{{ proto string snmp2_get(string host, string community, string object_id [, int timeout [, int retries]]) + Fetch a SNMP object */ +PHP_FUNCTION(snmp2_get) +{ + php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,1,SNMP_VERSION_2c); +} +/* }}} */ + +/* {{{ proto array snmp2_walk(string host, string community, string object_id [, int timeout [, int retries]]) + Return all objects under the specified object id */ +PHP_FUNCTION(snmp2_walk) +{ + php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,2,SNMP_VERSION_2c); +} +/* }}} */ + +/* {{{ proto array snmp2_real_walk(string host, string community, string object_id [, int timeout [, int retries]]) + Return all objects including their respective object id withing the specified one */ +PHP_FUNCTION(snmp2_real_walk) +{ + php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,3,SNMP_VERSION_2c); +} +/* }}} */ + +/* {{{ proto int snmp2_set(string host, string community, string object_id, string type, mixed value [, int timeout [, int retries]]) + Set the value of a SNMP object */ +PHP_FUNCTION(snmp2_set) +{ + php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,11,SNMP_VERSION_2c); +} +/* }}} */ /* {{{ proto void php_snmpv3(INTERNAL_FUNCTION_PARAMETERS, int st) *