PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LCOV - code coverage report
Current view: top level - ext/snmp - php_snmp.h (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 2 2 100.0 %
Date: 2022-01-16 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :   +----------------------------------------------------------------------+
       3             :   | PHP Version 7                                                        |
       4             :   +----------------------------------------------------------------------+
       5             :   | Copyright (c) 1997-2018 The PHP Group                                |
       6             :   +----------------------------------------------------------------------+
       7             :   | This source file is subject to version 3.01 of the PHP license,      |
       8             :   | that is bundled with this package in the file LICENSE, and is        |
       9             :   | available through the world-wide-web at the following url:           |
      10             :   | http://www.php.net/license/3_01.txt                                  |
      11             :   | If you did not receive a copy of the PHP license and are unable to   |
      12             :   | obtain it through the world-wide-web, please send a note to          |
      13             :   | license@php.net so we can mail you a copy immediately.               |
      14             :   +----------------------------------------------------------------------+
      15             :   | Authors: Rasmus Lerdorf <rasmus@php.net>                             |
      16             :   |          Mike Jackson <mhjack@tscnet.com>                            |
      17             :   |          Steven Lawrance <slawrance@technologist.com>                |
      18             :   |          Harrie Hazewinkel <harrie@lisanza.net>                      |
      19             :   |          Johann Hanne <jonny@nurfuerspam.de>                         |
      20             :   |          Boris Lytockin <lytboris@gmail.com>                         |
      21             :   +----------------------------------------------------------------------+
      22             : */
      23             : 
      24             : /* $Id$ */
      25             : 
      26             : #ifndef PHP_SNMP_H
      27             : #define PHP_SNMP_H
      28             : 
      29             : #define PHP_SNMP_VERSION "0.1"
      30             : 
      31             : #if HAVE_SNMP
      32             : 
      33             : #ifndef DLEXPORT
      34             : #define DLEXPORT
      35             : #endif
      36             : 
      37             : extern zend_module_entry snmp_module_entry;
      38             : #define snmp_module_ptr &snmp_module_entry
      39             : 
      40             : #ifdef ZTS
      41             : #include "TSRM.h"
      42             : #endif
      43             : 
      44             : #include <net-snmp/net-snmp-config.h>
      45             : #include <net-snmp/net-snmp-includes.h>
      46             : 
      47             : PHP_MINIT_FUNCTION(snmp);
      48             : PHP_MSHUTDOWN_FUNCTION(snmp);
      49             : PHP_MINFO_FUNCTION(snmp);
      50             : 
      51             : PHP_FUNCTION(snmpget);
      52             : PHP_FUNCTION(snmpgetnext);
      53             : PHP_FUNCTION(snmpwalk);
      54             : PHP_FUNCTION(snmprealwalk);
      55             : PHP_FUNCTION(snmpset);
      56             : PHP_FUNCTION(snmp_get_quick_print);
      57             : PHP_FUNCTION(snmp_set_quick_print);
      58             : PHP_FUNCTION(snmp_set_enum_print);
      59             : PHP_FUNCTION(snmp_set_oid_output_format);
      60             : 
      61             : PHP_FUNCTION(snmp2_get);
      62             : PHP_FUNCTION(snmp2_getnext);
      63             : PHP_FUNCTION(snmp2_walk);
      64             : PHP_FUNCTION(snmp2_real_walk);
      65             : PHP_FUNCTION(snmp2_set);
      66             : 
      67             : PHP_FUNCTION(snmp3_get);
      68             : PHP_FUNCTION(snmp3_getnext);
      69             : PHP_FUNCTION(snmp3_walk);
      70             : PHP_FUNCTION(snmp3_real_walk);
      71             : PHP_FUNCTION(snmp3_set);
      72             : 
      73             : PHP_FUNCTION(snmp_set_valueretrieval);
      74             : PHP_FUNCTION(snmp_get_valueretrieval);
      75             : 
      76             : PHP_FUNCTION(snmp_read_mib);
      77             : 
      78             : PHP_METHOD(SNMP, setSecurity);
      79             : PHP_METHOD(SNMP, close);
      80             : PHP_METHOD(SNMP, get);
      81             : PHP_METHOD(SNMP, getnext);
      82             : PHP_METHOD(SNMP, walk);
      83             : PHP_METHOD(SNMP, set);
      84             : PHP_METHOD(SNMP, getErrno);
      85             : PHP_METHOD(SNMP, getError);
      86             : 
      87             : typedef struct _php_snmp_object {
      88             :         struct snmp_session *session;
      89             :         int max_oids;
      90             :         int valueretrieval;
      91             :         int quick_print;
      92             :         int enum_print;
      93             :         int oid_output_format;
      94             :         int snmp_errno;
      95             :         int oid_increasing_check;
      96             :         int exceptions_enabled;
      97             :         char snmp_errstr[256];
      98             :         zend_object zo;
      99             : } php_snmp_object;
     100             : 
     101         282 : static inline php_snmp_object *php_snmp_fetch_object(zend_object *obj) {
     102         282 :         return (php_snmp_object *)((char*)(obj) - XtOffsetOf(php_snmp_object, zo));
     103             : }
     104             : 
     105             : #define Z_SNMP_P(zv) php_snmp_fetch_object(Z_OBJ_P((zv)))
     106             : 
     107             : typedef int (*php_snmp_read_t)(php_snmp_object *snmp_object, zval *retval);
     108             : typedef int (*php_snmp_write_t)(php_snmp_object *snmp_object, zval *newval);
     109             : 
     110             : typedef struct _ptp_snmp_prop_handler {
     111             :         const char *name;
     112             :         size_t name_length;
     113             :         php_snmp_read_t read_func;
     114             :         php_snmp_write_t write_func;
     115             : } php_snmp_prop_handler;
     116             : 
     117             : typedef struct _snmpobjarg {
     118             :         char *oid;
     119             :         char type;
     120             :         char *value;
     121             :         oid  name[MAX_OID_LEN];
     122             :         size_t name_length;
     123             : } snmpobjarg;
     124             : 
     125             : ZEND_BEGIN_MODULE_GLOBALS(snmp)
     126             :         int valueretrieval;
     127             : ZEND_END_MODULE_GLOBALS(snmp)
     128             : 
     129             : #ifdef ZTS
     130             : #define SNMP_G(v) TSRMG(snmp_globals_id, zend_snmp_globals *, v)
     131             : #else
     132             : #define SNMP_G(v) (snmp_globals.v)
     133             : #endif
     134             : 
     135             : #define REGISTER_SNMP_CLASS_CONST_LONG(const_name, value) \
     136             :         zend_declare_class_constant_long(php_snmp_ce, const_name, sizeof(const_name)-1, (zend_long)value);
     137             : 
     138             : #else
     139             : 
     140             : #define snmp_module_ptr NULL
     141             : 
     142             : #endif /* HAVE_SNMP */
     143             : 
     144             : #define phpext_snmp_ptr snmp_module_ptr
     145             : 
     146             : #endif  /* PHP_SNMP_H */

Generated by: LCOV version 1.10

Generated at Sun, 16 Jan 2022 08:19:20 +0000 (6 days ago)

Copyright © 2005-2022 The PHP Group
All rights reserved.