CVS update: php3/functions
| From: | mhjack | Date: | Sat, 22 May 1999 07:03:21 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-5852@lists.php.net to get a copy of this message | ||
Date: Saturday May 22, 1999 @ 3:03
Author: mhjack
Update of /repository/php3/functions
In directory php:/tmp/cvs-serv14612
Modified Files:
snmp.c
Log Message:
Added snmpwalkoid(), snmp_get_quickprint(), and snmp_set_quick_print()
Index: php3/functions/snmp.c
diff -u php3/functions/snmp.c:1.12 php3/functions/snmp.c:1.13
--- php3/functions/snmp.c:1.12 Tue May 18 13:33:44 1999
+++ php3/functions/snmp.c Sat May 22 03:03:21 1999
@@ -24,9 +24,10 @@
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+ | Mike Jackson <mhjack@tscnet.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: snmp.c,v 1.12 1999/05/18 17:33:44 rasmus Exp $ */
+/* $Id: snmp.c,v 1.13 1999/05/22 07:03:21 mhjack Exp $ */
#include "php.h"
#include "internal_functions.h"
@@ -91,6 +92,9 @@
PHP_FE(snmpget, NULL)
PHP_FE(snmpwalk, NULL)
PHP_FE(snmprealwalk, NULL)
+ PHP_FE(snmpwalkoid, NULL)
+ PHP_FE(snmp_get_quick_print, NULL)
+ PHP_FE(snmp_set_quick_print, NULL)
{NULL,NULL,NULL}
};
@@ -117,9 +121,16 @@
/*
* Generic SNMP object fetcher
*
- * st=1 GET
- * st=2 WALK
- * st=3 WALK (returns OIDs additionally)
+ * st=1 snmpget() - query an agent and return a single value.
+ * st=2 snmpwalk() - walk the mib and return a single dimensional array
+ * containing the values.
+ * st=3,4 snmprealwalk() and snmpwalkoid() - walk the mib and return an
+ * array of oid,value pairs.
+ * st=5-8 ** Reserved **
+ * st=9 snmp_get_quick_print() - Return the current value for quickprint
+ * (default setting is 0 (false)).
+ * st=10 snmp_set_quick_print() - Set the current value for quickprint
+ *
*/
void _php3_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) {
pval *a1, *a2, *a3, *a4, *a5;
@@ -137,7 +148,21 @@
long timeout=SNMP_DEFAULT_TIMEOUT;
long retries=SNMP_DEFAULT_RETRIES;
int myargc = ARG_COUNT(ht);
-
+ int quickp;
+
+ switch(st) {
+ case 4:
+ st = 3; /* This is temporary until snmprealwalk() is removed */
+ break;
+ case 9:
+ RETURN_LONG(snmp_get_quick_print()?1:0);
+ case 10:
+ if(myargc != 1 || getParameters(ht, myargc, &a1)) return(WRONG_PARAM_COUNT);
+ convert_to_long(a1);
+ snmp_set_quick_print((int) a1->value.lval);
+ RETURN_TRUE;
+ }
+
if (myargc<3 || myargc>5 || getParameters(ht, myargc, &a1, &a2, &a3, &a4,
&a5) == FAILURE) {
WRONG_PARAM_COUNT;
}
@@ -293,7 +318,32 @@
}
/* }}} */
+/* {{{ proto string snmprealoid(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(snmpwalkoid)
+{
+ return _php3_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,4);
+}
+/* }}} */
+
+/* {{{ proto int snmp_get_quick_print(void)
+ Return the current status of quick_print */
+PHP_FUNCTION(snmp_get_quick_print)
+{
+ return _php3_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,9);
+}
+/* }}} */
+
+/* {{{ proto void snmp_set_quick_print(int quick_print)
+ Return all objects including their respective object id withing the specified one */
+PHP_FUNCTION(snmp_set_quick_print)
+{
+ return _php3_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,10);
+}
+/* }}} */
+
#endif
+
/*
* Local variables:
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net