php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
php_snmp.h
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Copyright (c) The PHP Group |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.01 of the PHP license, |
6 | that is bundled with this package in the file LICENSE, and is |
7 | available through the world-wide-web at the following url: |
8 | https://www.php.net/license/3_01.txt |
9 | If you did not receive a copy of the PHP license and are unable to |
10 | obtain it through the world-wide-web, please send a note to |
11 | license@php.net so we can mail you a copy immediately. |
12 +----------------------------------------------------------------------+
13 | Authors: Rasmus Lerdorf <rasmus@php.net> |
14 | Mike Jackson <mhjack@tscnet.com> |
15 | Steven Lawrance <slawrance@technologist.com> |
16 | Harrie Hazewinkel <harrie@lisanza.net> |
17 | Johann Hanne <jonny@nurfuerspam.de> |
18 | Boris Lytockin <lytboris@gmail.com> |
19 +----------------------------------------------------------------------+
20*/
21
22#ifndef PHP_SNMP_H
23#define PHP_SNMP_H
24
25#define PHP_SNMP_VERSION PHP_VERSION
26
27#ifdef HAVE_SNMP
28
29#ifndef DLEXPORT
30#define DLEXPORT
31#endif
32
33extern zend_module_entry snmp_module_entry;
34#define snmp_module_ptr &snmp_module_entry
35
36#ifdef ZTS
37#include "TSRM.h"
38#endif
39
40#include <net-snmp/net-snmp-config.h>
41#include <net-snmp/net-snmp-includes.h>
42
46
47typedef struct _php_snmp_object {
48 struct snmp_session *session;
49 int max_oids;
50 int valueretrieval;
51 int quick_print;
52 int enum_print;
53 int oid_output_format;
54 int snmp_errno;
55 int oid_increasing_check;
56 int exceptions_enabled;
57 char snmp_errstr[256];
58 zend_object zo;
59} php_snmp_object;
60
61static inline php_snmp_object *php_snmp_fetch_object(zend_object *obj) {
62 return (php_snmp_object *)((char*)(obj) - XtOffsetOf(php_snmp_object, zo));
63}
64
65#define Z_SNMP_P(zv) php_snmp_fetch_object(Z_OBJ_P((zv)))
66
67typedef int (*php_snmp_read_t)(php_snmp_object *snmp_object, zval *retval);
68typedef int (*php_snmp_write_t)(php_snmp_object *snmp_object, zval *newval);
69
70typedef struct _ptp_snmp_prop_handler {
71 const char *name;
72 size_t name_length;
73 php_snmp_read_t read_func;
74 php_snmp_write_t write_func;
75} php_snmp_prop_handler;
76
77typedef struct _snmpobjarg {
78 char *oid;
79 char type;
80 char *value;
81 oid name[MAX_OID_LEN];
82 size_t name_length;
83} snmpobjarg;
84
86 int valueretrieval;
88
89#ifdef ZTS
90#define SNMP_G(v) TSRMG(snmp_globals_id, zend_snmp_globals *, v)
91#else
92#define SNMP_G(v) (snmp_globals.v)
93#endif
94
95#define SNMP_VALUE_LIBRARY (0 << 0)
96#define SNMP_VALUE_PLAIN (1 << 0)
97#define SNMP_VALUE_OBJECT (1 << 1)
98
99#define PHP_SNMP_ERRNO_NOERROR 0
100#define PHP_SNMP_ERRNO_GENERIC (1 << 1)
101#define PHP_SNMP_ERRNO_TIMEOUT (1 << 2)
102#define PHP_SNMP_ERRNO_ERROR_IN_REPLY (1 << 3)
103#define PHP_SNMP_ERRNO_OID_NOT_INCREASING (1 << 4)
104#define PHP_SNMP_ERRNO_OID_PARSING_ERROR (1 << 5)
105#define PHP_SNMP_ERRNO_MULTIPLE_SET_QUERIES (1 << 6)
106#define PHP_SNMP_ERRNO_ANY ( \
107 PHP_SNMP_ERRNO_GENERIC | \
108 PHP_SNMP_ERRNO_TIMEOUT | \
109 PHP_SNMP_ERRNO_ERROR_IN_REPLY | \
110 PHP_SNMP_ERRNO_OID_NOT_INCREASING | \
111 PHP_SNMP_ERRNO_OID_PARSING_ERROR | \
112 PHP_SNMP_ERRNO_MULTIPLE_SET_QUERIES | \
113 PHP_SNMP_ERRNO_NOERROR \
114 )
115
116#else
117
118#define snmp_module_ptr NULL
119
120#endif /* HAVE_SNMP */
121
122#define phpext_snmp_ptr snmp_module_ptr
123
124#endif /* PHP_SNMP_H */
zend_ffi_type * type
Definition ffi.c:3812
#define PHP_MSHUTDOWN_FUNCTION
Definition php.h:401
#define PHP_MINIT_FUNCTION
Definition php.h:400
#define PHP_MINFO_FUNCTION
Definition php.h:404
#define ZEND_END_MODULE_GLOBALS(module_name)
Definition zend_API.h:248
#define ZEND_BEGIN_MODULE_GLOBALS(module_name)
Definition zend_API.h:246
struct _zval_struct zval
struct _zend_module_entry zend_module_entry
#define XtOffsetOf(s_type, field)
struct _zend_object zend_object
zval retval
zend_string * name
value