summaryrefslogtreecommitdiff
path: root/ext/snmp/snmp.c
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2002-10-15 00:43:34 +0000
committerfoobar <sniper@php.net>2002-10-15 00:43:34 +0000
commit23706f18d6b34aa196f1f007c08c584b4f6f8493 (patch)
tree5d1e59ea24c12b0c601a7713a6ec4d81fe88142e /ext/snmp/snmp.c
parent226f0a1ed865a8aaed2c37f8629d35dbcaef86ee (diff)
downloadphp-git-23706f18d6b34aa196f1f007c08c584b4f6f8493.tar.gz
Make this thing to compile with net-snmp-5.0.x
Diffstat (limited to 'ext/snmp/snmp.c')
-rw-r--r--ext/snmp/snmp.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 7408ccb322..5fcf191c10 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -26,6 +26,9 @@
#include "php.h"
#include "ext/standard/info.h"
#include "php_snmp.h"
+
+#if HAVE_SNMP
+
#include <sys/types.h>
#ifdef PHP_WIN32
#include <winsock.h>
@@ -60,7 +63,6 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#if HAVE_SNMP
#ifndef __P
#ifdef __GNUC__
@@ -70,6 +72,11 @@
#endif
#endif
+#ifdef HAVE_NET_SNMP
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#define VersionInfo NetSnmpVersionInfo
+#else
#ifdef HAVE_DEFAULT_STORE_H
#include "default_store.h"
#endif
@@ -81,6 +88,7 @@
#include "parse.h"
#include "mib.h"
#include "version.h"
+#endif
/* 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
@@ -329,7 +337,11 @@ retry:
}
if (st != 11) {
- sprint_value((struct sbuf *)buf,vars->name, vars->name_length, vars);
+#ifdef HAVE_NET_SNMP
+ snprint_value(buf, strlen(buf), vars->name, vars->name_length, vars);
+#else
+ sprint_value((struct sbuf *) buf,vars->name, vars->name_length, vars);
+#endif
}
if (st == 1) {
@@ -337,7 +349,11 @@ retry:
} else if (st == 2) {
add_next_index_string(return_value,buf,1); /* Add to returned array */
} else if (st == 3) {
+#ifdef HAVE_NET_SNMP
+ snprint_objid(buf2, strlen(buf2), vars->name, vars->name_length);
+#else
sprint_objid((struct sbuf *)buf2, vars->name, vars->name_length);
+#endif
add_assoc_string(return_value,buf2,buf,1);
}
if (st >= 2 && st != 11) {
@@ -356,7 +372,11 @@ retry:
for (count=1, vars = response->variables; vars && count != response->errindex;
vars = vars->next_variable, count++);
if (vars) {
+#ifdef HAVE_NET_SNMP
+ snprint_objid(buf, strlen(buf), vars->name, vars->name_length);
+#else
sprint_objid((struct sbuf *)buf,vars->name, vars->name_length);
+#endif
}
php_error(E_WARNING,"This name does not exist: %s\n",buf);
}