$SNMP_SHARED_LIBADD
])
+ dnl Check whether shutdown_snmp_logging() exists.
+ PHP_CHECK_LIBRARY($SNMP_LIBNAME, shutdown_snmp_logging,
+ [
+ AC_DEFINE(HAVE_SHUTDOWN_SNMP_LOGGING, 1, [ ])
+ ], [], [
+ $SNMP_SHARED_LIBADD
+ ])
+
dnl Test build.
PHP_CHECK_LIBRARY($SNMP_LIBNAME, init_snmp,
[
#define zend_parse_parameters_none() zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "")
#endif
+/* For net-snmp prior to 5.4 */
+//#ifndef HAVE_SHUTDOWN_SNMP_LOGGING
+extern netsnmp_log_handler *logh_head;
+#define shutdown_snmp_logging() \
+ { \
+ snmp_disable_log(); \
+ while(NULL != logh_head) \
+ netsnmp_remove_loghandler( logh_head ); \
+ }
+//#endif
+
/* For really old ucd-snmp versions.. */
#ifndef HAVE_SNMP_PARSE_OID
#define snmp_parse_oid read_objid
}
}
objid_set->count++;
- } else if (Z_TYPE_PP(oid) == IS_ARRAY) { // we got objid array
+ } else if (Z_TYPE_PP(oid) == IS_ARRAY) { /* we got objid array */
if (zend_hash_num_elements(Z_ARRVAL_PP(oid)) == 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Got empty OID array");
return FALSE;
snmp_object = (php_snmp_object *)zend_object_store_get_object(object TSRMLS_CC);
if (snmp_object->max_oids > 0) {
objid_set.step = snmp_object->max_oids;
- if (max_repetitions < 0) { // unspecified in function call, use session-wise
+ if (max_repetitions < 0) { /* unspecified in function call, use session-wise */
max_repetitions = snmp_object->max_oids;
}
}
}
if (max_repetitions < 0) {
- max_repetitions = 20; // provide correct default value
+ max_repetitions = 20; /* provide correct default value */
}
php_snmp_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU, st, session, &objid_set, non_repeaters, max_repetitions, valueretrieval);
return;
}
+ /* handle re-open of snmp session */
+ if (snmp_object->session) {
+ netsnmp_session_free(&(snmp_object->session));
+ }
+
if (netsnmp_session_init(&(snmp_object->session), version, a1, a2, timeout, retries TSRMLS_CC)) {
return;
}