From 06c20347ae3cab7e07c493937b2be5bffd9ffebd Mon Sep 17 00:00:00 2001 From: Boris Lytochkin Date: Sun, 17 Jul 2011 18:14:38 +0000 Subject: [PATCH] swap non_repeaters and max_repetitions in walk query, max_repetitions whould be used more frequently --- ext/snmp/snmp.c | 6 +++--- ext/snmp/tests/snmp-object-error.phpt | 2 +- ext/snmp/tests/snmp-object.phpt | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index d889a0e3ad..9dc7a19b5f 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -345,8 +345,8 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_walk, 0, 0, 4) ZEND_ARG_INFO(0, object_id) ZEND_ARG_INFO(0, suffix_keys) - ZEND_ARG_INFO(0, non_repeaters) ZEND_ARG_INFO(0, max_repetitions) + ZEND_ARG_INFO(0, non_repeaters) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_set, 0, 0, 3) @@ -1355,7 +1355,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) RETURN_FALSE; } } else if (st & SNMP_CMD_WALK) { - if (zend_parse_parameters(argc TSRMLS_CC, "Z|bll", &oid, &suffix_keys, &(objid_query.non_repeaters), &(objid_query.max_repetitions)) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "Z|bll", &oid, &suffix_keys, &(objid_query.max_repetitions), &(objid_query.non_repeaters)) == FAILURE) { RETURN_FALSE; } if (suffix_keys) { @@ -1763,7 +1763,7 @@ PHP_METHOD(snmp, getnext) } /* }}} */ -/* {{{ proto mixed SNMP::walk(mixed object_id [, bool $suffix_as_key = FALSE [, int $non_repeaters [, int $max_repetitions ]]]) +/* {{{ proto mixed SNMP::walk(mixed object_id [, bool $suffix_as_key = FALSE [, int $max_repetitions [, int $non_repeaters]]) Return all objects including their respective object id withing the specified one as array of oid->value pairs */ PHP_METHOD(snmp, walk) { diff --git a/ext/snmp/tests/snmp-object-error.phpt b/ext/snmp/tests/snmp-object-error.phpt index 00db3a318c..83ba2b7263 100644 --- a/ext/snmp/tests/snmp-object-error.phpt +++ b/ext/snmp/tests/snmp-object-error.phpt @@ -47,7 +47,7 @@ var_dump($session->close()); $session = new SNMP(SNMP::VERSION_2c, $hostname, $community, $timeout, $retries); var_dump($session->walk('.1.3.6.1.2.1.1', FALSE, '')); -var_dump($session->walk('.1.3.6.1.2.1.1', FALSE, 0, '')); +var_dump($session->walk('.1.3.6.1.2.1.1', FALSE, 30, '')); var_dump($session->get()); var_dump($session->getnext()); var_dump($session->set()); diff --git a/ext/snmp/tests/snmp-object.phpt b/ext/snmp/tests/snmp-object.phpt index 684391b461..7830ec2cd7 100644 --- a/ext/snmp/tests/snmp-object.phpt +++ b/ext/snmp/tests/snmp-object.phpt @@ -48,18 +48,18 @@ var_dump(key($z)); var_dump(array_shift($z)); var_dump($session->close()); -echo "WALK multiple on single OID, non_repeaters set to 0\n"; +echo "WALK multiple on single OID, max_repetitions set to 30\n"; $session = new SNMP(SNMP::VERSION_2c, $hostname, $community, $timeout, $retries); -$z = $session->walk('.1.3.6.1.2.1.1', 0); +$z = $session->walk('.1.3.6.1.2.1.1', FALSE, 30); var_dump(gettype($z)); var_dump(count($z)); var_dump(key($z)); var_dump(array_shift($z)); var_dump($session->close()); -echo "WALK multiple on single OID, non_repeaters set to 0, max_repetitions set to 30\n"; +echo "WALK multiple on single OID, max_repetitions set to 30, non_repeaters set to 0\n"; $session = new SNMP(SNMP::VERSION_2c, $hostname, $community, $timeout, $retries); -$z = $session->walk('.1.3.6.1.2.1.1', 0, 30); +$z = $session->walk('.1.3.6.1.2.1.1', FALSE, 30, 0); var_dump(gettype($z)); var_dump(count($z)); var_dump(key($z)); @@ -154,13 +154,13 @@ int(%d) string(%d) "%S" string(%d) "%S" bool(true) -WALK multiple on single OID, non_repeaters set to 0 +WALK multiple on single OID, max_repetitions set to 30 string(5) "array" int(%d) string(%d) "%S" string(%d) "%S" bool(true) -WALK multiple on single OID, non_repeaters set to 0, max_repetitions set to 30 +WALK multiple on single OID, max_repetitions set to 30, non_repeaters set to 0 string(5) "array" int(%d) string(%d) "%S" -- 2.40.0