1999-04-22 10:48:28 +08:00
|
|
|
/*
|
1999-08-05 04:56:33 +08:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| PHP version 4.0 |
|
|
|
|
+----------------------------------------------------------------------+
|
2000-01-01 09:32:05 +08:00
|
|
|
| Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
|
1999-08-05 04:56:33 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2000-02-20 07:41:32 +08:00
|
|
|
| This source file is subject to version 2.01 of the PHP license, |
|
1999-08-05 04:56:33 +08:00
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
|
|
|
| available at through the world-wide-web at |
|
2000-02-20 07:41:32 +08:00
|
|
|
| http://www.php.net/license/2_01.txt. |
|
1999-08-05 04:56:33 +08:00
|
|
|
| If you did not receive a copy of the PHP license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@php.net so we can mail you a copy immediately. |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
|
|
|
|
| Mike Jackson <mhjack@tscnet.com> |
|
|
|
|
| Steven Lawrance <slawrance@technologist.com> |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
1999-04-22 10:48:28 +08:00
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
#include "php.h"
|
2000-04-07 05:07:44 +08:00
|
|
|
#include "ext/standard/info.h"
|
1999-04-22 10:48:28 +08:00
|
|
|
#if defined(COMPILE_DL)
|
1999-09-04 00:04:28 +08:00
|
|
|
#include "dl/phpdl.h"
|
1999-04-22 10:48:28 +08:00
|
|
|
#endif
|
1999-12-05 03:19:57 +08:00
|
|
|
#include "php_snmp.h"
|
1999-04-22 10:48:28 +08:00
|
|
|
#include <sys/types.h>
|
2000-02-11 23:59:30 +08:00
|
|
|
#ifdef PHP_WIN32
|
1999-04-22 10:48:28 +08:00
|
|
|
#include <winsock.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <process.h>
|
|
|
|
#include "win32/time.h"
|
|
|
|
#else
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <arpa/inet.h>
|
1999-08-05 04:56:33 +08:00
|
|
|
#ifndef _OSD_POSIX
|
1999-04-22 10:48:28 +08:00
|
|
|
#include <sys/errno.h>
|
1999-08-05 04:56:33 +08:00
|
|
|
#else
|
|
|
|
#include <errno.h> /* BS2000/OSD uses <errno.h>, not <sys/errno.h> */
|
|
|
|
#endif
|
1999-04-22 10:48:28 +08:00
|
|
|
#include <netdb.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#if HAVE_SNMP
|
|
|
|
|
|
|
|
#ifndef __P
|
|
|
|
#ifdef __GNUC__
|
|
|
|
#define __P(args) args
|
|
|
|
#else
|
|
|
|
#define __P(args) ()
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2000-03-19 20:38:53 +08:00
|
|
|
#ifdef HAVE_DEFAULT_STORE_H
|
|
|
|
#include "default_store.h"
|
|
|
|
#endif
|
1999-04-22 10:48:28 +08:00
|
|
|
#include "asn1.h"
|
|
|
|
#include "snmp_api.h"
|
|
|
|
#include "snmp_client.h"
|
|
|
|
#include "snmp_impl.h"
|
|
|
|
#include "snmp.h"
|
|
|
|
#include "parse.h"
|
|
|
|
#include "mib.h"
|
|
|
|
|
|
|
|
/* ucd-snmp 3.3.1 changed the name of a few #defines... They've been changed back to the original ones in 3.5.3! */
|
|
|
|
#ifndef SNMP_MSG_GET
|
|
|
|
#define SNMP_MSG_GET GET_REQ_MSG
|
|
|
|
#define SNMP_MSG_GETNEXT GETNEXT_REQ_MSG
|
|
|
|
#endif
|
|
|
|
|
1999-12-18 12:08:03 +08:00
|
|
|
void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st);
|
1999-04-22 10:48:28 +08:00
|
|
|
|
|
|
|
/* constant - can be shared among threads */
|
|
|
|
static oid objid_mib[] = {1, 3, 6, 1, 2, 1};
|
|
|
|
|
|
|
|
function_entry snmp_functions[] = {
|
2000-03-26 03:58:19 +08:00
|
|
|
PHP_FE(snmpget, NULL)
|
1999-08-05 04:56:33 +08:00
|
|
|
PHP_FE(snmpwalk, NULL)
|
|
|
|
PHP_FE(snmprealwalk, NULL)
|
2000-03-26 03:58:19 +08:00
|
|
|
PHP_FALIAS(snmpwalkoid, snmprealwalk, NULL)
|
1999-08-05 04:56:33 +08:00
|
|
|
PHP_FE(snmp_get_quick_print, NULL)
|
|
|
|
PHP_FE(snmp_set_quick_print, NULL)
|
|
|
|
PHP_FE(snmpset, NULL)
|
1999-04-22 10:48:28 +08:00
|
|
|
{NULL,NULL,NULL}
|
|
|
|
};
|
|
|
|
|
1999-12-18 04:55:31 +08:00
|
|
|
zend_module_entry snmp_module_entry = {
|
2000-03-07 02:44:01 +08:00
|
|
|
"snmp",snmp_functions,PHP_MINIT(snmp),NULL,NULL,NULL,PHP_MINFO(snmp),STANDARD_MODULE_PROPERTIES
|
1999-04-22 10:48:28 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#if COMPILE_DL
|
1999-12-18 04:55:31 +08:00
|
|
|
DLEXPORT zend_module_entry *get_module() { return &snmp_module_entry; };
|
1999-04-22 10:48:28 +08:00
|
|
|
#endif
|
|
|
|
|
1999-12-18 12:08:03 +08:00
|
|
|
/* THREAD_LS snmp_module php_snmp_module; - may need one of these at some point */
|
1999-04-22 10:48:28 +08:00
|
|
|
|
1999-12-18 12:08:03 +08:00
|
|
|
PHP_MINIT_FUNCTION(snmp)
|
|
|
|
{
|
1999-04-22 10:48:28 +08:00
|
|
|
init_mib();
|
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
|
1999-12-18 12:08:03 +08:00
|
|
|
PHP_MINFO_FUNCTION(snmp)
|
|
|
|
{
|
2000-04-07 05:07:44 +08:00
|
|
|
php_info_print_table_start();
|
|
|
|
php_info_print_table_row(2, "UCD-SNMP Support", "enabled");
|
|
|
|
php_info_print_table_end();
|
1999-04-22 10:48:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-08-05 04:56:33 +08:00
|
|
|
* Generic SNMP object fetcher
|
|
|
|
*
|
|
|
|
* 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.
|
2000-03-26 03:58:19 +08:00
|
|
|
* st=3 snmprealwalk() and snmpwalkoid() - walk the mib and return an
|
1999-08-05 04:56:33 +08:00
|
|
|
* array of oid,value pairs.
|
|
|
|
* st=5-8 ** Reserved **
|
|
|
|
* st=11 snmpset() - query an agent and set a single value
|
|
|
|
*
|
|
|
|
*/
|
1999-12-18 12:08:03 +08:00
|
|
|
void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) {
|
2000-03-26 03:58:19 +08:00
|
|
|
zval **a1, **a2, **a3, **a4, **a5, **a6, **a7;
|
1999-04-22 10:48:28 +08:00
|
|
|
struct snmp_session session, *ss;
|
|
|
|
struct snmp_pdu *pdu=NULL, *response;
|
|
|
|
struct variable_list *vars;
|
|
|
|
char *objid;
|
|
|
|
oid name[MAX_NAME_LEN];
|
|
|
|
int name_length;
|
|
|
|
int status, count,rootlen=0,gotroot=0;
|
|
|
|
oid root[MAX_NAME_LEN];
|
|
|
|
char buf[2048];
|
|
|
|
char buf2[2048];
|
|
|
|
int keepwalking=1;
|
|
|
|
long timeout=SNMP_DEFAULT_TIMEOUT;
|
|
|
|
long retries=SNMP_DEFAULT_RETRIES;
|
|
|
|
int myargc = ARG_COUNT(ht);
|
1999-12-12 19:02:07 +08:00
|
|
|
char type = (char) 0;
|
|
|
|
char *value = (char *) 0;
|
1999-04-22 10:48:28 +08:00
|
|
|
|
2000-03-26 03:58:19 +08:00
|
|
|
if (myargc < 3 || myargc > 7 ||
|
|
|
|
zend_get_parameters_ex(myargc, &a1, &a2, &a3, &a4, &a5, &a6, &a7) == FAILURE) {
|
|
|
|
WRONG_PARAM_COUNT;
|
|
|
|
}
|
|
|
|
|
|
|
|
convert_to_string_ex(a1);
|
|
|
|
convert_to_string_ex(a2);
|
|
|
|
convert_to_string_ex(a3);
|
|
|
|
|
|
|
|
if (st == 11) {
|
|
|
|
if (myargc < 5) {
|
2000-03-25 12:05:13 +08:00
|
|
|
WRONG_PARAM_COUNT;
|
|
|
|
}
|
2000-03-26 03:58:19 +08:00
|
|
|
|
|
|
|
convert_to_string_ex(a4);
|
|
|
|
convert_to_string_ex(a5);
|
1999-08-05 04:56:33 +08:00
|
|
|
|
2000-03-26 03:58:19 +08:00
|
|
|
if(myargc > 5) {
|
|
|
|
convert_to_long_ex(a6);
|
|
|
|
timeout = (*a6)->value.lval;
|
1999-08-05 04:56:33 +08:00
|
|
|
}
|
2000-03-26 03:58:19 +08:00
|
|
|
|
|
|
|
if(myargc > 6) {
|
|
|
|
convert_to_long_ex(a7);
|
|
|
|
retries = (*a7)->value.lval;
|
1999-08-05 04:56:33 +08:00
|
|
|
}
|
2000-03-26 03:58:19 +08:00
|
|
|
|
|
|
|
type = (*a4)->value.str.val[0];
|
|
|
|
value = (*a5)->value.str.val;
|
1999-08-05 04:56:33 +08:00
|
|
|
} else {
|
2000-03-26 03:58:19 +08:00
|
|
|
if(myargc > 3) {
|
|
|
|
convert_to_long_ex(a4);
|
|
|
|
timeout = (*a4)->value.lval;
|
1999-08-05 04:56:33 +08:00
|
|
|
}
|
2000-03-26 03:58:19 +08:00
|
|
|
|
|
|
|
if(myargc > 4) {
|
|
|
|
convert_to_long_ex(a5);
|
|
|
|
retries = (*a5)->value.lval;
|
1999-08-05 04:56:33 +08:00
|
|
|
}
|
1999-04-22 10:48:28 +08:00
|
|
|
}
|
2000-03-26 03:58:19 +08:00
|
|
|
|
|
|
|
objid = (*a3)->value.str.val;
|
1999-04-22 10:48:28 +08:00
|
|
|
|
2000-03-26 03:58:19 +08:00
|
|
|
if (st >= 2) { /* walk */
|
1999-04-22 10:48:28 +08:00
|
|
|
rootlen = MAX_NAME_LEN;
|
2000-03-26 03:58:19 +08:00
|
|
|
if ( strlen(objid) ) { /* on a walk, an empty string means top of tree - no error */
|
|
|
|
if ( read_objid(objid, root, &rootlen) ) {
|
1999-04-22 10:48:28 +08:00
|
|
|
gotroot = 1;
|
|
|
|
} else {
|
1999-08-03 03:17:14 +08:00
|
|
|
php_error(E_WARNING,"Invalid object identifier: %s\n", objid);
|
1999-04-22 10:48:28 +08:00
|
|
|
}
|
|
|
|
}
|
1999-08-05 04:56:33 +08:00
|
|
|
if (gotroot == 0) {
|
1999-04-22 10:48:28 +08:00
|
|
|
memmove((char *)root, (char *)objid_mib, sizeof(objid_mib));
|
1999-08-05 04:56:33 +08:00
|
|
|
rootlen = sizeof(objid_mib) / sizeof(oid);
|
|
|
|
gotroot = 1;
|
|
|
|
}
|
1999-04-22 10:48:28 +08:00
|
|
|
}
|
1999-08-05 04:56:33 +08:00
|
|
|
|
1999-04-22 10:48:28 +08:00
|
|
|
memset(&session, 0, sizeof(struct snmp_session));
|
2000-03-26 03:58:19 +08:00
|
|
|
|
2000-03-26 06:27:30 +08:00
|
|
|
session.peername = (*a1)->value.str.val;
|
1999-04-22 10:48:28 +08:00
|
|
|
session.version = SNMP_VERSION_1;
|
|
|
|
/*
|
1999-08-05 04:56:33 +08:00
|
|
|
* FIXME: potential memory leak
|
|
|
|
* This is a workaround for an "artifact" (Mike Slifcak)
|
|
|
|
* in (at least) ucd-snmp 3.6.1 which frees
|
|
|
|
* memory it did not allocate
|
|
|
|
*/
|
1999-06-28 05:45:06 +08:00
|
|
|
#ifdef UCD_SNMP_HACK
|
2000-03-26 06:27:30 +08:00
|
|
|
session.community = (u_char *) strdup((*a2)->value.str.val);
|
1999-06-28 05:45:06 +08:00
|
|
|
#else
|
2000-03-26 06:27:30 +08:00
|
|
|
session.community = (u_char *) (*a2)->value.str.val;
|
1999-06-28 05:45:06 +08:00
|
|
|
#endif
|
2000-03-26 06:27:30 +08:00
|
|
|
session.community_len = (*a2)->value.str.len;
|
1999-04-22 10:48:28 +08:00
|
|
|
session.retries = retries;
|
|
|
|
session.timeout = timeout;
|
1999-08-05 04:56:33 +08:00
|
|
|
|
1999-04-22 10:48:28 +08:00
|
|
|
session.authenticator = NULL;
|
|
|
|
snmp_synch_setup(&session);
|
2000-03-26 03:58:19 +08:00
|
|
|
|
|
|
|
if ((ss = snmp_open(&session)) == NULL) {
|
|
|
|
php_error(E_WARNING,"Could not open snmp\n");
|
1999-04-22 10:48:28 +08:00
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
2000-03-26 03:58:19 +08:00
|
|
|
|
|
|
|
if (st >= 2) {
|
1999-04-22 10:48:28 +08:00
|
|
|
memmove((char *)name, (char *)root, rootlen * sizeof(oid));
|
|
|
|
name_length = rootlen;
|
2000-03-26 03:58:19 +08:00
|
|
|
array_init(return_value); /* prepare result array */
|
1999-04-22 10:48:28 +08:00
|
|
|
}
|
2000-03-26 03:58:19 +08:00
|
|
|
|
1999-04-22 10:48:28 +08:00
|
|
|
while(keepwalking) {
|
|
|
|
keepwalking=0;
|
2000-03-26 03:58:19 +08:00
|
|
|
if (st == 1) {
|
|
|
|
pdu = snmp_pdu_create(SNMP_MSG_GET);
|
1999-04-22 10:48:28 +08:00
|
|
|
name_length = MAX_NAME_LEN;
|
2000-03-26 03:58:19 +08:00
|
|
|
if ( !read_objid(objid, name, &name_length) ) {
|
1999-08-03 03:17:14 +08:00
|
|
|
php_error(E_WARNING,"Invalid object identifier: %s\n", objid);
|
1999-04-22 10:48:28 +08:00
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
1999-08-05 04:56:33 +08:00
|
|
|
snmp_add_null_var(pdu, name, name_length);
|
2000-03-26 03:58:19 +08:00
|
|
|
} else if (st == 11) {
|
|
|
|
pdu = snmp_pdu_create(SNMP_MSG_SET);
|
1999-08-05 04:56:33 +08:00
|
|
|
if (snmp_add_var(pdu, name, name_length, type, value)) {
|
|
|
|
php_error(E_WARNING,"Could not add variable: %s\n", name);
|
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
2000-03-26 03:58:19 +08:00
|
|
|
} else if (st >= 2) {
|
|
|
|
pdu = snmp_pdu_create(SNMP_MSG_GETNEXT);
|
|
|
|
snmp_add_null_var(pdu, name, name_length);
|
1999-08-05 04:56:33 +08:00
|
|
|
}
|
|
|
|
|
1999-04-22 10:48:28 +08:00
|
|
|
retry:
|
|
|
|
status = snmp_synch_response(ss, pdu, &response);
|
|
|
|
if (status == STAT_SUCCESS) {
|
|
|
|
if (response->errstat == SNMP_ERR_NOERROR) {
|
2000-03-26 03:58:19 +08:00
|
|
|
for (vars = response->variables; vars; vars = vars->next_variable) {
|
|
|
|
if (st >= 2 && st != 11 &&
|
|
|
|
(vars->name_length < rootlen || memcmp(root, vars->name, rootlen * sizeof(oid)))) {
|
1999-04-22 10:48:28 +08:00
|
|
|
continue; /* not part of this subtree */
|
2000-03-26 03:58:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (st != 11) {
|
1999-08-05 04:56:33 +08:00
|
|
|
sprint_value(buf,vars->name, vars->name_length, vars);
|
2000-03-26 03:58:19 +08:00
|
|
|
}
|
1999-04-22 10:48:28 +08:00
|
|
|
#if 0
|
|
|
|
Debug("snmp response is: %s\n",buf);
|
|
|
|
#endif
|
2000-03-26 03:58:19 +08:00
|
|
|
if (st == 1) {
|
1999-04-22 10:48:28 +08:00
|
|
|
RETVAL_STRING(buf,1);
|
2000-03-26 03:58:19 +08:00
|
|
|
} else if (st == 2) {
|
|
|
|
add_next_index_string(return_value,buf,1); /* Add to returned array */
|
|
|
|
} else if (st == 3) {
|
1999-08-05 04:56:33 +08:00
|
|
|
sprint_objid(buf2, vars->name, vars->name_length);
|
1999-04-22 10:48:28 +08:00
|
|
|
add_assoc_string(return_value,buf2,buf,1);
|
|
|
|
}
|
2000-03-26 03:58:19 +08:00
|
|
|
if (st >= 2 && st != 11) {
|
|
|
|
if (vars->type != SNMP_ENDOFMIBVIEW &&
|
|
|
|
vars->type != SNMP_NOSUCHOBJECT && vars->type != SNMP_NOSUCHINSTANCE) {
|
1999-04-22 10:48:28 +08:00
|
|
|
memmove((char *)name, (char *)vars->name,vars->name_length * sizeof(oid));
|
|
|
|
name_length = vars->name_length;
|
|
|
|
keepwalking = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2000-03-26 03:58:19 +08:00
|
|
|
if (st != 2 || response->errstat != SNMP_ERR_NOSUCHNAME) {
|
1999-08-03 03:17:14 +08:00
|
|
|
php_error(E_WARNING,"Error in packet.\nReason: %s\n", snmp_errstring(response->errstat));
|
1999-04-22 10:48:28 +08:00
|
|
|
if (response->errstat == SNMP_ERR_NOSUCHNAME) {
|
2000-03-26 03:58:19 +08:00
|
|
|
for (count=1, vars = response->variables; vars && count != response->errindex;
|
1999-08-05 04:56:33 +08:00
|
|
|
vars = vars->next_variable, count++);
|
2000-03-26 03:58:19 +08:00
|
|
|
if (vars) {
|
|
|
|
sprint_objid(buf,vars->name, vars->name_length);
|
|
|
|
}
|
1999-08-03 03:17:14 +08:00
|
|
|
php_error(E_WARNING,"This name does not exist: %s\n",buf);
|
1999-04-22 10:48:28 +08:00
|
|
|
}
|
2000-03-26 03:58:19 +08:00
|
|
|
if (st == 1) {
|
|
|
|
if ((pdu = snmp_fix_pdu(response, SNMP_MSG_GET)) != NULL) {
|
|
|
|
goto retry;
|
|
|
|
}
|
|
|
|
} else if (st == 11) {
|
|
|
|
if ((pdu = snmp_fix_pdu(response, SNMP_MSG_SET)) != NULL) {
|
|
|
|
goto retry;
|
|
|
|
}
|
|
|
|
} else if (st >= 2) {
|
|
|
|
if ((pdu = snmp_fix_pdu(response, SNMP_MSG_GETNEXT)) != NULL) {
|
|
|
|
goto retry;
|
|
|
|
}
|
1999-04-22 10:48:28 +08:00
|
|
|
}
|
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (status == STAT_TIMEOUT) {
|
2000-03-26 03:58:19 +08:00
|
|
|
php_error(E_WARNING,"No Response from %s\n", (*a1)->value.str.val);
|
1999-04-22 10:48:28 +08:00
|
|
|
RETURN_FALSE;
|
|
|
|
} else { /* status == STAT_ERROR */
|
2000-03-26 06:27:30 +08:00
|
|
|
php_error(E_WARNING,"An error occurred, Quitting...\n");
|
1999-04-22 10:48:28 +08:00
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
2000-03-26 03:58:19 +08:00
|
|
|
if (response) {
|
|
|
|
snmp_free_pdu(response);
|
|
|
|
}
|
1999-04-22 10:48:28 +08:00
|
|
|
} /* keepwalking */
|
|
|
|
snmp_close(ss);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* {{{ proto string snmpget(string host, string community, string object_id [, int timeout [, int retries]])
|
2000-03-26 06:27:30 +08:00
|
|
|
Fetch a SNMP object */
|
1999-05-21 18:06:25 +08:00
|
|
|
PHP_FUNCTION(snmpget) {
|
1999-12-18 12:08:03 +08:00
|
|
|
php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
|
1999-04-22 10:48:28 +08:00
|
|
|
}
|
|
|
|
/* }}} */
|
|
|
|
|
2000-03-25 12:05:13 +08:00
|
|
|
/* {{{ proto array snmpwalk(string host, string community, string object_id [, int timeout [, int retries]])
|
2000-02-24 15:38:19 +08:00
|
|
|
Return all objects under the specified object id */
|
1999-05-21 18:06:25 +08:00
|
|
|
PHP_FUNCTION(snmpwalk) {
|
1999-12-18 12:08:03 +08:00
|
|
|
return php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,2);
|
1999-04-22 10:48:28 +08:00
|
|
|
}
|
|
|
|
/* }}} */
|
|
|
|
|
2000-03-25 12:05:13 +08:00
|
|
|
/* {{{ proto array snmprealwalk(string host, string community, string object_id [, int timeout [, int retries]])
|
2000-02-24 15:38:19 +08:00
|
|
|
Return all objects including their respective object id withing the specified one */
|
2000-03-26 03:58:19 +08:00
|
|
|
PHP_FUNCTION(snmprealwalk) {
|
1999-12-18 12:08:03 +08:00
|
|
|
return php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,3);
|
1999-04-22 10:48:28 +08:00
|
|
|
}
|
|
|
|
/* }}} */
|
|
|
|
|
2000-03-26 03:58:19 +08:00
|
|
|
/* {{{ proto bool snmp_get_quick_print(void)
|
2000-02-24 15:38:19 +08:00
|
|
|
Return the current status of quick_print */
|
2000-03-26 03:58:19 +08:00
|
|
|
PHP_FUNCTION(snmp_get_quick_print) {
|
|
|
|
RETURN_LONG(snmp_get_quick_print() ? 1 : 0);
|
1999-08-05 04:56:33 +08:00
|
|
|
}
|
|
|
|
/* }}} */
|
|
|
|
|
|
|
|
/* {{{ proto void snmp_set_quick_print(int quick_print)
|
2000-02-24 15:38:19 +08:00
|
|
|
Return all objects including their respective object id withing the specified one */
|
2000-03-26 03:58:19 +08:00
|
|
|
PHP_FUNCTION(snmp_set_quick_print) {
|
|
|
|
zval **a1;
|
|
|
|
if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &a1) == FAILURE) {
|
|
|
|
WRONG_PARAM_COUNT;
|
|
|
|
}
|
|
|
|
convert_to_long_ex(a1);
|
2000-03-30 08:19:24 +08:00
|
|
|
snmp_set_quick_print((int)(*a1)->value.lval);
|
1999-08-05 04:56:33 +08:00
|
|
|
}
|
|
|
|
/* }}} */
|
|
|
|
|
|
|
|
/* {{{ proto int snmpset(string host, string community, string object_id, string type, mixed value [, int timeout [, int retries]])
|
2000-02-24 15:38:19 +08:00
|
|
|
Set the value of a SNMP object */
|
1999-08-05 05:12:57 +08:00
|
|
|
PHP_FUNCTION(snmpset) {
|
1999-12-18 12:08:03 +08:00
|
|
|
php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,11);
|
1999-08-05 04:56:33 +08:00
|
|
|
}
|
|
|
|
/* }}} */
|
|
|
|
|
1999-04-22 10:48:28 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
1999-08-05 04:56:33 +08:00
|
|
|
* Local variables:
|
|
|
|
* tab-width: 4
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* End:
|
2000-04-07 05:07:44 +08:00
|
|
|
*/
|