shell bypass 403

GrazzMean Shell

: /proc/thread-self/root/proc/self/cwd/ [ drwxr-xr-x ]
Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 3.17.162.17
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : net-snmp.tar
types.h000064400000032302147511501070006062 0ustar00/*
 * Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 *
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */

#ifndef NET_SNMP_TYPES_H
#define NET_SNMP_TYPES_H

    /**
     *  Definitions of data structures, used within the library API.
     */

#include <stdio.h>

#ifndef NET_SNMP_CONFIG_H
#error "Please include <net-snmp/net-snmp-config.h> before this file"
#endif

                        /*
                         * For 'timeval' 
                         */
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
#  include <sys/time.h>
# else
#  include <time.h>
# endif
#endif

#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#include <sys/types.h>
#if 1
/*
 * If neither the Microsoft winsock header file nor the MinGW winsock header
 * file has already been included, do this now.
 */
# if defined(HAVE_WINSOCK2_H) && defined(HAVE_WS2TCPIP_H)
#  if !defined(__MINGW32__) && !defined(HAVE_WIN32_PLATFORM_SDK) && \
    _MSC_VER -0 <= 1200 && _WIN32_WINNT -0 >= 0x0400
    /*
     * When using the MSVC 6 header files, including <winsock2.h> when
     * _WIN32_WINNT >= 0x0400 results in a compilation error. Hence include
     * <windows.h> instead, because <winsock2.h> is included from inside
     * <windows.h> when _WIN32_WINNT >= 0x0400. The SDK version of <windows.h>
     * does not include <winsock2.h> however.
     */
#   include <windows.h>
#  else
#   include <winsock2.h>
#  endif
#  include <ws2tcpip.h>
# elif defined(HAVE_WINSOCK_H)
#  include <winsock.h>
# endif
#endif

#if defined(WIN32) && !defined(cygwin)
typedef HANDLE netsnmp_pid_t;
#define NETSNMP_NO_SUCH_PROCESS INVALID_HANDLE_VALUE
#else
/*
 * Note: on POSIX-compliant systems, pid_t is defined in <sys/types.h>.
 * And if pid_t has not been defined in <sys/types.h>, AC_TYPE_PID_T ensures
 * that a pid_t definition is present in net-snmp-config.h.
 */
typedef pid_t netsnmp_pid_t;
#define NETSNMP_NO_SUCH_PROCESS -1
#endif

#if HAVE_NETINET_IN_H
#include <netinet/in.h>		/* For definition of in_addr_t */
#endif

#include <net-snmp/library/oid.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifndef HAVE_SOCKLEN_T
typedef u_int socklen_t;
#endif

#ifndef HAVE_IN_ADDR_T
  /*
   * The type in_addr_t must match the type of sockaddr_in::sin_addr.
   * For MSVC and MinGW32, this is u_long.
   */
typedef u_long in_addr_t;
#endif

#ifndef HAVE_SSIZE_T
#if defined(__INT_MAX__) && __INT_MAX__ == 2147483647
typedef int ssize_t;
#else
typedef long ssize_t;
#endif
#endif

#ifndef HAVE_NFDS_T
typedef unsigned long int nfds_t;
#endif

    /*
     *  For the initial release, this will just refer to the
     *  relevant UCD header files.
     *    In due course, the types and structures relevant to the
     *  Net-SNMP API will be identified, and defined here directly.
     *
     *  But for the time being, this header file is primarily a placeholder,
     *  to allow application writers to adopt the new header file names.
     */

typedef union {
   long           *integer;
   u_char         *string;
   oid            *objid;
   u_char         *bitstring;
   struct counter64 *counter64;
#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
   float          *floatVal;
   double         *doubleVal;
   /*
    * t_union *unionVal; 
    */
#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
} netsnmp_vardata;


#define MAX_OID_LEN	    128 /* max subid's in an oid */

/** @typedef struct variable_list netsnmp_variable_list
 * Typedefs the variable_list struct into netsnmp_variable_list */
/** @struct variable_list
 * The netsnmp variable list binding structure, it's typedef'd to
 * netsnmp_variable_list.
 */
typedef struct variable_list {
   /** NULL for last variable */
   struct variable_list *next_variable;    
   /** Object identifier of variable */
   oid            *name;   
   /** number of subid's in name */
   size_t          name_length;    
   /** ASN type of variable */
   u_char          type;   
   /** value of variable */
    netsnmp_vardata val;
   /** the length of the value to be copied into buf */
   size_t          val_len;
   /** buffer to hold the OID */
   oid             name_loc[MAX_OID_LEN];  
   /** 90 percentile < 40. */
   u_char          buf[40];
   /** (Opaque) hook for additional data */
   void           *data;
   /** callback to free above */
   void            (*dataFreeHook)(void *);    
   int             index;
} netsnmp_variable_list;


/** @typedef struct snmp_pdu to netsnmp_pdu
 * Typedefs the snmp_pdu struct into netsnmp_pdu */
/** @struct snmp_pdu
 * The snmp protocol data unit.
 */	
typedef struct snmp_pdu {

#define non_repeaters	errstat
#define max_repetitions errindex

    /*
     * Protocol-version independent fields
     */
    /** snmp version */
    long            version;
    /** Type of this PDU */	
    int             command;
    /** Request id - note: incremented for each retry */
    long            reqid;  
    /** Message id for V3 messages note: incremented for each retry */
    long            msgid;
    /** Unique ID for incoming transactions */
    long            transid;
    /** Session id for AgentX messages */
    long            sessid;
    /** Error status (non_repeaters in GetBulk) */
    long            errstat;
    /** Error index (max_repetitions in GetBulk) */
    long            errindex;       
    /** Uptime */
    u_long          time;   
    u_long          flags;

    int             securityModel;
    /** noAuthNoPriv, authNoPriv, authPriv */
    int             securityLevel;  
    int             msgParseModel;

    /** smallest of max for transport, v3 msgMaxSize and local cfg. */
    long            msgMaxSize;

    /**
     * Transport-specific opaque data.  This replaces the IP-centric address
     * field.  
     */
    
    void           *transport_data;
    int             transport_data_length;

    /**
     * The actual transport domain.  This SHOULD NOT BE FREE()D.  
     */

    const oid      *tDomain;
    size_t          tDomainLen;

    netsnmp_variable_list *variables;


    /*
     * SNMPv1 & SNMPv2c fields
     */
    /** community for outgoing requests. */
    u_char         *community;
    /** length of community name. */
    size_t          community_len;  

    /*
     * Trap information
     */
    /** System OID */
    oid            *enterprise;     
    size_t          enterprise_length;
    /** trap type */
    long            trap_type;
    /** specific type */
    long            specific_type;
    /** This is ONLY used for v1 TRAPs  */
    unsigned char   agent_addr[4];  

    /*
     *  SNMPv3 fields
     */
    /** context snmpEngineID */
    u_char         *contextEngineID;
    /** Length of contextEngineID */
    size_t          contextEngineIDLen;     
    /** authoritative contextName */
    char           *contextName;
    /** Length of contextName */
    size_t          contextNameLen;
    /** authoritative snmpEngineID for security */
    u_char         *securityEngineID;
    /** Length of securityEngineID */
    size_t          securityEngineIDLen;    
    /** on behalf of this principal */
    char           *securityName;
    /** Length of securityName. */
    size_t          securityNameLen;        
    
    /*
     * AgentX fields
     *      (also uses SNMPv1 community field)
     */
    int             priority;
    int             range_subid;
    
    void           *securityStateRef;
} netsnmp_pdu;


/** @typedef struct snmp_session netsnmp_session
 * Typedefs the snmp_session struct intonetsnmp_session */
        struct snmp_session;
typedef struct snmp_session netsnmp_session;

/** for openssl this should match up with EVP_MAX_MD_SIZE */
#define USM_AUTH_KU_LEN     64
#define USM_PRIV_KU_LEN     64

typedef int        (*snmp_callback) (int, netsnmp_session *, int,
                                          netsnmp_pdu *, void *);
typedef int     (*netsnmp_callback) (int, netsnmp_session *, int,
                                          netsnmp_pdu *, void *);

struct netsnmp_container_s;

#ifndef NETSNMP_NO_TRAP_STATS
    /*
     * trap/inform statistics.
     *
     * all times are sysuptime
     */
typedef struct netsnmp_trap_stats_s {
    u_long   sent_count;
    u_long   sent_last_sent;

    u_long   sent_fail_count;
    u_long   sent_last_fail;

    u_long   ack_count;
    u_long   ack_last_rcvd;

    u_long   sec_err_count;
    u_long   sec_err_last;

    u_long   timeouts;
    u_long   sent_last_timeout;
} netsnmp_trap_stats;
#endif /* NETSNMP_NO_TRAP_STATS */

/** @struct snmp_session
 * The snmp session structure.
 */
struct snmp_session {
    /*
     * Protocol-version independent fields
     */
    /** snmp version */
    long            version;
    /** Number of retries before timeout. */
    int             retries;
    /** Number of uS until first timeout, then exponential backoff */
    long            timeout;        
    u_long          flags;
    struct snmp_session *subsession;
    struct snmp_session *next;

    /** name or address of default peer (may include transport specifier and/or port number) */
    char           *peername;
    /** UDP port number of peer. (NO LONGER USED - USE peername INSTEAD) */
    u_short         remote_port NETSNMP_ATTRIBUTE_DEPRECATED;
    /** My Domain name or dotted IP address, 0 for default */
    char           *localname;
    /** My UDP port number, 0 for default, picked randomly */
    u_short         local_port;     
    /**
     * Authentication function or NULL if null authentication is used 
     */
    u_char         *(*authenticator) (u_char *, size_t *, u_char *, size_t);
    /** Function to interpret incoming data */
    netsnmp_callback callback;      
    /**
     * Pointer to data that the callback function may consider important 
     */
    void           *callback_magic;
    /** copy of system errno */
    int             s_errno;
    /** copy of library errno */
    int             s_snmp_errno;   
    /** Session id - AgentX only */
    long            sessid; 

    /*
     * SNMPv1 & SNMPv2c fields
     */
    /** community for outgoing requests. */
    u_char         *community;
    /** Length of community name. */
    size_t          community_len;  
    /**  Largest message to try to receive.  */
    size_t          rcvMsgMaxSize;
    /**  Largest message to try to send.  */
    size_t          sndMsgMaxSize;  

    /*
     * SNMPv3 fields
     */
    /** are we the authoritative engine? */
    u_char          isAuthoritative;
    /** authoritative snmpEngineID */
    u_char         *contextEngineID;
    /** Length of contextEngineID */
    size_t          contextEngineIDLen;     
    /** initial engineBoots for remote engine */
    u_int           engineBoots;
    /** initial engineTime for remote engine */
    u_int           engineTime;
    /** authoritative contextName */
    char           *contextName;
    /** Length of contextName */
    size_t          contextNameLen;
    /** authoritative snmpEngineID */
    u_char         *securityEngineID;
    /** Length of contextEngineID */
    size_t          securityEngineIDLen;    
    /** on behalf of this principal */
    char           *securityName;
    /** Length of securityName. */
    size_t          securityNameLen;

    /** auth protocol oid */
    oid            *securityAuthProto;
    /** Length of auth protocol oid */
    size_t          securityAuthProtoLen;
    /** Ku for auth protocol XXX */
    u_char          securityAuthKey[USM_AUTH_KU_LEN];       
    /** Length of Ku for auth protocol */
    size_t          securityAuthKeyLen;
    /** Kul for auth protocol */
    u_char          *securityAuthLocalKey;       
    /** Length of Kul for auth protocol XXX */
    size_t          securityAuthLocalKeyLen;       

    /** priv protocol oid */
    oid            *securityPrivProto;
    /** Length of priv protocol oid */
    size_t          securityPrivProtoLen;
    /** Ku for privacy protocol XXX */
    u_char          securityPrivKey[USM_PRIV_KU_LEN];       
    /** Length of Ku for priv protocol */
    size_t          securityPrivKeyLen;
    /** Kul for priv protocol */
    u_char          *securityPrivLocalKey;       
    /** Length of Kul for priv protocol XXX */
    size_t          securityPrivLocalKeyLen;       

    /** snmp security model, v1, v2c, usm */
    int             securityModel;
    /** noAuthNoPriv, authNoPriv, authPriv */
    int             securityLevel;  
    /** target param name */
    char           *paramName;
#ifndef NETSNMP_NO_TRAP_STATS
    netsnmp_trap_stats *trap_stats;
#endif /* NETSNMP_NO_TRAP_STATS */

    /**
     * security module specific 
     */
    void           *securityInfo;

    /**
     * transport specific configuration 
     */
   struct netsnmp_container_s *transport_configuration;

    /**
     * use as you want data 
     *
     *     used by 'SNMP_FLAGS_RESP_CALLBACK' handling in the agent
     * XXX: or should we add a new field into this structure?
     */
    void           *myvoid;
};


#include <net-snmp/library/types.h>
#include <net-snmp/definitions.h>
#include <net-snmp/library/snmp_api.h>

#ifdef __cplusplus
}
#endif

#endif                          /* NET_SNMP_TYPES_H */
version.h000064400000000511147511501070006400 0ustar00#ifndef NET_SNMP_VERSION_H
#define NET_SNMP_VERSION_H

#ifdef __cplusplus
extern          "C" {
#endif

#ifdef UCD_COMPATIBLE
    extern const char *NetSnmpVersionInfo;
#endif

    NETSNMP_IMPORT
    const char     *netsnmp_get_version(void);

#ifdef __cplusplus
}
#endif
#endif                          /* NET_SNMP_VERSION_H */
definitions.h000064400000001663147511501070007237 0ustar00#ifndef NET_SNMP_DEFINITIONS_H
#define NET_SNMP_DEFINITIONS_H

    /**
     *  Defined constants, and other similar enumerations.
     */

#define MAX_OID_LEN	    128 /* max subid's in an oid */

#define ONE_SEC         1000000L

    /*
     *  For the initial release, this will just refer to the
     *  relevant UCD header files.
     *    In due course, the relevant definitions will be
     *  identified, and listed here directly.
     *
     *  But for the time being, this header file is primarily a placeholder,
     *  to allow application writers to adopt the new header file names.
     */

#include <net-snmp/types.h>     /* for oid */
#include <net-snmp/library/snmp_api.h>
#include <net-snmp/library/asn1.h>
#include <net-snmp/library/snmp_impl.h>
#include <net-snmp/library/snmp.h>
#include <net-snmp/library/snmp-tc.h>
/*
 * #include <net-snmp/library/libsnmp.h> 
 */

#endif                          /* NET_SNMP_DEFINITIONS_H */
net-snmp-config.h000064400000002515147511501070007725 0ustar00/* This file is here to prevent a file conflict on multiarch systems.  A
 * conflict will frequently occur because arch-specific build-time
 * configuration options are stored (and used, so they can't just be stripped
 * out) in net-snmp-config.h.  The original net-snmp-config.h has been renamed.
 * DO NOT INCLUDE THE NEW FILE DIRECTLY -- ALWAYS INCLUDE THIS ONE INSTEAD. */

#ifdef net_snmp_config_multilib_redirection_h
#error "Do not define net_snmp_config_multilib_redirection_h!"
#endif
#define net_snmp_config_multilib_redirection_h

#if defined(__i386__)
#include "net-snmp-config-i386.h"
#elif defined(__ia64__)
#include "net-snmp-config-ia64.h"
#elif defined(__powerpc64__)
#include "net-snmp-config-ppc64.h"
#elif defined(__powerpc__)
#include "net-snmp-config-ppc.h"
#elif defined(__s390x__)
#include "net-snmp-config-s390x.h"
#elif defined(__s390__)
#include "net-snmp-config-s390.h"
#elif defined(__x86_64__)
#include "net-snmp-config-x86_64.h"
#elif defined(__alpha__)
#include "net-snmp-config-alpha.h"
#elif defined(__sparc__) && defined (__arch64__)
#include "net-snmp-config-sparc64.h"
#elif defined(__sparc__)
#include "net-snmp-config-sparc.h"
#elif defined(__aarch64__)
#include "net-snmp-config-aarch64.h"
#else
#error "net-snmp-devel package does not work on your architecture"
#endif

#undef net_snmp_config_multilib_redirection_h
library/winpipe.h000064400000003323147511501070010036 0ustar00/*
  Copyright (c) Fabasoft R&D Software GmbH & Co KG, 2003
  oss@fabasoft.com
  Author: Bernhard Penz <bernhard.penz@fabasoft.com>

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are met:

  *  Redistributions of source code must retain the above copyright notice,
     this list of conditions and the following disclaimer.

  *  Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in the
     documentation and/or other materials provided with the distribution.

  *  The name of Fabasoft R&D Software GmbH & Co KG or any of its subsidiaries, 
     brand or product names may not be used to endorse or promote products 
     derived from this software without specific prior written permission.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY
  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifdef WIN32

#ifndef WINPIPE_H
#define WINPIPE_H

NETSNMP_IMPORT
int create_winpipe_transport(int *pipefds);

#endif

#endif

library/snmpv3-security-includes.h000064400000000235147511501070013261 0ustar00/* This file is automatically generated by configure.  Do not modify by hand. */
#include <net-snmp/library/snmptsm.h>
#include <net-snmp/library/snmpusm.h>
library/container.h000064400000043206147511501070010351 0ustar00/* Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 */
/*
 * Portions of this file are copyrighted by:
 * Copyright (C) 2007 Apple, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 *
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */
#ifndef NETSNMP_CONTAINER_H
#define NETSNMP_CONTAINER_H

/*
 * $Id$
 *
 * WARNING: This is a recently created file, and all of it's contents are
 *          subject to change at any time.
 *
 * A basic container template. A generic way for code to store and
 * retrieve data. Allows for interchangable storage algorithms.
 */
#ifndef NET_SNMP_CONFIG_H
#error "Please include <net-snmp/net-snmp-config.h> before this file"
#endif

#include <stdlib.h> /* free() */
#include <net-snmp/types.h>
#include <net-snmp/library/factory.h>
#include <net-snmp/library/snmp_logging.h>
#include <net-snmp/library/tools.h>

#ifdef  __cplusplus
extern "C" {
#endif

    /*************************************************************************
     *
     * function pointer definitions
     *
     *************************************************************************/
    struct netsnmp_iterator_s; /** forward declare */
    struct netsnmp_container_s; /** forward declare */

    /*
     * function for performing an operation on a container which
     * returns (maybe the same) container.
     */
    typedef struct netsnmp_container_s* (netsnmp_container_mod_op)
        (struct netsnmp_container_s *, void *context, u_int flags);

    /*
     * function for setting an option on a container
     */
    typedef int (netsnmp_container_option)(struct netsnmp_container_s *,
                                           int set, u_int flags);

    /*
     * function returning an int for an operation on a container
     */
    typedef int (netsnmp_container_rc)(struct netsnmp_container_s *);

    /*
     * function returning an iterator for a container
     */
    typedef struct netsnmp_iterator_s * (netsnmp_container_it)
        (struct netsnmp_container_s *);

    /*
     * function returning a size_t for an operation on a container
     */
    typedef size_t (netsnmp_container_size)(struct netsnmp_container_s *);

    /*
     * function returning an int for an operation on an object and
     * a container
     */
    typedef int (netsnmp_container_op)(struct netsnmp_container_s *,
                                       const void *data);

    /*
     * function returning an int for an operation on an object at a given
     * position in a container (for containers supporting direct access)
     */
    typedef int (netsnmp_container_da_op)(struct netsnmp_container_s *,
                                          size_t pos, void *data);

    /*
     * function returning an int and an object at a given position in a
     * container (for containers supporting direct access)
     */
    typedef int (netsnmp_container_da_op_rtn)(struct netsnmp_container_s *,
                                          size_t pos,
                                          void **data);

    /*
     * function returning an oject for an operation on an object and a
     * container
     */
    typedef void * (netsnmp_container_rtn)(struct netsnmp_container_s *,
                                           const void *data);

    /*
     * function with no return which acts on an object
     */
    typedef void (netsnmp_container_obj_func)(void *data, void *context);

    /*
     * function with no return which calls a function on an object
     */
    typedef void (netsnmp_container_func)(struct netsnmp_container_s *,
                                          netsnmp_container_obj_func *,
                                          void *context);

    /*
     * function returning an array of objects for an operation on an
     * ojbect and a container
     */
    typedef netsnmp_void_array * (netsnmp_container_set)
        (struct netsnmp_container_s *, void *data);

    /*
     * function returning an int for a comparison between two objects
     */
    typedef int (netsnmp_container_compare)(const void *lhs,
                                            const void *rhs);

    /*************************************************************************
     *
     * Basic container
     *
     *************************************************************************/
    typedef struct netsnmp_container_s {
       
       /*
        * pointer for container implementation
        */
       void *         container_data;

       /*
        * returns the number of items in a container
        */
       netsnmp_container_size  *get_size;
       
       /*
        * initialize a container
        */
       netsnmp_container_rc    *init;

       /*
        * release memory used by a container.
        *
        * Note: if your data structures contained allocated
        * memory, you are responsible for releasing that
        * memory before calling this function!
        */
       netsnmp_container_rc    *cfree;

       /*
        * add an entry to the container
        */
       netsnmp_container_op    *insert;

       /*
        * add an entry to the container at a given position
        */
       netsnmp_container_da_op *insert_before;
       netsnmp_container_da_op *insert_after;

       /*
        * remove an entry from the container
        */
       netsnmp_container_op    *remove;

       /*
        * remove an entry from the container at a given position
        */
       netsnmp_container_da_op_rtn *remove_at;

       /*
        * release memory for an entry from the container
        */
       netsnmp_container_op    *release; /* NOTE: deprecated. Use free_item */
       netsnmp_container_obj_func *free_item;

       /*
        * find the entry in the container with the same key
        *
        * Note: do not change the key!  If you need to
        * change a key, remove the entry, change the key,
        * and the re-add the entry.
        */
       netsnmp_container_rtn   *find;

       /*
        * find the entry in the container with the next highest key
        *
        * If the key is NULL, return the first item in the container.
        */
       netsnmp_container_rtn   *find_next;

       /*
        * get entry at the given index (for containers supporting direct access
        */
       netsnmp_container_da_op_rtn *get_at;

       /*
        * find all entries in the container which match the partial key
        * returns allocated memory (netsnmp_void_array). User is responsible
        * for releasing this memory (free(array->array), free(array)).
        * DO NOT FREE ELEMENTS OF THE ARRAY, because they are the same pointers
        * stored in the container.
        */
       netsnmp_container_set            *get_subset;

       /*
        * function to return an iterator for the container
        */
       netsnmp_container_it           *get_iterator;

       /*
        * function to call another function for each object in the container
        */
       netsnmp_container_func         *for_each;

       /*
        * specialized version of for_each used to optimize cleanup.
        * clear the container, optionally calling a function for each item.
        */
       netsnmp_container_func         *clear;

       /*
        * OPTIONAL function to filter inserts to the container
        *  (intended for a secondary container, which only wants
        *   a sub-set of the objects in the primary/parent container)
        * Returns:
        *   1 : filter matched (don't insert)
        *   0 : no match (insert)
        */
       netsnmp_container_op    *insert_filter;

        /*
         * OPTIONAL function to duplicate a container. Defaults to a shallow
         * copy. Only the specified container is copied (i.e. sub-containers
         * not included).
         */
        netsnmp_container_mod_op *duplicate;


       /*
        * function to compare two object stored in the container.
        *
        * Returns:
        *
        *   -1  LHS < RHS
        *    0  LHS = RHS
        *    1  LHS > RHS
        */
       netsnmp_container_compare        *compare;

       /*
        * same as compare, but RHS will be a partial key
        */
       netsnmp_container_compare        *ncompare;

       /*
        * function to set container options
        */
       netsnmp_container_option         *options;

       /*
        * unique name for finding a particular container in a list
        */
       char *container_name;

       /*
        * sort count, for iterators to track (insert/delete
        * bumps counter, invalidates iterator)
        */
       u_long                          sync;

       /*
        * flags
        */
       u_int                           flags;

       /*
        * containers can contain other containers (additional indexes)
        */
       struct netsnmp_container_s *next, *prev;

    } netsnmp_container;

    /*
     * initialize/free a container of container factories. used by
     * netsnmp_container_find* functions.
     */
    NETSNMP_IMPORT
    void netsnmp_container_init_list(void);
    NETSNMP_IMPORT
    void netsnmp_container_free_list(void);

    /*
     * register a new container factory
     */
    int netsnmp_container_register_with_compare(const char* name,
                                                netsnmp_factory *f,
                                                netsnmp_container_compare *c);
    int netsnmp_container_register(const char* name, netsnmp_factory *f);

    /*
     * search for and create a container from a list of types or a
     * specific type.
     */
    NETSNMP_IMPORT
    netsnmp_container * netsnmp_container_find(const char *type_list);
    netsnmp_container * netsnmp_container_get(const char *type);

    /*
     * utility routines
     */
    NETSNMP_IMPORT
    void netsnmp_container_add_index(netsnmp_container *primary,
                                     netsnmp_container *new_index);


    netsnmp_factory *netsnmp_container_get_factory(const char *type);

    /*
     * common comparison routines
     */
    /** first data element is a 'netsnmp_index' */
    NETSNMP_IMPORT
    int netsnmp_compare_netsnmp_index(const void *lhs, const void *rhs);
    NETSNMP_IMPORT
    int netsnmp_ncompare_netsnmp_index(const void *lhs, const void *rhs);

    /** first data element is a 'char *' */
    int netsnmp_compare_cstring(const void * lhs, const void * rhs);
    int netsnmp_ncompare_cstring(const void * lhs, const void * rhs);

    /** useful for octet strings */
    NETSNMP_IMPORT
    int netsnmp_compare_mem(const char * lhs, size_t lhs_len,
                            const char * rhs, size_t rhs_len);

    /** no structure, just 'char *' pointers */
    int netsnmp_compare_direct_cstring(const void * lhs, const void * rhs);

    int netsnmp_compare_long(const void * lhs, const void * rhs);
    int netsnmp_compare_ulong(const void * lhs, const void * rhs);
    int netsnmp_compare_int32(const void * lhs, const void * rhs);
    int netsnmp_compare_uint32(const void * lhs, const void * rhs);

    /** for_each callback to call free on data item */
    NETSNMP_IMPORT
    void  netsnmp_container_simple_free(void *data, void *context);

/*
 * container optionflags
 */
#define CONTAINER_KEY_ALLOW_DUPLICATES             0x00000001
#define CONTAINER_KEY_UNSORTED                     0x00000002
    /* ... */
#define CONTAINER_FLAG_INTERNAL_1                  0x80000000

#define CONTAINER_SET_OPTIONS(x,o,rc)  do {                             \
        if (NULL==(x)->options)                                         \
            rc = -1;                                                    \
        else {                                                          \
            rc = (x)->options(x, 1, o);                                 \
            if (rc != -1 )                                              \
                (x)->flags |= o;                                        \
        }                                                               \
    } while(0)

#define CONTAINER_CHECK_OPTION(x,o,rc)    do {                          \
        rc = x->flags & 0;                                              \
    } while(0)


    /*
     * useful macros (x = container; k = key; c = user context)
     */
#define CONTAINER_FIRST(x)          (x)->find_next(x,NULL)
#define CONTAINER_FIND(x,k)         (x)->find(x,k)
#define CONTAINER_NEXT(x,k)         (x)->find_next(x,k)
/*
 * GET_SUBSET returns allocated memory (netsnmp_void_array). User is responsible
 * for releasing this memory (free(array->array), free(array)).
 * DO NOT FREE ELEMENTS OF THE ARRAY, because they are the same pointers
 * stored in the container.
 */
#define CONTAINER_GET_SUBSET(x,k)   (x)->get_subset(x,k)
#define CONTAINER_SIZE(x)           (x)->get_size(x)
#define CONTAINER_ITERATOR(x)       (x)->get_iterator(x)
#define CONTAINER_COMPARE(x,l,r)    (x)->compare(l,r)
#define CONTAINER_FOR_EACH(x,f,c)   (x)->for_each(x,f,c)

    /*
     * if you are getting multiple definitions of these three
     * inline functions, you most likely have optimizations turned off.
     * Either turn them back on, or define NETSNMP_NO_INLINE
     */
    /*
     * insert k into all containers
     */
    NETSNMP_IMPORT
    int CONTAINER_INSERT(netsnmp_container *x, const void *k);

    /*
     * insert item before given position
     */
    NETSNMP_IMPORT
    int CONTAINER_INSERT_BEFORE(netsnmp_container *x, size_t pos, void *k);

    /*
     * remove k from all containers
     */
    NETSNMP_IMPORT
    int CONTAINER_REMOVE(netsnmp_container *x, const void *k);

    /*
     * remove item at given position
     */
    NETSNMP_IMPORT
    int CONTAINER_REMOVE_AT(netsnmp_container *x, size_t pos, void **k);

    /*
     * get item at given position
     */
    NETSNMP_IMPORT
    int CONTAINER_GET_AT(netsnmp_container *x, size_t pos, void **k);

    /*
     * duplicate container
     */
    NETSNMP_IMPORT
    netsnmp_container *CONTAINER_DUP(netsnmp_container *x, void *ctx,
                                     u_int flags);

    /*
     * clear all containers. When clearing the *first* container, and
     * *only* the first container, call the function f for each item.
     * After calling this function, all containers should be empty.
     */
    NETSNMP_IMPORT
    void CONTAINER_CLEAR(netsnmp_container *x, netsnmp_container_obj_func *f,
                        void *c);

    /*
     * clear all containers. When clearing the *first* container, and
     * *only* the first container, call the free_item function for each item.
     * After calling this function, all containers should be empty.
     */
    NETSNMP_IMPORT
    void CONTAINER_FREE_ALL(netsnmp_container *x, void *c);

    /*
     * free all containers
     */
    NETSNMP_IMPORT
    int CONTAINER_FREE(netsnmp_container *x);

    NETSNMP_IMPORT
    netsnmp_container *SUBCONTAINER_FIND(netsnmp_container *x,
                                         const char* name);

    /*
     * INTERNAL utility routines for container implementations
     */
    void netsnmp_init_container(netsnmp_container         *c,
                                netsnmp_container_rc      *init,
                                netsnmp_container_rc      *cfree,
                                netsnmp_container_size    *size,
                                netsnmp_container_compare *cmp,
                                netsnmp_container_op      *ins,
                                netsnmp_container_op      *rem,
                                netsnmp_container_rtn     *fnd);
    /** Duplicate container meta-data. */
    int netsnmp_container_data_dup(netsnmp_container *dup,
                                   netsnmp_container *c);

    
    /*************************************************************************
     *
     * container iterator
     *
     *************************************************************************/
    /*
     * function returning an int for an operation on an iterator
     */
    typedef int (netsnmp_iterator_rc)(struct netsnmp_iterator_s *);

    /*
     * function returning an oject for an operation on an iterator
     */
    typedef void * (netsnmp_iterator_rtn)(struct netsnmp_iterator_s *);


    /*
     * iterator structure
     */
    typedef struct netsnmp_iterator_s {

       netsnmp_container              *container;

        /*
         * sync from container when iterator created. used to invalidate
         * the iterator when the container changes.
         */
       u_long                          sync;

        /*
         * reset iterator position to beginning of container.
         */
       netsnmp_iterator_rc           *reset;

        /*
         * release iterator and memory it uses
         */
       netsnmp_iterator_rc           *release;

        /*
         * first, last and current DO NOT advance the iterator
         */
       netsnmp_iterator_rtn          *first;
       netsnmp_iterator_rtn          *curr;
       netsnmp_iterator_rtn          *last;

       netsnmp_iterator_rtn          *next;

        /*
         * remove will remove the item at the current position, then back up
         * the iterator to the previous item. That way next will move to the
         * item (the one that replaced the removed item.
         */
       netsnmp_iterator_rc           *remove;

    } netsnmp_iterator;


#define ITERATOR_FIRST(x)  x->first(x)
#define ITERATOR_NEXT(x)   x->next(x)
#define ITERATOR_LAST(x)   x->last(x)
#define ITERATOR_REMOVE(x) x->remove(x)
#define ITERATOR_RELEASE(x) do { x->release(x); x = NULL; } while(0)
    
#ifdef  __cplusplus
}
#endif

#endif /** NETSNMP_CONTAINER_H */
library/snmpTCPBaseDomain.h000064400000001000147511501070011620 0ustar00#ifndef SNMPTCPBASEDOMAIN_H
#define SNMPTCPBASEDOMAIN_H

#include <net-snmp/library/snmp_transport.h>

#ifdef __cplusplus
extern          "C" {
#endif

/*
 * Prototypes
 */
    int netsnmp_tcpbase_recv(netsnmp_transport *t, void *buf, int size,
                             void **opaque, int *olength);
    int netsnmp_tcpbase_send(netsnmp_transport *t, const void *buf, int size,
                             void **opaque, int *olength);
        
#ifdef __cplusplus
}
#endif

#endif /* SNMPTCPBASEDOMAIN_H */
library/lcd_time.h000064400000010006147511501070010137 0ustar00/*
 * lcd_time.h
 */

#ifndef _LCD_TIME_H
#define _LCD_TIME_H

#ifdef __cplusplus
extern          "C" {
#endif


    /*
     * undefine to enable time synchronization only on authenticated packets 
     */
#define LCD_TIME_SYNC_OPT 1

    /*
     * Macros and definitions.
     */
#define ETIMELIST_SIZE	23



    typedef struct enginetime_struct {
        u_char         *engineID;
        u_int           engineID_len;

        u_int           engineTime;
        u_int           engineBoot;
        /*
         * Time & boots values received from last authenticated
         * *   message within the previous time window.
         */

        time_t          lastReceivedEngineTime;
        /*
         * Timestamp made when engineTime/engineBoots was last
         * *   updated.  Measured in seconds.
         */

#ifdef LCD_TIME_SYNC_OPT
        u_int           authenticatedFlag;
#endif
        struct enginetime_struct *next;
    } enginetime   , *Enginetime;




    /*
     * Macros for streamlined engineID existence checks --
     *
     *      e       is char *engineID,
     *      e_l     is u_int engineID_len.
     *
     *
     *  ISENGINEKNOWN(e, e_l)
     *      Returns:
     *              TRUE    If engineID is recoreded in the EngineID List;
     *              FALSE   Otherwise.
     *
     *  ENSURE_ENGINE_RECORD(e, e_l)
     *      Adds the given engineID to the EngineID List if it does not exist
     *              already.  engineID is added with a <enginetime, engineboots>
     *              tuple of <0,0>.  ALWAYS succeeds -- except in case of a
     *              fatal internal error.
     *      Returns:
     *              SNMPERR_SUCCESS On success;
     *              SNMPERR_GENERR  Otherwise.
     *
     *  MAKENEW_ENGINE_RECORD(e, e_l)
     *      Returns:
     *              SNMPERR_SUCCESS If engineID already exists in the EngineID List;
     *              SNMPERR_GENERR  Otherwise -and- invokes ENSURE_ENGINE_RECORD()
     *                                      to add an entry to the EngineID List.
     *
     * XXX  Requres the following declaration in modules calling ISENGINEKNOWN():
     *      static u_int    dummy_etime, dummy_eboot;
     */
#define ISENGINEKNOWN(e, e_l)					\
	( (get_enginetime(e, e_l,				\
		&dummy_eboot, &dummy_etime, TRUE) == SNMPERR_SUCCESS)	\
		? TRUE						\
		: FALSE )

#define ENSURE_ENGINE_RECORD(e, e_l)				\
	( (set_enginetime(e, e_l, 0, 0, FALSE) == SNMPERR_SUCCESS)	\
		? SNMPERR_SUCCESS				\
		: SNMPERR_GENERR )

#define MAKENEW_ENGINE_RECORD(e, e_l)				\
	( (ISENGINEKNOWN(e, e_l) == TRUE)			\
		? SNMPERR_SUCCESS				\
		: (ENSURE_ENGINE_RECORD(e, e_l), SNMPERR_GENERR) )



    /*
     * Prototypes.
     */
    int             get_enginetime(const u_char * engineID, u_int engineID_len,
                                   u_int * engine_boot,
                                   u_int * engine_time,
                                   u_int authenticated);

    int             get_enginetime_ex(u_char * engineID,
                                      u_int engineID_len,
                                      u_int * engine_boot,
                                      u_int * engine_time,
                                      u_int * last_engine_time,
                                      u_int authenticated);

    NETSNMP_IMPORT
    int             set_enginetime(const u_char * engineID, u_int engineID_len,
                                   u_int engine_boot, u_int engine_time,
                                   u_int authenticated);

         
         
         
         
         
         
        Enginetime
        search_enginetime_list(const u_char * engineID, u_int engineID_len);

    int             hash_engineID(const u_char * engineID, u_int engineID_len);

    void            dump_etimelist_entry(Enginetime e, int count);
    void            dump_etimelist(void);
    void            free_etimelist(void);
    void            free_enginetime(unsigned char *engineID, size_t engineID_len);

#ifdef __cplusplus
}
#endif
#endif                          /* _LCD_TIME_H */
library/data_list.h000064400000007635147511501070010341 0ustar00/* Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 */
/*
 * Portions of this file are copyrighted by:
 * Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 *
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */
/*
 * @file netsnmp_data_list.h
 *
 * @addtogroup agent
 * @addtogroup library *
 *
 * $Id$
 *
 * External definitions for functions and variables in netsnmp_data_list.c.
 *
 * @{
 */

#ifndef DATA_LIST_H
#define DATA_LIST_H

#ifdef __cplusplus
extern          "C" {
#endif

#include <net-snmp/library/snmp_impl.h>
#include <net-snmp/library/tools.h>

    typedef void    (Netsnmp_Free_List_Data) (void *);
    typedef int     (Netsnmp_Save_List_Data) (char *buf, size_t buf_len, void *);
    typedef void *  (Netsnmp_Read_List_Data) (char *buf, size_t buf_len);

/** @struct netsnmp_data_list_s
 * used to iterate through lists of data
 */
    typedef struct netsnmp_data_list_s {
        struct netsnmp_data_list_s *next;
        char           *name;
 	/** The pointer to the data passed on. */
        void           *data;
        /** must know how to free netsnmp_data_list->data */
        Netsnmp_Free_List_Data *free_func;
    } netsnmp_data_list;

    typedef struct netsnmp_data_list_saveinfo_s {
       netsnmp_data_list **datalist;
       const char *type;
       const char *token;
       Netsnmp_Save_List_Data *data_list_save_ptr;
       Netsnmp_Read_List_Data *data_list_read_ptr;
       Netsnmp_Free_List_Data *data_list_free_ptr;
    } netsnmp_data_list_saveinfo;

    NETSNMP_IMPORT
    netsnmp_data_list *
      netsnmp_create_data_list(const char *, void *, Netsnmp_Free_List_Data* );
    void            netsnmp_data_list_add_node(netsnmp_data_list **head,
                                               netsnmp_data_list *node);
    netsnmp_data_list *
      netsnmp_data_list_add_data(netsnmp_data_list **head,
                                 const char *name, void *data,
                                 Netsnmp_Free_List_Data * beer);
    NETSNMP_IMPORT
    void           *netsnmp_get_list_data(netsnmp_data_list *head,
                                          const char *node);
    NETSNMP_IMPORT
    void            netsnmp_free_list_data(netsnmp_data_list *head);    /* single */
    NETSNMP_IMPORT
    void            netsnmp_free_all_list_data(netsnmp_data_list *head);        /* multiple */
    NETSNMP_IMPORT
    int             netsnmp_remove_list_node(netsnmp_data_list **realhead,
                                             const char *name);
    NETSNMP_IMPORT
    netsnmp_data_list *
    netsnmp_get_list_node(netsnmp_data_list *head,
                          const char *name);

    /** depreciated: use netsnmp_data_list_add_node() */
    NETSNMP_IMPORT
    void            netsnmp_add_list_data(netsnmp_data_list **head,
                                          netsnmp_data_list *node);


    void
    netsnmp_register_save_list(netsnmp_data_list **datalist,
                               const char *type, const char *token,
                               Netsnmp_Save_List_Data *data_list_save_ptr,
                               Netsnmp_Read_List_Data *data_list_read_ptr,
                               Netsnmp_Free_List_Data *data_list_free_ptr);
    int
    netsnmp_save_all_data(netsnmp_data_list *head,
                          const char *type, const char *token,
                          Netsnmp_Save_List_Data * data_list_save_ptr);
    SNMPCallback netsnmp_save_all_data_callback;
    void netsnmp_read_data_callback(const char *token, char *line);

    void shutdown_data_list(void);

#ifdef __cplusplus
}
#endif
#endif
/** @} */
library/snmpIPv4BaseDomain.h000064400000002171147511501070011766 0ustar00/* IPV4 base transport support functions
 */
#ifndef SNMPIPV4BASE_H
#define SNMPIPV4BASE_H

#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif

#include <net-snmp/library/snmp_transport.h>

#ifdef __cplusplus
extern          "C" {
#endif

/*
 * Prototypes
 */

    char *netsnmp_ipv4_fmtaddr(const char *prefix, netsnmp_transport *t,
                               const void *data, int len);
    void netsnmp_ipv4_get_taddr(struct netsnmp_transport_s *t, void **addr,
                                size_t *addr_len);
    int netsnmp_ipv4_ostring_to_sockaddr(struct sockaddr_in *sin,
                                         const void *o, size_t o_len);

/*
 * Convert a "traditional" peername into a sockaddr_in structure which is
 * written to *addr_  Returns 1 if the conversion was successful, or 0 if it
 * failed
 */

    int netsnmp_sockaddr_in(struct sockaddr_in *addr, const char *peername,
                            int remote_port);
    int netsnmp_sockaddr_in2(struct sockaddr_in *addr, const char *inpeername,
                             const char *default_target);

#ifdef __cplusplus
}
#endif
#endif /* SNMPIPV4BASE_H */
library/scapi.h000064400000016306147511501070007467 0ustar00/*
 * scapi.h
 *
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */

#ifndef _SCAPI_H
#define _SCAPI_H

#ifdef NETSNMP_USE_OPENSSL
#include <openssl/ossl_typ.h> /* EVP_MD */
#endif

#ifdef __cplusplus
extern          "C" {
#endif

    /*
     * Authentication/privacy transform bitlengths.
     */
#define SNMP_TRANS_AUTHLEN_HMACMD5	128
#define SNMP_TRANS_AUTHLEN_HMACSHA1	160
#define SNMP_TRANS_AUTHLEN_HMAC128SHA224   224 /* OPTIONAL */
#define SNMP_TRANS_AUTHLEN_HMAC192SHA256   256 /* MUST */
#define SNMP_TRANS_AUTHLEN_HMAC256SHA384   384 /* OPTIONAL */
#define SNMP_TRANS_AUTHLEN_HMAC384SHA512   512 /* SHOULD */

#define SNMP_TRANS_AUTHLEN_HMAC96	96

#define SNMP_TRANS_PRIVLEN_1DES		64
#define SNMP_TRANS_PRIVLEN_1DES_IV	64

#ifdef NETSNMP_DRAFT_REEDER_3DES
#define SNMP_TRANS_PRIVLEN_3DESEDE      256
#define SNMP_TRANS_PRIVLEN_3DESEDE_IV   64
#endif /* NETSNMP_DRAFT_REEDER_3DES */

#define SNMP_TRANS_PRIVLEN_AES          128
#define SNMP_TRANS_PRIVLEN_AES_IV       128

#define SNMP_TRANS_PRIVLEN_AES128       SNMP_TRANS_PRIVLEN_AES
#define SNMP_TRANS_PRIVLEN_AES128_IV    SNMP_TRANS_PRIVLEN_AES_IV

#define SNMP_TRANS_PRIVLEN_AES192       192
#define SNMP_TRANS_PRIVLEN_AES192_IV    128 /* 192 */

#define SNMP_TRANS_PRIVLEN_AES256       256
#define SNMP_TRANS_PRIVLEN_AES256_IV    128 /* 256 */


typedef struct netsnmp_auth_alg_info_s {
    int          type;
    const char * name;
    oid *        alg_oid;
    int          oid_len;
    int          proper_length;
    int          mac_length;
} netsnmp_auth_alg_info;

typedef struct netsnmp_priv_alg_info_s {
    int          type;
    const char * name;
    oid *        alg_oid;
    int          oid_len;
    int          proper_length;
    int         iv_length;
    int         pad_size;
#ifdef NETSNMP_USE_OPENSSL
    const EVP_CIPHER *  cipher;
#endif
} netsnmp_priv_alg_info;

    /*
     * Prototypes.
     */
    NETSNMP_IMPORT
    int             sc_get_authtype(const oid * hashoid, u_int hashoid_len);
    NETSNMP_IMPORT
    int             sc_get_proper_auth_length_bytype(int auth_type);
    NETSNMP_IMPORT
    int             sc_get_auth_maclen(int auth_type);
    NETSNMP_IMPORT
    const char*     sc_get_auth_name(int auth_type);
    NETSNMP_IMPORT
    oid *           sc_get_auth_oid(int auth_type, size_t *oid_len);
    NETSNMP_IMPORT
    netsnmp_auth_alg_info * sc_get_auth_alg_byoid(const oid *oid, u_int len);
    NETSNMP_IMPORT
    netsnmp_auth_alg_info * sc_get_auth_alg_bytype(u_int type);
    NETSNMP_IMPORT
    netsnmp_auth_alg_info * sc_get_auth_alg_byindex(u_int index);

    /** deprectated, use
     *        sc_get_authtype() + sc_get_proper_auth_length_bytype() */
    NETSNMP_IMPORT
    int             sc_get_properlength(const oid * hashtype,
                                        u_int hashtype_len);

#ifdef NETSNMP_USE_OPENSSL
    NETSNMP_IMPORT
    const EVP_MD *sc_get_openssl_hashfn(int auth_type);
    NETSNMP_IMPORT
    const EVP_CIPHER *sc_get_openssl_privfn(int priv_type);
#endif

    NETSNMP_IMPORT
    int             sc_get_privtype(const oid * privtype, u_int privtype_len);
    NETSNMP_IMPORT
    oid *           sc_get_priv_oid(int type, size_t *oid_len);
    NETSNMP_IMPORT
    int             sc_get_proper_priv_length(const oid * privtype,
                                              u_int privtype_len);
    NETSNMP_IMPORT
    int             sc_get_proper_priv_length_bytype(int privtype);
    NETSNMP_IMPORT
    netsnmp_priv_alg_info * sc_get_priv_alg_byoid(const oid *oid, u_int len);
    NETSNMP_IMPORT
    netsnmp_priv_alg_info * sc_get_priv_alg_bytype(u_int type);
    NETSNMP_IMPORT
    netsnmp_priv_alg_info * sc_get_priv_alg_byindex(u_int index);

    NETSNMP_IMPORT
    int             sc_init(void);
    NETSNMP_IMPORT
    int             sc_shutdown(int majorID, int minorID, void *serverarg,
                                void *clientarg);

    NETSNMP_IMPORT
    int             sc_random(u_char * buf, size_t * buflen);

    NETSNMP_IMPORT
    int             sc_generate_keyed_hash(const oid * authtype,
                                           size_t authtypelen,
                                           const u_char * key, u_int keylen,
                                           const u_char * message, u_int msglen,
                                           u_char * MAC, size_t * maclen);

    NETSNMP_IMPORT
    int             sc_check_keyed_hash(const oid * authtype,
                                        size_t authtypelen, const u_char * key,
                                        u_int keylen, const u_char * message,
                                        u_int msglen, const u_char * MAC,
                                        u_int maclen);

    NETSNMP_IMPORT
    int             sc_encrypt(const oid * privtype, size_t privtypelen,
                               u_char * key, u_int keylen,
                               u_char * iv, u_int ivlen,
                               const u_char * plaintext, u_int ptlen,
                               u_char * ciphertext, size_t * ctlen);

    NETSNMP_IMPORT
    int             sc_decrypt(const oid * privtype, size_t privtypelen,
                               u_char * key, u_int keylen,
                               u_char * iv, u_int ivlen,
                               u_char * ciphertext, u_int ctlen,
                               u_char * plaintext, size_t * ptlen);

    NETSNMP_IMPORT
    int             sc_hash_type(int auth_type, const u_char * buf,
                                 size_t buf_len, u_char * MAC,
                                 size_t * MAC_len);

    NETSNMP_IMPORT
    int             sc_hash(const oid * hashtype, size_t hashtypelen,
                            const u_char * buf, size_t buf_len,
                            u_char * MAC, size_t * MAC_len);

    NETSNMP_IMPORT
    int             sc_get_transform_type(oid * hashtype,
                                          u_int hashtype_len,
                                          int (**hash_fn) (const int mode,
                                                           void **context,
                                                           const u_char *
                                                           data,
                                                           const int
                                                           data_len,
                                                           u_char **
                                                           digest,
                                                           size_t *
                                                           digest_len));


    /*
     * All functions devolve to the following block if we can't do cryptography
     */
#define	_SCAPI_NOT_CONFIGURED					\
{								\
        snmp_log(LOG_ERR, "Encryption support not enabled.\n"); \
        DEBUGMSGTL(("scapi", "SCAPI not configured"));		\
	return SNMPERR_SC_NOT_CONFIGURED;			\
}

    /*
     * define a transform type if we're using the internal md5 support 
     */
#ifdef NETSNMP_USE_INTERNAL_MD5
#define INTERNAL_MD5 1
#endif

#ifdef __cplusplus
}
#endif
#endif                          /* _SCAPI_H */
library/snmp_enum.h000064400000011240147511501070010361 0ustar00#ifndef SNMP_ENUM_H
#define SNMP_ENUM_H

/*
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */

#ifdef __cplusplus
extern          "C" {
#endif

    struct snmp_enum_list {
        struct snmp_enum_list *next;
        int             value;
        char           *label;
    };

#define SE_MAX_IDS 5
#define SE_MAX_SUBIDS 32        /* needs to be a multiple of 8 */

    /*
     * begin storage definitions 
     */
    /*
     * These definitions correspond with the "storid" argument to the API 
     */
#define SE_LIBRARY_ID     0
#define SE_MIB_ID         1
#define SE_APPLICATION_ID 2
#define SE_ASSIGNED_ID    3

    /*
     * library specific enum locations 
     */

    /*
     * error codes 
     */
#define SE_OK            0
#define SE_NOMEM         1
#define SE_ALREADY_THERE 2
#define SE_DNE           -2

    int             init_snmp_enum(const char *type);
    struct snmp_enum_list *se_find_list(unsigned int major,
                                        unsigned int minor);
    struct snmp_enum_list *se_find_slist(const char *listname);
    int             se_store_in_list(struct snmp_enum_list *,
                                     unsigned int major, unsigned int minor);
    int             se_find_value(unsigned int major, unsigned int minor,
                                  const char *label);
    int             se_find_free_value(unsigned int major, unsigned int minor);
    char           *se_find_label(unsigned int major, unsigned int minor,
                                  int value);
    /**
     * Add the pair (label, value) to the list (major, minor). Transfers
     * ownership of the memory pointed to by label to the list:
     * clear_snmp_enum() deallocates that memory.
     */
    int             se_add_pair(unsigned int major, unsigned int minor,
                                char *label, int value);

    /*
     * finds a list of enums in a list of enum structs associated by a name. 
     */
    /*
     * find a list, and then operate on that list
     *   ( direct methods further below if you already have the list pointer)
     */
    NETSNMP_IMPORT
    char           *se_find_label_in_slist(const char *listname,
                                           int value);
    NETSNMP_IMPORT
    int             se_find_value_in_slist(const char *listname,
                                           const char *label);
    NETSNMP_IMPORT
    int             se_find_casevalue_in_slist(const char *listname,
                                               const char *label);
    int             se_find_free_value_in_slist(const char *listname);
    /**
     * Add the pair (label, value) to the slist with name listname. Transfers
     * ownership of the memory pointed to by label to the list:
     * clear_snmp_enum() deallocates that memory.
     */
    NETSNMP_IMPORT
    int             se_add_pair_to_slist(const char *listname, char *label,
                                         int value);

    /*
     * operates directly on a possibly external list 
     */
    char           *se_find_label_in_list(struct snmp_enum_list *list,
                                          int value);
    int             se_find_value_in_list(struct snmp_enum_list *list,
                                          const char *label);
    int             se_find_casevalue_in_list(struct snmp_enum_list *list,
                                              const char *label);
    int             se_find_free_value_in_list(struct snmp_enum_list *list);
    int             se_add_pair_to_list(struct snmp_enum_list **list,
                                        char *label, int value);

    /*
     * Persistent enumeration lists
     */
    void            se_store_enum_list(struct snmp_enum_list *new_list,
                                       const char *token, const char *type);
    void            se_store_list(unsigned int major, unsigned int minor,
                                  const char *type);
    void            se_clear_slist(const char *listname);
    void            se_store_slist(const char *listname, const char *type);
    int             se_store_slist_callback(int majorID, int minorID,
                                           void *serverargs, void *clientargs);
    void            se_read_conf(const char *word, const char *cptr);
    /**
     * Deallocate the memory allocated by init_snmp_enum(): remove all key/value
     * pairs stored by se_add_*() calls.
     */
    NETSNMP_IMPORT
    void            clear_snmp_enum(void);

#ifdef __cplusplus
}
#endif
#endif                          /* SNMP_ENUM_H */
library/snmpTCPIPv6Domain.h000064400000001413147511501070011542 0ustar00#ifndef _SNMPTCPIPV6DOMAIN_H
#define _SNMPTCPIPV6DOMAIN_H

#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif

config_require(IPv6Base)
config_require(SocketBase)
config_require(TCPBase)

#include <net-snmp/library/snmpIPv6BaseDomain.h>

#ifdef __cplusplus
extern          "C" {
#endif

/*
 * The SNMP over TCP over IPv6 transport domain is identified by
 * transportDomainTcpIpv4 as defined in RFC 3419.
 */

#define TRANSPORT_DOMAIN_TCP_IPV6	1,3,6,1,2,1,100,1,6
NETSNMP_IMPORT oid      netsnmp_TCPIPv6Domain[];

netsnmp_transport *netsnmp_tcp6_transport(const struct sockaddr_in6 *addr,
					  int local);

/*
 * "Constructor" for transport domain object.  
 */

NETSNMP_IMPORT void     netsnmp_tcpipv6_ctor(void);

#ifdef __cplusplus
}
#endif
#endif/*_SNMPTCPIPV6DOMAIN_H*/
library/container_null.h000064400000000522147511501070011375 0ustar00#ifndef NETSNMP_CONTAINER_NULL_H
#define NETSNMP_CONTAINER_NULL_H


#include <net-snmp/library/container.h>

#ifdef  __cplusplus
extern "C" {
#endif

netsnmp_container *netsnmp_container_get_null(void);

    NETSNMP_IMPORT
    void netsnmp_container_null_init(void);


#ifdef  __cplusplus
}
#endif

#endif /** NETSNMP_CONTAINER_NULL_H */
library/mt_support.h000064400000003717147511501070010606 0ustar00/*
 * mt_support.h - multi-thread resource locking support declarations 
 */
/*
 * Author: Markku Laukkanen
 * Created: 6-Sep-1999
 * History:
 *  8-Sep-1999 M. Slifcak method names changed;
 *                        use array of resource locking structures.
 */

#ifndef MT_SUPPORT_H
#define MT_SUPPORT_H

#ifdef __cplusplus
extern          "C" {
#endif
  
/*
 * Lock group identifiers 
 */

#define MT_LIBRARY_ID      0
#define MT_APPLICATION_ID  1
#define MT_TOKEN_ID        2

#define MT_MAX_IDS         3    /* one greater than last from above */
#define MT_MAX_SUBIDS      10


/*
 * Lock resource identifiers for library resources 
 */

#define MT_LIB_NONE        0
#define MT_LIB_SESSION     1
#define MT_LIB_REQUESTID   2
#define MT_LIB_MESSAGEID   3
#define MT_LIB_SESSIONID   4
#define MT_LIB_TRANSID     5

#define MT_LIB_MAXIMUM     6    /* must be one greater than the last one */


#if defined(NETSNMP_REENTRANT) || defined(WIN32)

#if HAVE_PTHREAD_H
#include <pthread.h>
typedef pthread_mutex_t mutex_type;
#ifdef pthread_mutexattr_default
#define MT_MUTEX_INIT_DEFAULT pthread_mutexattr_default
#else
#define MT_MUTEX_INIT_DEFAULT 0
#endif

#elif defined(WIN32) || defined(cygwin)

#include <windows.h>
typedef CRITICAL_SECTION mutex_type;

#else  /*  HAVE_PTHREAD_H  */
error "There is no re-entrant support as defined."
#endif /*  HAVE_PTHREAD_H  */


NETSNMP_IMPORT
int             snmp_res_init(void);
NETSNMP_IMPORT
int             snmp_res_lock(int groupID, int resourceID);
NETSNMP_IMPORT
int             snmp_res_unlock(int groupID, int resourceID);
NETSNMP_IMPORT
int             snmp_res_destroy_mutex(int groupID, int resourceID);

#else /*  NETSNMP_REENTRANT  */

#ifndef WIN32
#define snmp_res_init() do {} while (0)
#define snmp_res_lock(x,y) do {} while (0)
#define snmp_res_unlock(x,y) do {} while (0)
#define snmp_res_destroy_mutex(x,y) do {} while (0)
#endif /*  WIN32  */

#endif /*  NETSNMP_REENTRANT  */

#ifdef __cplusplus
}
#endif
#endif /*  MT_SUPPORT_H  */
library/snmpUnixDomain.h000064400000003123147511501070011332 0ustar00#ifndef _SNMPUNIXDOMAIN_H
#define _SNMPUNIXDOMAIN_H

#ifdef NETSNMP_TRANSPORT_UNIX_DOMAIN

#if defined(cygwin) || defined(mingw32) || defined(mingw32msvc)
    config_error(Unix domain protocol support unavailable for this platform)
#endif

#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if HAVE_SYS_UN_H
#include <sys/un.h>
#endif

#include <net-snmp/library/snmp_transport.h>

config_require(SocketBase)

#ifdef __cplusplus
extern          "C" {
#endif

/*
 * The SNMP over local socket transport domain is identified by
 * transportDomainLocal as defined in RFC 3419.
 */

#define TRANSPORT_DOMAIN_LOCAL	1,3,6,1,2,1,100,1,13
NETSNMP_IMPORT oid netsnmp_UnixDomain[];

netsnmp_transport *netsnmp_unix_transport(const struct sockaddr_un *addr,
                                          int local);
void netsnmp_unix_agent_config_tokens_register(void);
void netsnmp_unix_parse_security(const char *token, char *param);
int netsnmp_unix_getSecName(void *opaque, int olength,
                            const char *community,
                            size_t community_len, const char **secName,
                            const char **contextName);


/*
 * "Constructor" for transport domain object.  
 */

void            netsnmp_unix_ctor(void);

/*
 * Support functions
 */
void            netsnmp_unix_create_path_with_mode(int mode);
void            netsnmp_unix_dont_create_path(void);

#ifdef __cplusplus
}
#endif
#else

#define netsnmp_unix_create_path_with_mode(x)
#define netsnmp_unix_dont_create_path()

#endif                          /*NETSNMP_TRANSPORT_UNIX_DOMAIN */

#endif/*_SNMPUNIXDOMAIN_H*/
library/snmpv3.h000064400000006045147511501070007615 0ustar00/*
 * snmpv3.h
 *
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */

#ifndef SNMPV3_H
#define SNMPV3_H

#ifdef __cplusplus
extern          "C" {
#endif

#define MAX_ENGINEID_LENGTH 32 /* per SNMP-FRAMEWORK-MIB SnmpEngineID TC */

#define ENGINEID_TYPE_IPV4    1
#define ENGINEID_TYPE_IPV6    2
#define ENGINEID_TYPE_MACADDR 3
#define ENGINEID_TYPE_TEXT    4
#define ENGINEID_TYPE_EXACT   5
#define ENGINEID_TYPE_NETSNMP_RND 128

#define	DEFAULT_NIC "eth0"

    NETSNMP_IMPORT int
    snmpv3_parse_args(char *optarg, netsnmp_session * session, char **Apsz,
                      char **Xpsz, int argc, char *const *argv, int flags);
    NETSNMP_IMPORT
    int             setup_engineID(u_char ** eidp, const char *text);
    NETSNMP_IMPORT
    int             set_exact_engineID(const u_char *id, size_t len);
    void            engineID_conf(const char *word, char *cptr);
    void            engineBoots_conf(const char *, char *);
    void            engineIDType_conf(const char *, char *);
    void            engineIDNic_conf(const char *, char *);
    NETSNMP_IMPORT
    void            init_snmpv3(const char *);
    int             init_snmpv3_post_config(int majorid, int minorid,
                                            void *serverarg,
                                            void *clientarg);
    int             init_snmpv3_post_premib_config(int majorid,
                                                   int minorid,
                                                   void *serverarg,
                                                   void *clientarg);
    void            shutdown_snmpv3(const char *type);
    int             snmpv3_store(int majorID, int minorID, void *serverarg,
                                 void *clientarg);
    NETSNMP_IMPORT
    u_long          snmpv3_local_snmpEngineBoots(void);
    int             snmpv3_clone_engineID(u_char **, size_t *, u_char *,
                                          size_t);
    NETSNMP_IMPORT
    size_t          snmpv3_get_engineID(u_char * buf, size_t buflen);
    NETSNMP_IMPORT
    u_char         *snmpv3_generate_engineID(size_t *);
    NETSNMP_IMPORT
    u_long          snmpv3_local_snmpEngineTime(void);
    int             get_default_secLevel(void);
    void            snmpv3_set_engineBootsAndTime(int boots, int ttime);
    int             free_engineID(int majorid, int minorid, void *serverarg,
				  void *clientarg);
    NETSNMP_IMPORT
    int             parse_secLevel_conf(const char* word, char *cptr);
    NETSNMP_IMPORT int
    snmpv3_parse_arg(int arg, char *optarg, netsnmp_session *session,
                     char **Apsz, char **Xpsz, int argc, char *const *argv,
                     int flags);
    NETSNMP_IMPORT int
    snmpv3_options(char *optarg, netsnmp_session * session, char **Apsz,
                   char **Xpsz, int argc, char *const *argv);

#ifdef __cplusplus
}
#endif
#endif                          /* SNMPV3_H */
library/container_iterator.h000064400000004634147511501070012264 0ustar00/**
 * @file container_iterator.h
 * @addtogroup container_iterator
 * @{
 */
#ifndef _CONTAINER_ITERATOR_HANDLER_H_
#define _CONTAINER_ITERATOR_HANDLER_H_

#include "container.h"

#ifdef __cplusplus
extern          "C" {
#endif

    typedef int (Netsnmp_Iterator_Loop_Key) (void *iterator_ctx,
                                             netsnmp_ref_void* loop_ctx,
                                             netsnmp_ref_void* key);
    typedef int (Netsnmp_Iterator_Loop_Data)(void *iterator_ctx,
                                             netsnmp_ref_void* loop_ctx,
                                             netsnmp_ref_void* data);
    typedef int (Netsnmp_Iterator_Ctx) (void *iterator_ctx,
                                         netsnmp_ref_void* loop_ctx);
    typedef int (Netsnmp_Iterator_Ctx_Dup) (void *iterator_ctx,
                                            netsnmp_ref_void* loop_ctx,
                                            netsnmp_ref_void* dup_ctx,
                                            int reuse);
    typedef int (Netsnmp_Iterator_Op) (void *iterator_ctx);
    typedef int (Netsnmp_Iterator_Data) (void *iterator_ctx,
                                            const void *data);    

    void netsnmp_container_iterator_init(void);

    netsnmp_container* netsnmp_container_iterator_get(
        void *iterator_user_ctx,
        netsnmp_container_compare * compare,
        Netsnmp_Iterator_Loop_Key * get_first,
        Netsnmp_Iterator_Loop_Key * get_next,
        Netsnmp_Iterator_Loop_Data * get_data,
        Netsnmp_Iterator_Ctx_Dup * save_pos, /* iff returning static data */
        Netsnmp_Iterator_Ctx * init_loop_ctx,
        Netsnmp_Iterator_Ctx * cleanup_loop_ctx,
        Netsnmp_Iterator_Data * free_user_ctx,
        int sorted);
    
    /*
     * set up optional callbacks/
     * NOTE: even though the first parameter is a generic netsnmp_container,
     *       this function should only be called for a container created
     *       by netsnmp_container_iterator_get.
     */
    void
    netsnmp_container_iterator_set_data_cb(netsnmp_container *c,
                                           Netsnmp_Iterator_Data * insert_data,
                                           Netsnmp_Iterator_Data * remove_data,
                                           Netsnmp_Iterator_Op * get_size);

#ifdef __cplusplus
}
#endif

#endif                          /* _CONTAINER_ITERATOR_HANDLER_H_ */
/** @} */
library/snmp_secmod.h000064400000013454147511501070010700 0ustar00#ifndef SNMPSECMOD_H
#define SNMPSECMOD_H

#ifdef __cplusplus
extern          "C" {
#endif

#include <net-snmp/library/snmp_transport.h>

/* Locally defined security models.
 * (Net-SNMP enterprise number = 8072)*256 + local_num
 */
#define NETSNMP_SEC_MODEL_KSM     2066432
#define NETSNMP_KSM_SECURITY_MODEL     NETSNMP_SEC_MODEL_KSM
#define NETSNMP_TSM_SECURITY_MODEL     SNMP_SEC_MODEL_TSM

struct snmp_secmod_def;

/*
 * parameter information passed to security model routines
 */
struct snmp_secmod_outgoing_params {
    int             msgProcModel;
    u_char         *globalData;
    size_t          globalDataLen;
    int             maxMsgSize;
    int             secModel;
    u_char         *secEngineID;
    size_t          secEngineIDLen;
    char           *secName;
    size_t          secNameLen;
    int             secLevel;
    u_char         *scopedPdu;
    size_t          scopedPduLen;
    void           *secStateRef;
    u_char         *secParams;
    size_t         *secParamsLen;
    u_char        **wholeMsg;
    size_t         *wholeMsgLen;
    size_t         *wholeMsgOffset;
    netsnmp_pdu    *pdu;        /* IN - the pdu getting encoded            */
    netsnmp_session *session;   /* IN - session sending the message        */
};

struct snmp_secmod_incoming_params {
    int             msgProcModel;       /* IN */
    size_t          maxMsgSize; /* IN     - Used to calc maxSizeResponse.  */

    u_char         *secParams;  /* IN     - BER encoded securityParameters. */
    int             secModel;   /* IN */
    int             secLevel;   /* IN     - AuthNoPriv; authPriv etc.      */

    u_char         *wholeMsg;   /* IN     - Original v3 message.           */
    size_t          wholeMsgLen;        /* IN     - Msg length.                    */

    u_char         *secEngineID;        /* OUT    - Pointer snmpEngineID.          */
    size_t         *secEngineIDLen;     /* IN/OUT - Len available; len returned.   */
    /*
     * NOTE: Memory provided by caller.      
     */

    char           *secName;    /* OUT    - Pointer to securityName.       */
    size_t         *secNameLen; /* IN/OUT - Len available; len returned.   */

    u_char        **scopedPdu;  /* OUT    - Pointer to plaintext scopedPdu. */
    size_t         *scopedPduLen;       /* IN/OUT - Len available; len returned.   */

    size_t         *maxSizeResponse;    /* OUT    - Max size of Response PDU.      */
    void          **secStateRef;        /* OUT    - Ref to security state.         */
    netsnmp_session *sess;      /* IN     - session which got the message  */
    netsnmp_pdu    *pdu;        /* IN     - the pdu getting parsed         */
    u_char          msg_flags;  /* IN     - v3 Message flags.              */
};


/*
 * function pointers:
 */

/*
 * free's a given security module's data; called at unregistration time 
 */
typedef int     (SecmodSessionCallback) (netsnmp_session *);
typedef int     (SecmodPduCallback) (netsnmp_pdu *);
typedef int     (Secmod2PduCallback) (netsnmp_pdu *, netsnmp_pdu *);
typedef int     (SecmodOutMsg) (struct snmp_secmod_outgoing_params *);
typedef int     (SecmodInMsg) (struct snmp_secmod_incoming_params *);
typedef void    (SecmodFreeState) (void *);
typedef void    (SecmodHandleReport) (void *sessp,
                                      netsnmp_transport *transport,
                                      netsnmp_session *,
                                      int result,
                                      netsnmp_pdu *origpdu);
typedef int     (SecmodDiscoveryMethod) (void *slp, netsnmp_session *session);
typedef int     (SecmodPostDiscovery) (void *slp, netsnmp_session *session);

typedef int     (SecmodSessionSetup) (netsnmp_session *in_session,
                                      netsnmp_session *out_session);
/*
 * definition of a security module
 */

/*
 * all of these callback functions except the encoding and decoding
 * routines are optional.  The rest of them are available if need.  
 */
struct snmp_secmod_def {
    /*
     * session maniplation functions 
     */
    SecmodSessionCallback *session_open;        /* called in snmp_sess_open()  */
    SecmodSessionCallback *session_close;       /* called in snmp_sess_close() */
    SecmodSessionSetup    *session_setup;

    /*
     * pdu manipulation routines 
     */
    SecmodPduCallback *pdu_free;        /* called in free_pdu() */
    Secmod2PduCallback *pdu_clone;      /* called in snmp_clone_pdu() */
    SecmodPduCallback *pdu_timeout;     /* called when request timesout */
    SecmodFreeState *pdu_free_state_ref;        /* frees pdu->securityStateRef */

    /*
     * de/encoding routines: mandatory 
     */
    SecmodOutMsg   *encode_reverse;     /* encode packet back to front */
    SecmodOutMsg   *encode_forward;     /* encode packet forward */
    SecmodInMsg    *decode;     /* decode & validate incoming */

   /*
    * error and report handling
    */
   SecmodHandleReport *handle_report;

   /*
    * default engineID discovery mechanism
    */
   SecmodDiscoveryMethod *probe_engineid;
   SecmodPostDiscovery   *post_probe_engineid;
};


/*
 * internal list
 */
struct snmp_secmod_list {
    int             securityModel;
    struct snmp_secmod_def *secDef;
    struct snmp_secmod_list *next;
};


/*
 * register a security service 
 */
int             register_sec_mod(int, const char *,
                                 struct snmp_secmod_def *);
/*
 * find a security service definition 
 */
NETSNMP_IMPORT
struct snmp_secmod_def *find_sec_mod(int);
/*
 * register a security service 
 */
int             unregister_sec_mod(int);        /* register a security service */
void            init_secmod(void);
NETSNMP_IMPORT
void            shutdown_secmod(void);

/*
 * clears the sec_mod list
 */
NETSNMP_IMPORT
void            clear_sec_mod(void);

#ifdef __cplusplus
}
#endif
#endif                          /* SNMPSECMOD_H */
library/snmpIPv6BaseDomain.h000064400000002107147511501070011767 0ustar00/* IPV6 base transport support functions
 */
#ifndef SNMPIPV6BASE_H
#define SNMPIPV6BASE_H

#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif

#include <net-snmp/library/snmp_transport.h>

#ifdef __cplusplus
extern          "C" {
#endif

/*
 * Prototypes
 */

    NETSNMP_IMPORT
    char *netsnmp_ipv6_fmtaddr(const char *prefix, netsnmp_transport *t,
                               const void *data, int len);
    NETSNMP_IMPORT
    void netsnmp_ipv6_get_taddr(struct netsnmp_transport_s *t, void **addr,
                                size_t *addr_len);
    NETSNMP_IMPORT
    int netsnmp_ipv6_ostring_to_sockaddr(struct sockaddr_in6 *sin6,
                                         const void *o, size_t o_len);
    NETSNMP_IMPORT
    int netsnmp_sockaddr_in6_2(struct sockaddr_in6 *addr,
                               const char *inpeername,
                               const char *default_target);
    int netsnmp_sockaddr_in6(struct sockaddr_in6 *addr,
                             const char *inpeername, int remote_port);

#ifdef __cplusplus
}
#endif
#endif /* SNMPIPV6BASE_H */

library/vacm.h000064400000022750147511501070007316 0ustar00/*
 * vacm.h
 *
 * SNMPv3 View-based Access Control Model
 *
 * Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 *
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */

#ifndef VACM_H
#define VACM_H

#ifdef __cplusplus
extern          "C" {
#endif

#define VACM_SUCCESS       0
#define VACM_NOSECNAME     1
#define VACM_NOGROUP       2
#define VACM_NOACCESS      3
#define VACM_NOVIEW        4
#define VACM_NOTINVIEW     5
#define VACM_NOSUCHCONTEXT 6
#define VACM_SUBTREE_UNKNOWN 7

#define SECURITYMODEL	1
#define SECURITYNAME	2
#define SECURITYGROUP	3
#define SECURITYSTORAGE	4
#define SECURITYSTATUS	5

#define ACCESSPREFIX	1
#define ACCESSMODEL	2
#define ACCESSLEVEL	3
#define ACCESSMATCH	4
#define ACCESSREAD	5
#define ACCESSWRITE	6
#define ACCESSNOTIFY	7
#define ACCESSSTORAGE	8
#define ACCESSSTATUS	9

#define VACMVIEWSPINLOCK 1
#define VIEWNAME	2
#define VIEWSUBTREE	3
#define VIEWMASK	4
#define VIEWTYPE	5
#define VIEWSTORAGE	6
#define VACMVIEWSTATUS	7

#define VACM_MAX_STRING 32
#define VACMSTRINGLEN   34      /* VACM_MAX_STRING + 2 */

    struct vacm_groupEntry {
        int             securityModel;
        char            securityName[VACMSTRINGLEN];
        char            groupName[VACMSTRINGLEN];
        int             storageType;
        int             status;

        u_long          bitMask;
        struct vacm_groupEntry *reserved;
        struct vacm_groupEntry *next;
    };

#define CONTEXT_MATCH_EXACT  1
#define CONTEXT_MATCH_PREFIX 2

/* VIEW ENUMS ---------------------------------------- */

/* SNMPD usage: get/set/send-notification views */
#define VACM_VIEW_READ     0
#define VACM_VIEW_WRITE    1
#define VACM_VIEW_NOTIFY   2

/* SNMPTRAPD usage: log execute and net-access (forward) usage */
#define VACM_VIEW_LOG      3
#define VACM_VIEW_EXECUTE  4
#define VACM_VIEW_NET      5

/* VIEW BIT MASK VALUES-------------------------------- */

/* SNMPD usage: get/set/send-notification views */
#define VACM_VIEW_READ_BIT      (1 << VACM_VIEW_READ)
#define VACM_VIEW_WRITE_BIT     (1 << VACM_VIEW_WRITE)
#define VACM_VIEW_NOTIFY_BIT    (1 << VACM_VIEW_NOTIFY)

/* SNMPTRAPD usage: log execute and net-access (forward) usage */
#define VACM_VIEW_LOG_BIT      (1 << VACM_VIEW_LOG)
#define VACM_VIEW_EXECUTE_BIT  (1 << VACM_VIEW_EXECUTE)
#define VACM_VIEW_NET_BIT      (1 << VACM_VIEW_NET)
    
#define VACM_VIEW_NO_BITS      0

/* Maximum number of views in the view array */
#define VACM_MAX_VIEWS     8

#define VACM_VIEW_ENUM_NAME "vacmviews"
    
    void init_vacm(void);
    
    struct vacm_accessEntry {
        char            groupName[VACMSTRINGLEN];
        char            contextPrefix[VACMSTRINGLEN];
        int             securityModel;
        int             securityLevel;
        int             contextMatch;
        char            views[VACM_MAX_VIEWS][VACMSTRINGLEN];
        int             storageType;
        int             status;

        u_long          bitMask;
        struct vacm_accessEntry *reserved;
        struct vacm_accessEntry *next;
    };

    struct vacm_viewEntry {
        char            viewName[VACMSTRINGLEN];
        oid             viewSubtree[MAX_OID_LEN+1]; /* keep len in [0] */
        size_t          viewSubtreeLen;
        u_char          viewMask[VACMSTRINGLEN];
        size_t          viewMaskLen;
        int             viewType;
        int             viewStorageType;
        int             viewStatus;

        u_long          bitMask;

        struct vacm_viewEntry *reserved;
        struct vacm_viewEntry *next;
    };

    NETSNMP_IMPORT
    void            vacm_destroyViewEntry(const char *, oid *, size_t);
    NETSNMP_IMPORT
    void            vacm_destroyAllViewEntries(void);

#define VACM_MODE_FIND                0
#define VACM_MODE_IGNORE_MASK         1
#define VACM_MODE_CHECK_SUBTREE       2
    NETSNMP_IMPORT
    struct vacm_viewEntry *vacm_getViewEntry(const char *, oid *, size_t,
                                             int);
    /*
     * Returns a pointer to the viewEntry with the
     * same viewName and viewSubtree
     * Returns NULL if that entry does not exist.
     */

    NETSNMP_IMPORT
    int vacm_checkSubtree(const char *, oid *, size_t);

    /*
     * Check to see if everything within a subtree is in view, not in view,
     * or possibly both.
     *
     * Returns:
     *   VACM_SUCCESS          The OID is included in the view.
     *   VACM_NOTINVIEW        If no entry in the view list includes the
     *                         provided OID, or the OID is explicitly excluded
     *                         from the view. 
     *   VACM_SUBTREE_UNKNOWN  The entire subtree has both allowed and
     *                         disallowed portions.
     */

    NETSNMP_IMPORT
    void
                    vacm_scanViewInit(void);
    /*
     * Initialized the scan routines so that they will begin at the
     * beginning of the list of viewEntries.
     *
     */


    NETSNMP_IMPORT
    struct vacm_viewEntry *vacm_scanViewNext(void);
    /*
     * Returns a pointer to the next viewEntry.
     * These entries are returned in no particular order,
     * but if N entries exist, N calls to view_scanNext() will
     * return all N entries once.
     * Returns NULL if all entries have been returned.
     * view_scanInit() starts the scan over.
     */

    NETSNMP_IMPORT
    struct vacm_viewEntry *vacm_createViewEntry(const char *, oid *,
                                                size_t);
    /*
     * Creates a viewEntry with the given index
     * and returns a pointer to it.
     * The status of this entry is created as invalid.
     */

    NETSNMP_IMPORT
    void            vacm_destroyGroupEntry(int, const char *);
    NETSNMP_IMPORT
    void            vacm_destroyAllGroupEntries(void);
    NETSNMP_IMPORT
    struct vacm_groupEntry *vacm_createGroupEntry(int, const char *);
    NETSNMP_IMPORT
    struct vacm_groupEntry *vacm_getGroupEntry(int, const char *);
    NETSNMP_IMPORT
    void            vacm_scanGroupInit(void);
    NETSNMP_IMPORT
    struct vacm_groupEntry *vacm_scanGroupNext(void);

    NETSNMP_IMPORT
    void            vacm_destroyAccessEntry(const char *, const char *,
                                            int, int);
    NETSNMP_IMPORT
    void            vacm_destroyAllAccessEntries(void);
    NETSNMP_IMPORT
    struct vacm_accessEntry *vacm_createAccessEntry(const char *,
                                                    const char *, int,
                                                    int);
    NETSNMP_IMPORT
    struct vacm_accessEntry *vacm_getAccessEntry(const char *,
                                                 const char *, int, int);
    NETSNMP_IMPORT
    void            vacm_scanAccessInit(void);
    NETSNMP_IMPORT
    struct vacm_accessEntry *vacm_scanAccessNext(void);

    void            vacm_destroySecurityEntry(const char *);
    struct vacm_securityEntry *vacm_createSecurityEntry(const char *);
    struct vacm_securityEntry *vacm_getSecurityEntry(const char *);
    void            vacm_scanSecurityInit(void);
    struct vacm_securityEntry *vacm_scanSecurityEntry(void);
    NETSNMP_IMPORT
    int             vacm_is_configured(void);

    void            vacm_save(const char *token, const char *type);
    void            vacm_save_view(struct vacm_viewEntry *view,
                                   const char *token, const char *type);
    void            vacm_save_access(struct vacm_accessEntry *access_entry,
                                     const char *token, const char *type);
    void            vacm_save_auth_access(struct vacm_accessEntry *access_entry,
                                     const char *token, const char *type, int authtype);
    void            vacm_save_group(struct vacm_groupEntry *group_entry,
                                    const char *token, const char *type);

    NETSNMP_IMPORT
    void            vacm_parse_config_view(const char *token, const char *line);
    NETSNMP_IMPORT
    void            vacm_parse_config_group(const char *token,
                                            const char *line);
    NETSNMP_IMPORT
    void            vacm_parse_config_access(const char *token,
                                             const char *line);
    NETSNMP_IMPORT
    void            vacm_parse_config_auth_access(const char *token,
                                                  const char *line);

    NETSNMP_IMPORT
    int             store_vacm(int majorID, int minorID, void *serverarg,
                               void *clientarg);

    NETSNMP_IMPORT
    struct vacm_viewEntry *netsnmp_view_get(struct vacm_viewEntry *head,
                                            const char *viewName,
                                            oid * viewSubtree,
                                            size_t viewSubtreeLen, int mode);

    NETSNMP_IMPORT
    int    netsnmp_vacm_simple_usm_add(const char *user, int rw, int authLevel,
                                       const char *view, oid *oidView,
                                       size_t oidViewLen, const char *context);

    NETSNMP_IMPORT
    int    netsnmp_vacm_simple_usm_del(const char *user, int authLevel,
                                       const char *view, oid *oidView,
                                       size_t oidViewLen, const char *context);

#ifdef __cplusplus
}
#endif
#endif                          /* VACM_H */
library/system.h000064400000016371147511501070007716 0ustar00#ifndef SNMP_SYSTEM_H
#define SNMP_SYSTEM_H

#ifndef NET_SNMP_CONFIG_H
#error "Please include <net-snmp/net-snmp-config.h> before this file"
#endif

#include <stdarg.h> /* va_list */

#ifdef __cplusplus
extern          "C" {
#endif

/* Portions of this file are subject to the following copyrights.  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 */
/***********************************************************
        Copyright 1993 by Carnegie Mellon University

                      All Rights Reserved

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of CMU not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.

CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
 * portions Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */


    /*
     * function to create a daemon. Will fork and call setsid().
     *
     * Returns: -1 : fork failed
     *           0 : No errors
     */
    NETSNMP_IMPORT
    int netsnmp_daemonize(int quit_immediately, int stderr_log);

    /*
     * Definitions for the system dependent library file
     *
     * Do not define 'struct direct' when MSVC_PERL is defined because a
     * structure with that name is also defined in the Perl header
     * lib\CORE\dirent.h. Do not declare gettimeofday() either.
     */
#ifndef MSVC_PERL

#ifndef HAVE_READDIR
    /*
     * structure of a directory entry 
     */
    typedef struct direct {
        long            d_ino;  /* inode number (not used by MS-DOS) */
        int             d_namlen;       /* Name length */
        char            d_name[257];    /* file name */
    } _DIRECT;

    /*
     * structure for dir operations 
     */
    typedef struct _dir_struc {
        char           *start;  /* Starting position */
        char           *curr;   /* Current position */
        long            size;   /* Size of string table */
        long            nfiles; /* number if filenames in table */
        struct direct   dirstr; /* Directory structure to return */
    } DIR;

    NETSNMP_IMPORT
    DIR            *opendir(const char *filename);
    NETSNMP_IMPORT
    struct direct  *readdir(DIR * dirp);
    NETSNMP_IMPORT
    int             closedir(DIR * dirp);
#endif /* HAVE_READDIR */

#ifndef HAVE_GETTIMEOFDAY
    NETSNMP_IMPORT
    int             gettimeofday(struct timeval *, struct timezone *tz);
#endif

#endif                         /* MSVC_PERL */

/*
 * Note: when compiling Net-SNMP with dmalloc enabled on a system without
 * strcasecmp() or strncasecmp(), the macro HAVE_STRNCASECMP is
 * not defined but strcasecmp() and strncasecmp() are defined as macros in
 * <dmalloc.h>. In order to prevent a compilation error, do not declare
 * strcasecmp() or strncasecmp() when the <dmalloc.h> header has been included.
 */
#if !defined(HAVE_STRNCASECMP) && !defined(strcasecmp)
    NETSNMP_IMPORT
    int             strcasecmp(const char *s1, const char *s2);
#endif
#if !defined(HAVE_STRNCASECMP) && !defined(strncasecmp)
    NETSNMP_IMPORT
    int             strncasecmp(const char *s1, const char *s2, size_t n);
#endif

#ifdef WIN32
    NETSNMP_IMPORT
    char           *winsock_startup(void);
    NETSNMP_IMPORT
    void            winsock_cleanup(void);
#define SOCK_STARTUP winsock_startup()
#define SOCK_CLEANUP winsock_cleanup()
#else                           /* !WIN32 */
#define SOCK_STARTUP
#define SOCK_CLEANUP
#endif                          /* WIN32 */

#include <net-snmp/types.h>     /* For definition of in_addr_t */

    /* Simply resolve a hostname and return first IPv4 address.
     * Returns -1 on error */
    NETSNMP_IMPORT
    int             netsnmp_gethostbyname_v4(const char* name,
                                             in_addr_t *addr_out);

    /** netsnmp versions of dns resoloution.. may include DNSSEC validation. */
    struct addrinfo; /* forward declare */
    NETSNMP_IMPORT
    struct hostent *netsnmp_gethostbyname(const char *name);

    NETSNMP_IMPORT
    struct hostent *netsnmp_gethostbyaddr(const void *addr, socklen_t len,
                                          int type);

    NETSNMP_IMPORT
    int             netsnmp_getaddrinfo(const char *name, const char *service,
                                        const struct addrinfo *hints,
                                        struct addrinfo **res);

    NETSNMP_IMPORT
    in_addr_t       get_myaddr(void);
    NETSNMP_IMPORT
    long            get_uptime(void);

#ifndef HAVE_STRDUP
    char           *strdup(const char *);
#endif
#ifndef HAVE_SETENV
    NETSNMP_IMPORT
    int             setenv(const char *, const char *, int);
#endif

    NETSNMP_IMPORT
    int             calculate_time_diff(const struct timeval *,
                                        const struct timeval *);
    NETSNMP_IMPORT
    u_int           calculate_sectime_diff(const struct timeval *now,
                                           const struct timeval *then);

#ifndef HAVE_STRCASESTR
    char           *strcasestr(const char *, const char *);
#endif
#ifndef HAVE_STRTOL
    long            strtol(const char *, char **, int);
#endif
#ifndef HAVE_STRTOUL
    unsigned long   strtoul(const char *, char **, int);
#endif
#ifndef HAVE_STRTOULL
    NETSNMP_IMPORT uint64_t strtoull(const char *, char **, int);
#endif
#ifndef HAVE_STRTOK_R
    NETSNMP_IMPORT
    char           *strtok_r(char *, const char *, char **);
#endif
#ifndef HAVE_SNPRINTF
    int             snprintf(char *, size_t, const char *, ...);
#endif
#ifndef HAVE_ASPRINTF
    NETSNMP_IMPORT
    int vasprintf(char **strp, const char *fmt, va_list ap);
    NETSNMP_IMPORT
    int asprintf(char **strp, const char *fmt, ...);
#endif

    NETSNMP_IMPORT
    int             mkdirhier(const char *pathname, mode_t mode,
                              int skiplast);
    NETSNMP_IMPORT
    const char     *netsnmp_mktemp(void);
#ifndef HAVE_STRLCPY
    NETSNMP_IMPORT
    size_t            strlcpy(char *, const char *, size_t);
#endif
#ifndef HAVE_STRLCAT
    NETSNMP_IMPORT
    size_t            strlcat(char *, const char *, size_t);
#endif

    int             netsnmp_os_prematch(const char *ospmname,
                                        const char *ospmrelprefix);
    int             netsnmp_os_kernel_width(void);

    NETSNMP_IMPORT
    int             netsnmp_str_to_uid(const char *useroruid);
    NETSNMP_IMPORT
    int             netsnmp_str_to_gid(const char *grouporgid);

#ifdef __cplusplus
}
#endif
#endif                          /* SNMP_SYSTEM_H */
library/oid_stash.h000064400000005774147511501070010354 0ustar00#ifndef OID_STASH_H
#define OID_STASH_H

/*
 * designed to store/retrieve information associated with a given oid.
 * Storage is done in an efficient tree manner for fast lookups.
 */

#define OID_STASH_CHILDREN_SIZE 31

#ifdef __cplusplus
extern          "C" {
#endif

    struct netsnmp_oid_stash_node_s;

    /* args: buffer, sizeof(buffer), yourdata, stashnode */
    typedef int     (NetSNMPStashDump) (char *, size_t,
                                        void *,
                                        struct netsnmp_oid_stash_node_s *);

    typedef void    (NetSNMPStashFreeNode) (void *);
    
    typedef struct netsnmp_oid_stash_node_s {
        oid             value;
        struct netsnmp_oid_stash_node_s **children;     /* array of children */
        size_t          children_size;
        struct netsnmp_oid_stash_node_s *next_sibling;  /* cache too small links */
        struct netsnmp_oid_stash_node_s *prev_sibling;
        struct netsnmp_oid_stash_node_s *parent; 

        void           *thedata;
    } netsnmp_oid_stash_node;

    typedef struct netsnmp_oid_stash_save_info_s {
       const char *token;
       netsnmp_oid_stash_node **root;
       NetSNMPStashDump *dumpfn;
    } netsnmp_oid_stash_save_info;

    NETSNMP_IMPORT
    int             netsnmp_oid_stash_add_data(netsnmp_oid_stash_node **root,
					       const oid * lookup,
                                               size_t lookup_len,
                                               void *mydata);
    SNMPCallback netsnmp_oid_stash_store_all;


    netsnmp_oid_stash_node
        *netsnmp_oid_stash_get_node(netsnmp_oid_stash_node *root,
                                    const oid * lookup, size_t lookup_len);
    NETSNMP_IMPORT
    void           *netsnmp_oid_stash_get_data(netsnmp_oid_stash_node *root,
					       const oid * lookup,
                                               size_t lookup_len);
    NETSNMP_IMPORT
    netsnmp_oid_stash_node *
    netsnmp_oid_stash_getnext_node(netsnmp_oid_stash_node *root,
                                   oid * lookup, size_t lookup_len);

    netsnmp_oid_stash_node *netsnmp_oid_stash_create_sized_node(size_t
                                                                mysize);
    netsnmp_oid_stash_node *netsnmp_oid_stash_create_node(void);        /* returns a malloced node */

    void netsnmp_oid_stash_store(netsnmp_oid_stash_node *root,
                                 const char *tokenname,
                                 NetSNMPStashDump *dumpfn,
                                 oid *curoid, size_t curoid_len);

    /* frees all data in the stash and cleans it out.  Sets root = NULL */
    NETSNMP_IMPORT
    void netsnmp_oid_stash_free(netsnmp_oid_stash_node **root,
                                NetSNMPStashFreeNode *freefn);
                                

    /* a noop function that can be passed to netsnmp_oid_stash_node to
       NOT free the data */
    NetSNMPStashFreeNode netsnmp_oid_stash_no_free;
#ifdef __cplusplus
}
#endif
#endif                          /* OID_STASH_H */
library/dir_utils.h000064400000004025147511501070010361 0ustar00/* Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 */
/*
 * Portions of this file are copyrighted by:
 * Copyright (C) 2007 Apple, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */
#ifndef NETSNMP_DIR_UTILS_H
#define NETSNMP_DIR_UTILS_H

#ifdef __cplusplus
extern "C" {
#endif

    /*
     * filter function; return 1 to include file, 0 to exclude
     */
#define NETSNMP_DIR_EXCLUDE 0
#define NETSNMP_DIR_INCLUDE 1
    typedef int (netsnmp_directory_filter)(const void *text, void *ctx);


    /*------------------------------------------------------------------
     *
     * Prototypes
     */
    netsnmp_container *
    netsnmp_directory_container_read_some(netsnmp_container *user_container,
                                          const char *dirname,
                                          netsnmp_directory_filter *filter,
                                          void *filter_ctx, u_int flags);

#define netsnmp_directory_container_read(c,d,f) \
    netsnmp_directory_container_read_some(c,d,NULL,NULL,f);

    void netsnmp_directory_container_free(netsnmp_container *c);

        

    /*------------------------------------------------------------------
     *
     * flags
     */
#define NETSNMP_DIR_RECURSE                           0x0001
#define NETSNMP_DIR_RELATIVE_PATH                     0x0002
#define NETSNMP_DIR_SORTED                            0x0004
/** don't return null if dir empty */
#define NETSNMP_DIR_EMPTY_OK                          0x0008
/** store netsnmp_file instead of filenames */
#define NETSNMP_DIR_NSFILE                            0x0010
/** load stats in netsnmp_file */
#define NETSNMP_DIR_NSFILE_STATS                      0x0020
/** allow files to be indexed more than once */
#define NETSNMP_DIR_ALLOW_DUPLICATES                  0x0040

    
        
#ifdef __cplusplus
}
#endif

#endif /* NETSNMP_DIR_UTILS_H */
library/parse.h000064400000021342147511501070007476 0ustar00#ifndef PARSE_H
#define PARSE_H

#ifdef __cplusplus
extern          "C" {
#endif

#include <net-snmp/mib_api.h>

    /*
     * parse.h
     */
/***********************************************************
        Copyright 1989 by Carnegie Mellon University

                      All Rights Reserved

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of CMU not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.

CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/

#define NETSNMP_MAXLABEL 64      /* maximum characters in a label */
#define MAXTOKEN        128     /* maximum characters in a token */
#define MAXQUOTESTR     4096    /* maximum characters in a quoted string */

/*
 * MAXLABEL appears to be unused in code, and conflicts with
 * <arpa/nameser.h>. Only define it if requested. This will
 * cause problems if local DNSSEC validation is also enabled.
 */
#ifdef UCD_COMPATIBLE
#define MAXLABEL        NETSNMP_MAXLABEL
#endif

    struct variable_list;

    /*
     * A linked list of tag-value pairs for enumerated integers.
     */
    struct enum_list {
        struct enum_list *next;
        int             value;
        char           *label;
    };

    /*
     * A linked list of ranges
     */
    struct range_list {
        struct range_list *next;
        int             low, high;
    };

    /*
     * A linked list of indexes
     */
    struct index_list {
        struct index_list *next;
        char           *ilabel;
        char            isimplied;
    };

    /*
     * A linked list of varbinds
     */
    struct varbind_list {
        struct varbind_list *next;
        char           *vblabel;
    };

    /*
     * A tree in the format of the tree structure of the MIB.
     */
    struct tree {
        struct tree    *child_list;     /* list of children of this node */
        struct tree    *next_peer;      /* Next node in list of peers */
        struct tree    *next;   /* Next node in hashed list of names */
        struct tree    *parent;
        char           *label;  /* This node's textual name */
        u_long          subid;  /* This node's integer subidentifier */
        int             modid;  /* The module containing this node */
        int             number_modules;
        int            *module_list;    /* To handle multiple modules */
        int             tc_index;       /* index into tclist (-1 if NA) */
        int             type;   /* This node's object type */
        int             access; /* This nodes access */
        int             status; /* This nodes status */
        struct enum_list *enums;        /* (optional) list of enumerated integers */
        struct range_list *ranges;
        struct index_list *indexes;
        char           *augments;
        struct varbind_list *varbinds;
        char           *hint;
        char           *units;
        int             (*printomat) (u_char **, size_t *, size_t *, int,
                                      const netsnmp_variable_list *,
                                      const struct enum_list *, const char *,
                                      const char *);
        void            (*printer) (char *, const netsnmp_variable_list *, const struct enum_list *, const char *, const char *);   /* Value printing function */
        char           *description;    /* description (a quoted string) */
        char           *reference;    /* references (a quoted string) */
        int             reported;       /* 1=report started in print_subtree... */
        char           *defaultValue;
       char	       *parseErrorString; /* Contains the error string if there are errors in parsing MIBs */
    };

    /*
     * Information held about each MIB module
     */
    struct module_import {
        char           *label;  /* The descriptor being imported */
        int             modid;  /* The module imported from */
    };

    struct module {
        char           *name;   /* This module's name */
        char           *file;   /* The file containing the module */
        struct module_import *imports;  /* List of descriptors being imported */
        int             no_imports;     /* The number of such import descriptors */
        /*
         * -1 implies the module hasn't been read in yet 
         */
        int             modid;  /* The index number of this module */
        struct module  *next;   /* Linked list pointer */
    };

    struct module_compatability {
        const char     *old_module;
        const char     *new_module;
        const char     *tag;    /* NULL implies unconditional replacement,
                                 * otherwise node identifier or prefix */
        size_t          tag_len;        /* 0 implies exact match (or unconditional) */
        struct module_compatability *next;      /* linked list */
    };


    /*
     * non-aggregate types for tree end nodes 
     */
#define TYPE_OTHER          0
#define TYPE_OBJID          1
#define TYPE_OCTETSTR       2
#define TYPE_INTEGER        3
#define TYPE_NETADDR        4
#define TYPE_IPADDR         5
#define TYPE_COUNTER        6
#define TYPE_GAUGE          7
#define TYPE_TIMETICKS      8
#define TYPE_OPAQUE         9
#define TYPE_NULL           10
#define TYPE_COUNTER64      11
#define TYPE_BITSTRING      12
#define TYPE_NSAPADDRESS    13
#define TYPE_UINTEGER       14
#define TYPE_UNSIGNED32     15
#define TYPE_INTEGER32      16

#define TYPE_SIMPLE_LAST    16

#define TYPE_TRAPTYPE	    20
#define TYPE_NOTIFTYPE      21
#define TYPE_OBJGROUP	    22
#define TYPE_NOTIFGROUP	    23
#define TYPE_MODID	    24
#define TYPE_AGENTCAP       25
#define TYPE_MODCOMP        26
#define TYPE_OBJIDENTITY    27

#define MIB_ACCESS_READONLY    18
#define MIB_ACCESS_READWRITE   19
#define	MIB_ACCESS_WRITEONLY   20
#define MIB_ACCESS_NOACCESS    21
#define MIB_ACCESS_NOTIFY      67
#define MIB_ACCESS_CREATE      48

#define MIB_STATUS_MANDATORY   23
#define MIB_STATUS_OPTIONAL    24
#define MIB_STATUS_OBSOLETE    25
#define MIB_STATUS_DEPRECATED  39
#define MIB_STATUS_CURRENT     57

#define	ANON	"anonymous#"
#define	ANON_LEN  strlen(ANON)

    int             netsnmp_unload_module(const char *name);
#ifndef NETSNMP_NO_LEGACY_DEFINITIONS
    int             unload_module(const char *name);
#endif
    void            netsnmp_init_mib_internals(void);
    void            unload_all_mibs(void);
    int             add_mibfile(const char*, const char*, FILE *);
    int             which_module(const char *);
    NETSNMP_IMPORT
    char           *module_name(int, char *);
    NETSNMP_IMPORT
    void            print_subtree(FILE *, struct tree *, int);
    NETSNMP_IMPORT
    void            print_ascii_dump_tree(FILE *, struct tree *, int);
    NETSNMP_IMPORT
    struct tree    *find_tree_node(const char *, int);
    NETSNMP_IMPORT
    const char     *get_tc_descriptor(int);
    NETSNMP_IMPORT
    const char     *get_tc_description(int);
    NETSNMP_IMPORT
    struct tree    *find_best_tree_node(const char *, struct tree *,
                                        u_int *);
    /*
     * backwards compatability 
     */
    NETSNMP_IMPORT
    struct tree    *find_node(const char *, struct tree *);
    struct tree    *find_node2(const char *, const char *); 
    NETSNMP_IMPORT
    struct module  *find_module(int);
    void            adopt_orphans(void);
    NETSNMP_IMPORT
    char           *snmp_mib_toggle_options(char *options);
    NETSNMP_IMPORT
    void            snmp_mib_toggle_options_usage(const char *lead,
                                                  FILE * outf);
    NETSNMP_IMPORT
    void            print_mib(FILE *);
    NETSNMP_IMPORT
    void            print_mib_tree(FILE *, struct tree *, int);
    int             get_mib_parse_error_count(void);
    NETSNMP_IMPORT
    int             snmp_get_token(FILE * fp, char *token, int maxtlen);
    NETSNMP_IMPORT
    struct tree    *find_best_tree_node(const char *name,
                                        struct tree *tree_top,
                                        u_int * match);

#ifdef __cplusplus
}
#endif
#endif                          /* PARSE_H */
library/container_binary_array.h000064400000002007147511501070013105 0ustar00/*
 * binary_array.h
 * $Id$
 */

#ifndef BINARY_ARRAY_H
#define BINARY_ARRAY_H

#ifdef __cplusplus
extern          "C" {
#endif

#include <net-snmp/library/asn1.h>
#include <net-snmp/library/container.h>
#include <net-snmp/library/factory.h>

    /*
     * initialize binary array container. call at startup.
     */
    void netsnmp_container_binary_array_init(void);

    /*
     * get an container which uses an binary_array for storage
     */
    netsnmp_container *   netsnmp_container_get_binary_array(void);

    /*
     * get a factory for producing binary_array objects
     */
    netsnmp_factory *     netsnmp_container_get_binary_array_factory(void);


    int netsnmp_binary_array_remove(netsnmp_container *c, const void *key,
                                    void **save);

    void netsnmp_binary_array_release(netsnmp_container *c);

    void netsnmp_container_binary_array_init(void);

    int netsnmp_binary_array_options_set(netsnmp_container *c, int set, u_int flags);


#ifdef __cplusplus
}
#endif
#endif
library/ucd_compat.h000064400000002266147511501070010506 0ustar00/*
 *  UCD compatability definitions & declarations
 *
 */

#ifndef NET_SNMP_UCD_COMPAT_H
#define NET_SNMP_UCD_COMPAT_H

#ifdef __cplusplus
extern          "C" {
#endif

        /*
         * from snmp_api.h 
         */
NETSNMP_IMPORT
void            snmp_set_dump_packet(int);
NETSNMP_IMPORT
int             snmp_get_dump_packet(void);
NETSNMP_IMPORT
void            snmp_set_quick_print(int);
NETSNMP_IMPORT
int             snmp_get_quick_print(void);
NETSNMP_IMPORT
void            snmp_set_suffix_only(int);
NETSNMP_IMPORT
int             snmp_get_suffix_only(void);
NETSNMP_IMPORT
void            snmp_set_full_objid(int);
int             snmp_get_full_objid(void);
NETSNMP_IMPORT
void            snmp_set_random_access(int);
NETSNMP_IMPORT
int             snmp_get_random_access(void);

        /*
         * from parse.h 
         */
NETSNMP_IMPORT
void            snmp_set_mib_warnings(int);
NETSNMP_IMPORT
void            snmp_set_mib_errors(int);
NETSNMP_IMPORT
void            snmp_set_save_descriptions(int);
void            snmp_set_mib_comment_term(int);
void            snmp_set_mib_parse_label(int);

#ifdef __cplusplus
}
#endif
#endif                          /* NET_SNMP_UCD_COMPAT_H */
library/snmp_service.h000064400000001455147511501070011064 0ustar00#ifndef _SNMP_SERVICE_H
#define _SNMP_SERVICE_H

#ifdef __cplusplus
extern "C" {
#endif

/* Default port handling */

NETSNMP_IMPORT int
netsnmp_register_default_domain(const char* application, const char* domain);

extern const char*
netsnmp_lookup_default_domain(const char* application);

extern const char* const *
netsnmp_lookup_default_domains(const char* application);

extern void
netsnmp_clear_default_domain(void);

NETSNMP_IMPORT int
netsnmp_register_default_target(const char* application, const char* domain,
				const char* target);

extern const char*
netsnmp_lookup_default_target(const char* application, const char* domain);

extern void
netsnmp_clear_default_target(void);

NETSNMP_IMPORT void
netsnmp_register_service_handlers(void);

#ifdef __cplusplus
}
#endif

#endif /* _SNMP_SERVICE_H */
library/getopt.h000064400000000706147511501070007667 0ustar00#ifndef _GETOPT_H_
#define _GETOPT_H_ 1

#ifndef NET_SNMP_CONFIG_H
#error <net-snmp/net-snmp-config.h> must be included before <net-snmp/library/getopt.h>.
#endif

#if !defined(HAVE_GETOPT_H)

#ifdef __cplusplus
extern          "C" {
#endif

NETSNMP_IMPORT int   getopt(int, char *const *, const char *);
NETSNMP_IMPORT char *optarg;
NETSNMP_IMPORT int   optind, opterr, optopt, optreset;

#ifdef __cplusplus
}
#endif

#endif /* HAVE_GETOPT_H */

#endif
library/snmp_client.h000064400000013270147511501070010700 0ustar00/*
 * snmp_client.h
 */
/***********************************************************
	Copyright 1988, 1989 by Carnegie Mellon University

                      All Rights Reserved

Permission to use, copy, modify, and distribute this software and its 
documentation for any purpose and without fee is hereby granted, 
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in 
supporting documentation, and that the name of CMU not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.  

CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/

#ifndef SNMP_CLIENT_H
#define SNMP_CLIENT_H

#include <net-snmp/types.h>
#include <net-snmp/varbind_api.h>
#include <net-snmp/pdu_api.h>
#include <net-snmp/output_api.h>
#include <net-snmp/session_api.h>

#ifdef __cplusplus
extern          "C" {
#endif


    struct snmp_pdu;
    struct snmp_session;
    struct variable_list;

    struct synch_state {
        int             waiting;
        int             status;
        /*
         * status codes 
         */
#define STAT_SUCCESS	0
#define STAT_ERROR	1
#define STAT_TIMEOUT 2
        int             reqid;
        netsnmp_pdu    *pdu;
    };

    NETSNMP_IMPORT
    void            snmp_replace_var_types(netsnmp_variable_list * vbl,
                                           u_char old_type,
                                           u_char new_type);
    NETSNMP_IMPORT
    void            snmp_reset_var_buffers(netsnmp_variable_list * var);
    void            snmp_reset_var_types(netsnmp_variable_list * vbl,
                                         u_char new_type);
    NETSNMP_IMPORT
    int             count_varbinds(netsnmp_variable_list * var_ptr);
    NETSNMP_IMPORT
    int             count_varbinds_of_type(netsnmp_variable_list * var_ptr,
                                           u_char type);
    netsnmp_variable_list *find_varbind_of_type(netsnmp_variable_list *
                                                var_ptr, u_char type);
    NETSNMP_IMPORT
    netsnmp_variable_list *find_varbind_in_list(netsnmp_variable_list *vblist,
                                                const oid *name, size_t len);

    netsnmp_pdu    *snmp_split_pdu(netsnmp_pdu *, int skipCount,
                                   int copyCount);

    unsigned long   snmp_varbind_len(netsnmp_pdu *pdu);
    NETSNMP_IMPORT
    int             snmp_clone_var(netsnmp_variable_list *,
                                   netsnmp_variable_list *);
    NETSNMP_IMPORT
    int             snmp_synch_response_cb(netsnmp_session *,
                                           netsnmp_pdu *, netsnmp_pdu **,
                                           snmp_callback);
    NETSNMP_IMPORT
    int             snmp_clone_mem(void **, const void *, unsigned);


NETSNMP_IMPORT
void              netsnmp_query_set_default_session(netsnmp_session *);
NETSNMP_IMPORT
netsnmp_session * netsnmp_query_get_default_session_unchecked( void );
NETSNMP_IMPORT
netsnmp_session * netsnmp_query_get_default_session( void );
NETSNMP_IMPORT
int netsnmp_query_get(     netsnmp_variable_list *, netsnmp_session *);
NETSNMP_IMPORT
int netsnmp_query_getnext( netsnmp_variable_list *, netsnmp_session *);
NETSNMP_IMPORT
int netsnmp_query_walk(    netsnmp_variable_list *, netsnmp_session *);
#ifndef NETSNMP_NO_WRITE_SUPPORT
NETSNMP_IMPORT
int netsnmp_query_set(     netsnmp_variable_list *, netsnmp_session *);
#endif /* !NETSNMP_NO_WRITE_SUPPORT */

/** **************************************************************************
 *
 * state machine
 *
 */
    /** forward declare */
    struct netsnmp_state_machine_step_s;
    struct netsnmp_state_machine_input_s;

    /** state machine process */
    typedef int (netsnmp_state_machine_func)(struct netsnmp_state_machine_input_s *input,
                                             struct netsnmp_state_machine_step_s *step);

    typedef struct netsnmp_state_machine_step_s {

        const char   *name; /* primarily for logging/debugging */
        u_int         sm_flags;
        
        netsnmp_state_machine_func *run;
        int                         result; /* return code for this step */
        
        
        struct netsnmp_state_machine_step_s *on_success;
        struct netsnmp_state_machine_step_s *on_error;
        
        /*
         * user fields (not touched by state machine functions)
         */
        u_int         flags;
        void         *step_context;
        
    } netsnmp_state_machine_step;

    typedef struct netsnmp_state_machine_input_s {
        const char                  *name;
        int                          steps_so_far;
        netsnmp_state_machine_step  *steps;
        netsnmp_state_machine_step  *cleanup;
        netsnmp_state_machine_step  *last_run;

        /*
         * user fields (not touched by state machine functions)
         */
        void         *input_context;

    } netsnmp_state_machine_input;


    NETSNMP_IMPORT int
    netsnmp_state_machine_run( netsnmp_state_machine_input *input );

    NETSNMP_IMPORT int
    netsnmp_row_create(netsnmp_session *sess, netsnmp_variable_list *vars,
                       int row_status_index);


#ifdef __cplusplus
}
#endif
#endif                          /* SNMP_CLIENT_H */
library/snmpUDPIPv4BaseDomain.h000064400000004330147511501070012336 0ustar00/* UDPIPV4 base transport support functions
 *
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */
#ifndef SNMPUDPIPV4BASE_H
#define SNMPUDPIPV4BASE_H

#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif

config_require(UDPBase)
config_require(IPv4Base)

#include <net-snmp/library/snmpIPv4BaseDomain.h>
#include <net-snmp/library/snmpUDPBaseDomain.h>

#ifdef __cplusplus
extern          "C" {
#endif

/*
 * Prototypes
 */

    netsnmp_transport *netsnmp_udpipv4base_transport(const struct sockaddr_in *addr,
                                                     int local);

    netsnmp_transport *
    netsnmp_udpipv4base_transport_with_source(const struct sockaddr_in *addr,
                                              int local,
                                              const struct sockaddr_in *src_addr);

    netsnmp_transport *
    netsnmp_udpipv4base_tspec_transport(netsnmp_tdomain_spec *tspec);

    /** internal functions for derivatives of udpipv4base */
    netsnmp_transport *
    netsnmp_udpipv4base_transport_init(const struct sockaddr_in *addr,
                                       int local);

    int
    netsnmp_udpipv4base_transport_socket(int flags);

    int
    netsnmp_udpipv4base_transport_bind(netsnmp_transport *t,
                                       const struct sockaddr_in *addr,
                                       int flags);

    void
    netsnmp_udpipv4base_transport_get_bound_addr(netsnmp_transport *t);

#if defined(HAVE_IP_PKTINFO) || defined(HAVE_IP_RECVDSTADDR)
    int netsnmp_udpipv4_recvfrom(int s, void *buf, int len,
                                 struct sockaddr *from, socklen_t *fromlen,
                                 struct sockaddr *dstip, socklen_t *dstlen,
                                 int *if_index);
    int netsnmp_udpipv4_sendto(int fd, const struct in_addr *srcip,
                               int if_index, const struct sockaddr *remote,
                               const void *data, int len);
#endif


#ifdef __cplusplus
}
#endif
#endif /* SNMPUDPIPV4BASE_H */
library/snmp_transport.h000064400000030703147511501070011456 0ustar00#ifndef _SNMP_TRANSPORT_H
#define _SNMP_TRANSPORT_H

/*
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */
#include <sys/types.h>

#if HAVE_SYS_SOCKET_H
#ifdef solaris2
#define _XPG4_2
#endif

#if defined(aix4) || defined(aix5) || defined(aix6) || defined(aix7)
#define _LINUX_SOURCE_COMPAT
#endif

#include <sys/socket.h>

#ifdef solaris2
# ifndef CMSG_SPACE
#  define CMSG_SPACE(l) \
            ((unsigned int)_CMSG_HDR_ALIGN(sizeof (struct cmsghdr) + (l)))
#  define CMSG_LEN(l)   (_CMSG_HDR_ALIGN(sizeof(struct cmsghdr)) + (l))
# endif
#endif
#endif /* HAVE_SYS_SOCKET_H */

#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif

#include <net-snmp/library/asn1.h>

#ifdef __cplusplus
extern          "C" {
#endif

/*  Some transport-type constants.  */

#ifndef NETSNMP_STREAM_QUEUE_LEN
#define	NETSNMP_STREAM_QUEUE_LEN	5
#endif

/*  Some transport-type flags.  */

#define		NETSNMP_TRANSPORT_FLAG_STREAM	 0x01
#define		NETSNMP_TRANSPORT_FLAG_LISTEN	 0x02
#define		NETSNMP_TRANSPORT_FLAG_TUNNELED	 0x04
#define         NETSNMP_TRANSPORT_FLAG_TMSTATE   0x08  /* indicates opaque is a
                                                          TSM tmStateReference */
#define		NETSNMP_TRANSPORT_FLAG_EMPTY_PKT 0x10
#define		NETSNMP_TRANSPORT_FLAG_OPENED	 0x20  /* f_open called */
#define		NETSNMP_TRANSPORT_FLAG_SHARED	 0x40
#define		NETSNMP_TRANSPORT_FLAG_HOSTNAME	 0x80  /* for fmtaddr hook */

/*  The standard SNMP domains.  */

NETSNMP_IMPORT oid      netsnmpUDPDomain[]; 	/*      = { 1, 3, 6, 1, 6, 1, 1 };  */
NETSNMP_IMPORT oid      netsnmpCLNSDomain[];    /*      = { 1, 3, 6, 1, 6, 1, 2 };  */
NETSNMP_IMPORT oid      netsnmpCONSDomain[];    /*      = { 1, 3, 6, 1, 6, 1, 3 };  */
NETSNMP_IMPORT oid      netsnmpDDPDomain[]; 	/*      = { 1, 3, 6, 1, 6, 1, 4 };  */
NETSNMP_IMPORT oid      netsnmpIPXDomain[]; 	/*      = { 1, 3, 6, 1, 6, 1, 5 };  */
NETSNMP_IMPORT size_t   netsnmpUDPDomain_len;
NETSNMP_IMPORT size_t   netsnmpCLNSDomain_len;
NETSNMP_IMPORT size_t   netsnmpCONSDomain_len;
NETSNMP_IMPORT size_t   netsnmpDDPDomain_len;
NETSNMP_IMPORT size_t   netsnmpIPXDomain_len;

/* Structure which stores transport security model specific parameters */
/* isms-secshell-11 section 4.1 */

/* contents documented in draft-ietf-isms-transport-security-model
   Section 3.2 */
/* note: VACM only allows <= 32 so this is overkill till another ACM comes */
#define NETSNMP_TM_MAX_SECNAME 256

typedef union netsnmp_sockaddr_storage_u {
    struct sockaddr     sa;
    struct sockaddr_in  sin;
#ifdef NETSNMP_ENABLE_IPV6
    struct sockaddr_in6 sin6;
#endif
} netsnmp_sockaddr_storage;

typedef struct netsnmp_addr_pair_s {
   netsnmp_sockaddr_storage remote_addr;
   netsnmp_sockaddr_storage local_addr;
} netsnmp_addr_pair;

typedef struct netsnmp_indexed_addr_pair_s {
   netsnmp_sockaddr_storage remote_addr;
   netsnmp_sockaddr_storage local_addr;
    int if_index;
} netsnmp_indexed_addr_pair;

typedef struct netsnmp_tmStateReference_s {
   oid    transportDomain[MAX_OID_LEN];
   size_t transportDomainLen;
   char   securityName[NETSNMP_TM_MAX_SECNAME];
   size_t securityNameLen;
   int    requestedSecurityLevel;
   int    transportSecurityLevel;
   char   sameSecurity;
   char   sessionID[8];
   
   char   have_addresses;
   netsnmp_indexed_addr_pair addresses;

   void *otherTransportOpaque; /* XXX: May have mem leak issues */
} netsnmp_tmStateReference;

#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
#define NETSNMP_TSPEC_SHARED                    0x02
#define NETSNMP_TSPEC_NO_DFTL_CLIENT_ADDR       0x04

struct netsnmp_container_s; /* forward decl */
typedef struct netsnmp_tdomain_spec_s {
    const char *application;             /* application name */
    const char *target;                  /* target as string */
    u_int       flags;
    const char *default_domain;          /* default domain */
    const char *default_target;          /* default target */
    const char *source;                  /* source as string iff remote */
    struct netsnmp_container_s *transport_config; /* extra config */
} netsnmp_tdomain_spec;

/*  Structure which defines the transport-independent API.  */

struct snmp_session;

typedef struct netsnmp_transport_s {
    /*  The transport domain object identifier.  */

    const oid      *domain;
    int             domain_length;  /*  In sub-IDs, not octets.  */

    /*  Local transport address (in relevant SNMP-style encoding).  */
    
    void           *local;
    int             local_length;   /*  In octets.  */

    /*  Remote transport address (in relevant SNMP-style encoding).  */

    void           *remote;
    int             remote_length;  /*  In octets.  */

    /*  The actual socket.  */
    
    int             sock;

    /*  Flags (see #definitions above).  */

    unsigned int    flags;

    /*  Protocol-specific opaque data pointer.  */

    void           *data;
    int             data_length;

    /*  Maximum size of PDU that can be sent/received by this transport.  */

    size_t          msgMaxSize;

#ifdef FOR_STANDARDS_COMPLIANCE_OR_FUTURE_USE
    /* TM state reference per ISMS WG solution */
    netsnmp_tmStateReference *tmStateRef;
#endif

    /* tunneled transports */
    struct netsnmp_transport_s * base_transport;

    /*  Callbacks.  Arguments are:
     *		
     *              "this" pointer, fd, buf, size, *opaque, *opaque_length  
     */

    int             (*f_recv)   (struct netsnmp_transport_s *, void *,
				 int, void **, int *);
    int             (*f_send)   (struct netsnmp_transport_s *, const void *,
				 int, void **, int *);
    int             (*f_close)  (struct netsnmp_transport_s *);

    /* Optional: opening can occur during creation if more appropriate */
   struct netsnmp_transport_s * (*f_open)   (struct netsnmp_transport_s *);

    /*  This callback is only necessary for stream-oriented transports.  */

    int             (*f_accept) (struct netsnmp_transport_s *);

    /*  Optional callback to format a transport address.  */

    char           *(*f_fmtaddr)(struct netsnmp_transport_s *, const void *,
                                 int);

    /*  Optional callback to support extra configuration token/value pairs */
    /*  return non-zero on error */
    int            (*f_config)(struct netsnmp_transport_s *, const char *,
                               const char *);

    /*  Optional callback that is called after the first transport is
        cloned to the second */
    int            (*f_copy)(const struct netsnmp_transport_s *,
                             struct netsnmp_transport_s *);

    /*  Setup initial session config if special things are needed */
   int             (*f_setup_session)(struct netsnmp_transport_s *,
                                      struct snmp_session *);
  
    /* allocated host name identifier; used by configuration system
       to load localhost.conf for host-specific configuration */
    u_char         *identifier; /* udp:localhost:161 -> "localhost" */

    /* Duplicate the remote address in the format required by SNMP-TARGET-MIB */
    void           (*f_get_taddr)(struct netsnmp_transport_s *t,
                                  void **addr, size_t *addr_len);

} netsnmp_transport;

typedef struct netsnmp_transport_list_s {
    netsnmp_transport *transport;
    struct netsnmp_transport_list_s *next;
} netsnmp_transport_list;

typedef struct netsnmp_tdomain_s {
    const oid      *name;
    size_t          name_length;
    const char    **prefix;

    /*
     * The f_create_from_tstring and f_create_from_tstring_new fields are
     * deprecated, please do not use them for new code and try to migrate
     * old code away from using them.
     */
    netsnmp_transport *(*f_create_from_tstring) (const char *, int);

    /* @o and @o_len define an address in the format used by SNMP-TARGET-MIB */
    netsnmp_transport *(*f_create_from_ostring) (const void *o, size_t o_len,
                                                 int local);

    struct netsnmp_tdomain_s *next;

    /** deprecated, please do not use it */
    netsnmp_transport *(*f_create_from_tstring_new) (const char *, int,
						     const char*);
    netsnmp_transport *(*f_create_from_tspec) (netsnmp_tdomain_spec *);

} netsnmp_tdomain;

void init_snmp_transport(void);
void shutdown_snmp_transport(void);

/*  Some utility functions.  */

char *netsnmp_transport_peer_string(netsnmp_transport *t, const void *data,
                                    int len);

int netsnmp_transport_send(netsnmp_transport *t, const void *data, int len,
                           void **opaque, int *olength);
int netsnmp_transport_recv(netsnmp_transport *t, void *data, int len,
                           void **opaque, int *olength);

int netsnmp_transport_add_to_list(netsnmp_transport_list **transport_list,
				  netsnmp_transport *transport);
int netsnmp_transport_remove_from_list(netsnmp_transport_list **transport_list,
				       netsnmp_transport *transport);
int netsnmp_sockaddr_size(const struct sockaddr *sa);


/*
 * Return an exact (deep) copy of t, or NULL if there is a memory allocation
 * problem (for instance).
 */

netsnmp_transport *netsnmp_transport_copy(const netsnmp_transport *t);


/*  Free an netsnmp_transport.  */

NETSNMP_IMPORT
void            netsnmp_transport_free(netsnmp_transport *t);

#ifndef FEATURE_REMOVE_TRANSPORT_CACHE

/**  transport cache support */

NETSNMP_IMPORT
netsnmp_transport *netsnmp_transport_cache_get(int af, int type, int local,
                                               const netsnmp_sockaddr_storage *bind_addr);

NETSNMP_IMPORT
int                netsnmp_transport_cache_save(int af, int type, int local,
                                                const netsnmp_sockaddr_storage *addr,
                                                netsnmp_transport *t);

NETSNMP_IMPORT
int                netsnmp_transport_cache_remove(netsnmp_transport *t);

#endif /* FEATURE_REMOVE_TRANSPORT_CACHE */

/*
 * If the passed oid (in_oid, in_len) corresponds to a supported transport
 * domain, return 1; if not return 0.  If out_oid is not NULL and out_len is
 * not NULL, then the "internal" oid which should be used to identify this
 * domain (e.g. in pdu->tDomain etc.) is written to *out_oid and its length to
 * *out_len.
 */

NETSNMP_IMPORT
int             netsnmp_tdomain_support(const oid *in_oid, size_t in_len,
					const oid **out_oid, size_t *out_len);

int             netsnmp_tdomain_register(netsnmp_tdomain *domain);
    
int             netsnmp_tdomain_unregister(netsnmp_tdomain *domain);

NETSNMP_IMPORT
void            netsnmp_clear_tdomain_list(void);

void            netsnmp_tdomain_init(void);

NETSNMP_IMPORT
netsnmp_transport *netsnmp_tdomain_transport(const char *str,
					     int local,
					     const char *default_domain);

NETSNMP_IMPORT
netsnmp_transport *netsnmp_tdomain_transport_full(const char *application,
						  const char *str,
						  int local,
						  const char *default_domain,
						  const char *default_target);

NETSNMP_IMPORT
netsnmp_transport *netsnmp_tdomain_transport_oid(const oid * dom,
						 size_t dom_len,
						 const u_char * o,
						 size_t o_len,
						 int local);

NETSNMP_IMPORT
netsnmp_transport *netsnmp_tdomain_transport_tspec(netsnmp_tdomain_spec *tspec);

NETSNMP_IMPORT
netsnmp_transport*
netsnmp_transport_open_client(const char* application, const char* str);

NETSNMP_IMPORT
netsnmp_transport*
netsnmp_transport_open_server(const char* application, const char* str);

netsnmp_transport*
netsnmp_transport_open(const char* application, const char* str, int local);

typedef struct netsnmp_transport_config_s {
   char *key;
   char *value;
} netsnmp_transport_config;
    
NETSNMP_IMPORT    
int netsnmp_transport_config_compare(netsnmp_transport_config *left,
                                     netsnmp_transport_config *right);
NETSNMP_IMPORT
netsnmp_transport_config *netsnmp_transport_create_config(char *key,
                                                          char *value);

#ifndef NETSNMP_FEATURE_REMOVE_FILTER_SOURCE
NETSNMP_IMPORT
void netsnmp_transport_parse_filterType(const char *word, char *cptr);

NETSNMP_IMPORT
int netsnmp_transport_filter_add(const char *addrtxt);

NETSNMP_IMPORT
int netsnmp_transport_filter_remove(const char *addrtxt);

NETSNMP_IMPORT
int netsnmp_transport_filter_check(const char *addrtxt);

NETSNMP_IMPORT
void netsnmp_transport_filter_cleanup(void);

#endif /* NETSNMP_FEATURE_REMOVE_FILTER_SOURCE */

#ifdef __cplusplus
}
#endif
#endif/*_SNMP_TRANSPORT_H*/
library/types.h000064400000003623147511501070007532 0ustar00#ifndef NET_SNMP_LIBRARY_TYPES_H
#define NET_SNMP_LIBRARY_TYPES_H

#ifndef NET_SNMP_CONFIG_H
#error "Please include <net-snmp/net-snmp-config.h> before this file"
#endif


#include <net-snmp/types.h>


typedef struct netsnmp_index_s {
    size_t          len;
    oid            *oids;
} netsnmp_index;

typedef struct netsnmp_void_array_s {
    size_t          size;
    void          **array;
} netsnmp_void_array;

/*
 * references to various types
 */
typedef struct netsnmp_ref_void {
    void           *val;
} netsnmp_ref_void;

typedef union {
    u_long          ul;
    u_int           ui;
    u_short         us;
    u_char          uc;
    long            sl;
    int             si;
    short           ss;
    char            sc;
    char           *cp;
    void           *vp;
} netsnmp_cvalue;

typedef struct netsnmp_ref_size_t_s {
    size_t          val;
}              *netsnmp_ref_size_t;

/*
 * Structure for holding a set of file descriptors, similar to fd_set.
 *
 * This structure however can hold so-called large file descriptors
 * (>= FD_SETSIZE or 1024) on Unix systems or more than FD_SETSIZE (64)
 * sockets on Windows systems.
 *
 * It is safe to allocate this structure on the stack.
 *
 * This structure must be initialized by calling netsnmp_large_fd_set_init()
 * and must be cleaned up via netsnmp_large_fd_set_cleanup(). If this last
 * function is not called this may result in a memory leak.
 *
 * The members of this structure are:
 * lfs_setsize: maximum set size.
 * lsf_setptr:  points to lfs_set if lfs_setsize <= FD_SETSIZE, and otherwise
 *              to dynamically allocated memory.
 * lfs_set:     file descriptor / socket set data if lfs_setsize <= FD_SETSIZE.
 */
typedef struct netsnmp_large_fd_set_s {
    unsigned        lfs_setsize;
    fd_set         *lfs_setptr;
    fd_set          lfs_set;
} netsnmp_large_fd_set;
#endif                          /* NET_SNMP_LIBRARY_TYPES_H */
library/snmpSocketBaseDomain.h000064400000000765147511501070012443 0ustar00#ifndef SNMPSOCKETBASEDOMAIN_H
#define SNMPSOCKETBASEDOMAIN_H

#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif

#include <net-snmp/library/snmp_transport.h>

#ifdef __cplusplus
extern          "C" {
#endif

/*
 * Prototypes
 */
    int netsnmp_socketbase_close(netsnmp_transport *t);
    int netsnmp_sock_buffer_set(int s, int optname, int local, int size);
    int netsnmp_set_non_blocking_mode(int sock, int non_blocking_mode);

#ifdef __cplusplus
}
#endif

#endif /* SNMPSOCKETBASEDOMAIN_H */
library/snmpCallbackDomain.h000064400000005472147511501070012114 0ustar00#ifndef _SNMPCALLBACKDOMAIN_H
#define _SNMPCALLBACKDOMAIN_H

#ifndef NET_SNMP_CONFIG_H
#error "Please include <netsnmp/net-snmp-config.h> before this file"
#endif

#ifdef __cplusplus
extern          "C" {
#endif

#ifdef NETSNMP_TRANSPORT_CALLBACK_DOMAIN

#include <net-snmp/types.h>
#include <net-snmp/library/snmp_transport.h>

typedef struct netsnmp_callback_pass_s {
    int             return_transport_num;
    netsnmp_pdu    *pdu;
    struct netsnmp_callback_pass_s *next;
} netsnmp_callback_pass;

typedef struct netsnmp_callback_info_s {
    int             linkedto;
    void           *parent_data;
    netsnmp_callback_pass *data;
    int             callback_num;
    int             pipefds[2];
} netsnmp_callback_info;

netsnmp_transport *netsnmp_callback_transport(int);
int             netsnmp_callback_hook_parse(netsnmp_session * sp,
                                            netsnmp_pdu *pdu,
                                            u_char * packetptr,
                                            size_t len);
int             netsnmp_callback_hook_build(netsnmp_session * sp,
                                            netsnmp_pdu *pdu,
                                            u_char * ptk, size_t * len);
int             netsnmp_callback_check_packet(u_char * pkt, size_t len);
netsnmp_pdu    *netsnmp_callback_create_pdu(netsnmp_transport *transport,
                                            void *opaque, size_t olength);
NETSNMP_IMPORT
netsnmp_session *netsnmp_callback_open(int attach_to,
                                       int (*return_func) (int op,
                                                           netsnmp_session
                                                           * session,
                                                           int reqid,
                                                           netsnmp_pdu
                                                           *pdu,
                                                           void *magic),
                                       int (*fpre_parse) (netsnmp_session
                                                          *,
                                                          struct
                                                          netsnmp_transport_s
                                                          *, void *, int),
                                       int (*fpost_parse) (netsnmp_session
                                                           *,
                                                           netsnmp_pdu *,
                                                           int));
NETSNMP_IMPORT
void             netsnmp_clear_callback_list(void);

#else

#define netsnmp_clear_callback_list()

     
#endif /*NETSNMP_TRANSPORT_CALLBACK_DOMAIN*/

#ifdef __cplusplus
}
#endif
#endif/*_SNMPCALLBACKDOMAIN_H*/
library/md5.h000064400000005222147511501070007050 0ustar00/*
 * ** **************************************************************************
 * ** md5.h -- Header file for implementation of MD5 Message Digest Algorithm **
 * ** Updated: 2/13/90 by Ronald L. Rivest                                    **
 * ** (C) 1990 RSA Data Security, Inc.                                        **
 * ** **************************************************************************
 */

#ifndef MD5_H
#define MD5_H

#ifdef __cplusplus
extern          "C" {
#endif


    /*
     * MDstruct is the data structure for a message digest computation.
     */
    typedef struct {
        unsigned int    buffer[4];      /* Holds 4-word result of MD computation */
        unsigned char   count[8];       /* Number of bits processed so far */
        unsigned int    done;   /* Nonzero means MD computation finished */
    } MDstruct     , *MDptr;

    /*
     * MDbegin(MD)
     * ** Input: MD -- an MDptr
     * ** Initialize the MDstruct prepatory to doing a message digest computation.
     */
    NETSNMP_IMPORT void MDbegin(MDptr);

    /*
     * MDupdate(MD,X,count)
     * ** Input: MD -- an MDptr
     * **        X -- a pointer to an array of unsigned characters.
     * **        count -- the number of bits of X to use (an unsigned int).
     * ** Updates MD using the first ``count'' bits of X.
     * ** The array pointed to by X is not modified.
     * ** If count is not a multiple of 8, MDupdate uses high bits of last byte.
     * ** This is the basic input routine for a user.
     * ** The routine terminates the MD computation when count < 512, so
     * ** every MD computation should end with one call to MDupdate with a
     * ** count less than 512.  Zero is OK for a count.
     */
    NETSNMP_IMPORT int MDupdate(MDptr, const unsigned char *, unsigned int);

    /*
     * MDprint(MD)
     * ** Input: MD -- an MDptr
     * ** Prints message digest buffer MD as 32 hexadecimal digits.
     * ** Order is from low-order byte of buffer[0] to high-order byte of buffer[3].
     * ** Each byte is printed with high-order hexadecimal digit first.
     */
    extern void     MDprint(MDptr);

    int             MDchecksum(const u_char * data, size_t len, u_char * mac,
                               size_t maclen);
    int             MDsign(const u_char * data, size_t len, u_char * mac,
                           size_t maclen, const u_char * secret,
                           size_t secretlen);
    void            MDget(MDstruct * MD, u_char * buf, size_t buflen);

    /*
     * ** End of md5.h
     * ****************************(cut)****************************************
     */
#ifdef __cplusplus
}
#endif
#endif                          /* MD5_H */
library/asn1.h000064400000045426147511501070007237 0ustar00#ifndef ASN1_H
#define ASN1_H

#include <net-snmp/library/oid.h>

#ifdef __cplusplus
extern          "C" {
#endif

#define PARSE_PACKET	0
#define DUMP_PACKET	1

    /*
     * Definitions for Abstract Syntax Notation One, ASN.1
     * As defined in ISO/IS 8824 and ISO/IS 8825
     *
     *
     */
/***********************************************************
	Copyright 1988, 1989 by Carnegie Mellon University

                      All Rights Reserved

Permission to use, copy, modify, and distribute this software and its 
documentation for any purpose and without fee is hereby granted, 
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in 
supporting documentation, and that the name of CMU not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.  

CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 */

#define MIN_OID_LEN	    2
#define MAX_OID_LEN	    128 /* max subid's in an oid */
#ifndef MAX_NAME_LEN            /* conflicts with some libraries */
#define MAX_NAME_LEN	    MAX_OID_LEN /* obsolete. use MAX_OID_LEN */
#endif

#define OID_LENGTH(x)  (sizeof(x)/sizeof(oid))


#define ASN_BOOLEAN	    ((u_char)0x01)
#define ASN_INTEGER	    ((u_char)0x02)
#define ASN_BIT_STR	    ((u_char)0x03)
#define ASN_OCTET_STR	    ((u_char)0x04)
#define ASN_NULL	    ((u_char)0x05)
#define ASN_OBJECT_ID	    ((u_char)0x06)
#define ASN_SEQUENCE	    ((u_char)0x10)
#define ASN_SET		    ((u_char)0x11)

#define ASN_UNIVERSAL	    ((u_char)0x00)
#define ASN_APPLICATION     ((u_char)0x40)
#define ASN_CONTEXT	    ((u_char)0x80)
#define ASN_PRIVATE	    ((u_char)0xC0)

#define ASN_PRIMITIVE	    ((u_char)0x00)
#define ASN_CONSTRUCTOR	    ((u_char)0x20)

#define ASN_LONG_LEN	    (0x80)
#define ASN_EXTENSION_ID    (0x1F)
#define ASN_BIT8	    (0x80)

#define IS_CONSTRUCTOR(byte)	((byte) & ASN_CONSTRUCTOR)
#define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)

    struct counter64 {
        u_long          high;
        u_long          low;
    };

#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
    typedef struct counter64 integer64;
    typedef struct counter64 unsigned64;

    /*
     * The BER inside an OPAQUE is an context specific with a value of 48 (0x30)
     * plus the "normal" tag. For a Counter64, the tag is 0x46 (i.e., an
     * applications specific tag with value 6). So the value for a 64 bit
     * counter is 0x46 + 0x30, or 0x76 (118 base 10). However, values
     * greater than 30 can not be encoded in one octet. So the first octet
     * has the class, in this case context specific (ASN_CONTEXT), and
     * the special value (i.e., 31) to indicate that the real value follows
     * in one or more octets. The high order bit of each following octet
     * indicates if the value is encoded in additional octets. A high order
     * bit of zero, indicates the last. For this "hack", only one octet
     * will be used for the value. 
     */

    /*
     * first octet of the tag 
     */
#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
    /*
     * base value for the second octet of the tag - the
     * second octet was the value for the tag 
     */
#define ASN_OPAQUE_TAG2 ((u_char)0x30)

#define ASN_OPAQUE_TAG2U ((u_char)0x2f) /* second octet of tag for union */

    /*
     * All the ASN.1 types for SNMP "should have been" defined in this file,
     * but they were not. (They are defined in snmp_impl.h)  Thus, the tag for
     * Opaque and Counter64 is defined, again, here with a different names. 
     */
#define ASN_APP_OPAQUE (ASN_APPLICATION | 4)
#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
#define ASN_APP_I64 (ASN_APPLICATION | 10)
#define ASN_APP_U64 (ASN_APPLICATION | 11)
#define ASN_APP_UNION (ASN_PRIVATE | 1) /* or ASN_PRIV_UNION ? */

    /*
     * value for Counter64 
     */
#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
    /*
     * max size of BER encoding of Counter64 
     */
#define ASN_OPAQUE_COUNTER64_MX_BER_LEN 12

    /*
     * value for Float 
     */
#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
    /*
     * size of BER encoding of Float 
     */
#define ASN_OPAQUE_FLOAT_BER_LEN 7

    /*
     * value for Double 
     */
#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
    /*
     * size of BER encoding of Double 
     */
#define ASN_OPAQUE_DOUBLE_BER_LEN 11

    /*
     * value for Integer64 
     */
#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
    /*
     * max size of BER encoding of Integer64 
     */
#define ASN_OPAQUE_I64_MX_BER_LEN 11

    /*
     * value for Unsigned64 
     */
#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
    /*
     * max size of BER encoding of Unsigned64 
     */
#define ASN_OPAQUE_U64_MX_BER_LEN 12

#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */


#define ASN_PRIV_INCL_RANGE (ASN_PRIVATE | 2)
#define ASN_PRIV_EXCL_RANGE (ASN_PRIVATE | 3)
#define ASN_PRIV_DELEGATED  (ASN_PRIVATE | 5)
#define ASN_PRIV_IMPLIED_OCTET_STR  (ASN_PRIVATE | ASN_OCTET_STR)       /* 4 */
#define ASN_PRIV_IMPLIED_OBJECT_ID  (ASN_PRIVATE | ASN_OBJECT_ID)       /* 6 */
#define ASN_PRIV_RETRY      (ASN_PRIVATE | 7)   /* 199 */
#define ASN_PRIV_STOP       (ASN_PRIVATE | 8)   /* 200 */
#define IS_DELEGATED(x)   ((x) == ASN_PRIV_DELEGATED)


    NETSNMP_IMPORT
    int             asn_check_packet(u_char *, size_t);
    NETSNMP_IMPORT
    u_char         *asn_parse_int(u_char *, size_t *, u_char *, long *,
                                  size_t);
    NETSNMP_IMPORT
    u_char         *asn_build_int(u_char *, size_t *, u_char, const long *,
                                  size_t);
    NETSNMP_IMPORT
    u_char         *asn_parse_unsigned_int(u_char *, size_t *, u_char *,
                                           u_long *, size_t);
    NETSNMP_IMPORT
    u_char         *asn_build_unsigned_int(u_char *, size_t *, u_char,
                                           const u_long *, size_t);
    NETSNMP_IMPORT
    u_char         *asn_parse_string(u_char *, size_t *, u_char *,
                                     u_char *, size_t *);
    NETSNMP_IMPORT
    u_char         *asn_build_string(u_char *, size_t *, u_char,
                                     const u_char *, size_t);
    NETSNMP_IMPORT
    u_char         *asn_parse_header(u_char *, size_t *, u_char *);
    NETSNMP_IMPORT
    u_char         *asn_parse_sequence(u_char *, size_t *, u_char *, u_char expected_type,      /* must be this type */
                                       const char *estr);       /* error message prefix */
    NETSNMP_IMPORT
    u_char         *asn_build_header(u_char *, size_t *, u_char, size_t);
    NETSNMP_IMPORT
    u_char         *asn_build_sequence(u_char *, size_t *, u_char, size_t);
    NETSNMP_IMPORT
    u_char         *asn_parse_length(u_char *, u_long *);
    NETSNMP_IMPORT
    u_char         *asn_build_length(u_char *, size_t *, size_t);
    NETSNMP_IMPORT
    u_char         *asn_parse_objid(u_char *, size_t *, u_char *, oid *,
                                    size_t *);
    NETSNMP_IMPORT
    u_char         *asn_build_objid(u_char *, size_t *, u_char, oid *,
                                    size_t);
    NETSNMP_IMPORT
    u_char         *asn_parse_null(u_char *, size_t *, u_char *);
    NETSNMP_IMPORT
    u_char         *asn_build_null(u_char *, size_t *, u_char);
    NETSNMP_IMPORT
    u_char         *asn_parse_bitstring(u_char *, size_t *, u_char *,
                                        u_char *, size_t *);
    NETSNMP_IMPORT
    u_char         *asn_build_bitstring(u_char *, size_t *, u_char,
                                        const u_char *, size_t);
    NETSNMP_IMPORT
    u_char         *asn_parse_unsigned_int64(u_char *, size_t *, u_char *,
                                             struct counter64 *, size_t);
    NETSNMP_IMPORT
    u_char         *asn_build_unsigned_int64(u_char *, size_t *, u_char,
                                             const struct counter64 *, size_t);
    NETSNMP_IMPORT
    u_char         *asn_parse_signed_int64(u_char *, size_t *, u_char *,
                                           struct counter64 *, size_t);
    NETSNMP_IMPORT
    u_char         *asn_build_signed_int64(u_char *, size_t *, u_char,
                                           const struct counter64 *, size_t);
    NETSNMP_IMPORT
    u_char         *asn_build_float(u_char *, size_t *, u_char, const float *,
                                    size_t);
    NETSNMP_IMPORT
    u_char         *asn_parse_float(u_char *, size_t *, u_char *, float *,
                                    size_t);
    NETSNMP_IMPORT
    u_char         *asn_build_double(u_char *, size_t *, u_char, const double *,
                                     size_t);
    NETSNMP_IMPORT
    u_char         *asn_parse_double(u_char *, size_t *, u_char *,
                                     double *, size_t);

#ifdef NETSNMP_USE_REVERSE_ASNENCODING

    /*
     * Re-allocator function for below.  
     */

    NETSNMP_IMPORT
    int             asn_realloc(u_char **, size_t *);

    /*
     * Re-allocating reverse ASN.1 encoder functions.  Synopsis:
     * 
     * u_char *buf = (u_char*)malloc(100);
     * u_char type = (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER);
     * size_t buf_len = 100, offset = 0;
     * long data = 12345;
     * int allow_realloc = 1;
     * 
     * if (asn_realloc_rbuild_int(&buf, &buf_len, &offset, allow_realloc,
     * type, &data, sizeof(long)) == 0) {
     * error;
     * }
     * 
     * NOTE WELL: after calling one of these functions with allow_realloc
     * non-zero, buf might have moved, buf_len might have grown and
     * offset will have increased by the size of the encoded data.
     * You should **NEVER** do something like this:
     * 
     * u_char *buf = (u_char *)malloc(100), *ptr;
     * u_char type = (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER);
     * size_t buf_len = 100, offset = 0;
     * long data1 = 1234, data2 = 5678;
     * int rc = 0, allow_realloc = 1;
     * 
     * rc  = asn_realloc_rbuild_int(&buf, &buf_len, &offset, allow_realloc,
     * type, &data1, sizeof(long));
     * ptr = buf[buf_len - offset];   / * points at encoding of data1 * /
     * if (rc == 0) {
     * error;
     * }
     * rc  = asn_realloc_rbuild_int(&buf, &buf_len, &offset, allow_realloc,
     * type, &data2, sizeof(long));
     * make use of ptr here;
     * 
     * 
     * ptr is **INVALID** at this point.  In general, you should store the
     * offset value and compute pointers when you need them:
     * 
     * 
     * 
     * u_char *buf = (u_char *)malloc(100), *ptr;
     * u_char type = (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER);
     * size_t buf_len = 100, offset = 0, ptr_offset;
     * long data1 = 1234, data2 = 5678;
     * int rc = 0, allow_realloc = 1;
     * 
     * rc  = asn_realloc_rbuild_int(&buf, &buf_len, &offset, allow_realloc,
     * type, &data1, sizeof(long));
     * ptr_offset = offset;
     * if (rc == 0) {
     * error;
     * }
     * rc  = asn_realloc_rbuild_int(&buf, &buf_len, &offset, allow_realloc,
     * type, &data2, sizeof(long));
     * ptr = buf + buf_len - ptr_offset
     * make use of ptr here;
     * 
     * 
     * 
     * Here, you can see that ptr will be a valid pointer even if the block of
     * memory has been moved, as it may well have been.  Plenty of examples of
     * usage all over asn1.c, snmp_api.c, snmpusm.c.
     * 
     * The other thing you should **NEVER** do is to pass a pointer to a buffer
     * on the stack as the first argument when allow_realloc is non-zero, unless
     * you really know what you are doing and your machine/compiler allows you to
     * free non-heap memory.  There are rumours that such things exist, but many
     * consider them no more than the wild tales of a fool.
     * 
     * Of course, you can pass allow_realloc as zero, to indicate that you do not
     * wish the packet buffer to be reallocated for some reason; perhaps because
     * it is on the stack.  This may be useful to emulate the functionality of
     * the old API:
     * 
     * u_char my_static_buffer[100], *cp = NULL;
     * size_t my_static_buffer_len = 100;
     * float my_pi = (float)22/(float)7;
     * 
     * cp = asn_rbuild_float(my_static_buffer, &my_static_buffer_len,
     * ASN_OPAQUE_FLOAT, &my_pi, sizeof(float));
     * if (cp == NULL) {
     * error;
     * }
     * 
     * 
     * IS EQUIVALENT TO:
     * 
     * 
     * u_char my_static_buffer[100];
     * size_t my_static_buffer_len = 100, my_offset = 0;
     * float my_pi = (float)22/(float)7;
     * int rc = 0;
     * 
     * rc = asn_realloc_rbuild_float(&my_static_buffer, &my_static_buffer_len,
     * &my_offset, 0,
     * ASN_OPAQUE_FLOAT, &my_pi, sizeof(float));
     * if (rc == 0) {
     * error;
     * }
     * 
     * 
     */


    NETSNMP_IMPORT
    int             asn_realloc_rbuild_int(u_char ** pkt, size_t * pkt_len,
                                           size_t * offset,
                                           int allow_realloc, u_char type,
                                           const long *data, size_t data_size);

    NETSNMP_IMPORT
    int             asn_realloc_rbuild_string(u_char ** pkt,
                                              size_t * pkt_len,
                                              size_t * offset,
                                              int allow_realloc,
                                              u_char type,
                                              const u_char * data,
                                              size_t data_size);

    NETSNMP_IMPORT
    int             asn_realloc_rbuild_unsigned_int(u_char ** pkt,
                                                    size_t * pkt_len,
                                                    size_t * offset,
                                                    int allow_realloc,
                                                    u_char type,
                                                    const u_long * data,
                                                    size_t data_size);

    NETSNMP_IMPORT
    int             asn_realloc_rbuild_header(u_char ** pkt,
                                              size_t * pkt_len,
                                              size_t * offset,
                                              int allow_realloc,
                                              u_char type,
                                              size_t data_size);

    NETSNMP_IMPORT
    int             asn_realloc_rbuild_sequence(u_char ** pkt,
                                                size_t * pkt_len,
                                                size_t * offset,
                                                int allow_realloc,
                                                u_char type,
                                                size_t data_size);

    NETSNMP_IMPORT
    int             asn_realloc_rbuild_length(u_char ** pkt,
                                              size_t * pkt_len,
                                              size_t * offset,
                                              int allow_realloc,
                                              size_t data_size);

    NETSNMP_IMPORT
    int             asn_realloc_rbuild_objid(u_char ** pkt,
                                             size_t * pkt_len,
                                             size_t * offset,
                                             int allow_realloc,
                                             u_char type, const oid *,
                                             size_t);

    NETSNMP_IMPORT
    int             asn_realloc_rbuild_null(u_char ** pkt,
                                            size_t * pkt_len,
                                            size_t * offset,
                                            int allow_realloc,
                                            u_char type);

    NETSNMP_IMPORT
    int             asn_realloc_rbuild_bitstring(u_char ** pkt,
                                                 size_t * pkt_len,
                                                 size_t * offset,
                                                 int allow_realloc,
                                                 u_char type,
                                                 const u_char * data,
                                                 size_t data_size);

    NETSNMP_IMPORT
    int             asn_realloc_rbuild_unsigned_int64(u_char ** pkt,
                                                      size_t * pkt_len,
                                                      size_t * offset,
                                                      int allow_realloc,
                                                      u_char type,
                                                      struct counter64
                                                      const *data, size_t);

    NETSNMP_IMPORT
    int             asn_realloc_rbuild_signed_int64(u_char ** pkt,
                                                    size_t * pkt_len,
                                                    size_t * offset,
                                                    int allow_realloc,
                                                    u_char type,
                                                    const struct counter64 *data,
                                                    size_t);

    NETSNMP_IMPORT
    int             asn_realloc_rbuild_float(u_char ** pkt,
                                             size_t * pkt_len,
                                             size_t * offset,
                                             int allow_realloc,
                                             u_char type, const float *data,
                                             size_t data_size);

    NETSNMP_IMPORT
    int             asn_realloc_rbuild_double(u_char ** pkt,
                                              size_t * pkt_len,
                                              size_t * offset,
                                              int allow_realloc,
                                              u_char type, const double *data,
                                              size_t data_size);
#endif

#ifdef __cplusplus
}
#endif
#endif                          /* ASN1_H */
library/cert_util.h000064400000020503147511501070010354 0ustar00#ifndef NETSNMP_CERT_UTIL_H

#if defined(NETSNMP_USE_OPENSSL) && defined(HAVE_LIBSSL)

#ifndef HEADER_SSL_H
#error "must include <openssl/ssl.h> before cert_util.h"
#endif
#ifndef HEADER_X509_H
#error "must include <openssl/x509.h> before cert_util.h"
#endif

#ifdef  __cplusplus
extern "C" {
#endif

    /*************************************************************************
     *
     * netsnmp_cert structures, defines and function definitions
     *
     *************************************************************************/

    void netsnmp_certs_init(void);
    NETSNMP_IMPORT
    void netsnmp_certs_agent_init(void);
    void netsnmp_certs_shutdown(void);
    void netsnmp_certs_load(void);
    netsnmp_container *netsnmp_cert_get_trustlist(void);

    typedef struct netsnmp_cert_common_s {
        char           *dir;
        char           *filename;
        
        u_char          type;
        u_char          allowed_uses;
        u_char          _pad[2]; /* for future use */
    } netsnmp_cert_common;

    typedef struct netsnmp_key_s {
        netsnmp_cert_common info;

        EVP_PKEY       *okey;
        struct netsnmp_cert_s   *cert;
    } netsnmp_key;

    typedef struct netsnmp_cert_s {
        netsnmp_cert_common info;

        X509           *ocert;
        netsnmp_key    *key;
        struct netsnmp_cert_s *issuer_cert;

        char           *issuer;
        char           *subject;
        char           *fingerprint;
        char           *common_name;

        u_char          hash_type;
        u_char          _pad[1]; /* for future use */
        u_short         offset;
    } netsnmp_cert;

/** types */
    enum { NS_CERT_TYPE_UNKNOWN = 0, NS_CERT_TYPE_PEM, NS_CERT_TYPE_DER,
           NS_CERT_TYPE_PKCS12, NS_CERT_TYPE_KEY };

/** uses */
#define NS_CERT_IDENTITY       0x0001
#define NS_CERT_REMOTE_PEER    0x0002
#define NS_CERT_RESERVED1      0x0004
#define NS_CERT_CA             0x0008

/** source */
#define NS_CERTKEY_DEFAULT       0x000 /* get default from DS store */
#define NS_CERTKEY_FILE          0x001 /* filename/full path */
#define NS_CERTKEY_FINGERPRINT   0x002 /* public key fingerprint */
#define NS_CERTKEY_CA            0x004 /* trusted CA */
#define NS_CERTKEY_SAN_RFC822    0x008 /* subj alt name: rfc822 */
#define NS_CERTKEY_SAN_DNS       0x010 /* subj alt name: DNS */
#define NS_CERTKEY_SAN_IPADDR    0x020 /* subj alt name: IP address */
#define NS_CERTKEY_COMMON_NAME   0x040 /* common name */
#define NS_CERTKEY_TARGET_PARAM  0x080 /* tlstmParamsTable */
#define NS_CERTKEY_TARGET_ADDR   0x100 /* tlstmAddrTable */
#define NS_CERTKEY_MULTIPLE      0x200 /* try multiple sources */

/** RFC 5246 hash algorithms (Section 7.4.1.4.1) */
#define NS_HASH_NONE        0
#define NS_HASH_MD5         1
#define NS_HASH_SHA1        2
#define NS_HASH_SHA224      3
#define NS_HASH_SHA256      4
#define NS_HASH_SHA384      5
#define NS_HASH_SHA512      6
#define NS_HASH_MAX         NS_HASH_SHA512

/** SNMP-TLS-TM-MIB */
#define SNMPTLSFINGERPRINT_MAX_LEN   255

    /*************************************************************************
     * netsnmp_cert function definitions
     *************************************************************************/

    NETSNMP_IMPORT
    netsnmp_cert *netsnmp_cert_find(int what, int where, void *hint);
    netsnmp_void_array *netsnmp_certs_find(int what, int where, void *hint);

    int netsnmp_cert_check_vb_fingerprint(const netsnmp_variable_list *var);

    void netsnmp_fp_lowercase_and_strip_colon(char *fp);
    int netsnmp_cert_parse_hash_type(const char *str);
    int netsnmp_tls_fingerprint_build(int hash_type, const char *hex_fp,
                                      u_char **tls_fp, size_t *tls_fp_len,
                                      int allow_realloc);
    int netsnmp_tls_fingerprint_parse(const u_char *binary_fp, int fp_len,
                                      char **fp_str_ptr, u_int *fp_str_len,
                                      int allow_realloc, u_char *hash_type_ptr);


    int netsnmp_cert_trust(SSL_CTX *ctx, netsnmp_cert *thiscert);
    int netsnmp_cert_trust_ca(SSL_CTX *ctx, netsnmp_cert *thiscertsrootca);

    /*************************************************************************
     *
     *  certificate to Transport Security Name mapping (netsnmp_cert_map)
     *
     *************************************************************************/

#define TSNM_tlstmCertSpecified                 1
#define TSNM_tlstmCertSANRFC822Name             2
#define TSNM_tlstmCertSANDNSName                3
#define TSNM_tlstmCertSANIpAddress              4
#define TSNM_tlstmCertSANAny                    5
#define TSNM_tlstmCertCommonName                6
#define TSNM_tlstmCert_MAX                      TSNM_tlstmCertCommonName

#define NSCM_FROM_CONFIG                        0x0001
#define NSCM_FROM_MIB                           0x0002
#define NSCM_NONVOLATILE                        0x0004

    typedef struct netsnmp_cert_map_s {
        int             priority;
        char           *fingerprint;
        int             mapType;
        char           *data;

        char            hashType;
        char            flags;

        X509           *ocert;
    } netsnmp_cert_map;

    netsnmp_cert_map *netsnmp_cert_map_alloc(char *fp, X509 *ocert);
    void netsnmp_cert_map_free(netsnmp_cert_map *cert_map);
    int netsnmp_cert_map_add(netsnmp_cert_map *map);
    int netsnmp_cert_map_remove(netsnmp_cert_map *map);
    netsnmp_cert_map *netsnmp_cert_map_find(netsnmp_cert_map *map);

    void netsnmp_cert_map_container_free(netsnmp_container *c);
    netsnmp_container *netsnmp_cert_map_container_create(int with_fp);
    netsnmp_container *netsnmp_cert_map_container(void);

    netsnmp_cert_map *netsnmp_certToTSN_parse_common(char **line);
    int netsnmp_cert_get_secname_maps(netsnmp_container *cm);

    /*************************************************************************
     *
     *  snmpTlstmParamsTable data
     *
     *************************************************************************/
    typedef struct snmpTlstmParams_s {
        char         *name;
        char         *fingerprint;
        char          hashType;
        u_char        flags;
        u_char        fingerprint_len;
    } snmpTlstmParams;
    
#define TLSTM_PARAMS_FROM_CONFIG          0x01
#define TLSTM_PARAMS_FROM_MIB             0x02
#define TLSTM_PARAMS_NONVOLATILE          0x04
/** ine TLSTM_PARAMS_XXX                  0x08 */

    snmpTlstmParams *netsnmp_tlstmParams_create(const char *tag, int hashType,
                                                const char *fp, int fp_len);
    void netsnmp_tlstmParams_free(snmpTlstmParams *stp);
    snmpTlstmParams *netsnmp_tlstmParams_restore_common(char **line);

    netsnmp_container *netsnmp_tlstmParams_container(void);
    int netsnmp_tlstmParams_add(snmpTlstmParams *stp);
    int netsnmp_tlstmParams_remove(snmpTlstmParams *stp);
    snmpTlstmParams *netsnmp_tlstmParams_find(snmpTlstmParams *stp);

    /*************************************************************************
     *
     *  snmpTlstmAddrTable data
     *
     *************************************************************************/
    typedef struct snmpTlstmAddr_s {
        char         *name;
        char         *fingerprint;
        char         *identity;
        
        u_char        hashType;
        u_char        flags;
        
    } snmpTlstmAddr;

#define TLSTM_ADDR_FROM_CONFIG          0x01
#define TLSTM_ADDR_FROM_MIB             0x02
#define TLSTM_ADDR_NONVOLATILE          0x04
/** ine TLSTM_ADDR_XXX                  0x08 */

    int netsnmp_tlstmAddr_restore_common(char **line, char *name,
                                         size_t *name_len, char *id,
                                         size_t *id_len, char *fp,
                                         size_t *fp_len, u_char *ht);
    netsnmp_container *netsnmp_tlstmAddr_container(void);
    snmpTlstmAddr *netsnmp_tlstmAddr_find(snmpTlstmAddr *entry);
    snmpTlstmAddr *netsnmp_tlstmAddr_create(char *targetAddrName);
    void netsnmp_tlstmAddr_free(snmpTlstmAddr *entry);
    int netsnmp_tlstmAddr_add(snmpTlstmAddr *entry);
    int netsnmp_tlstmAddr_remove(snmpTlstmAddr *entry);
    NETSNMP_IMPORT
    char *netsnmp_tlstmAddr_get_serverId(const char *name);

#ifdef __cplusplus
}
#endif

#endif /* defined(NETSNMP_USE_OPENSSL) && defined(HAVE_LIBSSL) */

#endif /* NETSNMP_CERT_UTIL_H */

library/snmp_parse_args.h000064400000005717147511501070011557 0ustar00#ifndef SNMP_PARSE_ARGS_H
#define SNMP_PARSE_ARGS_H

/**
 * @file snmp_parse_args.h
 *
 * Support for initializing variables of type netsnmp_session from command
 * line arguments
 */

#ifdef __cplusplus
extern "C" {
#endif

/** Don't enable any logging even if there is no -L argument */
#define NETSNMP_PARSE_ARGS_NOLOGGING    0x0001
/** Don't zero out sensitive arguments as they are not on the command line
 *  anyway, typically used when the function is called from an internal
 *  config-line handler
 */
#define NETSNMP_PARSE_ARGS_NOZERO       0x0002

/**
 * Parsing of command line arguments succeeded and application is expected
 * to continue with normal operation.
 */
#define NETSNMP_PARSE_ARGS_SUCCESS       0
/**
  * Parsing of command line arguments succeeded, but the application is expected
  * to exit with zero exit code. For example, '-V' parameter has been found.
  */
#define NETSNMP_PARSE_ARGS_SUCCESS_EXIT  -2
/**
 * Parsing of command line arguments failed and application is expected to show
 * usage (i.e. list of parameters) and exit with nozero exit code. 
 */
#define NETSNMP_PARSE_ARGS_ERROR_USAGE   -1
/**
 * Parsing of command line arguments failed and application is expected to exit
 * with nozero exit code.  netsnmp_parse_args() has already printed what went
 * wrong.
 */
#define NETSNMP_PARSE_ARGS_ERROR         -3
    
/**
 *  Parse an argument list and initialize \link netsnmp_session
 *  session\endlink
 *  from it.
 *  @param argc Number of elements in argv
 *  @param argv string array of at least argc elements
 *  @param session
 *  @param localOpts Additional option characters to accept
 *  @param proc function pointer used to process any unhandled arguments
 *  @param flags flags directing how to handle the string
 *
 *  @retval 0 (= #NETSNMP_PARSE_ARGS_SUCCESS) on success
 *  @retval #NETSNMP_PARSE_ARGS_SUCCESS_EXIT when the application is expected
 *  to exit with zero exit code (e.g. '-V' option was found)
 *  @retval #NETSNMP_PARSE_ARGS_ERROR_USAGE when the function failed to parse
 *  the command line and the application is expected to show it's usage
 *  @retval #NETSNMP_PARSE_ARGS_ERROR when the function failed to parse
 *  the command line and it has already printed enough information for the user
 *  and no other output is needed
 *
 *  The proc function is called with argc, argv and the currently processed
 *  option as arguments
 */
NETSNMP_IMPORT int
netsnmp_parse_args(int argc, char **argv, netsnmp_session *session,
                   const char *localOpts, void (*proc)(int, char *const *, int),
                   int flags);

/**
 *  Calls \link netsnmp_parse_args()
 *  netsnmp_parse_args(argc, argv, session, localOpts, proc, 0)\endlink
 */
NETSNMP_IMPORT
int
snmp_parse_args(int argc, char **argv, netsnmp_session *session,
		const char *localOpts, void (*proc)(int, char *const *, int));

NETSNMP_IMPORT
void
snmp_parse_args_descriptions(FILE *);

NETSNMP_IMPORT
void
snmp_parse_args_usage(FILE *);

#ifdef __cplusplus
}
#endif
#endif
library/snmp_api.h000064400000073620147511501070010200 0ustar00/* Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 */
/*
 * Portions of this file are copyrighted by:
 * Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 *
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */
#ifndef SNMP_API_H
#define SNMP_API_H

/*
 * @file snmp_api.h - API for access to snmp.
 * 
 * @addtogroup library
 *
 * Caution: when using this library in a multi-threaded application,
 * the values of global variables "snmp_errno" and "snmp_detail"
 * cannot be reliably determined.  Suggest using snmp_error()
 * to obtain the library error codes.
 *
 * @{
 */

#include <net-snmp/types.h>
#include <net-snmp/varbind_api.h>
#include <net-snmp/output_api.h>
#include <net-snmp/pdu_api.h>
#include <net-snmp/session_api.h>

#include <net-snmp/net-snmp-features.h>

#ifndef DONT_SHARE_ERROR_WITH_OTHER_THREADS
#define SET_SNMP_ERROR(x) snmp_errno=(x)
#else
#define SET_SNMP_ERROR(x)
#endif


#ifdef __cplusplus
extern          "C" {
#endif

/***********************************************************
	Copyright 1989 by Carnegie Mellon University

                      All Rights Reserved

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of CMU not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.

CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/

struct timeval;
/*
 * A list of all the outstanding requests for a particular session.
 */
#ifdef SNMP_NEED_REQUEST_LIST
typedef struct request_list {
    struct request_list *next_request;
    long            request_id;     /* request id */
    long            message_id;     /* message id */
    netsnmp_callback callback;      /* user callback per request (NULL if unused) */
    void           *cb_data;        /* user callback data per request (NULL if unused) */
    int             retries;        /* Number of retries */
    u_long          timeout;        /* length to wait for timeout */
    struct timeval  timeM;   /* Time this request was made [monotonic clock] */
    struct timeval  expireM; /* Time this request is due to expire [monotonic clock]. */
    struct snmp_session *session;
    netsnmp_pdu    *pdu;    /* The pdu for this request
			     * (saved so it can be retransmitted */
} netsnmp_request_list;
#endif                          /* SNMP_NEED_REQUEST_LIST */

    /*
     * Set fields in session and pdu to the following to get a default or unconfigured value.
     */
#define SNMP_DEFAULT_COMMUNITY_LEN  0   /* to get a default community name */
#define SNMP_DEFAULT_RETRIES	    -1
#define SNMP_DEFAULT_TIMEOUT	    -1
#define SNMP_DEFAULT_REMPORT	    0
#define SNMP_DEFAULT_REQID	    -1
#define SNMP_DEFAULT_MSGID	    -1
#define SNMP_DEFAULT_ERRSTAT	    -1
#define SNMP_DEFAULT_ERRINDEX	    -1
#define SNMP_DEFAULT_ADDRESS	    0
#define SNMP_DEFAULT_PEERNAME	    NULL
#define SNMP_DEFAULT_ENTERPRISE_LENGTH	0
#define SNMP_DEFAULT_TIME	    0
#define SNMP_DEFAULT_VERSION	    -1
#define SNMP_DEFAULT_SECMODEL	    -1
#define SNMP_DEFAULT_CONTEXT        ""
#ifndef NETSNMP_DISABLE_MD5
#define SNMP_DEFAULT_AUTH_PROTO     usmHMACMD5AuthProtocol
#else
#define SNMP_DEFAULT_AUTH_PROTO     usmHMACSHA1AuthProtocol
#endif
#define SNMP_DEFAULT_AUTH_PROTOLEN  OID_LENGTH(SNMP_DEFAULT_AUTH_PROTO)
#ifndef NETSNMP_DISABLE_DES
#define SNMP_DEFAULT_PRIV_PROTO     usmDESPrivProtocol
#else
#define SNMP_DEFAULT_PRIV_PROTO     usmAESPrivProtocol
#endif
#define SNMP_DEFAULT_PRIV_PROTOLEN  OID_LENGTH(SNMP_DEFAULT_PRIV_PROTO)

    NETSNMP_IMPORT void     snmp_set_detail(const char *);

#define SNMP_MAX_RCV_MSG_SIZE      65536
#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
#define SNMP_MAX_MSG_V3_HDRS       (4+3+4+7+7+3+7+16)   /* fudge factor=16 */
#define SNMP_MAX_ENG_SIZE          32
#define SNMP_MAX_SEC_NAME_SIZE     256
#define SNMP_MAX_CONTEXT_SIZE      256
#define SNMP_SEC_PARAM_BUF_SIZE    256

    /*
     * set to one to ignore unauthenticated Reports 
     */
#define SNMPV3_IGNORE_UNAUTH_REPORTS 0

    /*
     * authoritative engine definitions 
     */
#define SNMP_SESS_NONAUTHORITATIVE 0    /* should be 0 to default to this */
#define SNMP_SESS_AUTHORITATIVE    1    /* don't learn engineIDs */
#define SNMP_SESS_UNKNOWNAUTH      2    /* sometimes (like NRs) */

    /*
     * to determine type of Report from varbind_list 
     */
#define REPORT_STATS_LEN  9	/* Length of prefix for MPD/USM report statistic objects */
#define REPORT_STATS_LEN2 8	/* Length of prefix for Target report statistic objects */
/* From SNMP-MPD-MIB */
#define REPORT_snmpUnknownSecurityModels_NUM 1
#define REPORT_snmpInvalidMsgs_NUM           2
#define REPORT_snmpUnknownPDUHandlers_NUM    3
/* From SNMP-USER-BASED-SM-MIB */
#define REPORT_usmStatsUnsupportedSecLevels_NUM 1
#define REPORT_usmStatsNotInTimeWindows_NUM 2
#define REPORT_usmStatsUnknownUserNames_NUM 3
#define REPORT_usmStatsUnknownEngineIDs_NUM 4
#define REPORT_usmStatsWrongDigests_NUM     5
#define REPORT_usmStatsDecryptionErrors_NUM 6
/* From SNMP-TARGET-MIB */
#define REPORT_snmpUnavailableContexts_NUM  4
#define REPORT_snmpUnknownContexts_NUM      5

#define SNMP_DETAIL_SIZE        512

#define SNMP_FLAGS_UDP_BROADCAST   0x800
#define SNMP_FLAGS_RESP_CALLBACK   0x400      /* Additional callback on response */
#define SNMP_FLAGS_USER_CREATED    0x200      /* USM user has been created */
#define SNMP_FLAGS_DONT_PROBE      0x100      /* don't probe for an engineID */
#define SNMP_FLAGS_STREAM_SOCKET   0x80
#define SNMP_FLAGS_LISTENING       0x40 /* Server stream sockets only */
#define SNMP_FLAGS_SUBSESSION      0x20
#define SNMP_FLAGS_SHARED_SOCKET   0x10 /* subsession list=related sessions */
#define SNMP_FLAGS_STRIKE2         0x02
#define SNMP_FLAGS_STRIKE1         0x01

#define CLEAR_SNMP_STRIKE_FLAGS(x) \
	x &= ~(SNMP_FLAGS_STRIKE2|SNMP_FLAGS_STRIKE1)

    /*
     * returns '1' if the session is to be regarded as dead,
     * otherwise set the strike flags appropriately, and return 0
     */
#define SET_SNMP_STRIKE_FLAGS(x) \
	((   x & SNMP_FLAGS_STRIKE2 ) ? 1 :				\
	 ((( x & SNMP_FLAGS_STRIKE1 ) ? ( x |= SNMP_FLAGS_STRIKE2 ) :	\
	                                ( x |= SNMP_FLAGS_STRIKE1 )),	\
	                                0))

    /*
     * Error return values.
     *
     * SNMPERR_SUCCESS is the non-PDU "success" code.
     *
     * XXX  These should be merged with SNMP_ERR_* defines and confined
     *      to values < 0.  ???
     */
#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
#define SNMPERR_GENERR			(-1)
#define SNMPERR_BAD_LOCPORT		(-2)
#define SNMPERR_BAD_ADDRESS		(-3)
#define SNMPERR_BAD_SESSION		(-4)
#define SNMPERR_TOO_LONG		(-5)
#define SNMPERR_NO_SOCKET		(-6)
#define SNMPERR_V2_IN_V1		(-7)
#define SNMPERR_V1_IN_V2		(-8)
#define SNMPERR_BAD_REPEATERS		(-9)
#define SNMPERR_BAD_REPETITIONS		(-10)
#define SNMPERR_BAD_ASN1_BUILD		(-11)
#define SNMPERR_BAD_SENDTO		(-12)
#define SNMPERR_BAD_PARSE		(-13)
#define SNMPERR_BAD_VERSION		(-14)
#define SNMPERR_BAD_SRC_PARTY		(-15)
#define SNMPERR_BAD_DST_PARTY		(-16)
#define SNMPERR_BAD_CONTEXT		(-17)
#define SNMPERR_BAD_COMMUNITY		(-18)
#define SNMPERR_NOAUTH_DESPRIV		(-19)
#define SNMPERR_BAD_ACL			(-20)
#define SNMPERR_BAD_PARTY		(-21)
#define SNMPERR_ABORT			(-22)
#define SNMPERR_UNKNOWN_PDU		(-23)
#define SNMPERR_TIMEOUT 		(-24)
#define SNMPERR_BAD_RECVFROM 		(-25)
#define SNMPERR_BAD_ENG_ID 		(-26)
#define SNMPERR_BAD_SEC_NAME 		(-27)
#define SNMPERR_BAD_SEC_LEVEL 		(-28)
#define SNMPERR_ASN_PARSE_ERR           (-29)
#define SNMPERR_UNKNOWN_SEC_MODEL 	(-30)
#define SNMPERR_INVALID_MSG             (-31)
#define SNMPERR_UNKNOWN_ENG_ID          (-32)
#define SNMPERR_UNKNOWN_USER_NAME 	(-33)
#define SNMPERR_UNSUPPORTED_SEC_LEVEL 	(-34)
#define SNMPERR_AUTHENTICATION_FAILURE 	(-35)
#define SNMPERR_NOT_IN_TIME_WINDOW 	(-36)
#define SNMPERR_DECRYPTION_ERR          (-37)
#define SNMPERR_SC_GENERAL_FAILURE	(-38)
#define SNMPERR_SC_NOT_CONFIGURED	(-39)
#define SNMPERR_KT_NOT_AVAILABLE	(-40)
#define SNMPERR_UNKNOWN_REPORT          (-41)
#define SNMPERR_USM_GENERICERROR		(-42)
#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
#define SNMPERR_USM_ENCRYPTIONERROR		(-45)
#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
#define SNMPERR_USM_PARSEERROR			(-47)
#define SNMPERR_USM_UNKNOWNENGINEID		(-48)
#define SNMPERR_USM_NOTINTIMEWINDOW		(-49)
#define SNMPERR_USM_DECRYPTIONERROR		(-50)
#define SNMPERR_NOMIB			(-51)
#define SNMPERR_RANGE			(-52)
#define SNMPERR_MAX_SUBID		(-53)
#define SNMPERR_BAD_SUBID		(-54)
#define SNMPERR_LONG_OID		(-55)
#define SNMPERR_BAD_NAME		(-56)
#define SNMPERR_VALUE			(-57)
#define SNMPERR_UNKNOWN_OBJID		(-58)
#define SNMPERR_NULL_PDU		(-59)
#define SNMPERR_NO_VARS			(-60)
#define SNMPERR_VAR_TYPE		(-61)
#define SNMPERR_MALLOC			(-62)
#define SNMPERR_KRB5			(-63)
#define SNMPERR_PROTOCOL		(-64)
#define SNMPERR_OID_NONINCREASING       (-65)
#define SNMPERR_JUST_A_CONTEXT_PROBE    (-66)
#define SNMPERR_TRANSPORT_NO_CONFIG     (-67)
#define SNMPERR_TRANSPORT_CONFIG_ERROR  (-68)
#define SNMPERR_TLS_NO_CERTIFICATE      (-69)

#define SNMPERR_MAX			(-69)


    /*
     * General purpose memory allocation functions. Use these functions to
     * allocate memory that may be reallocated or freed by the Net-SNMP
     * library or to reallocate or free memory that has been allocated by the
     * Net-SNMP library, and when working in a context where there is more than
     * one heap. Examples are:
     * - Perl XSUB's.
     * - MSVC or MinGW with the Net-SNMP library compiled as a DLL instead of
     *   a static library.
     */
    NETSNMP_IMPORT void *netsnmp_malloc(size_t size);
    NETSNMP_IMPORT void *netsnmp_calloc(size_t nelem, size_t elsize);
    NETSNMP_IMPORT void *netsnmp_realloc(void *ptr, size_t size);
    NETSNMP_IMPORT void netsnmp_free(void *ptr);
    NETSNMP_IMPORT char *netsnmp_strdup(const char *s1);

    NETSNMP_IMPORT long int netsnmp_random(void);
    NETSNMP_IMPORT void netsnmp_srandom(unsigned int seed);

    /*
     * void
     * snmp_free_pdu(pdu)
     *     netsnmp_pdu *pdu;
     *
     * Frees the pdu and any malloc'd data associated with it.
     */

    NETSNMP_IMPORT void snmp_free_var_internals(netsnmp_variable_list *);     /* frees contents only */


    /*
     * This routine must be supplied by the application:
     *
     * u_char *authenticator(pdu, length, community, community_len)
     * u_char *pdu;         The rest of the PDU to be authenticated
     * int *length;         The length of the PDU (updated by the authenticator)
     * u_char *community;   The community name to authenticate under.
     * int  community_len   The length of the community name.
     *
     * Returns the authenticated pdu, or NULL if authentication failed.
     * If null authentication is used, the authenticator in snmp_session can be
     * set to NULL(0).
     */



    /*
     * This routine must be supplied by the application:
     *
     * int callback(operation, session, reqid, pdu, magic)
     * int operation;
     * netsnmp_session *session;    The session authenticated under.
     * int reqid;                       The request id of this pdu (0 for TRAP)
     * netsnmp_pdu *pdu;        The pdu information.
     * void *magic                      A link to the data for this routine.
     *
     * Returns 1 if request was successful, 0 if it should be kept pending.
     * Any data in the pdu must be copied because it will be freed elsewhere.
     * Operations are defined below:
     */

#define NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE	1
#define NETSNMP_CALLBACK_OP_TIMED_OUT		2
#define NETSNMP_CALLBACK_OP_SEND_FAILED		3
#define NETSNMP_CALLBACK_OP_CONNECT		4
#define NETSNMP_CALLBACK_OP_DISCONNECT		5
#define NETSNMP_CALLBACK_OP_RESEND		6
#define NETSNMP_CALLBACK_OP_SEC_ERROR		7

    NETSNMP_IMPORT
    long            snmp_get_next_msgid(void);
    NETSNMP_IMPORT
    long            snmp_get_next_reqid(void);
    NETSNMP_IMPORT
    long            snmp_get_next_sessid(void);
    NETSNMP_IMPORT
    long            snmp_get_next_transid(void);

    NETSNMP_IMPORT
    int             netsnmp_max_send_msg_size(void);

    NETSNMP_IMPORT
    int             snmp_oid_compare(const oid *, size_t, const oid *,
                                     size_t);
    NETSNMP_IMPORT
    int             snmp_oid_ncompare(const oid *, size_t, const oid *,
                                      size_t, size_t);
    NETSNMP_IMPORT
    int             snmp_oidtree_compare(const oid *, size_t, const oid *,
                                         size_t);
    NETSNMP_IMPORT
    int             snmp_oidsubtree_compare(const oid *, size_t, const oid *,
                                         size_t);
    NETSNMP_IMPORT
    int             netsnmp_oid_compare_ll(const oid * in_name1,
                                           size_t len1, const oid * in_name2,
                                           size_t len2, size_t *offpt);
    NETSNMP_IMPORT
    int             netsnmp_oid_equals(const oid *, size_t, const oid *,
                                       size_t);
    NETSNMP_IMPORT
    int             netsnmp_oid_tree_equals(const oid *, size_t, const oid *,
                                            size_t);
    NETSNMP_IMPORT
    int             netsnmp_oid_is_subtree(const oid *, size_t, const oid *,
                                           size_t);
    NETSNMP_IMPORT
    int             netsnmp_oid_find_prefix(const oid * in_name1, size_t len1,
                                            const oid * in_name2, size_t len2);
    NETSNMP_IMPORT
    void            init_snmp(const char *);

    int
    snmp_build(u_char ** pkt, size_t * pkt_len, size_t * offset,
               netsnmp_session * pss, netsnmp_pdu *pdu);

    NETSNMP_IMPORT
    u_char         *snmp_pdu_build(netsnmp_pdu *, u_char *, size_t *);
#ifdef NETSNMP_USE_REVERSE_ASNENCODING
    NETSNMP_IMPORT
    u_char         *snmp_pdu_rbuild(netsnmp_pdu *, u_char *, size_t *);
#endif
    NETSNMP_IMPORT
    int             snmpv3_parse(netsnmp_pdu *, u_char *, size_t *,
                                 u_char **, netsnmp_session *);
    NETSNMP_IMPORT
    int             snmpv3_packet_build(netsnmp_session *,
                                        netsnmp_pdu *pdu, u_char * packet,
                                        size_t * out_length,
                                        u_char * pdu_data,
                                        size_t pdu_data_len);
    NETSNMP_IMPORT
    int             snmpv3_packet_rbuild(netsnmp_session *,
                                         netsnmp_pdu *pdu, u_char * packet,
                                         size_t * out_length,
                                         u_char * pdu_data,
                                         size_t pdu_data_len);
    NETSNMP_IMPORT
    int             snmpv3_make_report(netsnmp_pdu *pdu, int error);
    NETSNMP_IMPORT
    int             snmpv3_get_report_type(netsnmp_pdu *pdu);
    NETSNMP_IMPORT
    int             snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data,
                                   size_t * length);
    NETSNMP_IMPORT
    u_char         *snmpv3_scopedPDU_parse(netsnmp_pdu *pdu, u_char * cp,
                                           size_t * length);
    NETSNMP_IMPORT
    void            snmp_store_needed(const char *type);
    NETSNMP_IMPORT
    void            snmp_store_if_needed(void);
    NETSNMP_IMPORT
    void            snmp_store(const char *type);
    NETSNMP_IMPORT
    void            snmp_shutdown(const char *type);
    NETSNMP_IMPORT
    int             snmp_add_var(netsnmp_pdu *, const oid *, size_t, char,
                                 const char *);
    NETSNMP_IMPORT
    oid            *snmp_duplicate_objid(const oid * objToCopy, size_t);

#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
    NETSNMP_IMPORT
    u_int           snmp_increment_statistic(int which);
    NETSNMP_IMPORT
    u_int           snmp_increment_statistic_by(int which, int count);
    NETSNMP_IMPORT
    u_int           snmp_get_statistic(int which);
    NETSNMP_IMPORT
    void            snmp_init_statistics(void);
#else /* NETSNMP_FEATURE_REMOVE_STATISTICS */

/* allow code to continue referencing API even if statistics are removed */
#define snmp_increment_statistic(X)
#define snmp_increment_statistic_by(X,Y)
#define snmp_init_statistics()

#endif

    NETSNMP_IMPORT
    int             create_user_from_session(netsnmp_session * session);
    NETSNMP_IMPORT
    int snmpv3_probe_contextEngineID_rfc5343(void *slp,
                                             netsnmp_session *session);

    /*
     * New re-allocating reverse encoding functions.  
     */
#ifdef NETSNMP_USE_REVERSE_ASNENCODING

    NETSNMP_IMPORT
    int        snmpv3_packet_realloc_rbuild(u_char ** pkt, size_t * pkt_len,
                                     size_t * offset,
                                     netsnmp_session * session,
                                     netsnmp_pdu *pdu, u_char * pdu_data,
                                     size_t pdu_data_len);

    NETSNMP_IMPORT
    int        snmp_pdu_realloc_rbuild(u_char ** pkt, size_t * pkt_len,
                                size_t * offset, netsnmp_pdu *pdu);
#endif



struct netsnmp_transport_s;

    /*
     * Extended open; fpre_parse has changed.  
     */

    NETSNMP_IMPORT
    netsnmp_session *snmp_open_ex(netsnmp_session *,
                                  int (*fpre_parse) (netsnmp_session *,
                                                     struct
                                                     netsnmp_transport_s *,
                                                     void *, int),
                                  int (*fparse) (netsnmp_session *,
                                                 netsnmp_pdu *, u_char *,
                                                 size_t),
                                  int (*fpost_parse) (netsnmp_session *,
                                                      netsnmp_pdu *, int),
                                  int (*fbuild) (netsnmp_session *,
                                                 netsnmp_pdu *, u_char *,
                                                 size_t *),
                                  int (*frbuild) (netsnmp_session *,
                                                  netsnmp_pdu *, u_char **,
                                                  size_t *, size_t *),
                                  int (*fcheck) (u_char *, size_t));

    /*
     * provided for backwards compatability.  Don't use these functions.
     * See snmp_debug.h and snmp_debug.c instead.
     */

    NETSNMP_IMPORT
    void            snmp_set_do_debugging(int);
    NETSNMP_IMPORT
    int             snmp_get_do_debugging(void);


    NETSNMP_IMPORT
    void            netsnmp_sess_log_error(int priority,
                                           const char *prog_string,
                                           netsnmp_session * ss);

    NETSNMP_IMPORT
    const char *    snmp_pdu_type(int type);

    /*
     * Return the netsnmp_transport structure associated with the given opaque
     * pointer.  
     */

    NETSNMP_IMPORT
    struct netsnmp_transport_s *snmp_sess_transport(void *);
    NETSNMP_IMPORT
    void            snmp_sess_transport_set(void *,
					    struct netsnmp_transport_s *);

    NETSNMP_IMPORT int
    netsnmp_sess_config_transport(struct netsnmp_container_s *transport_configuration,
                                  struct netsnmp_transport_s *transport);

    NETSNMP_IMPORT int
    netsnmp_sess_config_and_open_transport(netsnmp_session *in_session,
                                           struct netsnmp_transport_s *transport);

    /*
     * EXTENDED SESSION API ------------------------------------------ 
     * 
     * snmp_sess_add_ex, snmp_sess_add, snmp_add 
     * 
     * Analogous to snmp_open family of functions, but taking an
     * netsnmp_transport pointer as an extra argument.  Unlike snmp_open et
     * al. it doesn't attempt to interpret the in_session->peername as a
     * transport endpoint specifier, but instead uses the supplied transport.
     * JBPN
     * 
     */

    NETSNMP_IMPORT
    void           *snmp_sess_add_ex(netsnmp_session *,
                                     struct netsnmp_transport_s *,
                                     int (*fpre_parse) (netsnmp_session *,
                                                        struct
                                                        netsnmp_transport_s
                                                        *, void *, int),
                                     int (*fparse) (netsnmp_session *,
                                                    struct snmp_pdu *,
                                                    u_char *, size_t),
                                     int (*fpost_parse) (netsnmp_session *,
                                                         struct snmp_pdu *,
                                                         int),
                                     int (*fbuild) (netsnmp_session *,
                                                    struct snmp_pdu *,
                                                    u_char *, size_t *),
                                     int (*frbuild) (netsnmp_session *,
                                                     struct snmp_pdu *,
                                                     u_char **, size_t *,
                                                     size_t *),
                                     int (*fcheck) (u_char *, size_t),
                                     netsnmp_pdu *(*fcreate_pdu) (struct
                                                                  netsnmp_transport_s
                                                                  *,
                                                                  void *,
                                                                  size_t));

    NETSNMP_IMPORT
    void           *snmp_sess_add(netsnmp_session *,
                                  struct netsnmp_transport_s *,
                                  int (*fpre_parse) (netsnmp_session *,
                                                     struct
                                                     netsnmp_transport_s *,
                                                     void *, int),
                                  int (*fpost_parse) (netsnmp_session *,
                                                      netsnmp_pdu *, int));

    NETSNMP_IMPORT
    netsnmp_session *snmp_add(netsnmp_session *,
                              struct netsnmp_transport_s *,
                              int (*fpre_parse) (netsnmp_session *,
                                                 struct netsnmp_transport_s
                                                 *, void *, int),
                              int (*fpost_parse) (netsnmp_session *,
                                                  netsnmp_pdu *, int));
    NETSNMP_IMPORT
    netsnmp_session *snmp_add_full(netsnmp_session * in_session,
                                   struct netsnmp_transport_s *transport,
                                   int (*fpre_parse) (netsnmp_session *,
                                                      struct
                                                      netsnmp_transport_s
                                                      *, void *, int),
                                   int (*fparse) (netsnmp_session *,
                                                  netsnmp_pdu *, u_char *,
                                                  size_t),
                                   int (*fpost_parse) (netsnmp_session *,
                                                       netsnmp_pdu *, int),
                                   int (*fbuild) (netsnmp_session *,
                                                  netsnmp_pdu *, u_char *,
                                                  size_t *),
                                   int (*frbuild) (netsnmp_session *,
                                                   netsnmp_pdu *,
                                                   u_char **, size_t *,
                                                   size_t *),
                                   int (*fcheck) (u_char *, size_t),
                                   netsnmp_pdu *(*fcreate_pdu) (struct
                                                                netsnmp_transport_s
                                                                *, void *,
                                                                size_t)
        );
    /*
     * end single session API 
     */

    /*
     * generic statistic counters 
     */

    /*
     * snmpv3 statistics 
     */

    /*
     * mpd stats 
     */
#define   STAT_SNMPUNKNOWNSECURITYMODELS     0
#define   STAT_SNMPINVALIDMSGS               1
#define   STAT_SNMPUNKNOWNPDUHANDLERS        2
#define   STAT_MPD_STATS_START               STAT_SNMPUNKNOWNSECURITYMODELS
#define   STAT_MPD_STATS_END                 STAT_SNMPUNKNOWNPDUHANDLERS

    /*
     * usm stats 
     */
#define   STAT_USMSTATSUNSUPPORTEDSECLEVELS  3
#define   STAT_USMSTATSNOTINTIMEWINDOWS      4
#define   STAT_USMSTATSUNKNOWNUSERNAMES      5
#define   STAT_USMSTATSUNKNOWNENGINEIDS      6
#define   STAT_USMSTATSWRONGDIGESTS          7
#define   STAT_USMSTATSDECRYPTIONERRORS      8
#define   STAT_USM_STATS_START               STAT_USMSTATSUNSUPPORTEDSECLEVELS
#define   STAT_USM_STATS_END                 STAT_USMSTATSDECRYPTIONERRORS

    /*
     * snmp counters 
     */
#define  STAT_SNMPINPKTS                     9
#define  STAT_SNMPOUTPKTS                    10
#define  STAT_SNMPINBADVERSIONS              11
#define  STAT_SNMPINBADCOMMUNITYNAMES        12
#define  STAT_SNMPINBADCOMMUNITYUSES         13
#define  STAT_SNMPINASNPARSEERRS             14
    /*
     * #define  STAT_SNMPINBADTYPES              15 
     */
#define  STAT_SNMPINTOOBIGS                  16
#define  STAT_SNMPINNOSUCHNAMES              17
#define  STAT_SNMPINBADVALUES                18
#define  STAT_SNMPINREADONLYS                19
#define  STAT_SNMPINGENERRS                  20
#define  STAT_SNMPINTOTALREQVARS             21
#define  STAT_SNMPINTOTALSETVARS             22
#define  STAT_SNMPINGETREQUESTS              23
#define  STAT_SNMPINGETNEXTS                 24
#define  STAT_SNMPINSETREQUESTS              25
#define  STAT_SNMPINGETRESPONSES             26
#define  STAT_SNMPINTRAPS                    27
#define  STAT_SNMPOUTTOOBIGS                 28
#define  STAT_SNMPOUTNOSUCHNAMES             29
#define  STAT_SNMPOUTBADVALUES               30
    /*
     * #define  STAT_SNMPOUTREADONLYS            31 
     */
#define  STAT_SNMPOUTGENERRS                 32
#define  STAT_SNMPOUTGETREQUESTS             33
#define  STAT_SNMPOUTGETNEXTS                34
#define  STAT_SNMPOUTSETREQUESTS             35
#define  STAT_SNMPOUTGETRESPONSES            36
#define  STAT_SNMPOUTTRAPS                   37
    /*
     * AUTHTRAPENABLE                            38 
     */
#define  STAT_SNMPSILENTDROPS		     39
#define  STAT_SNMPPROXYDROPS		     40
#define  STAT_SNMP_STATS_START               STAT_SNMPINPKTS
#define  STAT_SNMP_STATS_END                 STAT_SNMPPROXYDROPS

    /*
     * target mib counters 
     */
#define  STAT_SNMPUNAVAILABLECONTEXTS	     41
#define  STAT_SNMPUNKNOWNCONTEXTS	     42
#define  STAT_TARGET_STATS_START             STAT_SNMPUNAVAILABLECONTEXTS
#define  STAT_TARGET_STATS_END               STAT_SNMPUNKNOWNCONTEXTS

    /*
     * TSM counters
     */
#define  STAT_TSM_SNMPTSMINVALIDCACHES             43
#define  STAT_TSM_SNMPTSMINADEQUATESECURITYLEVELS  44
#define  STAT_TSM_SNMPTSMUNKNOWNPREFIXES           45
#define  STAT_TSM_SNMPTSMINVALIDPREFIXES           46
#define  STAT_TSM_STATS_START                 STAT_TSM_SNMPTSMINVALIDCACHES
#define  STAT_TSM_STATS_END                   STAT_TSM_SNMPTSMINVALIDPREFIXES

    /*
     * TLSTM counters
     */
#define  STAT_TLSTM_SNMPTLSTMSESSIONOPENS                      47
#define  STAT_TLSTM_SNMPTLSTMSESSIONCLIENTCLOSES               48
#define  STAT_TLSTM_SNMPTLSTMSESSIONOPENERRORS                 49
#define  STAT_TLSTM_SNMPTLSTMSESSIONACCEPTS                    50
#define  STAT_TLSTM_SNMPTLSTMSESSIONSERVERCLOSES               51
#define  STAT_TLSTM_SNMPTLSTMSESSIONNOSESSIONS                 52
#define  STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCLIENTCERTIFICATES  53
#define  STAT_TLSTM_SNMPTLSTMSESSIONUNKNOWNSERVERCERTIFICATE   54
#define  STAT_TLSTM_SNMPTLSTMSESSIONINVALIDSERVERCERTIFICATES  55
#define  STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES              56

#define  STAT_TLSTM_STATS_START                 STAT_TLSTM_SNMPTLSTMSESSIONOPENS
#define  STAT_TLSTM_STATS_END          STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES

    /* this previously was end+1; don't know why the +1 is needed;
       XXX: check the code */
#define  NETSNMP_STAT_MAX_STATS              (STAT_TLSTM_STATS_END+1)
/** backwards compatability */
#define MAX_STATS NETSNMP_STAT_MAX_STATS

    /*
     * Internal: The list of active/open sessions.
     */
    struct session_list {
       struct session_list *next;
       netsnmp_session *session;
       netsnmp_transport *transport;
       struct snmp_internal_session *internal;
    };

#ifdef __cplusplus
}
#endif
#endif                          /* SNMP_API_H */
library/snmpusm.h000064400000037515147511501070010077 0ustar00/*
 * snmpusm.h
 *
 * Header file for USM support.
 *
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */

#ifndef SNMPUSM_H
#define SNMPUSM_H

#include <net-snmp/library/callback.h>

#ifdef __cplusplus
extern          "C" {
#endif

#define WILDCARDSTRING "*"

    /*
     * General.
     */
#define USM_MAX_ID_LENGTH		1024    /* In bytes. */
#define USM_MAX_SALT_LENGTH		128     /* In BITS. */
#define USM_DES_SALT_LENGTH		64      /* In BITS. */
#define USM_AES_SALT_LENGTH		128     /* In BITS. */
#define USM_MAX_KEYEDHASH_LENGTH	128     /* In BITS. */

#define USM_TIME_WINDOW			150
#define USM_MD5_AND_SHA_AUTH_LEN        12      /* bytes */
#define USM_HMAC128SHA224_AUTH_LEN      16      /* OPTIONAL */
#define USM_HMAC192SHA256_AUTH_LEN      24      /* MUST */
#define USM_HMAC256SHA384_AUTH_LEN      32      /* OPTIONAL */
#define USM_HMAC384SHA512_AUTH_LEN      48      /* SHOULD */
#define USM_MAX_AUTHSIZE                USM_HMAC384SHA512_AUTH_LEN

#define USM_SEC_MODEL_NUMBER            SNMP_SEC_MODEL_USM

    /*
     * Structures.
     */
    struct usmStateReference {
        int             refcnt;
        char           *usr_name;
        size_t          usr_name_length;
        u_char         *usr_engine_id;
        size_t          usr_engine_id_length;
        oid            *usr_auth_protocol;
        size_t          usr_auth_protocol_length;
        u_char         *usr_auth_key;
        size_t          usr_auth_key_length;
        oid            *usr_priv_protocol;
        size_t          usr_priv_protocol_length;
        u_char         *usr_priv_key;
        size_t          usr_priv_key_length;
        u_int           usr_sec_level;
    };


    /*
     * struct usmUser: a structure to represent a given user in a list 
     */
    /*
     * Note: Any changes made to this structure need to be reflected in
     * the following functions: 
     */

    struct usmUser;
    struct usmUser {
        u_int          flags;
        u_char         *engineID;
        size_t          engineIDLen;
        char           *name;
        char           *secName;
        oid            *cloneFrom;
        size_t          cloneFromLen;
        oid            *authProtocol;
        size_t          authProtocolLen;
        u_char         *authKey;
        size_t          authKeyLen;
        u_char         *authKeyKu;
        size_t          authKeyKuLen;
        oid            *privProtocol;
        size_t          privProtocolLen;
        u_char         *privKeyKu;
        size_t          privKeyKuLen;
        u_char         *privKey;
        size_t          privKeyLen;
        u_char         *userPublicString;
        size_t          userPublicStringLen;
        int             userStatus;
        int             userStorageType;
       /* these are actually DH * pointers but only if openssl is avail. */
        void           *usmDHUserAuthKeyChange;
        void           *usmDHUserPrivKeyChange;
        struct usmUser *next;
        struct usmUser *prev;
    };

#define USMUSER_FLAG_KEEP_MASTER_KEY             0x01


    /*
     * Prototypes.
     */
    struct usmStateReference *usm_malloc_usmStateReference(void);

    void            usm_free_usmStateReference(void *old);

    int             usm_set_usmStateReference_name(struct usmStateReference
                                                   *ref, char *name,
                                                   size_t name_len);

    int             usm_set_usmStateReference_engine_id(struct
                                                        usmStateReference
                                                        *ref,
                                                        u_char * engine_id,
                                                        size_t
                                                        engine_id_len);

    int             usm_set_usmStateReference_auth_protocol(struct
                                                            usmStateReference
                                                            *ref,
                                                            oid *
                                                            auth_protocol,
                                                            size_t
                                                            auth_protocol_len);

    int             usm_set_usmStateReference_auth_key(struct
                                                       usmStateReference
                                                       *ref,
                                                       u_char * auth_key,
                                                       size_t
                                                       auth_key_len);

    int             usm_set_usmStateReference_priv_protocol(struct
                                                            usmStateReference
                                                            *ref,
                                                            oid *
                                                            priv_protocol,
                                                            size_t
                                                            priv_protocol_len);

    int             usm_set_usmStateReference_priv_key(struct
                                                       usmStateReference
                                                       *ref,
                                                       u_char * priv_key,
                                                       size_t
                                                       priv_key_len);

    int             usm_set_usmStateReference_sec_level(struct
                                                        usmStateReference
                                                        *ref,
                                                        int sec_level);
    int             usm_clone_usmStateReference(struct usmStateReference *from,
                                                    struct usmStateReference **to);


#ifdef NETSNMP_ENABLE_TESTING_CODE
    void            emergency_print(u_char * field, u_int length);
#endif

    int             asn_predict_int_length(int type, long number,
                                           size_t len);

    int             asn_predict_length(int type, u_char * ptr,
                                       size_t u_char_len);

    int             usm_set_salt(u_char * iv,
                                 size_t * iv_length,
                                 u_char * priv_salt,
                                 size_t priv_salt_length,
                                 u_char * msgSalt);

    NETSNMP_IMPORT
    int             usm_extend_user_kul(struct usmUser *user,
                                        u_int privKeyBufSize);

    int             usm_parse_security_parameters(u_char * secParams,
                                                  size_t remaining,
                                                  u_char * secEngineID,
                                                  size_t * secEngineIDLen,
                                                  u_int * boots_uint,
                                                  u_int * time_uint,
                                                  char *secName,
                                                  size_t * secNameLen,
                                                  u_char * signature,
                                                  size_t *
                                                  signature_length,
                                                  u_char * salt,
                                                  size_t * salt_length,
                                                  u_char ** data_ptr);

    int             usm_check_and_update_timeliness(u_char * secEngineID,
                                                    size_t secEngineIDLen,
                                                    u_int boots_uint,
                                                    u_int time_uint,
                                                    int *error);

    SecmodSessionCallback usm_open_session;
    SecmodOutMsg    usm_secmod_generate_out_msg;
    SecmodOutMsg    usm_secmod_generate_out_msg;
    SecmodInMsg     usm_secmod_process_in_msg;
    int             usm_generate_out_msg(int, u_char *, size_t, int, int,
                                         u_char *, size_t, char *, size_t,
                                         int, u_char *, size_t, void *,
                                         u_char *, size_t *, u_char **,
                                         size_t *);
    int             usm_rgenerate_out_msg(int, u_char *, size_t, int, int,
                                          u_char *, size_t, char *, size_t,
                                          int, u_char *, size_t, void *,
                                          u_char **, size_t *, size_t *);

    int             usm_process_in_msg(int, size_t, u_char *, int, int,
                                       u_char *, size_t, u_char *,
                                       size_t *, char *, size_t *,
                                       u_char **, size_t *, size_t *,
                                       void **, netsnmp_session *, u_char);

    int             usm_check_secLevel(int level, struct usmUser *user);
    NETSNMP_IMPORT
    struct usmUser *usm_get_userList(void);
    NETSNMP_IMPORT
    struct usmUser *usm_get_user(u_char * engineID, size_t engineIDLen,
                                 char *name);
    struct usmUser *usm_get_user_from_list(u_char * engineID,
                                           size_t engineIDLen, char *name,
                                           struct usmUser *userList,
                                           int use_default);
    NETSNMP_IMPORT
    struct usmUser *usm_add_user(struct usmUser *user);
    struct usmUser *usm_add_user_to_list(struct usmUser *user,
                                         struct usmUser *userList);
    NETSNMP_IMPORT
    struct usmUser *usm_free_user(struct usmUser *user);
    NETSNMP_IMPORT
    struct usmUser *usm_create_user(void);
    NETSNMP_IMPORT
    struct usmUser *usm_create_initial_user(const char *name,
                                            const oid * authProtocol,
                                            size_t authProtocolLen,
                                            const oid * privProtocol,
                                            size_t privProtocolLen);
    NETSNMP_IMPORT
    struct usmUser *usm_cloneFrom_user(struct usmUser *from,
                                       struct usmUser *to);
    NETSNMP_IMPORT
    struct usmUser *usm_remove_user(struct usmUser *user);
    struct usmUser *usm_remove_user_from_list(struct usmUser *user,
                                              struct usmUser **userList);
    char           *get_objid(char *line, oid ** optr, size_t * len);
    NETSNMP_IMPORT
    void            usm_save_users(const char *token, const char *type);
    void            usm_save_users_from_list(struct usmUser *user,
                                             const char *token,
                                             const char *type);
    void            usm_save_user(struct usmUser *user, const char *token,
                                  const char *type);
    NETSNMP_IMPORT
    SNMPCallback    usm_store_users;
    struct usmUser *usm_read_user(const char *line);
    NETSNMP_IMPORT
    void            usm_parse_config_usmUser(const char *token,
                                             char *line);

    void            usm_set_password(const char *token, char *line);
    NETSNMP_IMPORT
    void            usm_set_user_password(struct usmUser *user,
                                          const char *token, char *line);
    void            init_usm(void);
    NETSNMP_IMPORT
    void            init_usm_conf(const char *app);
    int             init_usm_post_config(int majorid, int minorid,
                                         void *serverarg, void *clientarg);
    int             deinit_usm_post_config(int majorid, int minorid, void *serverarg,
					   void *clientarg);
    NETSNMP_IMPORT
    void            clear_user_list(void);
    NETSNMP_IMPORT
    void            shutdown_usm(void);

    NETSNMP_IMPORT
    int             usm_lookup_auth_type(const char *str);
    NETSNMP_IMPORT
    const char     *usm_lookup_auth_str(int value);
    NETSNMP_IMPORT
    oid            *usm_get_auth_oid(int auth_type, size_t *oid_len);

    NETSNMP_IMPORT
    int             usm_lookup_priv_type(const char *str);
    NETSNMP_IMPORT
    const char     *usm_lookup_priv_str(int value);
    NETSNMP_IMPORT
    oid            *usm_get_priv_oid(int priv_type, size_t *oid_len);


#define USM_CREATE_USER_AUTH_DFLT -1
#define USM_CREATE_USER_AUTH_NONE NETSNMP_USMAUTH_NONE
#define USM_CREATE_USER_AUTH_MD5  NETSNMP_USMAUTH_HMACMD5
#define USM_CREATE_USER_AUTH_SHA1 NETSNMP_USMAUTH_HMACSHA1
#define USM_CREATE_USER_AUTH_SHA  USM_CREATE_USER_AUTH_SHA1
#define USM_CREATE_USER_AUTH_SHA512  NETSNMP_USMAUTH_HMAC384SHA512
#define USM_CREATE_USER_AUTH_SHA384  NETSNMP_USMAUTH_HMAC256SHA384
#define USM_CREATE_USER_AUTH_SHA256  NETSNMP_USMAUTH_HMAC192SHA256
#define USM_CREATE_USER_AUTH_SHA224  NETSNMP_USMAUTH_HMAC128SHA224

    /** flags for variants fo priv algorithsm */
#define USM_DES_FLAG_3                      0x000100

#define USM_AES_FLAG_192                    0x000100
#define USM_AES_FLAG_256                    0x000200

#define USM_AES_REEDER_FLAG                 0x030000
#define USM_AES_FLAG_CISCO                  0x100000

#define USM_PRIV_MASK_ALG                   0x0000ff
#define USM_PRIV_MASK_VARIANT               0x00ff00

#define USM_CREATE_USER_PRIV_DFLT          -1
#define USM_CREATE_USER_PRIV_NONE           0

#define USM_CREATE_USER_PRIV_DES            0x01
#define USM_CREATE_USER_PRIV_3DES           \
    (USM_CREATE_USER_PRIV_DES | USM_DES_FLAG_3)

#define USM_CREATE_USER_PRIV_AES            0x02
#define USM_CREATE_USER_PRIV_AES192         \
    (USM_CREATE_USER_PRIV_AES | USM_AES_FLAG_192)
#define USM_CREATE_USER_PRIV_AES256         \
    (USM_CREATE_USER_PRIV_AES | USM_AES_FLAG_256)

#define USM_CREATE_USER_PRIV_AES192_CISCO   \
    (USM_CREATE_USER_PRIV_AES | USM_AES_FLAG_192 | USM_AES_FLAG_CISCO \
     | USM_AES_REEDER_FLAG)
#define USM_CREATE_USER_PRIV_AES256_CISCO   \
    (USM_CREATE_USER_PRIV_AES | USM_AES_FLAG_256 | USM_AES_FLAG_CISCO \
     | USM_AES_REEDER_FLAG)


    struct usmUser *usm_create_usmUser(const char *userName,
                                       const char *engineID, u_int flags,
                                       int authType, const char *authPass,
                                       int privType, const char *privPass,
                                       const char **errorMsg);

    NETSNMP_IMPORT
    int             usm_remove_usmUser(struct usmUser *user);

    NETSNMP_IMPORT
    int             usm_remove_usmUser_from_list(struct usmUser *user,
                                                 struct usmUser **ppuserList);

    NETSNMP_IMPORT
    struct usmUser *usm_create_usmUser_from_string(char *line,
                                                   const char **errorMsg);

    NETSNMP_IMPORT
    int             usm_create_user_from_session(netsnmp_session * session);
    SecmodPostDiscovery usm_create_user_from_session_hook;
    NETSNMP_IMPORT
    void            usm_parse_create_usmUser(const char *token,
                                             char *line);
    NETSNMP_IMPORT
    const oid      *get_default_authtype(size_t *);
    NETSNMP_IMPORT
    const oid      *get_default_privtype(size_t *);
    void            snmpv3_authtype_conf(const char *word, char *cptr);
    void            snmpv3_privtype_conf(const char *word, char *cptr);

#ifdef __cplusplus
}
#endif
#endif                          /* SNMPUSM_H */
library/callback.h000064400000005247147511501070010126 0ustar00/*
 * callback.c: A generic callback mechanism 
 */

#ifndef CALLBACK_H
#define CALLBACK_H

#ifdef __cplusplus
extern          "C" {
#endif

#define MAX_CALLBACK_IDS    2
#define MAX_CALLBACK_SUBIDS 17

    /*
     * Callback Major Types 
     */
#define SNMP_CALLBACK_LIBRARY     0
#define SNMP_CALLBACK_APPLICATION 1

    /*
     * SNMP_CALLBACK_LIBRARY minor types 
     */
#define SNMP_CALLBACK_POST_READ_CONFIG	        0
#define SNMP_CALLBACK_STORE_DATA	        1
#define SNMP_CALLBACK_SHUTDOWN		        2
#define SNMP_CALLBACK_POST_PREMIB_READ_CONFIG	3
#define SNMP_CALLBACK_LOGGING			4
#define SNMP_CALLBACK_SESSION_INIT		5
#define SNMP_CALLBACK_PRE_READ_CONFIG	        7
#define SNMP_CALLBACK_PRE_PREMIB_READ_CONFIG	8


    /*
     * Callback priority (lower priority numbers called first(
     */
#define NETSNMP_CALLBACK_HIGHEST_PRIORITY      -1024 
#define NETSNMP_CALLBACK_DEFAULT_PRIORITY       0
#define NETSNMP_CALLBACK_LOWEST_PRIORITY        1024

    typedef int     (SNMPCallback) (int majorID, int minorID,
                                    void *serverarg, void *clientarg);

    struct snmp_gen_callback {
        SNMPCallback   *sc_callback;
        void           *sc_client_arg;
        int             priority;
        struct snmp_gen_callback *next;
    };

    /*
     * function prototypes 
     */
    NETSNMP_IMPORT
    void            init_callbacks(void);

    NETSNMP_IMPORT
    int             netsnmp_register_callback(int major, int minor,
                                              SNMPCallback * new_callback,
                                              void *arg, int priority);
    NETSNMP_IMPORT
    int             snmp_register_callback(int major, int minor,
                                           SNMPCallback * new_callback,
                                           void *arg);
    NETSNMP_IMPORT
    int             snmp_call_callbacks(int major, int minor,
                                        void *caller_arg);
    NETSNMP_IMPORT
    int             snmp_callback_available(int major, int minor);      /* is >1 available */
    NETSNMP_IMPORT
    int             snmp_count_callbacks(int major, int minor); /* ret the number registered */
    NETSNMP_IMPORT
    int             snmp_unregister_callback(int major, int minor,
                                             SNMPCallback * new_callback,
                                             void *arg, int matchargs);
    NETSNMP_IMPORT
    void            clear_callback (void);
    int             netsnmp_callback_clear_client_arg(void *, int i, int j);

    struct snmp_gen_callback *snmp_callback_list(int major, int minor);

#ifdef __cplusplus
}
#endif
#endif                          /* CALLBACK_H */
library/check_varbind.h000064400000003722147511501070011150 0ustar00#ifndef SNMP_CHECK_VARBIND_H
#define SNMP_CHECK_VARBIND_H

#ifdef __cplusplus
extern          "C" {
#endif

    /*
     * Assorted convience routines to check the contents of a
     * netsnmp_variable_list instance.
     */

    int netsnmp_check_vb_type(const netsnmp_variable_list *var, int type);
    int netsnmp_check_vb_size(const netsnmp_variable_list *var, size_t size );
    int netsnmp_check_vb_max_size(const netsnmp_variable_list *var, size_t size );
    int netsnmp_check_vb_range(const netsnmp_variable_list *var,
                               size_t low, size_t high );
    int netsnmp_check_vb_size_range(const netsnmp_variable_list *var,
                                    size_t low, size_t high );

    NETSNMP_IMPORT
    int netsnmp_check_vb_type_and_size(const netsnmp_variable_list *var,
                                    int type, size_t size);
    NETSNMP_IMPORT
    int netsnmp_check_vb_type_and_max_size(const netsnmp_variable_list *var,
                                    int type, size_t size);

    NETSNMP_IMPORT
    int netsnmp_check_vb_oid(const netsnmp_variable_list *var);
    NETSNMP_IMPORT
    int netsnmp_check_vb_int(const netsnmp_variable_list *var);
    NETSNMP_IMPORT
    int netsnmp_check_vb_uint(const netsnmp_variable_list *var);
    NETSNMP_IMPORT
    int netsnmp_check_vb_int_range(const netsnmp_variable_list *var, int low,
                                   int high);

    NETSNMP_IMPORT
    int netsnmp_check_vb_truthvalue(const netsnmp_variable_list *var);

    NETSNMP_IMPORT
    int netsnmp_check_vb_rowstatus_value(const netsnmp_variable_list *var);
    NETSNMP_IMPORT
    int netsnmp_check_vb_rowstatus(const netsnmp_variable_list *var, int old_val);
    int netsnmp_check_vb_rowstatus_with_storagetype(const netsnmp_variable_list *var, int old_val, int old_storage);

    int netsnmp_check_vb_storagetype(const netsnmp_variable_list *var, int old_val);


#ifdef __cplusplus
}
#endif
#endif                          /* SNMP_CHECK_VARBIND_H */
library/README000064400000006504147511501100007070 0ustar00One of the goals of the Net-SNMP v5 development line, is to try and
clarify the distinction between the "public" library API, and routines
that are regarded as being more "internal" to the library.

  This doesn't mean that application writers are discouraged from
making use of such internal routines.  There is a strong feeling
within the development team that as much as possible of the library
should be made externally visible, to support writing as wide a
range of applications as possible.  To that end, most routines
will be declared within an installed header file, rather than
privately within the library code files themselves.

  The public/internal categorisation is rather concerned with issues
of documentation, stability, and ease of programming.  The public
API routines have been selected as those covering the more common
requirements (e.g. creating SNMP requests, sending them to other SNMP
agents, and interpreting the results), together with certain supporting
activities (e.g. run-time configuration).

  The intention is that these routines should be properly documented,
and remain relatively stable.  We will attempt to avoid changing the
profile of these interfaces, and would normally provide some mechanism
to retain backward compatability if need be.

  On the other hand, the internal API routines are regarded as just
that - "internal" - so may legitimately be changed without providing
any compatability mechanism.  You are perfectly free to make use of
these routines, but be aware that you do so "at your own risk".

[This statement is in no way intended to challenge or amend the status
 of the disclaimers in the top-level 'COPYING' file, which remain
 unchanged  as the legal basis for using this code]


  There are (currently) eight main "public API" header files, relating
to various areas of SNMP programming, plus a combined "all-in-one"
header file (net-snmp-includes.h).
  Currently these simply include the relevant library header files
following the UCD-SNMP organisation.  However, the intention is for
future releases to declare the public API calls directly within these
top-level header files, and use the 'library/*.h' files for the more
internal calls.  (i.e. those that are more likely to change over time).

  Until this process can be started, the best approximation to the
"public API" list is probably those routines that are documented
in manual pages.  Apologies for any confusion, but hopefully this
process will result in a clearer end result than at present.

Applications writers are encouraged to start #including the new header
files as soon as possible - either individually, or using the combined
wrapper file.  Hopefully, with only a handful of top-level files, it
will be reasonably clear which file(s) might be appropriate for any
particular programming requirement.



  One final disclaimer:  The above description represents my own
personal aims and understanding of the likely development of the
library API.  While I have every confidence in having the support of
the other developers (or being able to persuade them of the benefits
of this approach!), it may turn out that things actually take a different
route.  Anyone wishing to influence the organisation of the eventual
library API is encouraged to subscribe to the net-snmp-coders mailing
list, and contribute to the discussions there.

Dave Shield
February 2002
library/snmpUDPDomain.h000064400000006266147511501100011044 0ustar00#ifndef _SNMPUDPDOMAIN_H
#define _SNMPUDPDOMAIN_H

/*
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */
#ifdef __cplusplus
extern          "C" {
#endif

#include <net-snmp/library/snmp_transport.h>
#include <net-snmp/library/asn1.h>

#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif

config_require(UDPIPv4Base)
#include <net-snmp/library/snmpUDPIPv4BaseDomain.h>

NETSNMP_IMPORT
netsnmp_transport *netsnmp_udp_transport(const struct sockaddr_in *addr,
                                         int local);

NETSNMP_IMPORT
netsnmp_transport *netsnmp_udp_create_tspec(netsnmp_tdomain_spec *tspec);

NETSNMP_IMPORT
netsnmp_transport *
netsnmp_udp_transport_with_source(const struct sockaddr_in *addr, int local,
                                  const struct sockaddr_in *src_addr);

#define C2SE_ERR_SUCCESS             0
#define C2SE_ERR_MISSING_ARG        -1
#define C2SE_ERR_COMMUNITY_TOO_LONG -2
#define C2SE_ERR_SECNAME_TOO_LONG   -3
#define C2SE_ERR_CONTEXT_TOO_LONG   -4
#define C2SE_ERR_MASK_MISMATCH      -5
#define C2SE_ERR_MEMORY             -6

typedef struct com2SecEntry_s com2SecEntry;

NETSNMP_IMPORT
int         netsnmp_udp_com2SecEntry_create(com2SecEntry **entryp,
                                            const char *community,
                                            const char *secName,
                                            const char *contextName,
                                            struct in_addr *network,
                                            struct in_addr *mask,
                                            int negate);
NETSNMP_IMPORT
void        netsnmp_udp_com2Sec_free(com2SecEntry *e);

NETSNMP_IMPORT
int         netsnmp_udp_com2SecList_remove(com2SecEntry *e);

/*
 * Register any configuration tokens specific to the agent.  
 */

NETSNMP_IMPORT
void            netsnmp_udp_agent_config_tokens_register(void);

NETSNMP_IMPORT
void            netsnmp_udp_parse_security(const char *token, char *param);

NETSNMP_IMPORT
int             netsnmp_udp_getSecName(void *opaque, int olength,
                                       const char *community,
                                       size_t community_len,
                                       const char **secname,
                                       const char **contextName);

/*
 * "Constructor" for transport domain object.  
 */

void            netsnmp_udp_ctor(void);

/*
 * protected-ish functions used by other core-code
 */
char *netsnmp_udp_fmtaddr(netsnmp_transport *t, const void *data, int len);
#if defined(HAVE_IP_PKTINFO) || defined(HAVE_IP_RECVDSTADDR)
int netsnmp_udp_recvfrom(int s, void *buf, int len, struct sockaddr *from,
                         socklen_t *fromlen, struct sockaddr *dstip,
                         socklen_t *dstlen, int *if_index);
int netsnmp_udp_sendto(int fd, const struct in_addr *srcip, int if_index,
                       const struct sockaddr *remote, const void *data,
                       int len);
#endif

#ifdef __cplusplus
}
#endif
#endif/*_SNMPUDPDOMAIN_H*/
library/read_config.h000064400000014332147511501100010617 0ustar00/*
 *  read_config.h: reads configuration files for extensible sections.
 *
 */
#ifndef READ_CONFIG_H
#define READ_CONFIG_H

#ifdef __cplusplus
extern          "C" {
#endif

#define STRINGMAX 1024

#define NORMAL_CONFIG 0
#define PREMIB_CONFIG 1
#define EITHER_CONFIG 2

/*
 * Value of 'type' parameter of various snmp_config calls,
 * used by Net-SNMP client utilities.
 */
#define NETSNMP_APPLICATION_CONFIG_TYPE "snmpapp"

#include <net-snmp/config_api.h>
#include <net-snmp/library/netsnmp-attribute-format.h>

    /*
     * Defines a set of file types and the parse and free functions
     * which process the syntax following a given token in a given file.
     */
    struct config_files {
        char           *fileHeader;     /* Label for entire file. */
        struct config_line *start;
        struct config_files *next;
    };

    struct config_line {
        char           *config_token;   /* Label for each line parser
                                         * in the given file. */
        void            (*parse_line) (const char *, char *);
        void            (*free_func) (void);
        struct config_line *next;
        char            config_time;    /* {NORMAL,PREMIB,EITHER}_CONFIG */
        char           *help;
    };

    struct read_config_memory {
        char           *line;
        struct read_config_memory *next;
    };


    NETSNMP_IMPORT
    int             netsnmp_config(char *);     /* parse a simple line: token=values */
    NETSNMP_IMPORT
    void            netsnmp_config_remember(char *);    /* process later, during snmp_init() */
    void            netsnmp_config_process_memories(void);      /* run all memories through parser */
    int             read_config(const char *, struct config_line *, int);
    int             read_config_files(int);
    NETSNMP_IMPORT
    void            free_config(void);
    NETSNMP_IMPORT
    void            netsnmp_config_error(const char *, ...)
	NETSNMP_ATTRIBUTE_FORMAT(printf, 1, 2);
    NETSNMP_IMPORT
    void            netsnmp_config_warn(const char *, ...)
	NETSNMP_ATTRIBUTE_FORMAT(printf, 1, 2);

    NETSNMP_IMPORT
    char           *skip_white(char *);
    NETSNMP_IMPORT
    const char     *skip_white_const(const char *);
    NETSNMP_IMPORT
    char           *skip_not_white(char *);
    NETSNMP_IMPORT
    const char     *skip_not_white_const(const char *);
    NETSNMP_IMPORT
    char           *skip_token(char *);
    NETSNMP_IMPORT
    const char     *skip_token_const(const char *);
    NETSNMP_IMPORT
    char           *copy_nword(char *, char *, int);
    NETSNMP_IMPORT
    const char     *copy_nword_const(const char *, char *, int);
    NETSNMP_IMPORT
    char           *copy_word(char *, char *);  /* do not use */
    NETSNMP_IMPORT
    int             read_config_with_type(const char *, const char *);
    NETSNMP_IMPORT
    char           *read_config_save_octet_string(char *saveto,
                                                  const u_char * str,
                                                  size_t len);
    NETSNMP_IMPORT
    char           *read_config_read_octet_string(const char *readfrom,
                                                  u_char ** str,
                                                  size_t * len);
    NETSNMP_IMPORT
    const char     *read_config_read_octet_string_const(const char *readfrom,
                                                        u_char ** str,
                                                        size_t * len);
    NETSNMP_IMPORT
    char           *read_config_read_objid(char *readfrom, oid ** objid,
                                           size_t * len);
    const char     *read_config_read_objid_const(const char *readfrom,
                                                 oid ** objid,
                                                 size_t * len);
    NETSNMP_IMPORT
    char           *read_config_save_objid(char *saveto, oid * objid,
                                           size_t len);
    NETSNMP_IMPORT
    char           *read_config_read_data(int type, char *readfrom,
                                          void *dataptr, size_t * len);
    NETSNMP_IMPORT
    char           *read_config_read_memory(int type, char *readfrom,
                                            char *dataptr, size_t * len);
    NETSNMP_IMPORT
    char           *read_config_store_data(int type, char *storeto,
                                           void *dataptr, size_t * len);
    char           *read_config_store_data_prefix(char prefix, int type,
                                                  char *storeto,
                                                  void *dataptr, size_t len);
    int  read_config_files_of_type(int when, struct config_files *ctmp);
    NETSNMP_IMPORT
    void            read_config_store(const char *type, const char *line);
    NETSNMP_IMPORT
    void            read_app_config_store(const char *line);
    NETSNMP_IMPORT
    void            snmp_save_persistent(const char *type);
    NETSNMP_IMPORT
    void            snmp_clean_persistent(const char *type);
    struct config_line *read_config_get_handlers(const char *type);

    /*
     * external memory list handlers 
     */
    void            snmp_config_remember_in_list(char *line,
                                                 struct read_config_memory
                                                 **mem);
    void            snmp_config_process_memory_list(struct
                                                    read_config_memory
                                                    **mem, int, int);
    void            snmp_config_remember_free_list(struct
                                                   read_config_memory
                                                   **mem);

    void            set_configuration_directory(const char *dir);
    NETSNMP_IMPORT
    const char     *get_configuration_directory(void);
    void            set_persistent_directory(const char *dir);
    const char     *get_persistent_directory(void);
    void            set_temp_file_pattern(const char *pattern);
    NETSNMP_IMPORT
    const char     *get_temp_file_pattern(void);
    NETSNMP_IMPORT
    void            handle_long_opt(const char *myoptarg);


#ifdef __cplusplus
}
#endif
#endif                          /* READ_CONFIG_H */
library/container_list_ssll.h000064400000000737147511501100012435 0ustar00/*
 * container_list_sl.h
 * $Id$
 *
 */
#ifndef NETSNMP_CONTAINER_SSLL_H
#define NETSNMP_CONTAINER_SSLL_H


#include <net-snmp/library/container.h>

#ifdef  __cplusplus
extern "C" {
#endif

    netsnmp_container *netsnmp_container_get_sorted_singly_linked_list(void);
    netsnmp_container *netsnmp_container_get_singly_linked_list(int fifo);

    NETSNMP_IMPORT
    void netsnmp_container_ssll_init(void);


#ifdef  __cplusplus
}
#endif

#endif /** NETSNMP_CONTAINER_SSLL_H */
library/snmpTLSTCPDomain.h000064400000001446147511501100011420 0ustar00#ifndef _SNMPTLSTCPDOMAIN_H
#define _SNMPTLSTCPDOMAIN_H

#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif

config_require(IPv4Base)
config_require(SocketBase)
config_require(TLSBase)

#include <net-snmp/library/snmpIPv4BaseDomain.h>

#ifdef __cplusplus
extern          "C" {
#endif

#define TRANSPORT_DOMAIN_TLS_TCP_IP	1,3,6,1,6,1,8
NETSNMP_IMPORT oid netsnmpTLSTCPDomain[7];
NETSNMP_IMPORT size_t netsnmpTLSTCPDomain_len;

netsnmp_transport *netsnmp_tlstcp_transport(const char *addr_string, int local);

/*
 * Register any configuration tokens specific to the agent.  
 */

void            netsnmp_tlstcp_agent_config_tokens_register(void);

/*
 * "Constructor" for transport domain object.  
 */

void            netsnmp_tlstcp_ctor(void);

#ifdef __cplusplus
}
#endif
#endif/*_SNMPTLSTCPDOMAIN_H*/
library/snmpTLSBaseDomain.h000064400000005603147511501100011643 0ustar00#ifndef _SNMPTLSBASEDOMAIN_H
#define _SNMPTLSBASEDOMAIN_H

#ifdef __cplusplus
extern          "C" {
#endif

#include <net-snmp/library/snmp_transport.h>
#include <net-snmp/library/asn1.h>
#include <net-snmp/library/container.h>

/* OpenSSL Includes */
#include "openssl/bio.h"
#include "openssl/ssl.h"
#include "openssl/err.h"

/*
 * Prototypes
 */

    void netsnmp_tlsbase_ctor(void);
    void netsnmp_init_tlsbase(void);
    const char * _x509_get_error(int x509failvalue, const char *location);
    void _openssl_log_error(int rc, SSL *con, const char *location);

    /* will likely go away */
    SSL_CTX *get_client_ctx(void);
    SSL_CTX *get_server_ctx(void);

#define NETSNMP_TLSBASE_IS_CLIENT     0x01
#define NETSNMP_TLSBASE_CERT_FP_VERIFIED 0x02

    /*
     * _Internal_ structures
     */
    typedef struct _netsnmpTLSBaseData_s {
       int                        flags;
       SSL_CTX                   *ssl_context;
       SSL                       *ssl;
       BIO                       *sslbio;
       BIO                       *accept_bio;
       BIO                       *accepted_bio;
       char                      *securityName;
       char                      *addr_string;
       netsnmp_indexed_addr_pair *addr;
       char                      *our_identity;
       char                      *their_identity;
       char                      *their_fingerprint;
       char                      *their_hostname;
       char                      *trust_cert;
    } _netsnmpTLSBaseData;

#define VRFY_PARENT_WAS_OK 1
    typedef struct _netsnmp_verify_info_s {
       int flags;
    } _netsnmp_verify_info;

    SSL_CTX *sslctx_client_setup(const SSL_METHOD *,
                                 _netsnmpTLSBaseData *tlsbase);
    SSL_CTX *sslctx_server_setup(const SSL_METHOD *);

    int netsnmp_tlsbase_verify_server_cert(SSL *ssl,
                                           _netsnmpTLSBaseData *tlsdata);
    int netsnmp_tlsbase_verify_client_cert(SSL *ssl,
                                           _netsnmpTLSBaseData *tlsdata);
    int netsnmp_tlsbase_extract_security_name(SSL *ssl, _netsnmpTLSBaseData *tlsdata);
    _netsnmpTLSBaseData *netsnmp_tlsbase_allocate_tlsdata(netsnmp_transport *t,
                                                          int isserver);
    int netsnmp_tlsbase_wrapup_recv(netsnmp_tmStateReference *tmStateRef,
                                    _netsnmpTLSBaseData *tlsdata,
                                    void **opaque, int *olength);
    int netsnmp_tlsbase_config(struct netsnmp_transport_s *t,
                               const char *token, const char *value);

    int netsnmp_tlsbase_session_init(struct netsnmp_transport_s *,
                                     struct snmp_session *sess);
    int tls_get_verify_info_index(void);

    void netsnmp_tlsbase_free_tlsdata(_netsnmpTLSBaseData *tlsbase);
#ifdef __cplusplus
}
#endif
#endif/*_SNMPTLSBASEDOMAIN_H*/
library/snmp_logging.h000064400000010320147511501100011033 0ustar00#ifndef SNMP_LOGGING_H
#define SNMP_LOGGING_H

#include <net-snmp/types.h>
#include <net-snmp/output_api.h>

#if HAVE_SYSLOG_H
#include <syslog.h>
#endif
#include <stdio.h>
#include <stdarg.h>

#ifdef __cplusplus
extern          "C" {
#endif

#ifndef LOG_ERR
#define LOG_EMERG       0       /* system is unusable */
#define LOG_ALERT       1       /* action must be taken immediately */
#define LOG_CRIT        2       /* critical conditions */
#define LOG_ERR         3       /* error conditions */
#define LOG_WARNING     4       /* warning conditions */
#define LOG_NOTICE      5       /* normal but significant condition */
#define LOG_INFO        6       /* informational */
#define LOG_DEBUG       7       /* debug-level messages */
#endif

    struct snmp_log_message {
        int             priority;
        const char     *msg;
    };

#ifndef DEFAULT_LOG_ID
#define DEFAULT_LOG_ID "net-snmp"
#endif

#define NETSNMP_LOGONCE(x) do { \
        static char logged = 0; \
        if (!logged) {          \
            logged = 1;         \
            snmp_log x ;        \
        }                       \
    } while(0)

    void            init_snmp_logging(void);
    NETSNMP_IMPORT
    void            snmp_disable_syslog(void);
    void            snmp_disable_filelog(void);
    NETSNMP_IMPORT
    void            snmp_disable_stderrlog(void);
    void            snmp_disable_calllog(void);
    NETSNMP_IMPORT
    void            snmp_enable_syslog(void);
    NETSNMP_IMPORT
    void            snmp_enable_syslog_ident(const char *ident,
                                             const int   facility);
    NETSNMP_IMPORT
    void            snmp_enable_filelog(const char *logfilename,
                                        int dont_zero_log);
    NETSNMP_IMPORT
    void            snmp_enable_stderrlog(void);
    NETSNMP_IMPORT
    void            snmp_enable_calllog(void);

    NETSNMP_IMPORT
    int             snmp_stderrlog_status(void);


#define NETSNMP_LOGHANDLER_STDOUT	1
#define NETSNMP_LOGHANDLER_STDERR	2
#define NETSNMP_LOGHANDLER_FILE		3
#define NETSNMP_LOGHANDLER_SYSLOG	4
#define NETSNMP_LOGHANDLER_CALLBACK	5
#define NETSNMP_LOGHANDLER_NONE		6

    NETSNMP_IMPORT
    void netsnmp_set_line_buffering(FILE *stream);
    NETSNMP_IMPORT
    int snmp_log_options(char *optarg, int argc, char *const *argv);
    NETSNMP_IMPORT
    void snmp_log_options_usage(const char *lead, FILE *outf);
    NETSNMP_IMPORT
    char *snmp_log_syslogname(const char *syslogname);
    typedef struct netsnmp_log_handler_s netsnmp_log_handler; 
    typedef int (NetsnmpLogHandler)(netsnmp_log_handler*, int, const char *);

    NetsnmpLogHandler log_handler_stdouterr;
    NetsnmpLogHandler log_handler_file;
    NetsnmpLogHandler log_handler_syslog;
    NetsnmpLogHandler log_handler_callback;
    NetsnmpLogHandler log_handler_null;

    struct netsnmp_log_handler_s {
        int	enabled;
        int	priority;
        int	pri_max;
        int	type;
	const char *token;		/* Also used for filename */

	NetsnmpLogHandler	*handler;

	int     imagic;		/* E.g. file descriptor, syslog facility */
	void   *magic;		/* E.g. Callback function */

	netsnmp_log_handler	*next, *prev;
    };

NETSNMP_IMPORT
netsnmp_log_handler *get_logh_head( void );
NETSNMP_IMPORT
netsnmp_log_handler *netsnmp_register_loghandler( int type, int pri );
netsnmp_log_handler *netsnmp_find_loghandler( const char *token );
int netsnmp_add_loghandler(    netsnmp_log_handler *logh );
NETSNMP_IMPORT
int netsnmp_remove_loghandler( netsnmp_log_handler *logh );
int netsnmp_enable_loghandler( const char *token );
int netsnmp_disable_loghandler( const char *token );
NETSNMP_IMPORT
void netsnmp_enable_this_loghandler( netsnmp_log_handler *logh );
NETSNMP_IMPORT
void netsnmp_disable_this_loghandler( netsnmp_log_handler *logh );
NETSNMP_IMPORT
void netsnmp_logging_restart(void);

NETSNMP_IMPORT
netsnmp_log_handler *
netsnmp_create_stdio_loghandler(int is_stdout, int priority, int priority_max,
                                const char *tok);
NETSNMP_IMPORT
netsnmp_log_handler *
netsnmp_register_filelog_handler(const char* logfilename, int priority,
                                 int priority_max, int dont_zero_log);

#ifdef __cplusplus
}
#endif
#endif                          /* SNMP_LOGGING_H */
library/snmp_impl.h000064400000010732147511501100010355 0ustar00#ifndef SNMP_IMPL_H
#define SNMP_IMPL_H

#ifdef __cplusplus
extern          "C" {
#endif
    /*
     * * file: snmp_impl.h
     */

    /*
     * Definitions for SNMP implementation.
     *
     *
     */
/***********************************************************
	Copyright 1988, 1989 by Carnegie Mellon University

                      All Rights Reserved

Permission to use, copy, modify, and distribute this software and its 
documentation for any purpose and without fee is hereby granted, 
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in 
supporting documentation, and that the name of CMU not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.  

CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/

#include<stdio.h>
#include<net-snmp/types.h>      /* for 'u_char', etc */

#define COMMUNITY_MAX_LEN	256

    /*
     * Space for character representation of an object identifier 
     */
#define SPRINT_MAX_LEN		2560


#ifndef NULL
#define NULL 0
#endif

#ifndef TRUE
#define TRUE	1
#endif
#ifndef FALSE
#define FALSE	0
#endif

#define READ	    1
#define WRITE	    0

#define RESERVE1    0
#define RESERVE2    1
#define ACTION	    2
#define COMMIT      3
#define FREE        4
#define UNDO        5
#define FINISHED_SUCCESS        9
#define FINISHED_FAILURE	10

    /*
     * Access control statements for the agent 
     */
#define NETSNMP_OLDAPI_RONLY	0x1     /* read access only */
#define NETSNMP_OLDAPI_RWRITE	0x2     /* read and write access (must have 0x2 bit set) */
#define NETSNMP_OLDAPI_NOACCESS 0x0000  /* no access for anybody */

#ifndef NETSNMP_NO_LEGACY_DEFINITIONS
#define RONLY           NETSNMP_OLDAPI_RONLY
#define RWRITE          NETSNMP_OLDAPI_RWRITE
#define NOACCESS        NETSNMP_OLDAPI_NOACCESS
#endif

    /*
     * defined types (from the SMI, RFC 1157) 
     */
#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
#define ASN_COUNTER	(ASN_APPLICATION | 1)
#define ASN_GAUGE	(ASN_APPLICATION | 2)
#define ASN_UNSIGNED    (ASN_APPLICATION | 2)   /* RFC 1902 - same as GAUGE */
#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */

    /*
     * defined types (from the SMI, RFC 1442) 
     */
#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
#define ASN_COUNTER64   (ASN_APPLICATION | 6)
#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */

#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
    /*
     * defined types from draft-perkins-opaque-01.txt 
     */
#define ASN_FLOAT	    (ASN_APPLICATION | 8)
#define ASN_DOUBLE	    (ASN_APPLICATION | 9)
#define ASN_INTEGER64        (ASN_APPLICATION | 10)
#define ASN_UNSIGNED64       (ASN_APPLICATION | 11)
#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */

    /*
     * changed to ERROR_MSG to eliminate conflict with other includes 
     */
#ifndef ERROR_MSG
#define ERROR_MSG(string)	snmp_set_detail(string)
#endif

    /*
     * from snmp.c 
     */
    extern u_char   sid[];      /* size SID_MAX_LEN */
    NETSNMP_IMPORT int      snmp_errno;


    /*
     * For calling secauth_build, FIRST_PASS is an indication that a new nonce
     * and lastTimeStamp should be recorded.  LAST_PASS is an indication that
     * the packet should be checksummed and encrypted if applicable, in
     * preparation for transmission.
     * 0 means do neither, FIRST_PASS | LAST_PASS means do both.
     * For secauth_parse, FIRST_PASS means decrypt the packet, otherwise leave it
     * alone.  LAST_PASS is ignored.
     */
#define FIRST_PASS	1
#define	LAST_PASS	2
    u_char         *snmp_comstr_parse(u_char *, size_t *, u_char *,
                                      size_t *, long *);
    u_char         *snmp_comstr_build(u_char *, size_t *, u_char *,
                                      size_t *, long *, size_t);

    int             has_access(u_char, int, int, int);
#ifdef __cplusplus
}
#endif
#endif                          /* SNMP_IMPL_H */
library/snmp_alarm.h000064400000004627147511501100010516 0ustar00#ifndef SNMP_ALARM_H
#define SNMP_ALARM_H

#ifdef __cplusplus
extern          "C" {
#endif

    typedef void    (SNMPAlarmCallback) (unsigned int clientreg,
                                         void *clientarg);

    /*
     * alarm flags 
     */
#define SA_REPEAT 0x01          /* keep repeating every X seconds */
#define SA_FIRED 0x10          /* Being processed in run_alarms */

    struct snmp_alarm {
        /** Alarm interval. Zero if single-shot. */
        struct timeval  t;
        unsigned int    flags;
        unsigned int    clientreg;
        /** Last time the alarm fired [monotonic clock]. */
        struct timeval  t_lastM;
        /** Next time the alarm will fire [monotonic clock]. */
        struct timeval  t_nextM;
        void           *clientarg;
        SNMPAlarmCallback *thecallback;
        struct snmp_alarm *next;
    };

    /*
     * the ones you should need 
     */
    NETSNMP_IMPORT
    void            snmp_alarm_unregister(unsigned int clientreg);
    void	    snmp_alarm_unregister_all(void);
    NETSNMP_IMPORT
    unsigned int    snmp_alarm_register(unsigned int when,
                                        unsigned int flags,
                                        SNMPAlarmCallback * thecallback,
                                        void *clientarg);

    unsigned int    snmp_alarm_register_hr(struct timeval t,
                                           unsigned int flags,
                                           SNMPAlarmCallback * cb,
                                           void *cd);
    NETSNMP_IMPORT
    int             snmp_alarm_reset(unsigned int clientreg);


    /*
     * the ones you shouldn't 
     */
    NETSNMP_IMPORT void init_snmp_alarm(void);
    int             init_alarm_post_config(int majorid, int minorid,
                                           void *serverarg,
                                           void *clientarg);
    void            sa_update_entry(struct snmp_alarm *alrm);
    struct snmp_alarm *sa_find_next(void);
    NETSNMP_IMPORT void run_alarms(void);
    RETSIGTYPE      alarm_handler(int a);
    void            set_an_alarm(void);
    int             netsnmp_get_next_alarm_time(struct timeval *alarm_tm,
                                                const struct timeval *now);
    int             get_next_alarm_delay_time(struct timeval *delta);


#ifdef __cplusplus
}
#endif
#endif                          /* SNMP_ALARM_H */
library/winservice.h000064400000007027147511501100010540 0ustar00#ifndef WINSERVICE_H
#define WINSERVICE_H

    /*
     * 
     * Windows Service related functions declaration
     * By Raju Krishanppa(raju_krishnappa@yahoo.com)
     *
     */

#ifdef __cplusplus
extern "C"
{

#endif				/*  */

  /*
   * Define Constants for Register, De-register , Run As service or Console mode
   */
#define REGISTER_SERVICE 0
#define UN_REGISTER_SERVICE 1
#define RUN_AS_SERVICE 2
#define RUN_AS_CONSOLE 3


  /*
   * Error levels returned when registering or unregistering the service
  */
#define SERVICE_ERROR_NONE 0            
#define SERVICE_ERROR_SCM_OPEN 1                /* Can not open SCM */
#define SERVICE_ERROR_CREATE_SERVICE 2          /* Can not create service */
#define SERVICE_ERROR_CREATE_REGISTRY_ENTRIES 3 /* Can not create registry entries */
#define SERVICE_ERROR_OPEN_SERVICE 4            /* Can not open service (service does not exist) */
 
  /*
   * Define Message catalog ID
   * MessageId: DISPLAY_MSG
   * MessageText:  %1.
   */
#define DISPLAY_MSG                      0x00000064L

  /*
   * Hint Value to SCM to wait before sending successive commands to service
   */
#define SCM_WAIT_INTERVAL 7000

  /*
   * Define Generic String Size, to hold Error or Information
   */
#define MAX_STR_SIZE  1024

  /*
   * Delcare Global variables, which are visible to other modules 
   */
  extern BOOL g_fRunningAsService;

  /*
   * Input parameter structure to thread 
   */
  typedef struct _InputParams
  {
    DWORD Argc;
    LPTSTR *Argv;
  } InputParams;

  /*
   * Define Service Related functions
   */

  /*
   * To register application as windows service with SCM 
   */
  int RegisterService (LPCTSTR lpszServiceName,
			LPCTSTR lpszServiceDisplayName,
			LPCTSTR lpszServiceDescription, InputParams * StartUpArg, int quiet);

  /*
   * To unregister service 
   */
  int UnregisterService (LPCTSTR lpszServiceName, int quiet);

  /*
   * To parse command line for startup option 
   */
  INT ParseCmdLineForServiceOption (INT argc, TCHAR * argv[], int *quiet);

  /*
   * To write to windows event log 
   */
  VOID WriteToEventLog (WORD wType, LPCTSTR pszFormat, ...);

  /*
   * To display generic windows error 
   */
  VOID DisplayError (LPCTSTR pszTitle, int quite);

  /*
   * Service Main function,  Which will spawn a thread, and calls the
   * Service run part
   */
  VOID WINAPI ServiceMain (DWORD argc, LPTSTR argv[]);

  /*
   * To start Service 
   */

  BOOL RunAsService (INT (*ServiceFunction) (INT, LPTSTR *));

  /*
   * Call back function to process SCM Requests 
   */
  VOID WINAPI ControlHandler (DWORD dwControl);

  /*
   * To Stop the service 
   */
  VOID ProcessServiceStop (VOID);

  /*
   * To Pause service 
   */
  VOID ProcessServicePause (VOID);

  /*
   * To Continue paused service 
   */
  VOID ProcessServiceContinue (VOID);

  /*
   * To send Current Service status to SCM when INTERROGATE command is sent 
   */
  VOID ProcessServiceInterrogate (VOID);

  /*
   * To allocate and Set security descriptor 
   */
  BOOL SetSimpleSecurityAttributes (SECURITY_ATTRIBUTES * pSecurityAttr);

  /*
   * To free Security Descriptor 
   */
  VOID FreeSecurityAttributes (SECURITY_ATTRIBUTES * pSecurityAttr);

  /*
   * TheadFunction - To spawan as thread - Invokes registered service function 
   */
  unsigned WINAPI ThreadFunction (LPVOID lpParam);

  /*
   * Service STOP function registration with this framewrok
   * * this function must be invoked before calling RunAsService
   */
  VOID RegisterStopFunction (VOID (*StopFunc) (VOID));

#ifdef __cplusplus
}
#endif				/*  */
#endif				/* WINSERVICE_H */

library/default_store.h000064400000032204147511501100011215 0ustar00/* Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 */
/*
 * Portions of this file are copyrighted by:
 * Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 *
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */
/*
 * Note:
 *    If new default_store entries are added to this header file,
 *    then remember to run 'perl/default_store/gen' to update the
 *    corresponding perl interface.
 */
/*
 * @file default_store.h: storage space for defaults
 *
 * @addtogroup default_store
 *
 * @{
 */
#ifndef DEFAULT_STORE_H
#define DEFAULT_STORE_H

#include <net-snmp/net-snmp-config.h>

#ifdef __cplusplus
extern          "C" {
#endif

#define NETSNMP_DS_MAX_IDS 3
#define NETSNMP_DS_MAX_SUBIDS 48        /* needs to be a multiple of 8 */

    /*
     * begin storage definitions 
     */
/**
 * @def NETSNMP_DS_LIBRARY_ID
 * These definitions correspond with the "storid" argument to the API.
 */
#define NETSNMP_DS_LIBRARY_ID     0
#define NETSNMP_DS_APPLICATION_ID 1
#define NETSNMP_DS_TOKEN_ID       2

    /*
     * These definitions correspond with the "which" argument to the API,
     * when the storeid argument is NETSNMP_DS_LIBRARY_ID 
     */
    /*
     * library booleans 
     */
#define NETSNMP_DS_LIB_MIB_ERRORS          0
#define NETSNMP_DS_LIB_SAVE_MIB_DESCRS     1
#define NETSNMP_DS_LIB_MIB_COMMENT_TERM    2
#define NETSNMP_DS_LIB_MIB_PARSE_LABEL     3
#define NETSNMP_DS_LIB_DUMP_PACKET         4
#define NETSNMP_DS_LIB_LOG_TIMESTAMP       5
#define NETSNMP_DS_LIB_DONT_READ_CONFIGS   6    /* don't read normal config files */
#define NETSNMP_DS_LIB_DISABLE_CONFIG_LOAD      NETSNMP_DS_LIB_DONT_READ_CONFIGS
#define NETSNMP_DS_LIB_MIB_REPLACE         7    /* replace objects from latest module */
#define NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM  8    /* print only numeric enum values */
#define NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS  9    /* print only numeric enum values */
#define NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS 10   /* dont print oid indexes specially */
#define NETSNMP_DS_LIB_ALARM_DONT_USE_SIG  11   /* don't use the alarm() signal */
#define NETSNMP_DS_LIB_PRINT_FULL_OID      12   /* print fully qualified oids */
#define NETSNMP_DS_LIB_QUICK_PRINT         13   /* print very brief output for parsing */
#define NETSNMP_DS_LIB_RANDOM_ACCESS	   14   /* random access to oid labels */
#define NETSNMP_DS_LIB_REGEX_ACCESS	   15   /* regex matching to oid labels */
#define NETSNMP_DS_LIB_DONT_CHECK_RANGE    16   /* don't check values for ranges on send */
#define NETSNMP_DS_LIB_NO_TOKEN_WARNINGS   17   /* no warn about unknown config tokens */
#define NETSNMP_DS_LIB_NUMERIC_TIMETICKS   18   /* print timeticks as a number */
#define NETSNMP_DS_LIB_ESCAPE_QUOTES       19   /* shell escape quote marks in oids */
#define NETSNMP_DS_LIB_REVERSE_ENCODE      20   /* encode packets from back to front */
#define NETSNMP_DS_LIB_PRINT_BARE_VALUE	   21   /* just print value (not OID = value) */
#define NETSNMP_DS_LIB_EXTENDED_INDEX	   22   /* print extended index format [x1][x2] */
#define NETSNMP_DS_LIB_PRINT_HEX_TEXT      23   /* print ASCII text along with hex strings */
#define NETSNMP_DS_LIB_PRINT_UCD_STYLE_OID 24   /* print OID's using the UCD-style prefix suppression */
#define NETSNMP_DS_LIB_READ_UCD_STYLE_OID  25   /* require top-level OIDs to be prefixed with a dot */
#define NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG 26       /* have the pre-mib parsing config tokens been processed */
#define NETSNMP_DS_LIB_HAVE_READ_CONFIG    27   /* have the config tokens been processed */
#define NETSNMP_DS_LIB_QUICKE_PRINT        28   
#define NETSNMP_DS_LIB_DONT_PRINT_UNITS    29 /* don't print UNITS suffix */
#define NETSNMP_DS_LIB_NO_DISPLAY_HINT     30 /* don't apply DISPLAY-HINTs */
#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
#define NETSNMP_DS_LIB_DONT_PERSIST_STATE  32	/* don't load config and don't load/save persistent file */
#define NETSNMP_DS_LIB_2DIGIT_HEX_OUTPUT   33	/* print a leading 0 on hex values <= 'f' */
#define NETSNMP_DS_LIB_IGNORE_NO_COMMUNITY 34	/* don't complain if no community is specified in the command arguments */
#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD  35 /* don't load persistent file */
#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE  36 /* don't save persistent file */
#define NETSNMP_DS_LIB_APPEND_LOGFILES     37 /* append, don't overwrite, log files */
#define NETSNMP_DS_LIB_NO_DISCOVERY        38 /* don't support RFC5343 contextEngineID discovery */
#define NETSNMP_DS_LIB_TSM_USE_PREFIX      39 /* TSM's simple security name mapping */
#define NETSNMP_DS_LIB_DONT_LOAD_HOST_FILES 40 /* don't read host.conf files */
#define NETSNMP_DS_LIB_DNSSEC_WARN_ONLY     41 /* tread DNSSEC errors as warnings */
#define NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT 42 /* NETSNMP_DS_LIB_CLIENT_ADDR includes address and also port */
#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
#define NETSNMP_DS_LIB_DISABLE_V2c         44 /* disable SNMPv2c */
#define NETSNMP_DS_LIB_DISABLE_V3          45 /* disable SNMPv3 */
#define NETSNMP_DS_LIB_FILTER_SOURCE       46 /* filter pkt by source IP */
#define NETSNMP_DS_LIB_MAX_BOOL_ID         48 /* match NETSNMP_DS_MAX_SUBIDS */

    /*
     * library integers 
     */
#define NETSNMP_DS_LIB_MIB_WARNINGS         0
#define NETSNMP_DS_LIB_SECLEVEL             1
#define NETSNMP_DS_LIB_SNMPVERSION          2
#define NETSNMP_DS_LIB_DEFAULT_PORT         3
#define NETSNMP_DS_LIB_OID_OUTPUT_FORMAT    4
#define NETSNMP_DS_LIB_PRINT_SUFFIX_ONLY    NETSNMP_DS_LIB_OID_OUTPUT_FORMAT
#define NETSNMP_DS_LIB_STRING_OUTPUT_FORMAT 5
#define NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH    6
#define NETSNMP_DS_LIB_SERVERSENDBUF        7 /* send buffer (server) */
#define NETSNMP_DS_LIB_SERVERRECVBUF        8 /* receive buffer (server) */
#define NETSNMP_DS_LIB_CLIENTSENDBUF        9 /* send buffer (client) */
#define NETSNMP_DS_LIB_CLIENTRECVBUF       10 /* receive buffer (client) */
#define NETSNMP_DS_SSHDOMAIN_SOCK_PERM     11
#define NETSNMP_DS_SSHDOMAIN_DIR_PERM      12
#define NETSNMP_DS_SSHDOMAIN_SOCK_USER     12
#define NETSNMP_DS_SSHDOMAIN_SOCK_GROUP    13
#define NETSNMP_DS_LIB_TIMEOUT             14
#define NETSNMP_DS_LIB_RETRIES             15
#define NETSNMP_DS_LIB_MSG_SEND_MAX        16 /* global max response size */
#define NETSNMP_DS_LIB_FILTER_TYPE         17 /* 0=NONE, 1=whitelist, -1=blacklist */
#define NETSNMP_DS_LIB_MAX_INT_ID          48 /* match NETSNMP_DS_MAX_SUBIDS */
    
    /*
     * special meanings for the default SNMP version slot (NETSNMP_DS_LIB_SNMPVERSION) 
     */
#ifndef NETSNMP_DISABLE_SNMPV1
#define NETSNMP_DS_SNMP_VERSION_1    128        /* bogus */
#endif
#ifndef NETSNMP_DISABLE_SNMPV2C
#define NETSNMP_DS_SNMP_VERSION_2c   1  /* real */
#endif
#define NETSNMP_DS_SNMP_VERSION_3    3  /* real */


    /*
     * library strings 
     */
#define NETSNMP_DS_LIB_SECNAME           0
#define NETSNMP_DS_LIB_CONTEXT           1
#define NETSNMP_DS_LIB_PASSPHRASE        2
#define NETSNMP_DS_LIB_AUTHPASSPHRASE    3
#define NETSNMP_DS_LIB_PRIVPASSPHRASE    4
#define NETSNMP_DS_LIB_OPTIONALCONFIG    5
#define NETSNMP_DS_LIB_APPTYPE           6
#define NETSNMP_DS_LIB_COMMUNITY         7
#define NETSNMP_DS_LIB_PERSISTENT_DIR    8
#define NETSNMP_DS_LIB_CONFIGURATION_DIR 9
#define NETSNMP_DS_LIB_SECMODEL          10
#define NETSNMP_DS_LIB_MIBDIRS           11
#define NETSNMP_DS_LIB_OIDSUFFIX         12
#define NETSNMP_DS_LIB_OIDPREFIX         13
#define NETSNMP_DS_LIB_CLIENT_ADDR       14
#define NETSNMP_DS_LIB_TEMP_FILE_PATTERN 15
#define NETSNMP_DS_LIB_AUTHMASTERKEY     16
#define NETSNMP_DS_LIB_PRIVMASTERKEY     17
#define NETSNMP_DS_LIB_AUTHLOCALIZEDKEY  18
#define NETSNMP_DS_LIB_PRIVLOCALIZEDKEY  19
#define NETSNMP_DS_LIB_APPTYPES          20
#define NETSNMP_DS_LIB_KSM_KEYTAB        21
#define NETSNMP_DS_LIB_KSM_SERVICE_NAME  22
#define NETSNMP_DS_LIB_X509_CLIENT_PUB   23
#define NETSNMP_DS_LIB_X509_SERVER_PUB   24
#define NETSNMP_DS_LIB_SSHTOSNMP_SOCKET  25
#define NETSNMP_DS_LIB_CERT_EXTRA_SUBDIR 26
#define NETSNMP_DS_LIB_HOSTNAME          27
#define NETSNMP_DS_LIB_X509_CRL_FILE     28
#define NETSNMP_DS_LIB_TLS_ALGORITMS     29
#define NETSNMP_DS_LIB_TLS_LOCAL_CERT    30
#define NETSNMP_DS_LIB_TLS_PEER_CERT     31
#define NETSNMP_DS_LIB_SSH_USERNAME      32
#define NETSNMP_DS_LIB_SSH_PUBKEY        33
#define NETSNMP_DS_LIB_SSH_PRIVKEY       34
#define NETSNMP_DS_LIB_OUTPUT_PRECISION  35
#define NETSNMP_DS_LIB_MAX_STR_ID        48 /* match NETSNMP_DS_MAX_SUBIDS */

    /*
     * end storage definitions 
     */

    /*
     * macros for dynamic protocol switches
     */
#ifndef NETSNMP_FEATURE_REMOVE_RUNTIME_DISABLE_VERSION

#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)

#define NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) \
    ((pc_ver == SNMP_VERSION_1) &&                                     \
     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
                            NETSNMP_DS_LIB_DISABLE_V1))

#define NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver) \
    ((pc_ver == SNMP_VERSION_2c) &&                                     \
     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
                            NETSNMP_DS_LIB_DISABLE_V2c))

#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pc_ver, pc_target) do {    \
        if (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||                \
            NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver)) {                \
            DEBUGMSGTL(("snmp:protocol:disabled", "enforced\n"));      \
            goto pc_target;                                            \
        }                                                              \
    } while(0)
#else
#define NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) (0)
#define NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver) (0)
#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(ver, gt) do { ; } while(0)
#endif

#define NETSNMP_RUNTIME_PROTOCOL_SKIP_V3(pc_ver) \
    ((pc_ver == SNMP_VERSION_3) &&                                   \
     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                     \
                            NETSNMP_DS_LIB_DISABLE_V3))

#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V3(pc_ver, pc_target) do {      \
        if (NETSNMP_RUNTIME_PROTOCOL_SKIP_V3(pc_ver)) {                \
            DEBUGMSGTL(("snmp:protocol:disabled", "enforced\n"));      \
            goto pc_target;                                            \
        }                                                              \
    } while(0)

#define NETSNMP_RUNTIME_PROTOCOL_CHECK(pc_ver, pc_target) do {         \
        NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pc_ver, pc_target);            \
        NETSNMP_RUNTIME_PROTOCOL_CHECK_V3(pc_ver, pc_target);            \
    } while(0)

#define NETSNMP_RUNTIME_PROTOCOL_SKIP(pc_ver) \
    (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||        \
     NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver) ||        \
     NETSNMP_RUNTIME_PROTOCOL_SKIP_V3(pc_ver))

#else /* NETSNMP_FEATURE_REMOVE_RUNTIME_DISABLE_VERSION */
#define NETSNMP_RUNTIME_PROTOCOL_SKIP(pc_ver) (0)
#define NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) (0)
#define NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver) (0)
#define NETSNMP_RUNTIME_PROTOCOL_SKIP_V3(pc_ver) (0)
#define NETSNMP_RUNTIME_PROTOCOL_CHECK(ver, gt) do { ; } while(0)
#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(ver, gt) do { ; } while(0)
#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V3(ver, gt) do { ; } while(0)
#endif /* NETSNMP_FEATURE_REMOVE_RUNTIME_DISABLE_VERSION */


    NETSNMP_IMPORT
    int             netsnmp_ds_set_boolean(int storeid, int which, int value);
    NETSNMP_IMPORT
    int             netsnmp_ds_get_boolean(int storeid, int which);
    NETSNMP_IMPORT
    int             netsnmp_ds_toggle_boolean(int storeid, int which);
    NETSNMP_IMPORT
    int             netsnmp_ds_set_int(int storeid, int which, int value);
    NETSNMP_IMPORT
    int             netsnmp_ds_get_int(int storeid, int which);
    NETSNMP_IMPORT
    int             netsnmp_ds_set_string(int storeid, int which,
                                  const char *value);
    NETSNMP_IMPORT
    char           *netsnmp_ds_get_string(int storeid, int which);
    NETSNMP_IMPORT
    int             netsnmp_ds_set_void(int storeid, int which, void *value);
    NETSNMP_IMPORT
    void           *netsnmp_ds_get_void(int storeid, int which);
    NETSNMP_IMPORT
    int             netsnmp_ds_register_config(u_char type, const char *ftype,
                                       const char *token, int storeid,
                                       int which);
    NETSNMP_IMPORT
    int             netsnmp_ds_register_premib(u_char type, const char *ftype,
                                       const char *token, int storeid,
                                       int which);
    NETSNMP_IMPORT
    int             netsnmp_ds_parse_boolean(char *line);
    NETSNMP_IMPORT
    void            netsnmp_ds_shutdown(void);

#ifdef __cplusplus
}
#endif
#endif                          /* DEFAULT_STORE_H */
/** @} */
library/fd_event_manager.h000064400000012426147511501100011645 0ustar00/**************************************************************************
 * UNIT: File Descriptor (FD) Event Manager
 *
 * OVERVIEW: This unit contains functions to register a FD with the FD
 *           event manager for callbacks when activity is received on that
 *           FD.  Notification of read, write, and exception activity can 
 *           all be registered for individually.  Once a registered FD is
 *           closed by the user, the FD must be unregistered.  To use
 *           the FD Event manager you need to make calls to 
 *           netsnmp_external_event_info() and 
 *           netsnmp_dispatch_external_events() in your event loop to receive
 *           callbacks for registered events.  See snmpd.c and snmptrapd.c 
 *           for examples.
 *
 * LIMITATIONS:
 **************************************************************************/
#ifndef FD_EVENT_MANAGER_H
#define FD_EVENT_MANAGER_H

#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif

#ifdef __cplusplus
extern          "C" {
#endif

#define NUM_EXTERNAL_FDS 32
#define FD_REGISTERED_OK                 0
#define FD_REGISTRATION_FAILED          -2
#define FD_UNREGISTERED_OK               0
#define FD_NO_SUCH_REGISTRATION         -1

/* Since the inception of netsnmp_external_event_info and 
 * netsnmp_dispatch_external_events, there is no longer a need for the data 
 * below to be globally visible.  We will leave it global for now for 
 * compatibility purposes. */
extern int      external_readfd[NUM_EXTERNAL_FDS],   external_readfdlen;
extern int      external_writefd[NUM_EXTERNAL_FDS],  external_writefdlen;
extern int      external_exceptfd[NUM_EXTERNAL_FDS], external_exceptfdlen;

extern void     (*external_readfdfunc[NUM_EXTERNAL_FDS])   (int, void *);
extern void     (*external_writefdfunc[NUM_EXTERNAL_FDS])  (int, void *);
extern void     (*external_exceptfdfunc[NUM_EXTERNAL_FDS]) (int, void *);

extern void    *external_readfd_data[NUM_EXTERNAL_FDS];
extern void    *external_writefd_data[NUM_EXTERNAL_FDS];
extern void    *external_exceptfd_data[NUM_EXTERNAL_FDS];

/* Here are the key functions of this unit.  Use register_xfd to register
 * a callback to be called when there is x activity on the register fd.  
 * x can be read, write, or except (for exception).  When registering,
 * you can pass in a pointer to some data that you have allocated that
 * you would like to have back when the callback is called. */
int             register_readfd(int, void (*func)(int, void *),   void *);
int             register_writefd(int, void (*func)(int, void *),  void *);
int             register_exceptfd(int, void (*func)(int, void *), void *);

/* Unregisters a given fd for events */
int             unregister_readfd(int);
int             unregister_writefd(int);
int             unregister_exceptfd(int);

/*
 * External Event Info
 *
 * Description:
 *   Call this function to add an external event fds to your read, write, 
 *   exception fds that your application already has.  When this function
 *   returns, your fd_sets will be ready for select().  It returns the
 *   biggest fd in the fd_sets so far.
 *
 * Input Parameters: None
 *
 * Output Parameters: None
 *
 * In/Out Parameters: 
 *   numfds - The biggest fd so far.  On exit to this function, numfds
 *            could of changed since we pass out the new biggest fd.
 *   readfds - Set of read FDs that we are monitoring.  This function
 *             can modify this set to have more FDs that we are monitoring.
 *   writefds - Set of write FDs that we are monitoring.  This function
 *             can modify this set to have more FDs that we are monitoring.
 *   exceptfds - Set of exception FDs that we are monitoring.  This function
 *             can modify this set to have more FDs that we are monitoring.
 *
 * Return Value: None
 *
 * Side Effects: None
 */
NETSNMP_IMPORT
void netsnmp_external_event_info(int *numfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds);

NETSNMP_IMPORT
void netsnmp_external_event_info2(int *numfds,
                                  netsnmp_large_fd_set *readfds,
                                  netsnmp_large_fd_set *writefds,
                                  netsnmp_large_fd_set *exceptfds);

/*
 * Dispatch External Events
 *
 * Description:
 *   Call this function after select returns with pending events.  If any of
 *   them were NETSNMP external events, the registered callback will be called.
 *   The corresponding fd_set will have the FD cleared after the event is
 *   dispatched.
 *
 * Input Parameters: None
 *
 * Output Parameters: None
 *
 * In/Out Parameters: 
 *   count - Number of FDs that have activity.  In this function, we decrement
 *           count as we dispatch an event.
 *   readfds - Set of read FDs that have activity
 *   writefds - Set of write FDs that have activity
 *   exceptfds - Set of exception FDs that have activity 
 *
 * Return Value: None
 *
 * Side Effects: None
 */
NETSNMP_IMPORT
void netsnmp_dispatch_external_events(int *count, fd_set *readfds, fd_set *writefds, fd_set *exceptfds);
NETSNMP_IMPORT
void netsnmp_dispatch_external_events2(int *count,
                                       netsnmp_large_fd_set *readfds,
                                       netsnmp_large_fd_set *writefds,
                                       netsnmp_large_fd_set *exceptfds);
#ifdef __cplusplus
}
#endif
#endif
library/snmpTCPDomain.h000064400000001565147511501100011037 0ustar00#ifndef _SNMPTCPDOMAIN_H
#define _SNMPTCPDOMAIN_H

#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif

config_require(IPv4Base)
config_require(SocketBase)
config_require(TCPBase)

#ifdef NETSNMP_TRANSPORT_TCP_DOMAIN

#include <net-snmp/library/snmpIPv4BaseDomain.h>

#ifdef __cplusplus
extern          "C" {
#endif

/*
 * The SNMP over TCP over IPv4 transport domain is identified by
 * transportDomainTcpIpv4 as defined in RFC 3419.
 */

#define TRANSPORT_DOMAIN_TCP_IP		1,3,6,1,2,1,100,1,5
NETSNMP_IMPORT oid netsnmp_snmpTCPDomain[];

netsnmp_transport *netsnmp_tcp_transport(const struct sockaddr_in *addr,
                                         int local);

/*
 * "Constructor" for transport domain object.  
 */

void            netsnmp_tcp_ctor(void);

#ifdef __cplusplus
}
#endif
#endif                          /*NETSNMP_TRANSPORT_TCP_DOMAIN */

#endif/*_SNMPTCPDOMAIN_H*/
library/snmpUDPBaseDomain.h000064400000002276147511501100011634 0ustar00#ifndef SNMPUDPBASEDOMAIN_H
#define SNMPUDPBASEDOMAIN_H

config_require(SocketBase)

#include <net-snmp/library/snmp_transport.h>

#ifdef __cplusplus
extern          "C" {
#endif

/*
 * "Constructor" for transport domain object.  
 */

    void netsnmp_udp_base_ctor(void);

/*
 * Prototypes
 */
    void _netsnmp_udp_sockopt_set(int fd, int local);
    int netsnmp_udpbase_recv(netsnmp_transport *t, void *buf, int size,
                             void **opaque, int *olength);
    int netsnmp_udpbase_send(netsnmp_transport *t, const void *buf, int size,
                             void **opaque, int *olength);

#if defined(HAVE_IP_PKTINFO) || defined(HAVE_IP_RECVDSTADDR)
    int netsnmp_udpbase_recvfrom(int s, void *buf, int len,
                                 struct sockaddr *from, socklen_t *fromlen,
                                 struct sockaddr *dstip, socklen_t *dstlen,
                                 int *if_index);
    int netsnmp_udpbase_sendto(int fd, const struct in_addr *srcip,
                               int if_index, const struct sockaddr *remote,
                               const void *data, int len);
#endif

#ifdef __cplusplus
}
#endif

#endif /* SNMPUDPBASEDOMAIN_H */
library/file_utils.h000064400000004263147511501100010520 0ustar00#ifndef NETSNMP_FILE_UTILS_H
#define NETSNMP_FILE_UTILS_H

#ifdef __cplusplus
extern "C" {
#endif

    
    /*------------------------------------------------------------------
     *
     * structures
     *
     */
    typedef struct netsnmp_file_s {
        
        /** file name */
        char                   *name;
        
        /** file descriptor for the file */
        int                     fd;

        /** filesystem flags */
        int                     fs_flags;

        /** open/create mode */
        mode_t                  mode;

        /** netsnmp flags */
        u_int                   ns_flags;

        /** file stats */
        struct stat            *stats;

        /*
         * future expansion
         */
        netsnmp_data_list      *extras;

    } netsnmp_file;


    
    /*------------------------------------------------------------------
     *
     * Prototypes
     *
     */
    netsnmp_file *netsnmp_file_new(const char *name, int fs_flags, mode_t mode,
                                   u_int ns_flags);

    netsnmp_file * netsnmp_file_create(void);
    netsnmp_file * netsnmp_file_fill(netsnmp_file * filei, const char* name,
                                     int fs_flags, mode_t mode, u_int ns_flags);
    int netsnmp_file_release(netsnmp_file * filei);

    int netsnmp_file_open(netsnmp_file * filei);
    int netsnmp_file_close(netsnmp_file * filei);

    /** support netsnmp_file containers */
    int netsnmp_file_compare_name(netsnmp_file *lhs, netsnmp_file *rhs);
    void netsnmp_file_container_free(netsnmp_file *file, void *context);



    /*------------------------------------------------------------------
     *
     * flags
     *
     */
#define NETSNMP_FILE_NO_AUTOCLOSE                         0x00000001
#define NETSNMP_FILE_STATS                                0x00000002
#define NETSNMP_FILE_AUTO_OPEN                            0x00000004

    /*------------------------------------------------------------------
     *
     * macros
     *
     */
#define NS_FI_AUTOCLOSE(x) (0 == (x & NETSNMP_FILE_NO_AUTOCLOSE))
#define NS_FI_(x) (0 == (x & NETSNMP_FILE_))

    
        
#ifdef __cplusplus
}
#endif

#endif /* NETSNMP_FILE_UTILS_H */
library/snmp-tc.h000064400000003520147511501100007735 0ustar00#ifndef SNMP_TC_H
#define SNMP_TC_H

#ifdef __cplusplus
extern          "C" {
#endif
    /*
     * snmp-tc.h: Provide some standard #defines for Textual Convention
     * related value information 
     */

    int
    netsnmp_dateandtime_set_buf_from_vars(u_char *buf, size_t *bufsize,
                                          u_short y, u_char mon, u_char d,
                                          u_char h, u_char min, u_char s,
                                          u_char deci_seconds,
                                          int utc_offset_direction,
                                          u_char utc_offset_hours,
                                          u_char utc_offset_minutes);

    NETSNMP_IMPORT
    u_char         *date_n_time(const time_t *, size_t *);
    time_t          ctime_to_timet(const char *);

    /*
     * TrueValue 
     */
#define TV_TRUE 1
#define TV_FALSE 2

    /*
     * RowStatus 
     */
#define RS_NONEXISTENT    0
#define RS_ACTIVE	        1
#define RS_NOTINSERVICE	        2
#define RS_NOTREADY	        3
#define RS_CREATEANDGO	        4
#define RS_CREATEANDWAIT	5
#define RS_DESTROY		6

#define RS_IS_GOING_ACTIVE( x ) ( x == RS_CREATEANDGO || x == RS_ACTIVE )
#define RS_IS_ACTIVE( x ) ( x == RS_ACTIVE )
#define RS_IS_NOT_ACTIVE( x ) ( ! RS_IS_GOING_ACTIVE(x) )

    /*
     * StorageType 
     */
#define ST_NONE 0
#define ST_OTHER	1
#define ST_VOLATILE	2
#define ST_NONVOLATILE	3
#define ST_PERMANENT	4
#define ST_READONLY	5

    NETSNMP_IMPORT
    char            check_rowstatus_transition(int old_val, int new_val);
    NETSNMP_IMPORT
    char            check_rowstatus_with_storagetype_transition(int old_val, int new_val, int old_storage);
    NETSNMP_IMPORT
    char            check_storage_transition(int old_val, int new_val);

#ifdef __cplusplus
}
#endif
#endif                          /* SNMP_TC_H */
library/oid.h000064400000001476147511501100007137 0ustar00#ifndef NETSNMP_LIBRARY_OID_H
#define NETSNMP_LIBRARY_OID_H

#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif

#if defined(__CYGWIN__) && defined(__LP64__)
/*
 * The winExtDLL implementation assumes that the size of an OID component is
 * 32 bits. Since on the 64-bit Cygwin environment unsigned long is 64 bits
 * wide, use unsigned int instead for oids. See also the definition of
 * SnmpVarBindList on MSDN
 * (https://msdn.microsoft.com/en-us/library/windows/desktop/aa378929.aspx).
 */
typedef unsigned int oid;
#define MAX_SUBID   0xFFFFFFFFUL
#define NETSNMP_PRIo ""
#else
#ifndef EIGHTBIT_SUBIDS
typedef u_long oid;
#define MAX_SUBID   0xFFFFFFFFUL
#define NETSNMP_PRIo "l"
#else
typedef uint8_t oid;
#define MAX_SUBID   0xFF
#define NETSNMP_PRIo ""
#endif
#endif /* __CYGWIN64__ */

#endif /* NETSNMP_LIBRARY_OID_H */
library/transform_oids.h000064400000004571147511501100011414 0ustar00#ifndef _net_snmp_transform_oids_h
#define _net_snmp_transform_oids_h

#ifdef __cplusplus
extern          "C" {
#endif
/*
 * transform_oids.h
 *
 * Numeric MIB names for auth and priv transforms.
 *
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */

/** auth */
#define NETSNMP_USMAUTH_BASE_OID 1,3,6,1,6,3,10,1,1
#define NETSNMP_USMAUTH_NOAUTH            1
#define NETSNMP_USMAUTH_HMACMD5           2
#define NETSNMP_USMAUTH_HMACSHA1          3
#define NETSNMP_USMAUTH_HMACSHA           NETSNMP_USMAUTH_HMACSHA1
#define NETSNMP_USMAUTH_HMAC128SHA224     4 /* RFC 7860; OPTIONAL */
#define NETSNMP_USMAUTH_HMAC192SHA256     5 /* RFC 7860; MUST */
#define NETSNMP_USMAUTH_HMAC256SHA384     6 /* RFC 7860; OPTIONAL */
#define NETSNMP_USMAUTH_HMAC384SHA512     7 /* RFC 7860; SHOULD */

NETSNMP_IMPORT oid      usmNoAuthProtocol[10];

#ifndef NETSNMP_DISABLE_MD5
NETSNMP_IMPORT oid      usmHMACMD5AuthProtocol[10];
#endif

NETSNMP_IMPORT oid      usmHMACSHA1AuthProtocol[10];

NETSNMP_IMPORT oid      usmHMAC128SHA224AuthProtocol[10];
NETSNMP_IMPORT oid      usmHMAC192SHA256AuthProtocol[10];
NETSNMP_IMPORT oid      usmHMAC256SHA384AuthProtocol[10];
NETSNMP_IMPORT oid      usmHMAC384SHA512AuthProtocol[10];

/** priv */
NETSNMP_IMPORT oid      usmNoPrivProtocol[10];

#ifndef NETSNMP_DISABLE_DES
NETSNMP_IMPORT oid      usmDESPrivProtocol[10];
#endif

NETSNMP_IMPORT oid      usmAESPrivProtocol[10];
NETSNMP_IMPORT oid      *usmAES128PrivProtocol; /* backwards compat */

/*
 * backwards compatibility. should not be used in internal code.
 */
#define USM_AUTH_PROTO_NOAUTH_LEN 10
#define USM_AUTH_PROTO_MD5_LEN 10
#define USM_AUTH_PROTO_SHA_LEN 10
#define USM_PRIV_PROTO_NOPRIV_LEN 10
#define USM_PRIV_PROTO_DES_LEN 10

#define USM_PRIV_PROTO_AES_LEN 10
#define USM_PRIV_PROTO_AES128_LEN 10 /* backwards compat */

#ifdef NETSNMP_DRAFT_BLUMENTHAL_AES_04
NETSNMP_IMPORT oid      usmAES192PrivProtocol[9];
NETSNMP_IMPORT oid      usmAES256PrivProtocol[9];

NETSNMP_IMPORT oid      usmAES192CiscoPrivProtocol[11];
NETSNMP_IMPORT oid      usmAES256CiscoPrivProtocol[11];

NETSNMP_IMPORT oid      usmAES192Cisco2PrivProtocol[11];
NETSNMP_IMPORT oid      usmAES256Cisco2PrivProtocol[11];
#endif /* NETSNMP_DRAFT_BLUMENTHAL_AES_04 */

#ifdef __cplusplus
}
#endif
#endif
library/snmp.h000064400000033323147511501100007335 0ustar00#ifndef SNMP_H
#define SNMP_H

#ifdef __cplusplus
extern          "C" {
#endif
    /*
     * Definitions for the Simple Network Management Protocol (RFC 1067).
     *
     *
     */
/***********************************************************
	Copyright 1988, 1989 by Carnegie Mellon University

                      All Rights Reserved

Permission to use, copy, modify, and distribute this software and its 
documentation for any purpose and without fee is hereby granted, 
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in 
supporting documentation, and that the name of CMU not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.  

CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/

/*
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 */


#define SNMP_PORT	    161 /* standard UDP port for SNMP agents
                                 * to receive requests messages */
#define SNMP_TRAP_PORT	    162 /* standard UDP port for SNMP
                                 * managers to receive notificaion
                                 * (trap and inform) messages */

#define SNMP_MAX_LEN	    1500        /* typical maximum message size */
#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
#define SNMP_MAX_PACKET_LEN (0x7fffffff)

    /*
     * SNMP versions 
     */
    /*
     * There currently exists the following SNMP versions.
     * * (Note that only SNMPv1 is in widespread usage, and this code supports
     * *  only SNMPv1, SNMPv2c, and SNMPv3.
     * *
     * *  SNMPv1 - (full) the original version, defined by RFC 1157
     * *  SNMPsec - (historic) the first attempt to add strong security
     * *             to SNMPv1, defined by RFCs 1351, 1352, and 1353.
     * *  SNMPv2p - (historic) party-based SNMP, which was another
     * *             attempt to add strong security to SNMP, defined
     * *             by RFCs 1441, 1445, 1446, 1448, and 1449.
     * *  SNMPv2c - (experimental) community string-based SNMPv2,
     * *             which was an attempt to combine the protocol
     * *             operations of SNMPv2 with the security of
     * *             SNMPv1, defined by RFCs 1901, 1905, and 1906.
     * *  SNMPv2u - (experimental) user-based SNMPv2, which provided
     * *             security based on user names and protocol
     * *             operations of SNMPv2, defined by RFCs 1905,
     * *             1909, and 1910.
     * *  SNMPv2* (or SNMPv2star) - (experimental) an attempt to add the
     * *             best features of SNMPv2p and SNMPv2u, defined
     * *             by unpublished documents found at WEB site
     * *             owned by SNMP Research (a leading SNMP vendor)
     * *  SNMPv3 - the current attempt by the IETF working group to merge
     * *             the SNMPv2u and SNMPv2* proposals into a more widly
     * *             accepted SNMPv3.  It is defined by not yet published
     * *             documents of the IETF SNMPv3 WG.
     * *
     * * SNMPv1, SNMPv2c, SNMPv2u, and SNMPv3 messages have a common
     * * form, which is an ASN.1 sequence containing a message version 
     * * field, followed by version dependent fields.
     * * SNMPsec, SNMPv2p, and SNMPv2* messages have a common form,
     * * which is a tagged ASN.1 context specific sequence containing
     * * message dependent fields.
     * *
     * * In the #defines for the message versions below, the value
     * * for SNMPv1, SNMPv2c, SNMPv2u, and SNMPv3 messages is the
     * * value of the message version field. Since SNMPsec, SNMPv2p,
     * * and SNMPv2* messages do not have a message version field,
     * * the value in the defines for them is choosen to be a large
     * * arbitrary number.
     * *
     * * Note that many of the version ID's are defined below purely for
     * * documentational purposes.  At this point the only protocol planned
     * * for future implementations is SNMP3, as the other v2 protocols will
     * * not be supported by the IETF (ie, v2u, v2sec, v2star) or used by
     * * the snmp community at large (at the time of this writing).  
     */

    /*
     * versions based on version field 
     */
#ifndef NETSNMP_DISABLE_SNMPV1
#define SNMP_VERSION_1	   0
#endif
#ifndef NETSNMP_DISABLE_SNMPV2C
#define SNMP_VERSION_2c    1
#endif
#define SNMP_VERSION_2u    2    /* not (will never be) supported by this code */
#define SNMP_VERSION_3     3

    /*
     * versions not based on a version field 
     */
#define SNMP_VERSION_sec   128  /* not (will never be) supported by this code */
#define SNMP_VERSION_2p	   129  /* no longer supported by this code (> 4.0) */
#define SNMP_VERSION_2star 130  /* not (will never be) supported by this code */

    /*
     * PDU types in SNMPv1, SNMPsec, SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 
     */
#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
#ifndef NETSNMP_NO_WRITE_SUPPORT
#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
#endif /* !NETSNMP_NO_WRITE_SUPPORT */

    /*
     * PDU types in SNMPv1 and SNMPsec 
     */
#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */

    /*
     * PDU types in SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 
     */
#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */

    /*
     * PDU types in SNMPv2u, SNMPv2*, and SNMPv3 
     */
#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */

#ifndef NETSNMP_NO_WRITE_SUPPORT
    /*
     * internal modes that should never be used by the protocol for the
     * pdu type.
     *
     * All modes < 128 are reserved for SET requests.
     */
#define SNMP_MSG_INTERNAL_SET_BEGIN        -1
#define SNMP_MSG_INTERNAL_SET_RESERVE1     0    /* these should match snmp.h */
#define SNMP_MSG_INTERNAL_SET_RESERVE2     1
#define SNMP_MSG_INTERNAL_SET_ACTION       2
#define SNMP_MSG_INTERNAL_SET_COMMIT       3
#define SNMP_MSG_INTERNAL_SET_FREE         4
#define SNMP_MSG_INTERNAL_SET_UNDO         5
#define SNMP_MSG_INTERNAL_SET_MAX          6

#define SNMP_MSG_INTERNAL_CHECK_VALUE           17
#define SNMP_MSG_INTERNAL_ROW_CREATE            18
#define SNMP_MSG_INTERNAL_UNDO_SETUP            19
#define SNMP_MSG_INTERNAL_SET_VALUE             20
#define SNMP_MSG_INTERNAL_CHECK_CONSISTENCY     21
#define SNMP_MSG_INTERNAL_UNDO_SET              22
#define SNMP_MSG_INTERNAL_COMMIT                23
#define SNMP_MSG_INTERNAL_UNDO_COMMIT           24
#define SNMP_MSG_INTERNAL_IRREVERSIBLE_COMMIT   25
#define SNMP_MSG_INTERNAL_UNDO_CLEANUP          26
#endif /* !NETSNMP_NO_WRITE_SUPPORT */

    /*
     * modes > 128 for non sets.
     * Note that 160-168 overlap with SNMP ASN1 pdu types
     */
#define SNMP_MSG_INTERNAL_PRE_REQUEST           128
#define SNMP_MSG_INTERNAL_OBJECT_LOOKUP         129
#define SNMP_MSG_INTERNAL_POST_REQUEST          130
#define SNMP_MSG_INTERNAL_GET_STASH             131

    /*
     * test for member of Confirmed Class i.e., reportable 
     */
#ifdef NETSNMP_NO_WRITE_SUPPORT
#define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
                               c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET )
#else /* !NETSNMP_NO_WRITE_SUPPORT */
#define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
                               c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET || \
                               c == SNMP_MSG_SET )
#endif /* !NETSNMP_NO_WRITE_SUPPORT */

    /*
     * Exception values for SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 
     */
#define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
#define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
#define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */

    /*
     * Error codes (the value of the field error-status in PDUs) 
     */

    /*
     * in SNMPv1, SNMPsec, SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 PDUs 
     */
#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
#define SNMP_ERR_TOOBIG	                (1)
#define SNMP_ERR_NOSUCHNAME             (2)
#define SNMP_ERR_BADVALUE               (3)
#define SNMP_ERR_READONLY               (4)
#define SNMP_ERR_GENERR	                (5)

    /*
     * in SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 PDUs 
     */
#define SNMP_ERR_NOACCESS		(6)
#define SNMP_ERR_WRONGTYPE		(7)
#define SNMP_ERR_WRONGLENGTH		(8)
#define SNMP_ERR_WRONGENCODING		(9)
#define SNMP_ERR_WRONGVALUE		(10)
#define SNMP_ERR_NOCREATION		(11)
#define SNMP_ERR_INCONSISTENTVALUE	(12)
#define SNMP_ERR_RESOURCEUNAVAILABLE	(13)
#define SNMP_ERR_COMMITFAILED		(14)
#define SNMP_ERR_UNDOFAILED		(15)
#define SNMP_ERR_AUTHORIZATIONERROR	(16)
#define SNMP_ERR_NOTWRITABLE		(17)

    /*
     * in SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 PDUs 
     */
#define SNMP_ERR_INCONSISTENTNAME	(18)

#define MAX_SNMP_ERR	18

#define SNMP_VALIDATE_ERR(x)  ( (x > MAX_SNMP_ERR) ? \
                                   SNMP_ERR_GENERR : \
                                   (x < SNMP_ERR_NOERROR) ? \
                                      SNMP_ERR_GENERR : \
                                      x )

    /*
     * values of the generic-trap field in trap PDUs 
     */
#define SNMP_TRAP_COLDSTART		(0)
#define SNMP_TRAP_WARMSTART		(1)
#define SNMP_TRAP_LINKDOWN		(2)
#define SNMP_TRAP_LINKUP		(3)
#define SNMP_TRAP_AUTHFAIL		(4)
#define SNMP_TRAP_EGPNEIGHBORLOSS	(5)
#define SNMP_TRAP_ENTERPRISESPECIFIC	(6)

    /*
     * row status values 
     */
#define SNMP_ROW_NONEXISTENT		0
#define SNMP_ROW_ACTIVE			1
#define SNMP_ROW_NOTINSERVICE		2
#define SNMP_ROW_NOTREADY		3
#define SNMP_ROW_CREATEANDGO		4
#define SNMP_ROW_CREATEANDWAIT		5
#define SNMP_ROW_DESTROY		6

    /*
     * row storage values 
     */
#define SNMP_STORAGE_NONE  0
#define SNMP_STORAGE_OTHER		1
#define SNMP_STORAGE_VOLATILE		2
#define SNMP_STORAGE_NONVOLATILE	3
#define SNMP_STORAGE_PERMANENT		4
#define SNMP_STORAGE_READONLY		5

    /*
     * message processing models 
     */
#define SNMP_MP_MODEL_SNMPv1		0
#define SNMP_MP_MODEL_SNMPv2c		1
#define SNMP_MP_MODEL_SNMPv2u		2
#define SNMP_MP_MODEL_SNMPv3		3
#define SNMP_MP_MODEL_SNMPv2p		256

    /*
     * security values 
     */
#define SNMP_SEC_MODEL_ANY		0
#define SNMP_SEC_MODEL_SNMPv1		1
#define SNMP_SEC_MODEL_SNMPv2c		2
#define SNMP_SEC_MODEL_USM		3
#define SNMP_SEC_MODEL_TSM              4
#define SNMP_SEC_MODEL_SNMPv2p		256

#define SNMP_SEC_LEVEL_NOAUTH		1
#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
#define SNMP_SEC_LEVEL_AUTHPRIV		3

#define SNMP_MSG_FLAG_AUTH_BIT          0x01
#define SNMP_MSG_FLAG_PRIV_BIT          0x02
#define SNMP_MSG_FLAG_RPRT_BIT          0x04

    /*
     * control PDU handling characteristics 
     */
/** NOTE low byte used for AGENTX_MSG_FLAG_*   */
#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
#define UCD_MSG_FLAG_FORCE_PDU_COPY          0x400
#define UCD_MSG_FLAG_ALWAYS_IN_VIEW          0x800
#define UCD_MSG_FLAG_PDU_TIMEOUT            0x1000
#define UCD_MSG_FLAG_ONE_PASS_ONLY          0x2000
#define UCD_MSG_FLAG_TUNNELED               0x4000
#ifdef NETSNMP_USE_REVERSE_ASNENCODING
#define UCD_MSG_FLAG_FORWARD_ENCODE         0x8000
#endif
#define UCD_MSG_FLAG_BULK_TOOBIG          0x010000

    /*
     * view status 
     */
#define SNMP_VIEW_INCLUDED		1
#define SNMP_VIEW_EXCLUDED		2

    /*
     * basic oid values 
     */
#define SNMP_OID_INTERNET		1, 3, 6, 1
#define SNMP_OID_ENTERPRISES		SNMP_OID_INTERNET, 4, 1
#define SNMP_OID_MIB2			SNMP_OID_INTERNET, 2, 1
#define SNMP_OID_SNMPV2			SNMP_OID_INTERNET, 6
#define SNMP_OID_SNMPMODULES		SNMP_OID_SNMPV2, 3

    /*
     * lengths as defined by TCs 
     */
#define SNMPADMINLENGTH 255


    NETSNMP_IMPORT
    char           *uptime_string(u_long, char *);
    char           *uptime_string_n(u_long, char *, size_t);
    NETSNMP_IMPORT
    void            xdump(const void *, size_t, const char *);
    NETSNMP_IMPORT
    u_char         *snmp_parse_var_op(u_char *, oid *, size_t *, u_char *,
                                      size_t *, u_char **, size_t *);
    NETSNMP_IMPORT
    u_char         *snmp_build_var_op(u_char *, oid *, size_t *, u_char,
                                      size_t, u_char *, size_t *);


#ifdef NETSNMP_USE_REVERSE_ASNENCODING
    int             snmp_realloc_rbuild_var_op(u_char ** pkt,
                                               size_t * pkt_len,
                                               size_t * offset,
                                               int allow_realloc,
                                               const oid * name,
                                               size_t * name_len,
                                               u_char value_type,
                                               u_char * value,
                                               size_t value_length);
#endif

#ifdef __cplusplus
}
#endif
#endif                          /* SNMP_H */
library/snmpDTLSUDPDomain.h000064400000001534147511501100011524 0ustar00#ifndef _SNMPDTLSUDPDOMAIN_H
#define _SNMPDTLSUDPDOMAIN_H

#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif

config_require(UDP)
config_require(TLSBase)

#include <net-snmp/types.h>
#include <net-snmp/library/snmp_transport.h>

#ifdef __cplusplus
extern          "C" {
#endif

#define TRANSPORT_DOMAIN_DTLS_UDP_IP	1,3,6,1,6,1,9
NETSNMP_IMPORT oid netsnmpDTLSUDPDomain[7];
NETSNMP_IMPORT size_t netsnmpDTLSUDPDomain_len;

netsnmp_transport *netsnmp_dtlsudp_transport(const struct sockaddr_in *addr,
                                             int local);


/*
 * Register any configuration tokens specific to the agent.  
 */

void            netsnmp_dtlsudp_agent_config_tokens_register(void);

/*
 * "Constructor" for transport domain object.  
 */

void            netsnmp_dtlsudp_ctor(void);

#ifdef __cplusplus
}
#endif
#endif/*_SNMPDTLSUDPDOMAIN_H*/
library/netsnmp-attribute-format.h000064400000000624147511501100013331 0ustar00#ifndef _NETSNMP_ATTRIBUTE_FORMAT_H_
#define _NETSNMP_ATTRIBUTE_FORMAT_H_

#if !defined(__GNUC__) || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
#define NETSNMP_ATTRIBUTE_FORMAT(type, formatArg, firstArg)
#else
#define NETSNMP_ATTRIBUTE_FORMAT(type, formatArg, firstArg) \
  __attribute__((__format__( __ ## type ## __, formatArg, firstArg )))
#endif

#endif /* _NETSNMP_ATTRIBUTE_FORMAT_H_ */
library/snmpAliasDomain.h000064400000001246147511501100011436 0ustar00#ifndef _SNMPALIASDOMAIN_H
#define _SNMPALIASDOMAIN_H

#ifdef NETSNMP_TRANSPORT_ALIAS_DOMAIN

#ifdef __cplusplus
extern          "C" {
#endif

#include <net-snmp/library/snmp_transport.h>
#include <net-snmp/library/asn1.h>

/*
 * Simple aliases for complex transport strings that can be specified
 * via the snmp.conf file and the 'alias' token.
 */

#define TRANSPORT_DOMAIN_ALIAS_IP		1,3,6,1,2,1,100,1,5
NETSNMP_IMPORT oid netsnmp_snmpALIASDomain[];

/*
 * "Constructor" for transport domain object.  
 */

void            netsnmp_alias_ctor(void);

#ifdef __cplusplus
}
#endif
#endif                          /*NETSNMP_TRANSPORT_ALIAS_DOMAIN */

#endif/*_SNMPALIASDOMAIN_H*/
library/keytools.h000064400000004443147511501100010232 0ustar00/*
 * keytools.h
 */

#ifndef _KEYTOOLS_H
#define _KEYTOOLS_H

#ifdef __cplusplus
extern          "C" {
#endif


#define USM_LENGTH_EXPANDED_PASSPHRASE	(1024 * 1024)   /* 1Meg. */

#define USM_LENGTH_KU_HASHBLOCK		64      /* In bytes. */

#define USM_LENGTH_P_MIN		8       /* In characters. */
    /*
     * Recommended practice given in <draft-ietf-snmpv3-usm-v2-02.txt>,
     * * Section 11.2 "Defining Users".  Move into cmdline app argument
     * * parsing, and out of the internal routine?  XXX
     */

    /*
     * Prototypes.h
     */
    NETSNMP_IMPORT
    int             generate_Ku(const oid * hashtype, u_int hashtype_len,
                                const u_char * P, size_t pplen,
                                u_char * Ku, size_t * kulen);

    NETSNMP_IMPORT
    int             generate_kul(const oid * hashtype, u_int hashtype_len,
                                 const u_char * engineID, size_t engineID_len,
                                 const u_char * Ku, size_t ku_len,
                                 u_char * Kul, size_t * kul_len);

    NETSNMP_IMPORT
    int netsnmp_extend_kul(u_int needKeyLen, oid *hashoid, u_int hashoid_len,
                           int privType, u_char *engineID, u_int engineIDLen,
                           u_char **kulBuf, size_t *kulBufLen,
                           u_int kulBufSize);

    NETSNMP_IMPORT
    int             encode_keychange(const oid * hashtype,
                                     u_int hashtype_len, u_char * oldkey,
                                     size_t oldkey_len, u_char * newkey,
                                     size_t newkey_len, u_char * kcstring,
                                     size_t * kcstring_len);

    NETSNMP_IMPORT
    int             decode_keychange(const oid * hashtype,
                                     u_int hashtype_len, u_char * oldkey,
                                     size_t oldkey_len, u_char * kcstring,
                                     size_t kcstring_len, u_char * newkey,
                                     size_t * newkey_len);


    /*
     * All functions devolve to the following block if we can't do cryptography
     */
#define	_KEYTOOLS_NOT_AVAILABLE			\
{						\
	return SNMPERR_KT_NOT_AVAILABLE;	\
}

#ifdef __cplusplus
}
#endif
#endif                          /* _KEYTOOLS_H */
library/large_fd_set.h000064400000012452147511501100010776 0ustar00/**
 * @file  large_fd_set.h
 *
 * @brief Macro's and functions for manipulation of large file descriptor sets.
 */


#ifndef LARGE_FD_SET_H
#define LARGE_FD_SET_H


#include <net-snmp/net-snmp-config.h>
#include <net-snmp/types.h>

#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif

#if defined(HAVE_WINSOCK_H) && !defined(_WINSOCKAPI_) && !defined(_WINSOCK_H)
#error <winsock.h> or <winsock2.h> must have been included before this file.
#endif


#ifdef __cplusplus
extern "C" {
#endif



/**
 * Add socket fd to the set *fdset if not yet present.
 * Enlarges the set if necessary.
 */
#define NETSNMP_LARGE_FD_SET(fd, fdset) \
                    netsnmp_large_fd_setfd(fd, fdset)

/**
 * Remove socket fd from the set *fdset.
 * Do nothing if fd is not present in *fdset.
 * Do nothing if fd >= fdset->lfs_setsize.
 */
#define NETSNMP_LARGE_FD_CLR(fd, fdset) \
                    netsnmp_large_fd_clr(fd, fdset)

/**
 * Test whether set *fdset contains socket fd.
 * Evaluates to zero (false) if fd >= fdset->lfs_setsize.
 */
#define NETSNMP_LARGE_FD_ISSET(fd, fdset) \
                    netsnmp_large_fd_is_set(fd, fdset)

#if !defined(cygwin) && defined(HAVE_WINSOCK_H)

/**
 * Number of bytes needed to store a number of file descriptors as a
 * struct fd_set.
 */
#define NETSNMP_FD_SET_BYTES(setsize)                                   \
    (sizeof(fd_set) + ((setsize) > FD_SETSIZE ?                         \
                       ((setsize) - FD_SETSIZE) * sizeof(SOCKET) : 0))

/** Remove all sockets from the set *fdset. */
#define NETSNMP_LARGE_FD_ZERO(fdset) \
    do { (fdset)->lfs_setptr->fd_count = 0; } while(0)


NETSNMP_IMPORT
void   netsnmp_large_fd_setfd( SOCKET fd, netsnmp_large_fd_set *fdset);
NETSNMP_IMPORT
void   netsnmp_large_fd_clr(   SOCKET fd, netsnmp_large_fd_set *fdset);
NETSNMP_IMPORT
int    netsnmp_large_fd_is_set(SOCKET fd, netsnmp_large_fd_set *fdset);

#else

/**
 * Size of a single element of the array with file descriptor bitmasks.
 *
 * According to SUSv2, this array must have the name fds_bits. See also
 * <a href="http://www.opengroup.org/onlinepubs/007908775/xsh/systime.h.html">The Single UNIX Specification, Version 2, &lt;sys/time.h&gt;</a>.
 */
#define NETSNMP_FD_MASK_SIZE sizeof(((fd_set*)0)->fds_bits[0])

/** Number of bits in one element of the fd_set.fds_bits array. */
#define NETSNMP_BITS_PER_FD_MASK (8 * NETSNMP_FD_MASK_SIZE)

/** Number of elements needed for the fds_bits array. */
#define NETSNMP_FD_SET_ELEM_COUNT(setsize) \
    (setsize + NETSNMP_BITS_PER_FD_MASK - 1) / NETSNMP_BITS_PER_FD_MASK

/**
 * Number of bytes needed to store a number of file descriptors as a
 * struct fd_set.
 */
#define NETSNMP_FD_SET_BYTES(setsize)                                    \
    (sizeof(fd_set) + ((setsize) > FD_SETSIZE ?                          \
                       NETSNMP_FD_SET_ELEM_COUNT((setsize) - FD_SETSIZE) \
                       * NETSNMP_FD_MASK_SIZE : 0))

/** Remove all file descriptors from the set *fdset. */
#define NETSNMP_LARGE_FD_ZERO(fdset)                            \
    do {                                                        \
        memset((fdset)->lfs_setptr, 0,                          \
               NETSNMP_FD_SET_BYTES((fdset)->lfs_setsize));     \
    } while (0)


void   netsnmp_large_fd_setfd( int fd, netsnmp_large_fd_set *fdset);
void   netsnmp_large_fd_clr(   int fd, netsnmp_large_fd_set *fdset);
int    netsnmp_large_fd_is_set(int fd, netsnmp_large_fd_set *fdset);

#endif

/**
 * Initialize a netsnmp_large_fd_set structure.
 *
 * Note: this function only initializes the lfs_setsize and lfs_setptr
 * members of netsnmp_large_fd_set, not the file descriptor set itself.
 * The file descriptor set must be initialized separately, e.g. via
 * NETSNMP_LARGE_FD_CLR().
 */
NETSNMP_IMPORT
void   netsnmp_large_fd_set_init(   netsnmp_large_fd_set *fdset, int setsize);

/**
 * Modify the size of a file descriptor set and preserve the first
 * min(fdset->lfs_setsize, setsize) file descriptors.
 *
 * Returns 1 upon success or 0 if memory allocation failed.
 */
int    netsnmp_large_fd_set_resize( netsnmp_large_fd_set *fdset, int setsize);

/**
 * Synchronous I/O multiplexing for large file descriptor sets.
 *
 * On POSIX systems, any file descriptor set with size below numfds will be
 * resized before invoking select().
 *
 * @see See also select(2) for more information.
 */
NETSNMP_IMPORT
int    netsnmp_large_fd_set_select(int numfds, netsnmp_large_fd_set *readfds,
			    netsnmp_large_fd_set *writefds,
			    netsnmp_large_fd_set *exceptfds,
			    struct timeval *timeout);

/** Deallocate the memory allocated by netsnmp_large_fd_set_init. */
NETSNMP_IMPORT
void   netsnmp_large_fd_set_cleanup(netsnmp_large_fd_set *fdset);

/**
 * Copy an fd_set to a netsnmp_large_fd_set structure.
 *
 * @note dst must have been initialized before this function is called.
 */
void   netsnmp_copy_fd_set_to_large_fd_set(netsnmp_large_fd_set *dst,
                                                   const fd_set *src);

/**
 * Copy a netsnmp_large_fd_set structure into an fd_set.
 *
 * @return 0 upon success, -1 when copying fails because *src is too large to
 *         fit into *dst.
 */
int    netsnmp_copy_large_fd_set_to_fd_set(              fd_set *dst,
                                     const netsnmp_large_fd_set *src);

#ifdef __cplusplus
}
#endif


#endif /* LARGE_FD_SET_H */
library/tools.h000064400000023101147511501100007511 0ustar00/**
 * @file library/tools.h
 * @defgroup util Memory Utility Routines
 * @ingroup library
 * @{
 *
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */

#ifndef _TOOLS_H
#define _TOOLS_H

#ifdef HAVE_INTTYPES_H
#include <inttypes.h> /* uintptr_t */
#endif

#ifdef __cplusplus
extern          "C" {
#endif



    /*
     * General acros and constants.
     */
#ifdef WIN32
#  define SNMP_MAXPATH MAX_PATH
#else
#  ifdef PATH_MAX
#    define SNMP_MAXPATH PATH_MAX
#  else
#    ifdef MAXPATHLEN
#      define SNMP_MAXPATH MAXPATHLEN
#    else
#      define SNMP_MAXPATH 1024		/* Should be safe enough */
#    endif
#  endif
#endif

#define SNMP_MAXBUF		(1024 * 4)
#define SNMP_MAXBUF_MEDIUM	1024
#define SNMP_MAXBUF_SMALL	512

#define SNMP_MAXBUF_MESSAGE	1500

#define SNMP_MAXOID		64
#define SNMP_MAX_CMDLINE_OIDS	128

#define SNMP_FILEMODE_CLOSED	0600
#define SNMP_FILEMODE_OPEN	0644

#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
#define ROUNDUP8(x)		( ( (x+7) >> 3 ) * 8 )

#define SNMP_STRORNULL(x)       ( x ? x : "(null)")

/** @def SNMP_FREE(s)
    Frees a pointer only if it is !NULL and sets its value to NULL */
#define SNMP_FREE(s)    do { if (s) { free((void *)s); s=NULL; } } while(0)

/** @def SNMP_SWIPE_MEM(n, s)
    Frees pointer n only if it is !NULL, sets n to s and sets s to NULL */
#define SNMP_SWIPE_MEM(n,s) do { if (n) free((void *)n); n = s; s=NULL; } while(0)

    /*
     * XXX Not optimal everywhere. 
     */
/** @def SNMP_MALLOC_STRUCT(s)
    Mallocs memory of sizeof(struct s), zeros it and returns a pointer to it. */
#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))

/** @def SNMP_MALLOC_TYPEDEF(t)
    Mallocs memory of sizeof(t), zeros it and returns a pointer to it. */
#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))

/** @def SNMP_ZERO(s,l)
    Zeros l bytes of memory starting at s. */
#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)


/**
 * @def NETSNMP_REMOVE_CONST(t, e)
 *
 * Cast away constness without that gcc -Wcast-qual prints a compiler warning,
 * similar to const_cast<> in C++.
 *
 * @param[in] t A pointer type.
 * @param[in] e An expression of a type that can be assigned to the type (const t).
 */
#if defined(__GNUC__)
#define NETSNMP_REMOVE_CONST(t, e)                                      \
    (__extension__ ({ const t tmp = (e); (t)(uintptr_t)tmp; }))
#else
#define NETSNMP_REMOVE_CONST(t, e) ((t)(uintptr_t)(e))
#endif


#define TOUPPER(c)	(c >= 'a' && c <= 'z' ? c - ('a' - 'A') : c)
#define TOLOWER(c)	(c >= 'A' && c <= 'Z' ? c + ('a' - 'A') : c)

#define HEX2VAL(s) \
	((isalpha(s) ? (TOLOWER(s)-'a'+10) : (TOLOWER(s)-'0')) & 0xf)
#define VAL2HEX(s)	( (s) + (((s) >= 10) ? ('a'-10) : '0') )


/** @def SNMP_MAX(a, b)
    Computers the maximum of a and b. */
#define SNMP_MAX(a,b) ((a) > (b) ? (a) : (b))

/** @def SNMP_MIN(a, b)
    Computers the minimum of a and b. */
#define SNMP_MIN(a,b) ((a) > (b) ? (b) : (a))

/** @def SNMP_MACRO_VAL_TO_STR(s)
 *  Expands to string with value of the s. 
 *  If s is macro, the resulting string is value of the macro.
 *  Example: 
 *   \#define TEST 1234
 *   SNMP_MACRO_VAL_TO_STR(TEST) expands to "1234"
 *   SNMP_MACRO_VAL_TO_STR(TEST+1) expands to "1234+1"
 */
#define SNMP_MACRO_VAL_TO_STR(s) SNMP_MACRO_VAL_TO_STR_PRIV(s)  
#define SNMP_MACRO_VAL_TO_STR_PRIV(s) #s
	
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE  1
#endif

    /*
     * QUIT the FUNction:
     *      e       Error code variable
     *      l       Label to goto to cleanup and get out of the function.
     *
     * XXX  It would be nice if the label could be constructed by the
     *      preprocessor in context.  Limited to a single error return value.
     *      Temporary hack at best.
     */
#define QUITFUN(e, l)			\
	if ( (e) != SNMPERR_SUCCESS) {	\
		rval = SNMPERR_GENERR;	\
		goto l ;		\
	}

/**
 * Compute res = a + b.
 *
 * @pre a and b must be normalized 'struct timeval' values.
 *
 * @note res may be the same variable as one of the operands. In other
 *   words, &a == &res || &b == &res may hold.
 */
#define NETSNMP_TIMERADD(a, b, res)                  \
{                                                    \
    (res)->tv_sec  = (a)->tv_sec  + (b)->tv_sec;     \
    (res)->tv_usec = (a)->tv_usec + (b)->tv_usec;    \
    if ((res)->tv_usec >= 1000000L) {                \
        (res)->tv_usec -= 1000000L;                  \
        (res)->tv_sec++;                             \
    }                                                \
}

/**
 * Compute res = a - b.
 *
 * @pre a and b must be normalized 'struct timeval' values.
 *
 * @note res may be the same variable as one of the operands. In other
 *   words, &a == &res || &b == &res may hold.
 */
#define NETSNMP_TIMERSUB(a, b, res)                             \
{                                                               \
    (res)->tv_sec  = (a)->tv_sec  - (b)->tv_sec - 1;            \
    (res)->tv_usec = (a)->tv_usec - (b)->tv_usec + 1000000L;    \
    if ((res)->tv_usec >= 1000000L) {                           \
        (res)->tv_usec -= 1000000L;                             \
        (res)->tv_sec++;                                        \
    }                                                           \
}

#define ENGINETIME_MAX	2147483647      /* ((2^31)-1) */
#define ENGINEBOOT_MAX	2147483647      /* ((2^31)-1) */




    /*
     * Prototypes.
     */

    NETSNMP_IMPORT
    int             snmp_realloc(u_char ** buf, size_t * buf_len);

    void            free_zero(void *buf, size_t size);

    u_char         *malloc_random(size_t * size);
    u_char         *malloc_zero(size_t size);
    NETSNMP_IMPORT
    void           *netsnmp_memdup(const void * from, size_t size);
    NETSNMP_IMPORT
    void *netsnmp_memdup_nt(const void *from, size_t from_len, size_t *to_len);

    void            netsnmp_check_definedness(const void *packet,
                                              size_t length);

    NETSNMP_IMPORT
    u_int           netsnmp_binary_to_hex(u_char ** dest, size_t *dest_len,
                                          int allow_realloc,
                                          const u_char * input, size_t len);

    NETSNMP_IMPORT
    u_int           binary_to_hex(const u_char * input, size_t len,
                                  char **output);
                    /* preferred */
    int             netsnmp_hex_to_binary(u_char ** buf, size_t * buf_len,
                                         size_t * offset, int allow_realloc,
                                         const char *hex, const char *delim);
                    /* calls netsnmp_hex_to_binary w/delim of " " */
    NETSNMP_IMPORT
    int             snmp_hex_to_binary(u_char ** buf, size_t * buf_len,
                                       size_t * offset, int allow_realloc,
                                       const char *hex);
                    /* handles odd lengths */
    NETSNMP_IMPORT
    int             hex_to_binary2(const u_char * input, size_t len,
                                   char **output);

    NETSNMP_IMPORT
    int             snmp_decimal_to_binary(u_char ** buf, size_t * buf_len,
                                           size_t * out_len,
                                           int allow_realloc,
                                           const char *decimal);
#define snmp_cstrcat(b,l,o,a,s) snmp_strcat(b,l,o,a,(const u_char *)s)
    NETSNMP_IMPORT
    int             snmp_strcat(u_char ** buf, size_t * buf_len,
                                size_t * out_len, int allow_realloc,
                                const u_char * s);
    NETSNMP_IMPORT
    char           *netsnmp_strdup_and_null(const u_char * from,
                                            size_t from_len);

    NETSNMP_IMPORT
    void            dump_chunk(const char *debugtoken, const char *title,
                               const u_char * buf, int size);
    char           *dump_snmpEngineID(const u_char * buf, size_t * buflen);

    /** A pointer to an opaque time marker value. */
    typedef void   *marker_t;
    typedef const void* const_marker_t;

    NETSNMP_IMPORT
    marker_t        atime_newMarker(void);
    NETSNMP_IMPORT
    void            atime_setMarker(marker_t pm);
    NETSNMP_IMPORT
    void            netsnmp_get_monotonic_clock(struct timeval* tv);
    NETSNMP_IMPORT
    void            netsnmp_set_monotonic_marker(marker_t *pm);
    NETSNMP_IMPORT
    long            atime_diff(const_marker_t first, const_marker_t second);
    NETSNMP_IMPORT
    u_long          uatime_diff(const_marker_t first, const_marker_t second);       /* 1/1000th sec */
    NETSNMP_IMPORT
    u_long          uatime_hdiff(const_marker_t first, const_marker_t second);      /* 1/100th sec */
    NETSNMP_IMPORT
    int             atime_ready(const_marker_t pm, int delta_ms);
    NETSNMP_IMPORT
    int             netsnmp_ready_monotonic(const_marker_t pm, int delta_ms);
    int             uatime_ready(const_marker_t pm, unsigned int delta_ms);

    int             marker_tticks(const_marker_t pm);
    int             timeval_tticks(const struct timeval *tv);
    NETSNMP_IMPORT
    char            *netsnmp_getenv(const char *name);
    NETSNMP_IMPORT
    int             netsnmp_setenv(const char *envname, const char *envval,
                                   int overwrite);

    int             netsnmp_addrstr_hton(char *ptr, size_t len);

    NETSNMP_IMPORT
    int             netsnmp_string_time_to_secs(const char *time_string);

#ifdef __cplusplus
}
#endif
#endif                          /* _TOOLS_H */
/* @} */
library/snmptsm.h000064400000001605147511501100010057 0ustar00/*
 * Header file for Transport Security Model support
 */

#ifndef SNMPTSM_H
#define SNMPTSM_H

#define TSM_SEC_MODEL_NUMBER            SNMP_SEC_MODEL_TSM

#ifdef __cplusplus
extern          "C" {
#endif

    int             tsm_rgenerate_out_msg(struct
                                          snmp_secmod_outgoing_params *);
    int             tsm_process_in_msg(struct snmp_secmod_incoming_params
                                       *);
    void            init_tsm(void);

    void            shutdown_tsm(void);

    #define NETSNMP_TM_SAME_SECURITY_NOT_REQUIRED 0
    #define NETSNMP_TM_USE_SAME_SECURITY          1

    /* basically we store almost nothing else but a tm ref */
    typedef struct netsnmp_tsmSecurityReference_s {
       netsnmp_tmStateReference *tmStateRef;
    } netsnmp_tsmSecurityReference;

#ifdef __cplusplus
}
#endif
#endif                          /* SNMPTSM_H */
library/text_utils.h000064400000006633147511501100010570 0ustar00#ifndef NETSNMP_TEXT_UTILS_H
#define NETSNMP_TEXT_UTILS_H

#ifdef __cplusplus
extern "C" {
#endif

    
    /*------------------------------------------------------------------
     *
     * text file processing
     *
     */
    netsnmp_container *
    netsnmp_file_text_parse(netsnmp_file *f, netsnmp_container *cin,
                            int parse_mode, u_int flags, void *context);

#define PM_SAVE_EVERYTHING                                             1
#define PM_INDEX_STRING_STRING                                         2
#define PM_USER_FUNCTION                                               3

#define PM_FLAG_NO_CONTAINER                                  0x00000001
#define PM_FLAG_SKIP_WHITESPACE                               0x00000002


    /*
     * line processing user function
     */
    struct netsnmp_line_process_info_s; /* fwd decl */

    typedef struct netsnmp_line_info_s {

        size_t                     index;

        char                      *line;
        size_t                     line_len;
        size_t                     line_max;

        char                      *start;
        size_t                     start_len;

    } netsnmp_line_info;

    typedef int (Netsnmp_Process_Text_Line)
        (netsnmp_line_info *line_info, void *mem,
         struct netsnmp_line_process_info_s* lpi);

    typedef struct netsnmp_line_process_info_s {

        size_t                     line_max; /* defaults to STRINGMAX if 0 */
        size_t                     mem_size;

        u_int                      flags;

        Netsnmp_Process_Text_Line *process;

        void                      *user_context;
        
    } netsnmp_line_process_info;
    
/*
 * user function return codes
 */
#define PMLP_RC_STOP_PROCESSING                           -1
#define PMLP_RC_MEMORY_USED                                0
#define PMLP_RC_MEMORY_UNUSED                              1

    
/** ALLOC_LINE: wasteful, but fast */
#define PMLP_FLAG_ALLOC_LINE                               0x00000001
/** STRDUP_LINE: slower if you don't keep memory in most cases */
#define PMLP_FLAG_STRDUP_LINE                              0x00000002
/** don't strip trailing newlines */
#define PMLP_FLAG_LEAVE_NEWLINE                            0x00000004
/** don't skip blank or comment lines */
#define PMLP_FLAG_PROCESS_WHITESPACE                       0x00000008
/** just process line, don't save it */
#define PMLP_FLAG_NO_CONTAINER                             0x00000010
    

    /*
     * a few useful pre-defined helpers
     */

    typedef struct netsnmp_token_value_index_s {

        char               *token;
        netsnmp_cvalue      value;
        size_t              index;

    } netsnmp_token_value_index;

    netsnmp_container *netsnmp_text_token_container_from_file(const char *file,
                                                              u_int flags,
                                                              netsnmp_container *c,
                                                              void *context);
/*
 * flags
 */
#define NSTTC_FLAG_TYPE_CONTEXT_DIRECT                      0x00000001


#define PMLP_TYPE_UNSIGNED                                  1
#define PMLP_TYPE_INTEGER                                   2
#define PMLP_TYPE_STRING                                    3
#define PMLP_TYPE_BOOLEAN                                   4

        
#ifdef __cplusplus
}
#endif

#endif /* NETSNMP_TEXT_UTILS_H */
library/factory.h000064400000003030147511501100010017 0ustar00#ifndef NETSNMP_FACTORY_H
#define NETSNMP_FACTORY_H


#ifdef __cplusplus
extern "C" {
#endif

    typedef void * (netsnmp_factory_produce_f)(void);
    typedef int (netsnmp_factory_produce_noalloc_f)(void *);

    typedef struct netsnmp_factory_s {
        /*
         * a string describing the product the factory creates
         */
        const char                           *product;

        /*
         * a function to create an object in newly allcoated memory
         */
        netsnmp_factory_produce_f            *produce;

        /*
         * a function to create an object in previously allcoated memory
         */
        netsnmp_factory_produce_noalloc_f    *produce_noalloc;

    } netsnmp_factory;

    /*
     * init factory registry
     */
    void netsnmp_factory_init(void);

    /*
     * register a factory type
     */
    int  netsnmp_factory_register(netsnmp_factory *f);

    /*
     * get a factory
     */
    netsnmp_factory* netsnmp_factory_get(const char* product);

    /*
     * ask a factory to produce an object
     */
    void * netsnmp_factory_produce(const char* product);

    /*
     * ask a factory to produce an object in the provided memory
     */
    int netsnmp_factory_produce_noalloc(const char *product, void *memory);

    /*
     * factory return codes
     */
    enum {
        FACTORY_NOERROR = 0,
        FACTORY_EXISTS,
        FACTORY_NOTFOUND,
        FACTORY_NOMEMORY,
        FACTORY_GENERR,
        FACTORY_MAXIMUM_ERROR
    };

#ifdef __cplusplus
}
#endif


#endif /* NETSNMP_FACTORY_H */
library/int64.h000064400000004331147511501100007321 0ustar00#ifndef INT64_INCLUDED
#define INT64_INCLUDED

#ifdef __cplusplus
extern          "C" {
#endif

#ifndef NETSNMP_REMOVE_U64
    /*
     * Note: using the U64 typedef is deprecated because this typedef conflicts
     * with a typedef with the same name defined in the Perl header files.
     */
//    typedef struct counter64 U64;
#endif

#define I64CHARSZ 21

    void            divBy10(struct counter64, struct counter64 *,
                            unsigned int *);
    void            multBy10(struct counter64, struct counter64 *);
    void            incrByU16(struct counter64 *, unsigned int);
    void            incrByU32(struct counter64 *, unsigned int);
    NETSNMP_IMPORT
    void            zeroU64(struct counter64 *);
    int             isZeroU64(const struct counter64 *);
    NETSNMP_IMPORT
    void            printU64(char *, const struct counter64 *);
    NETSNMP_IMPORT
    void            printI64(char *, const struct counter64 *);
    int             read64(struct counter64 *, const char *);
    NETSNMP_IMPORT
    void            u64Subtract(const struct counter64 *pu64one,
                                const struct counter64 *pu64two,
                                struct counter64 *pu64out);
    void            u64Incr(struct counter64 *pu64out,
                            const struct counter64 *pu64one);
    void            u64UpdateCounter(struct counter64 *pu64out,
                                     const struct counter64 *pu64one,
                                     const struct counter64 *pu64two);
    void            u64Copy(struct counter64 *pu64one,
                            const struct counter64 *pu64two);

    int             netsnmp_c64_check_for_32bit_wrap(struct counter64 *old_val,
                                                     struct counter64 *new_val,
                                                     int adjust);
    NETSNMP_IMPORT
    int             netsnmp_c64_check32_and_update(struct counter64 *prev_val,
                                                   struct counter64 *new_val,
                                                   struct counter64 *old_prev_val,
                                                   int *need_wrap_check);

#ifdef __cplusplus
}
#endif
#endif
library/mib.h000064400000057553147511501100007142 0ustar00#ifndef MIB_H
#define MIB_H

#ifdef __cplusplus
extern          "C" {
#endif
    /*
     * mib.h - Definitions for the variables as defined in the MIB
     *
     * Update: 1998-07-17 <jhy@gsu.edu>
     * Added prototypes for print_oid_report* functions.
     */
/***********************************************************
	Copyright 1988, 1989 by Carnegie Mellon University

                      All Rights Reserved

Permission to use, copy, modify, and distribute this software and its 
documentation for any purpose and without fee is hereby granted, 
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in 
supporting documentation, and that the name of CMU not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.  

CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/

#include <stdio.h>              /* for FILE */

#include <net-snmp/mib_api.h>

#define NETSNMP_MIB2_OID 1, 3, 6, 1, 2, 1

#ifndef NETSNMP_NO_LEGACY_DEFINITIONS
#define MIB NETSNMP_MIB2_OID
#endif

#define MIB_IFTYPE_OTHER		    1
#define MIB_IFTYPE_REGULAR1822		    2
#define MIB_IFTYPE_HDH1822		    3
#define MIB_IFTYPE_DDNX25		    4
#define MIB_IFTYPE_RFC877X25		    5
#define MIB_IFTYPE_ETHERNETCSMACD	    6
#define MIB_IFTYPE_ISO88023CSMACD	    7
#define MIB_IFTYPE_ISO88024TOKENBUS	    8
#define MIB_IFTYPE_ISO88025TOKENRING	    9
#define MIB_IFTYPE_ISO88026MAN		    10
#define MIB_IFTYPE_STARLAN		    11
#define MIB_IFTYPE_PROTEON10MBIT	    12
#define MIB_IFTYPE_PROTEON80MBIT	    13
#define MIB_IFTYPE_HYPERCHANNEL		    14
#define MIB_IFTYPE_FDDI			    15
#define MIB_IFTYPE_LAPB			    16
#define MIB_IFTYPE_SDLC			    17
#define MIB_IFTYPE_T1CARRIER		    18
#define MIB_IFTYPE_CEPT			    19
#define MIB_IFTYPE_BASICISDN		    20
#define MIB_IFTYPE_PRIMARYISDN		    21
#define MIB_IFTYPE_PROPPOINTTOPOINTSERIAL   22

#define MIB_IFSTATUS_UP		1
#define MIB_IFSTATUS_DOWN	2
#define MIB_IFSTATUS_TESTING	3

#define MIB_FORWARD_GATEWAY	1
#define MIB_FORWARD_HOST	2

#define MIB_IPROUTETYPE_OTHER	1
#define MIB_IPROUTETYPE_INVALID	2
#define MIB_IPROUTETYPE_DIRECT	3
#define MIB_IPROUTETYPE_REMOTE	4

#define MIB_IPROUTEPROTO_OTHER	    1
#define MIB_IPROUTEPROTO_LOCAL	    2
#define MIB_IPROUTEPROTO_NETMGMT    3
#define MIB_IPROUTEPROTO_ICMP	    4
#define MIB_IPROUTEPROTO_EGP	    5
#define MIB_IPROUTEPROTO_GGP	    6
#define MIB_IPROUTEPROTO_HELLO	    7
#define MIB_IPROUTEPROTO_RIP	    8
#define MIB_IPROUTEPROTO_ISIS	    9
#define MIB_IPROUTEPROTO_ESIS	    10
#define MIB_IPROUTEPROTO_CISCOIGRP  11
#define MIB_IPROUTEPROTO_BBNSPFIGP  12
#define MIB_IPROUTEPROTO_OIGP	    13

#define MIB_TCPRTOALG_OTHER	1
#define MIB_TCPRTOALG_CONSTANT	2
#define MIB_TCPRTOALG_RSRE	3
#define MIB_TCPRTOALG_VANJ	4

#define MIB_TCPCONNSTATE_CLOSED		1
#define MIB_TCPCONNSTATE_LISTEN		2
#define MIB_TCPCONNSTATE_SYNSENT	3
#define MIB_TCPCONNSTATE_SYNRECEIVED	4
#define MIB_TCPCONNSTATE_ESTABLISHED	5
#define MIB_TCPCONNSTATE_FINWAIT1	6
#define MIB_TCPCONNSTATE_FINWAIT2	7
#define MIB_TCPCONNSTATE_CLOSEWAIT	8
#define MIB_TCPCONNSTATE_LASTACK	9
#define MIB_TCPCONNSTATE_CLOSING	10
#define MIB_TCPCONNSTATE_TIMEWAIT	11

#define MIB_EGPNEIGHSTATE_IDLE		1
#define MIB_EGPNEIGHSTATE_AQUISITION	2
#define MIB_EGPNEIGHSTATE_DOWN		3
#define MIB_EGPNEIGHSTATE_UP		4
#define MIB_EGPNEIGHSTATE_CEASE		5

    struct variable_list;
    struct enum_list;

    NETSNMP_IMPORT
    void            print_ascii_dump(FILE *);
    void            register_mib_handlers(void);
    void            netsnmp_set_mib_directory(const char *dir);
    NETSNMP_IMPORT
    char            *netsnmp_get_mib_directory(void);
    void            netsnmp_fixup_mib_directory(void);
    void            netsnmp_mibindex_load( void );
    char *          netsnmp_mibindex_lookup( const char * );
    FILE *          netsnmp_mibindex_new( const char * );
    int             sprint_realloc_description(u_char ** buf, size_t * buf_len,
                                size_t * out_len, int allow_realloc,
                                oid * objid, size_t objidlen, int width);
    NETSNMP_IMPORT
    int             get_wild_node(const char *, oid *, size_t *);
    NETSNMP_IMPORT
    int             get_node(const char *, oid *, size_t *);
    NETSNMP_IMPORT
    struct tree    *get_tree(const oid *, size_t, struct tree *);
    NETSNMP_IMPORT
    struct tree    *get_tree_head(void);
    void            set_function(struct tree *);

    NETSNMP_IMPORT
    int             parse_one_oid_index(oid ** oidStart, size_t * oidLen,
                                        netsnmp_variable_list * data,
                                        int complete);
    NETSNMP_IMPORT
    int             parse_oid_indexes(oid * oidIndex, size_t oidLen,
                                      netsnmp_variable_list * data);
    NETSNMP_IMPORT
    int             build_oid_noalloc(oid * in, size_t in_len,
                                      size_t * out_len, oid * prefix,
                                      size_t prefix_len,
                                      netsnmp_variable_list * indexes);
    NETSNMP_IMPORT
    int             build_oid(oid ** out, size_t * out_len, oid * prefix,
                              size_t prefix_len,
                              netsnmp_variable_list * indexes);
    int             build_oid_segment(netsnmp_variable_list * var);

    NETSNMP_IMPORT
    int             sprint_realloc_variable(u_char ** buf, size_t * buf_len,
                                   size_t * out_len, int allow_realloc,
                                   const oid * objid, size_t objidlen,
                                   const netsnmp_variable_list * variable);

    NETSNMP_IMPORT
#ifndef NETSNMP_DISABLE_MIB_LOADING
    struct tree    *
#else
    void
#endif
                    netsnmp_sprint_realloc_objid_tree(u_char ** buf,
                                                      size_t * buf_len,
                                                      size_t * out_len,
                                                      int allow_realloc,
                                                      int *buf_overflow,
                                                      const oid * objid,
                                                      size_t objidlen);

    NETSNMP_IMPORT
    void
                    netsnmp_sprint_realloc_objid(u_char ** buf,
                                                 size_t * buf_len,
                                                 size_t * out_len,
                                                 int allow_realloc,
                                                 int *buf_overflow,
                                                 const oid * objid,
                                                 size_t objidlen);

    NETSNMP_IMPORT
    int             sprint_realloc_value(u_char ** buf, size_t * buf_len,
                                 size_t * out_len, int allow_realloc,
                                 const oid * objid, size_t objidlen,
                                 const netsnmp_variable_list * variable);

    NETSNMP_IMPORT
    int             sprint_realloc_objid(u_char ** buf, size_t * buf_len,
                                 size_t * out_len, int allow_realloc,
                                 const oid * objid, size_t objidlen);

    NETSNMP_IMPORT
    int             sprint_realloc_by_type(u_char ** buf, size_t * buf_len,
                                           size_t * out_len,
                                           int allow_realloc,
                                           const netsnmp_variable_list * var,
                                           const struct enum_list *enums,
                                           const char *hint,
                                           const char *units);

    NETSNMP_IMPORT
    int             sprint_realloc_hexstring(u_char ** buf,
                                             size_t * buf_len,
                                             size_t * out_len,
                                             int allow_realloc,
                                             const u_char *, size_t);

    NETSNMP_IMPORT
    int             sprint_realloc_asciistring(u_char ** buf,
                                               size_t * buf_len,
                                               size_t * out_len,
                                               int allow_realloc,
                                               const u_char * cp,
                                               size_t len);

    int             sprint_realloc_octet_string(u_char ** buf,
                                                size_t * buf_len,
                                                size_t * out_len,
                                                int allow_realloc,
                                                const netsnmp_variable_list *,
                                                const struct enum_list *,
                                                const char *,
                                                const char *);

    int             sprint_realloc_opaque(u_char ** buf, size_t * buf_len,
                                          size_t * out_len,
                                          int allow_realloc,
                                          const netsnmp_variable_list *,
                                          const struct enum_list *, const char *,
                                          const char *);

    int             sprint_realloc_object_identifier(u_char ** buf,
                                                     size_t * buf_len,
                                                     size_t * out_len,
                                                     int allow_realloc,
                                                     const netsnmp_variable_list
                                                     *, const struct enum_list *,
                                                     const char *,
                                                     const char *);

    int             sprint_realloc_timeticks(u_char ** buf,
                                             size_t * buf_len,
                                             size_t * out_len,
                                             int allow_realloc,
                                             const netsnmp_variable_list *,
                                             const struct enum_list *,
                                             const char *, const char *);

    int             sprint_realloc_hinted_integer(u_char ** buf,
                                                  size_t * buf_len,
                                                  size_t * out_len,
                                                  int allow_realloc, long,
                                                  const char, const char *,
                                                  const char *);

    int             sprint_realloc_integer(u_char ** buf, size_t * buf_len,
                                           size_t * out_len,
                                           int allow_realloc,
                                           const netsnmp_variable_list *,
                                           const struct enum_list *,
                                           const char *, const char *);

    int             sprint_realloc_uinteger(u_char ** buf,
                                            size_t * buf_len,
                                            size_t * out_len,
                                            int allow_realloc,
                                            const netsnmp_variable_list *,
                                            const struct enum_list *,
                                            const char *, const char *);

    int             sprint_realloc_gauge(u_char ** buf, size_t * buf_len,
                                         size_t * out_len,
                                         int allow_realloc,
                                         const netsnmp_variable_list *,
                                         const struct enum_list *, const char *,
                                         const char *);

    int             sprint_realloc_counter(u_char ** buf, size_t * buf_len,
                                           size_t * out_len,
                                           int allow_realloc,
                                           const netsnmp_variable_list *,
                                           const struct enum_list *,
                                           const char *, const char *);

    int             sprint_realloc_networkaddress(u_char ** buf,
                                                  size_t * buf_len,
                                                  size_t * out_len,
                                                  int allow_realloc,
                                                  const netsnmp_variable_list *,
                                                  const struct enum_list *,
                                                  const char *,
                                                  const char *);

    int             sprint_realloc_ipaddress(u_char ** buf,
                                             size_t * buf_len,
                                             size_t * out_len,
                                             int allow_realloc,
                                             const netsnmp_variable_list *,
                                             const struct enum_list *,
                                             const char *, const char *);

    int             sprint_realloc_null(u_char ** buf, size_t * buf_len,
                                        size_t * out_len,
                                        int allow_realloc,
                                        const netsnmp_variable_list *,
                                        const struct enum_list *, const char *,
                                        const char *);

    int             sprint_realloc_bitstring(u_char ** buf,
                                             size_t * buf_len,
                                             size_t * out_len,
                                             int allow_realloc,
                                             const netsnmp_variable_list *,
                                             const struct enum_list *,
                                             const char *, const char *);

    int             sprint_realloc_nsapaddress(u_char ** buf,
                                               size_t * buf_len,
                                               size_t * out_len,
                                               int allow_realloc,
                                               const netsnmp_variable_list *,
                                               const struct enum_list *,
                                               const char *, const char *);

    int             sprint_realloc_counter64(u_char ** buf,
                                             size_t * buf_len,
                                             size_t * out_len,
                                             int allow_realloc,
                                             const netsnmp_variable_list *,
                                             const struct enum_list *,
                                             const char *, const char *);

    int             sprint_realloc_badtype(u_char ** buf, size_t * buf_len,
                                           size_t * out_len,
                                           int allow_realloc,
                                           const netsnmp_variable_list *,
                                           const struct enum_list *,
                                           const char *, const char *);

#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
    int             sprint_realloc_float(u_char ** buf, size_t * buf_len,
                                         size_t * out_len,
                                         int allow_realloc,
                                         const netsnmp_variable_list *,
                                         const struct enum_list *, const char *,
                                         const char *);

    int             sprint_realloc_double(u_char ** buf, size_t * buf_len,
                                          size_t * out_len,
                                          int allow_realloc,
                                          const netsnmp_variable_list *,
                                          const struct enum_list *, const char *,
                                          const char *);
#endif


    int             snprint_by_type(char *buf, size_t buf_len,
                                    netsnmp_variable_list * var,
                                    const struct enum_list *enums,
                                    const char *hint, const char *units);

    int             snprint_hexstring(char *buf, size_t buf_len,
                                      const u_char *, size_t);

    int             snprint_asciistring(char *buf, size_t buf_len,
                                        const u_char * cp, size_t len);

    int             snprint_octet_string(char *buf, size_t buf_len,
                                         const netsnmp_variable_list *,
                                         const struct enum_list *, const char *,
                                         const char *);

    int             snprint_opaque(char *buf, size_t buf_len,
                                   const netsnmp_variable_list *,
                                   const struct enum_list *, const char *,
                                   const char *);

    int             snprint_object_identifier(char *buf, size_t buf_len,
                                              const netsnmp_variable_list *,
                                              const struct enum_list *,
                                              const char *, const char *);

    int             snprint_timeticks(char *buf, size_t buf_len,
                                      const netsnmp_variable_list *,
                                      const struct enum_list *, const char *,
                                      const char *);

    int             snprint_hinted_integer(char *buf, size_t buf_len,
                                           long, const char *,
                                           const char *);

    int             snprint_integer(char *buf, size_t buf_len,
                                    const netsnmp_variable_list *,
                                    const struct enum_list *, const char *,
                                    const char *);

    int             snprint_uinteger(char *buf, size_t buf_len,
                                     const netsnmp_variable_list *,
                                     const struct enum_list *, const char *,
                                     const char *);

    int             snprint_gauge(char *buf, size_t buf_len,
                                  const netsnmp_variable_list *,
                                  const struct enum_list *, const char *,
                                  const char *);

    int             snprint_counter(char *buf, size_t buf_len,
                                    const netsnmp_variable_list *,
                                    const struct enum_list *, const char *,
                                    const char *);

    int             snprint_networkaddress(char *buf, size_t buf_len,
                                           const netsnmp_variable_list *,
                                           const struct enum_list *,
                                           const char *, const char *);

    int             snprint_ipaddress(char *buf, size_t buf_len,
                                      const netsnmp_variable_list *,
                                      const struct enum_list *, const char *,
                                      const char *);

    int             snprint_null(char *buf, size_t buf_len,
                                 const netsnmp_variable_list *,
                                 const struct enum_list *, const char *,
                                 const char *);

    NETSNMP_IMPORT
    int             snprint_bitstring(char *buf, size_t buf_len,
                                      const netsnmp_variable_list *,
                                      const struct enum_list *, const char *,
                                      const char *);

    int             snprint_nsapaddress(char *buf, size_t buf_len,
                                        const netsnmp_variable_list *,
                                        const struct enum_list *, const char *,
                                        const char *);

    int             snprint_counter64(char *buf, size_t buf_len,
                                      const netsnmp_variable_list *,
                                      const struct enum_list *, const char *,
                                      const char *);

    int             snprint_badtype(char *buf, size_t buf_len,
                                    const netsnmp_variable_list *,
                                    const struct enum_list *, const char *,
                                    const char *);

#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
    int             snprint_float(char *buf, size_t buf_len,
                                  const netsnmp_variable_list *,
                                  const struct enum_list *, const char *,
                                  const char *);

    int             snprint_double(char *buf, size_t buf_len,
                                   const netsnmp_variable_list *,
                                   const struct enum_list *, const char *,
                                   const char *);
#endif

    NETSNMP_IMPORT
    void            print_oid_report(FILE *);
    NETSNMP_IMPORT
    void            print_oid_report_enable_labeledoid(void);
    NETSNMP_IMPORT
    void            print_oid_report_enable_oid(void);
    NETSNMP_IMPORT
    void            print_oid_report_enable_suffix(void);
    NETSNMP_IMPORT
    void            print_oid_report_enable_symbolic(void);
    NETSNMP_IMPORT
    void            print_oid_report_enable_mibchildoid(void);

    const char     *parse_octet_hint(const char *hint, const char *value,
	                             unsigned char **new_val, int *new_val_len);

    NETSNMP_IMPORT
    void            clear_tree_flags(register struct tree *tp);

    NETSNMP_IMPORT
    char           *snmp_out_toggle_options(char *);
    NETSNMP_IMPORT
    char           *snmp_out_options(char *, int, char * const *);
    NETSNMP_IMPORT
    void            snmp_out_toggle_options_usage(const char *, FILE *);
    NETSNMP_IMPORT
    char           *snmp_in_toggle_options(char *);
    NETSNMP_IMPORT
    char           *snmp_in_options(char *, int, char * const *);
    NETSNMP_IMPORT
    void            snmp_in_toggle_options_usage(const char *, FILE *);
    NETSNMP_IMPORT
    u_char          mib_to_asn_type(int mib_type);


    int             netsnmp_str2oid(const char *S, oid * O, int L);
    char            *make_printf_format_string(const char *);


#define NETSNMP_STRING_OUTPUT_GUESS  1
#define NETSNMP_STRING_OUTPUT_ASCII  2
#define NETSNMP_STRING_OUTPUT_HEX    3

#define NETSNMP_OID_OUTPUT_SUFFIX  1
#define NETSNMP_OID_OUTPUT_MODULE  2
#define NETSNMP_OID_OUTPUT_FULL    3
#define NETSNMP_OID_OUTPUT_NUMERIC 4
#define NETSNMP_OID_OUTPUT_UCD     5
#define NETSNMP_OID_OUTPUT_NONE    6
#ifdef __cplusplus
}
#endif
#endif                          /* MIB_H */
library/snmpUDPIPv6Domain.h000064400000004733147511501100011546 0ustar00#ifndef _SNMPUDPIPV6DOMAIN_H
#define _SNMPUDPIPV6DOMAIN_H

/*
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */

#include <net-snmp/types.h>

#ifdef __cplusplus
extern          "C" {
#endif

#include <net-snmp/library/snmp_transport.h>

config_require(IPv6Base)
config_require(UDPBase)

#include <net-snmp/library/snmpIPv6BaseDomain.h>

/*
 * The SNMP over UDP over IPv6 transport domain is identified by
 * transportDomainUdpIpv6 as defined in RFC 3419.
 */

#define TRANSPORT_DOMAIN_UDP_IPV6	1,3,6,1,2,1,100,1,2
NETSNMP_IMPORT oid      netsnmp_UDPIPv6Domain[];

netsnmp_transport *netsnmp_udp6_transport(const struct sockaddr_in6 *addr,
                                          int local);

netsnmp_transport *
netsnmp_udp6_transport_with_source(const struct sockaddr_in6 *addr, int local,
                                   const struct sockaddr_in6 *src_addr);

    /** internal functions for derivatives of udpipv6 */

    netsnmp_transport *
    netsnmp_udp6_transport_init(const struct sockaddr_in6 *addr, int local);

    int
    netsnmp_udp6_transport_socket(int flags);

    int
    netsnmp_udp6_transport_bind(netsnmp_transport *t,
                                const struct sockaddr_in6 *addr, int flags);

    void
    netsnmp_udp6_transport_get_bound_addr(netsnmp_transport *t);


/*
 * Convert a "traditional" peername into a sockaddr_in6 structure which is
 * written to *addr.  Returns 1 if the conversion was successful, or 0 if it
 * failed.
 */

int             netsnmp_sockaddr_in6(struct sockaddr_in6 *addr,
                                     const char *peername,
                                     int remote_port);

NETSNMP_IMPORT
void            netsnmp_udp6_agent_config_tokens_register(void);
NETSNMP_IMPORT
void            netsnmp_udp6_parse_security(const char *token,
                                            char *param);

NETSNMP_IMPORT
int             netsnmp_udp6_getSecName(void *opaque, int olength,
                                        const char *community,
                                        int community_len,
                                        const char **secname,
                                        const char **contextName);

/*
 * "Constructor" for transport domain object.
 */

NETSNMP_IMPORT void netsnmp_udpipv6_ctor(void);

#ifdef __cplusplus
}
#endif
#endif/*_SNMPUDPIPV6DOMAIN_H*/
library/snmp_debug.h000064400000022061147511501100010500 0ustar00/*
 * Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 *
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */

#ifndef SNMP_DEBUG_H
#define SNMP_DEBUG_H

#include <net-snmp/library/netsnmp-attribute-format.h>

#ifdef __cplusplus
extern          "C" {
#endif

    /*
     * snmp_debug.h:
     * 
     * - prototypes for snmp debugging routines.
     * - easy to use macros to wrap around the functions.  This also provides
     * the ability to remove debugging code easily from the applications at
     * compile time.
     */

    /*
     * These functions should not be used, if at all possible.  Instead, use
     * the macros below. 
     */
    NETSNMP_IMPORT
    void            debugmsg(const char *token, const char *format, ...)
                        NETSNMP_ATTRIBUTE_FORMAT(printf, 2, 3);
    NETSNMP_IMPORT
    void            debugmsgtoken(const char *token, const char *format,
                                  ...)
                        NETSNMP_ATTRIBUTE_FORMAT(printf, 2, 3);
    NETSNMP_IMPORT
    void            debug_combo_nc(const char *token, const char *format,
                                   ...)
                        NETSNMP_ATTRIBUTE_FORMAT(printf, 2, 3);
    NETSNMP_IMPORT
    void            debugmsg_oid(const char *token, const oid * theoid,
                                 size_t len);
    NETSNMP_IMPORT
    void            debugmsg_suboid(const char *token, const oid * theoid,
                                    size_t len);
    NETSNMP_IMPORT
    void            debugmsg_var(const char *token,
                                 netsnmp_variable_list * var);
    NETSNMP_IMPORT
    void            debugmsg_oidrange(const char *token,
                                      const oid * theoid, size_t len,
                                      size_t var_subid, oid range_ubound);
    NETSNMP_IMPORT
    void            debugmsg_hex(const char *token, const u_char * thedata,
                                 size_t len);
    NETSNMP_IMPORT
    void            debugmsg_hextli(const char *token, const u_char * thedata,
                                    size_t len);
    NETSNMP_IMPORT
    void            debug_indent_add(int amount);
    NETSNMP_IMPORT
    void            debug_indent_reset(void);
    NETSNMP_IMPORT
    int             debug_indent_get(void);
    NETSNMP_IMPORT
    void            debug_indent_reset(void);
    /*
     * What is said above is true for this function as well. Further this
     * function is deprecated and only provided for backwards compatibility.
     * Please use "%*s", debug_indent_get(), "" if you used this one before.
     */
    NETSNMP_IMPORT
    const char     *debug_indent(void);

    /*
     * Use these macros instead of the functions above to allow them to be
     * re-defined at compile time to NOP for speed optimization.
     * 
     * They need to be called enclosing all the arguments in a single set of ()s.
     * Example:
     * DEBUGMSGTL(("token", "debugging of something %s related\n", "snmp"));
     * 
     * Usage:
     * All of the functions take a "token" argument that helps determine when
     * the output in question should be printed.  See the snmpcmd.1 manual page
     * on the -D flag to turn on/off output for a given token on the command line.
     * 
     * DEBUGMSG((token, format, ...)):      equivalent to printf(format, ...)
     * (if "token" debugging output
     * is requested by the user)
     * 
     * DEBUGMSGT((token, format, ...)):     equivalent to DEBUGMSG, but prints
     * "token: " at the beginning of the
     * line for you.
     * 
     * DEBUGTRACE                           Insert this token anywhere you want
     * tracing output displayed when the
     * "trace" debugging token is selected.
     * 
     * DEBUGMSGL((token, format, ...)):     equivalent to DEBUGMSG, but includes
     * DEBUGTRACE debugging line just before
     * yours.
     * 
     * DEBUGMSGTL((token, format, ...)):    Same as DEBUGMSGL and DEBUGMSGT
     * combined.
     * 
     * Important:
     * It is considered best if you use DEBUGMSGTL() everywhere possible, as it
     * gives the nicest format output and provides tracing support just before
     * every debugging statement output.
     * 
     * To print multiple pieces to a single line in one call, use:
     * 
     * DEBUGMSGTL(("token", "line part 1"));
     * DEBUGMSG  (("token", " and part 2\n"));
     * 
     * to get:
     * 
     * token: line part 1 and part 2
     * 
     * as debugging output.
     *
     *
     * Each of these macros also have a version with a suffix of '_NC'. The
     * NC suffix stands for 'No Check', which means that no check will be
     * performed to see if debug is enabled or if the token has been turned
     * on. These NC versions are intended for use within a DEBUG_IF {} block,
     * where the debug/token check has already been performed.
     */

#ifndef NETSNMP_NO_DEBUGGING       /* make sure we're wanted */

    /*
     * define two macros : one macro with, one without,
     *                     a test if debugging is enabled.
     * 
     * Generally, use the macro with _DBG_IF_
     */

/******************* Start private macros ************************/
#define _DBG_IF_            snmp_get_do_debugging()
#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)

#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
#define __DBGMSG_NC(x)   debugmsg x
#define __DBGMSGT_NC(x)  debug_combo_nc x
#define __DBGMSGL_NC(x)  __DBGTRACE; debugmsg x
#define __DBGMSGTL_NC(x) __DBGTRACE; debug_combo_nc x

#ifdef  NETSNMP_FUNCTION
#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
				NETSNMP_FUNCTION,__FILE__,__LINE__))
#define __DBGTRACETOK(x) __DBGMSGT((x,"%s(): %s, %d:\n",       \
                                    NETSNMP_FUNCTION,__FILE__,__LINE__))
#else
#define __DBGTRACE       __DBGMSGT(("trace"," %s, %d:\n", __FILE__,__LINE__))
#define __DBGTRACETOK(x) __DBGMSGT((x," %s, %d:\n", __FILE__,__LINE__))
#endif

#define __DBGMSGL(x)     __DBGTRACE, debugmsg x
#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
#define __DBGMSGOID(x)     debugmsg_oid x
#define __DBGMSGSUBOID(x)  debugmsg_suboid x
#define __DBGMSGVAR(x)     debugmsg_var x
#define __DBGMSGOIDRANGE(x) debugmsg_oidrange x
#define __DBGMSGHEX(x)     debugmsg_hex x
#define __DBGMSGHEXTLI(x)  debugmsg_hextli x
#define __DBGINDENT()      debug_indent_get()
#define __DBGINDENTADD(x)  debug_indent_add(x)
#define __DBGINDENTMORE()  debug_indent_add(2)
#define __DBGINDENTLESS()  debug_indent_add(-2)
#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))

#define __DBGDUMPHEADER(token,x) \
        __DBGPRINTINDENT("dumph_" token); \
        debugmsg("dumph_" token,x); \
        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
            debugmsg("dumph_" token,"\n"); \
        } else { \
            debugmsg("dumph_" token,"  "); \
        } \
        __DBGINDENTMORE()

#define __DBGDUMPSECTION(token,x) \
        __DBGPRINTINDENT("dumph_" token); \
        debugmsg("dumph_" token,"%s\n",x);\
        __DBGINDENTMORE()

#define __DBGDUMPSETUP(token,buf,len) \
        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
        __DBGMSGHEX(("dumpx_" token,buf,len)); \
        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
            debugmsg("dumpx_" token,"\n"); \
        } else { \
            debugmsg("dumpx_" token,"  "); \
        } \
        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");

/******************* End   private macros ************************/
/*****************************************************************/
#endif /* NETSNMP_NO_DEBUGGING */

#ifdef __cplusplus
}
#endif

    /* Public macros moved to top-level API header file */
#include <net-snmp/output_api.h>

#ifdef __cplusplus
extern          "C" {
#endif

    void            snmp_debug_init(void);
    void            snmp_debug_shutdown(void);

#define MAX_DEBUG_TOKENS 256
#define MAX_DEBUG_TOKEN_LEN 128
#define DEBUG_TOKEN_DELIMITER ","
#define DEBUG_ALWAYS_TOKEN "all"

#ifndef NETSNMP_NO_DEBUGGING

/*
 * internal:
 * You probably shouldn't be using this information unless the word
 * "expert" applies to you.  I know it looks tempting.
 */
typedef struct netsnmp_token_descr_s {
    char *token_name;
    char  enabled;
} netsnmp_token_descr;

NETSNMP_IMPORT int                 debug_num_tokens;
NETSNMP_IMPORT netsnmp_token_descr dbg_tokens[MAX_DEBUG_TOKENS];

#endif /* NETSNMP_NO_DEBUGGING */

#ifdef __cplusplus
}
#endif
#endif                          /* SNMP_DEBUG_H */
library/snmp_assert.h000064400000007364147511501100010724 0ustar00#ifndef SNMP_ASSERT_H
#define SNMP_ASSERT_H

#ifdef NETSNMP_USE_ASSERT
#   include <assert.h>
#else
#   include <net-snmp/library/snmp_logging.h>
#endif


/*
 * MACROs don't need extern "C"
 */

/*
 * define __STRING for systems (*cough* sun *cough*) that don't have it
 */
#ifndef __STRING
#  if defined(__STDC__) || defined(_MSC_VER)
#    define __STRING(x) #x
#  else
#    define __STRING(x) "x"
#  endif /* __STDC__ */
#endif /* __STRING */

/*
 * always use assert if requested
 */
#ifdef NETSNMP_USE_ASSERT
/*   void netsnmp_assert( int );*/
#   define netsnmp_assert(x)  assert( x )
#   define netsnmp_assert_or_return(x, y)  assert( x )
#   define netsnmp_assert_or_msgreturn(x, y, z)  assert( x )
#else
/*
 *  if asserts weren't requested, just log, unless NETSNMP_NO_DEBUGGING specified
 */
#   ifndef NETSNMP_NO_DEBUGGING
#      ifdef  NETSNMP_FUNCTION
#          define NETSNMP_FUNC_FMT " %s()\n"
#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
#      else
#          define NETSNMP_FUNC_FMT "%c"
#          define NETSNMP_FUNC_PARAM '\n'
#      endif
#
#      define netsnmp_assert(x)  do { \
              if ( x ) \
                 ; \
              else \
                 snmp_log(LOG_ERR, \
                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
                          __STRING(x),__FILE__,__LINE__, \
                          NETSNMP_FUNC_PARAM); \
           }while(0)
#      define netsnmp_assert_or_return(x, y)  do {        \
              if ( x ) \
                 ; \
              else { \
                 snmp_log(LOG_ERR, \
                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
                          __STRING(x),__FILE__,__LINE__, \
                          NETSNMP_FUNC_PARAM); \
                 return y; \
              } \
           }while(0)
#      define netsnmp_assert_or_msgreturn(x, y, z)  do {       \
              if ( x ) \
                 ; \
              else { \
                 snmp_log(LOG_ERR, \
                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
                          __STRING(x),__FILE__,__LINE__, \
                          NETSNMP_FUNC_PARAM); \
                 snmp_log(LOG_ERR, y); \
                 return z; \
              } \
           }while(0)
#   else /* NO DEBUGGING */
#      define netsnmp_assert(x)
#      define netsnmp_assert_or_return(x, y)  do {        \
                 if ( x ) \
                    ; \
                 else { \
                    return y; \
                 } \
              }while(0)
#      define netsnmp_assert_or_msgreturn(x, y, z)  do {       \
                 if ( x ) \
                    ; \
                 else { \
                    return z; \
                 } \
              }while(0)
#   endif /* NO DEBUGGING */
#endif /* not NETSNMP_USE_ASSERT */


#define netsnmp_static_assert(x) \
    do { switch(0) { case (x): case 0: ; } } while(0)


/*
 *  EXPERIMENTAL macros. May be removed without warning in future
 * releases. Use at your own risk
 *
 * The series of uppercase letters at or near the end of these macros give
 * an indication of what they do. The letters used are:
 *
 *   L  : log a message
 *   RN : return NULL
 *   RE : return a specific hardcoded error appropriate for the condition
 *   RV : return user specified value
 *
 */
#define netsnmp_malloc_check_LRN(ptr)           \
    netsnmp_assert_or_return( (ptr) != NULL, NULL)
#define netsnmp_malloc_check_LRE(ptr)           \
    netsnmp_assert_or_return( (ptr) != NULL, SNMPERR_MALLOC)
#define netsnmp_malloc_check_LRV(ptr, val)                          \
    netsnmp_assert_or_return( (ptr) != NULL, val)

#define netsnmp_require_ptr_LRV( ptr, val ) \
    netsnmp_assert_or_return( (ptr) != NULL, val)


#endif /* SNMP_ASSERT_H */
snmpv3_api.h000064400000002232147511501100006766 0ustar00#ifndef NET_SNMP_SNMPV3_H
#define NET_SNMP_SNMPV3_H

    /**
     *  Library API routines concerned with SNMPv3 handling.
     *
     *  Most of these would typically not be used directly,
     *     but be invoked via version-independent API routines.
     */

#include <net-snmp/types.h>

    /*
     *  For the initial release, this will just refer to the
     *  relevant UCD header files.
     *    In due course, the routines relevant to this area of the
     *  API will be identified, and listed here directly.
     *
     *  But for the time being, this header file is a placeholder,
     *  to allow application writers to adopt the new header file names.
     */

#include <net-snmp/library/snmp_api.h>

#include <net-snmp/library/callback.h>
#include <net-snmp/library/snmpv3.h>
#include <net-snmp/library/transform_oids.h>
#include <net-snmp/library/keytools.h>
#include <net-snmp/library/scapi.h>
#include <net-snmp/library/lcd_time.h>
#ifdef NETSNMP_USE_INTERNAL_MD5
#include <net-snmp/library/md5.h>
#endif

#include <net-snmp/library/snmp_secmod.h>
#include <net-snmp/library/snmpv3-security-includes.h>

#endif                          /* NET_SNMP_SNMPV3_H */
pdu_api.h000064400000002400147511501100006325 0ustar00#ifndef NET_SNMP_PDU_API_H
#define NET_SNMP_PDU_API_H

    /**
     *  Library API routines concerned with SNMP PDUs.
     */

#include <net-snmp/types.h>

#ifdef __cplusplus
extern          "C" {
#endif

NETSNMP_IMPORT
netsnmp_pdu    *snmp_pdu_create(int type);
NETSNMP_IMPORT
netsnmp_pdu    *snmp_clone_pdu(netsnmp_pdu *pdu);
NETSNMP_IMPORT
netsnmp_pdu    *snmp_fix_pdu(  netsnmp_pdu *pdu, int idx);
NETSNMP_IMPORT
void            snmp_free_pdu( netsnmp_pdu *pdu);

#ifdef __cplusplus
}
#endif

    /*
     *    Having extracted the main ("public API") calls relevant
     *  to this area of the Net-SNMP project, the next step is to
     *  identify the related "public internal API" routines.
     *
     *    In due course, these should probably be gathered
     *  together into a companion 'library/pdu_api.h' header file.
     *  [Or some suitable name]
     *
     *    But for the time being, the expectation is that the
     *  traditional headers that provided the above definitions
     *  will probably also cover the relevant internal API calls.
     *  Hence they are listed here:
     */

#include <net-snmp/library/snmp_api.h>
#include <net-snmp/library/snmp_client.h>
#include <net-snmp/library/asn1.h>

#endif                          /* NET_SNMP_PDU_API_H */
agent/auto_nlist.h000064400000001135147511501100010167 0ustar00/*
 * auto_nlist.h
 */
#ifndef AUTO_NLIST_H
#define AUTO_NLIST_H
#ifdef __cplusplus
extern          "C" {
#endif

#if defined(irix6) && defined(IRIX64)
#define nlist nlist64
#endif

#ifdef NETSNMP_CAN_USE_NLIST
int             auto_nlist(const char *, char *, size_t);
long            auto_nlist_value(const char *);
int             KNLookup(struct nlist *, int, char *, size_t);
#else
int             auto_nlist_noop(void);
#	define auto_nlist(x,y,z) auto_nlist_noop()
#	define auto_nlist_value(z) auto_nlist_noop()
#	define KNLookup(w,x,y,z) auto_nlist_noop()
#endif

#ifdef __cplusplus
}
#endif
#endif
agent/table_array.h000064400000012523147511501100010276 0ustar00/*
 * table_array.h
 * $Id$
 */
#ifndef _TABLE_ARRAY_HANDLER_H_
#define _TABLE_ARRAY_HANDLER_H_

#ifdef __cplusplus
extern          "C" {
#endif

    /*
     * The table array helper is designed to simplify the task of
     * writing a table handler for the net-snmp agent when the data being
     * accessed is in an oid sorted form and must be accessed externally.
     * 
     * Functionally, it is a specialized version of the more
     * generic table helper but easies the burden of GETNEXT processing by
     * retrieving the appropriate row for ead index through
     * function calls which should be supplied by the module that wishes
     * help.  The module the table_array helps should, afterwards,
     * never be called for the case of "MODE_GETNEXT" and only for the GET
     * and SET related modes instead.
     */

#include <net-snmp/library/container.h>
#include <net-snmp/agent/table.h>

#define TABLE_ARRAY_NAME "table_array"

    /*
     * group_item is to allow us to keep a list of requests without
     * disrupting the actual netsnmp_request_info list.
     */
    typedef struct netsnmp_request_group_item_s {
        netsnmp_request_info *ri;
        netsnmp_table_request_info *tri;
        struct netsnmp_request_group_item_s *next;
    } netsnmp_request_group_item;

    /*
     * structure to keep a list of requests for each unique index
     */
    typedef struct netsnmp_request_group_s {
       /*
        * index for this row. points to someone else's memory, so
        * don't free it!
        */
        netsnmp_index               index;

       /*
        * container in which rows belong
        */
        netsnmp_container           *table;

       /*
        * actual old and new rows
        */
        netsnmp_index               *existing_row;
        netsnmp_index               *undo_info;

       /*
        * flags
        */
       char                          row_created;
       char                          row_deleted;
       char                          fill1;
       char                          fill2;

       /*
        * requests for this row
        */
        netsnmp_request_group_item  *list;

        int                          status;

        void                        *rg_void;

    } netsnmp_request_group;

    typedef int     (Netsnmp_User_Row_Operation_c) (const void *lhs,
                                                    const void *rhs);
    typedef int     (Netsnmp_User_Row_Operation) (void *lhs, void *rhs);
    typedef int     (Netsnmp_User_Get_Processor) (netsnmp_request_info *,
                                                  netsnmp_index
                                                  *,
                                                  netsnmp_table_request_info
                                                  *);
    typedef netsnmp_index
        *(UserRowMethod) (netsnmp_index *);
    typedef int     (Netsnmp_User_Row_Action) (netsnmp_index *,
                                               netsnmp_index *,
                                               netsnmp_request_group *);
    typedef void    (Netsnmp_User_Group_Method) (netsnmp_request_group *);

    /*
     * structure for array callbacks
     */
    typedef struct netsnmp_table_array_callbacks_s {

        Netsnmp_User_Row_Operation   *row_copy;
        Netsnmp_User_Row_Operation_c *row_compare;

        Netsnmp_User_Get_Processor *get_value;


        Netsnmp_User_Row_Action *can_activate;
        Netsnmp_User_Row_Action *activated;
        Netsnmp_User_Row_Action *can_deactivate;
        Netsnmp_User_Row_Action *deactivated;
        Netsnmp_User_Row_Action *can_delete;

        UserRowMethod  *create_row;
        UserRowMethod  *duplicate_row;
        UserRowMethod  *delete_row;    /* always returns NULL */

        Netsnmp_User_Group_Method *set_reserve1;
        Netsnmp_User_Group_Method *set_reserve2;
        Netsnmp_User_Group_Method *set_action;
        Netsnmp_User_Group_Method *set_commit;
        Netsnmp_User_Group_Method *set_free;
        Netsnmp_User_Group_Method *set_undo;

       /** not callbacks, but this is a useful place for them... */
       netsnmp_container* container;
       char can_set;

    } netsnmp_table_array_callbacks;


    int            
        netsnmp_table_container_register(netsnmp_handler_registration *reginfo,
                                     netsnmp_table_registration_info
                                     *tabreq,
                                     netsnmp_table_array_callbacks *cb,
                                     netsnmp_container *container,
                                     int group_rows);

    int netsnmp_table_array_register(netsnmp_handler_registration *reginfo,
                                     netsnmp_table_registration_info *tabreq,
                                     netsnmp_table_array_callbacks *cb,
                                     netsnmp_container *container,
                                     int group_rows);

    netsnmp_container * netsnmp_extract_array_context(netsnmp_request_info *);

    Netsnmp_Node_Handler netsnmp_table_array_helper_handler;

    int
    netsnmp_table_array_check_row_status(netsnmp_table_array_callbacks *cb,
                                         netsnmp_request_group *ag,
                                         long *rs_new, long *rs_old);

#ifdef __cplusplus
}
#endif

#endif                          /* _TABLE_ARRAY_HANDLER_H_ */
agent/old_api.h000064400000002622147511501100007417 0ustar00#ifndef OLD_API_H
#define OLD_API_H

#ifdef __cplusplus
extern          "C" {
#endif

#define OLD_API_NAME "old_api"

typedef struct netsnmp_old_api_info_s {
    struct variable *var;
    size_t          varsize;
    size_t          numvars;

    /*
     * old stuff 
     */
    netsnmp_session *ss;
    int             flags;
} netsnmp_old_api_info;

typedef struct old_opi_cache_s {
    u_char         *data;
    WriteMethod    *write_method;
} netsnmp_old_api_cache;

int             netsnmp_register_old_api(const char *moduleName,
                                         const struct variable *var,
                                         size_t varsize,
                                         size_t numvars,
                                         const oid * mibloc,
                                         size_t mibloclen,
                                         int priority,
                                         int range_subid,
                                         oid range_ubound,
                                         netsnmp_session * ss,
                                         const char *context,
                                         int timeout, int flags);
Netsnmp_Node_Handler netsnmp_old_api_helper;

/*
 * really shouldn't be used 
 */
netsnmp_agent_session *netsnmp_get_current_agent_session(void);

#ifdef __cplusplus
}
#endif
#endif                          /* OLD_API_H */
agent/baby_steps.h000064400000006636147511501100010154 0ustar00/*
 * $Id$
 */
#ifndef BABY_STEPS_H
#define BABY_STEPS_H

#ifdef __cplusplus
extern          "C" {
#endif

#include <net-snmp/agent/agent_handler.h>

    /*
     * Flags for baby step modes
     */
#define BABY_STEP_NONE                  0
#define BABY_STEP_PRE_REQUEST           (0x1 <<  1)
#define BABY_STEP_OBJECT_LOOKUP         (0x1 <<  2)
#ifndef NETSNMP_NO_WRITE_SUPPORT
#define BABY_STEP_CHECK_VALUE           (0x1 <<  3)
#define BABY_STEP_ROW_CREATE            (0x1 <<  4)
#define BABY_STEP_UNDO_SETUP            (0x1 <<  5)
#define BABY_STEP_SET_VALUE             (0x1 <<  6)
#define BABY_STEP_CHECK_CONSISTENCY     (0x1 <<  7)
#define BABY_STEP_UNDO_SET              (0x1 <<  8)
#define BABY_STEP_COMMIT                (0x1 <<  9)
#define BABY_STEP_UNDO_COMMIT           (0x1 << 10)
#define BABY_STEP_IRREVERSIBLE_COMMIT   (0x1 << 11)
#define BABY_STEP_UNDO_CLEANUP          (0x1 << 12)
#endif /* NETSNMP_NO_WRITE_SUPPORT */
#define BABY_STEP_POST_REQUEST          (0x1 << 13)

#define BABY_STEP_ALL                   (0xffffffff)


#ifndef NETSNMP_NO_WRITE_SUPPORT
#define BABY_STEP_CHECK_OBJECT          BABY_STEP_CHECK_VALUE
#define BABY_STEP_SET_VALUES            BABY_STEP_SET_VALUE
#define BABY_STEP_UNDO_SETS             BABY_STEP_UNDO_SET
#endif /* NETSNMP_NO_WRITE_SUPPORT */

/** @name baby_steps
 *
 * This helper expands the original net-snmp set modes into the newer, finer
 * grained modes.
 *
 *  @{ */

    typedef struct netsnmp_baby_steps_modes_s {
       /** Number of handlers whose myvoid pointer points at this object. */
       int         refcnt;
       u_int       registered;
       u_int       completed;
    } netsnmp_baby_steps_modes;

void                 netsnmp_baby_steps_init(void);

netsnmp_mib_handler *netsnmp_baby_steps_handler_get(u_long modes);

/** @} */


/** @name access_multiplexer
 *
 * This helper calls individual access methods based on the mode. All
 * access methods share the same handler, and the same myvoid pointer.
 * If you need individual myvoid pointers, check out the multiplexer
 * handler (though it currently only works for traditional modes).
 *
 *  @{ */

/** @struct netsnmp_mib_handler_access_methods
 *  Defines the access methods to be called by the access_multiplexer helper
 */
typedef struct netsnmp_baby_steps_access_methods_s {
      
   /*
    * baby step modes
    */
   Netsnmp_Node_Handler *pre_request;
   Netsnmp_Node_Handler *object_lookup;
   Netsnmp_Node_Handler *get_values;
#ifndef NETSNMP_NO_WRITE_SUPPORT
   Netsnmp_Node_Handler *object_syntax_checks;
   Netsnmp_Node_Handler *row_creation;
   Netsnmp_Node_Handler *undo_setup;
   Netsnmp_Node_Handler *set_values;
   Netsnmp_Node_Handler *consistency_checks;
   Netsnmp_Node_Handler *commit;
   Netsnmp_Node_Handler *undo_sets;
   Netsnmp_Node_Handler *undo_cleanup;
   Netsnmp_Node_Handler *undo_commit;
   Netsnmp_Node_Handler *irreversible_commit;
#endif /* NETSNMP_NO_WRITE_SUPPORT */
   Netsnmp_Node_Handler *post_request;

   void                 *my_access_void;

} netsnmp_baby_steps_access_methods;

    netsnmp_mib_handler * netsnmp_baby_steps_access_multiplexer_get(
        netsnmp_baby_steps_access_methods *);

    int netsnmp_baby_step_mode2flag( u_int mode );

/** @} */


/** backwards compatability. don't use in new code */
#define netsnmp_get_baby_steps_handler netsnmp_baby_steps_handler_get
#define netsnmp_init_baby_steps_helper netsnmp_baby_steps_handler_init


#ifdef __cplusplus
}
#endif
#endif /* baby_steps */
agent/cache_handler.h000064400000011174147511501100010552 0ustar00/* Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 */
/*
 * Portions of this file are copyrighted by:
 * Copyright (C) 2007 Apple, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */
#ifndef NETSNMP_CACHE_HANDLER_H
#define NETSNMP_CACHE_HANDLER_H

/*
 * This caching helper provides a generalised (SNMP-manageable) caching
 * mechanism.  Individual SNMP table and scalar/scalar group MIB
 * implementations can use data caching in a consistent manner, without
 * needing to handle the generic caching details themselves.
 */

#include <net-snmp/library/tools.h>

#ifdef __cplusplus
extern          "C" {
#endif

#define CACHE_NAME "cache_info"

    typedef struct netsnmp_cache_s netsnmp_cache;

    typedef int  (NetsnmpCacheLoad)(netsnmp_cache *, void*);
    typedef void (NetsnmpCacheFree)(netsnmp_cache *, void*);

    struct netsnmp_cache_s {
	/** Number of handlers whose myvoid member points at this structure. */
	int      refcnt;
        /*
	 * For operation of the data caches
	 */
        int      flags;
        int      enabled;
        int      valid;
        char     expired;
        int      timeout;	/* Length of time the cache is valid (in s) */
        marker_t timestampM;	/* When the cache was last loaded */
        u_long   timer_id;      /* periodic timer id */

        NetsnmpCacheLoad *load_cache;
        NetsnmpCacheFree *free_cache;

       /*
        * void pointer for the user that created the cache.
        * You never know when it might not come in useful ....
        */
        void             *magic;

       /*
        * hint from the cache helper. contains the standard
        * handler arguments.
        */
       netsnmp_handler_args          *cache_hint;

        /*
	 * For SNMP-management of the data caches
	 */
	netsnmp_cache *next, *prev;
        oid *rootoid;
        int  rootoid_len;

    };


    void netsnmp_cache_reqinfo_insert(netsnmp_cache* cache,
                                      netsnmp_agent_request_info * reqinfo,
                                      const char *name);
    netsnmp_cache  *
       netsnmp_cache_reqinfo_extract(netsnmp_agent_request_info * reqinfo,
                                     const char *name);
    netsnmp_cache* netsnmp_extract_cache_info(netsnmp_agent_request_info *);

    int            netsnmp_cache_check_and_reload(netsnmp_cache * cache);
    int            netsnmp_cache_check_expired(netsnmp_cache *cache);
    int            netsnmp_cache_is_valid(    netsnmp_agent_request_info *,
                                              const char *name);
    /** for backwards compat */
    int            netsnmp_is_cache_valid(    netsnmp_agent_request_info *);
    netsnmp_mib_handler *netsnmp_get_cache_handler(int, NetsnmpCacheLoad *,
                                                        NetsnmpCacheFree *,
                                                        const oid*, int);
    int   netsnmp_register_cache_handler(netsnmp_handler_registration *reginfo,
                                         int, NetsnmpCacheLoad *,
                                              NetsnmpCacheFree *);

    Netsnmp_Node_Handler netsnmp_cache_helper_handler;

    netsnmp_cache *
    netsnmp_cache_create(int timeout, NetsnmpCacheLoad * load_hook,
                         NetsnmpCacheFree * free_hook,
                         const oid * rootoid, int rootoid_len);
    int netsnmp_cache_remove(netsnmp_cache *cache);
    int netsnmp_cache_free(netsnmp_cache *cache);

    netsnmp_mib_handler *
    netsnmp_cache_handler_get(netsnmp_cache* cache);
    void netsnmp_cache_handler_owns_cache(netsnmp_mib_handler *handler);

    netsnmp_cache * netsnmp_cache_find_by_oid(const oid * rootoid,
                                              int rootoid_len);

    unsigned int netsnmp_cache_timer_start(netsnmp_cache *cache);
    void netsnmp_cache_timer_stop(netsnmp_cache *cache);

/*
 * Flags affecting cache handler operation
 */
#define NETSNMP_CACHE_DONT_INVALIDATE_ON_SET                0x0001
#define NETSNMP_CACHE_DONT_FREE_BEFORE_LOAD                 0x0002
#define NETSNMP_CACHE_DONT_FREE_EXPIRED                     0x0004
#define NETSNMP_CACHE_DONT_AUTO_RELEASE                     0x0008
#define NETSNMP_CACHE_PRELOAD                               0x0010
#define NETSNMP_CACHE_AUTO_RELOAD                           0x0020
#define NETSNMP_CACHE_RESET_TIMER_ON_USE                    0x0040

#define NETSNMP_CACHE_HINT_HANDLER_ARGS                     0x1000


#ifdef __cplusplus
}
#endif
#endif /* NETSNMP_CACHE_HANDLER_H */
agent/netsnmp_close_fds.h000064400000000235147511501100011513 0ustar00#ifndef netsnmp_close_fds_h_INCLUDED
#define netsnmp_close_fds_h_INCLUDED

extern void netsnmp_close_fds(int fd);

#endif /* netsnmp_close_fds_h_INCLUDED */
agent/agent_callbacks.h000064400000001524147511501100011105 0ustar00#ifndef AGENT_CALLBACKS_H
#define AGENT_CALLBACKS_H

#define SNMPD_CALLBACK_ACM_CHECK         0
#define SNMPD_CALLBACK_REGISTER_OID      1
#define SNMPD_CALLBACK_UNREGISTER_OID    2
#define SNMPD_CALLBACK_REG_SYSOR         3
#define SNMPD_CALLBACK_UNREG_SYSOR       4
#define SNMPD_CALLBACK_ACM_CHECK_INITIAL 5
#define SNMPD_CALLBACK_SEND_TRAP1        6
#define SNMPD_CALLBACK_SEND_TRAP2        7
#define SNMPD_CALLBACK_REGISTER_NOTIFICATIONS 8
#define SNMPD_CALLBACK_PRE_UPDATE_CONFIG 9
#define SNMPD_CALLBACK_INDEX_START	 10
#define SNMPD_CALLBACK_INDEX_STOP	 11
#define SNMPD_CALLBACK_ACM_CHECK_SUBTREE 12
#define SNMPD_CALLBACK_REQ_REG_SYSOR     13
#define SNMPD_CALLBACK_REQ_UNREG_SYSOR   14
#define SNMPD_CALLBACK_REQ_UNREG_SYSOR_SESS 15
#define SNMPD_CALLBACK_UNREGISTER_NOTIFICATIONS 16

#endif                          /* AGENT_CALLBACKS_H */
agent/agent_index.h000064400000003030147511501100010267 0ustar00#ifndef AGENT_INDEX_H
#define AGENT_INDEX_H

#ifdef __cplusplus
extern          "C" {
#endif

#define ALLOCATE_THIS_INDEX		0x0
#define ALLOCATE_ANY_INDEX		0x1
#define ALLOCATE_NEW_INDEX		0x3
        /*
         * N.B: it's deliberate that NEW_INDEX & ANY_INDEX == ANY_INDEX 
         */

#define ANY_INTEGER_INDEX		-1
#define ANY_STRING_INDEX		NULL
#define ANY_OID_INDEX			NULL

#define	INDEX_ERR_GENERR		-1
#define	INDEX_ERR_WRONG_TYPE		-2
#define	INDEX_ERR_NOT_ALLOCATED		-3
#define	INDEX_ERR_WRONG_SESSION		-4

char           *register_string_index(oid *, size_t, char *);
int             register_int_index(oid *, size_t, int);
netsnmp_variable_list *register_oid_index(oid *, size_t, oid *, size_t);
netsnmp_variable_list *register_index(netsnmp_variable_list *, int,
                                      netsnmp_session *);

int             unregister_string_index(oid *, size_t, char *);
int             unregister_int_index(oid *, size_t, int);
int             unregister_oid_index(oid *, size_t, oid *, size_t);

int             release_index(netsnmp_variable_list *);
int             remove_index(netsnmp_variable_list *, netsnmp_session *);
void            unregister_index_by_session(netsnmp_session *);
int             unregister_index(netsnmp_variable_list *, int,
                                 netsnmp_session *);

unsigned long   count_indexes(oid * name, size_t namelen,
                              int include_unallocated);

void dump_idx_registry(void);

#ifdef __cplusplus
}
#endif
#endif                          /* AGENT_INDEX_H */
agent/agent_module_config.h000064400000002354147511501100012002 0ustar00/* This file is automatically generated by configure.  Do not modify by hand. */
/* Define if compiling with the agentx/master module files.  */
#define USING_AGENTX_MASTER_MODULE 1
 
/* Define if compiling with the agentx/subagent module files.  */
#define USING_AGENTX_SUBAGENT_MODULE 1
 
/* Define if compiling with the smux/smux module files.  */
#define USING_SMUX_SMUX_MODULE 1
 
/* Define if compiling with the agentx/protocol module files.  */
#define USING_AGENTX_PROTOCOL_MODULE 1
 
/* Define if compiling with the agentx/master_admin module files.  */
#define USING_AGENTX_MASTER_ADMIN_MODULE 1
 
/* Define if compiling with the agentx/agentx_config module files.  */
#define USING_AGENTX_AGENTX_CONFIG_MODULE 1
 
/* Define if compiling with the agentx/client module files.  */
#define USING_AGENTX_CLIENT_MODULE 1
 
/* Define if compiling with the snmpv3/usmConf module files.  */
#define USING_SNMPV3_USMCONF_MODULE 1
 
/* Define if compiling with the utilities/execute module files.  */
#define USING_UTILITIES_EXECUTE_MODULE 1
 
/* Define if compiling with the utilities/iquery module files.  */
#define USING_UTILITIES_IQUERY_MODULE 1
 
/* Define if compiling with the mibII/vacm_conf module files.  */
#define USING_MIBII_VACM_CONF_MODULE 1
 
agent/set_helper.h000064400000001036147511501100010140 0ustar00#ifndef SET_HELPER_H
#define SET_HELPER_H

#ifdef __cplusplus
extern          "C" {
#endif

typedef struct netsnmp_set_info_s {
    int             action;
    void           *stateRef;

    /*
     * don't use yet: 
     */
    void          **oldData;
    int             setCleanupFlags;    /* XXX: client sets this to: */
#define AUTO_FREE_STATEREF 0x01 /* calls free(stateRef) */
#define AUTO_FREE_OLDDATA  0x02 /* calls free(*oldData) */
#define AUTO_UNDO          0x04 /* ... */
} netsnmp_set_info;

#ifdef __cplusplus
}
#endif
#endif
agent/agent_read_config.h000064400000002307147511501100011426 0ustar00/*
 * agent_read_config.h: reads configuration files for extensible sections.
 *
 */
#ifndef _AGENT_READ_CONFIG_H
#define _AGENT_READ_CONFIG_H

#ifdef __cplusplus
extern          "C" {
#endif

    void            init_agent_read_config(const char *);
    void            update_config(void);
    void            snmpd_register_config_handler(const char *token,
                                                  void (*parser) (const
                                                                  char *,
                                                                  char *),
                                                  void (*releaser) (void),
                                                  const char *help);
    void            snmpd_register_const_config_handler(
                                 const char *,
                                 void (*parser) (const char *, const char *),
                                 void (*releaser) (void),
                                 const char *);
    void            snmpd_unregister_config_handler(const char *);
    void            snmpd_store_config(const char *);

#ifdef __cplusplus
}
#endif
#endif                          /* _AGENT_READ_CONFIG_H */
agent/mode_end_call.h000064400000001547147511501100010562 0ustar00/*
 * mode_end_call.h 
 */
#ifndef MODE_END_CALL_H
#define MODE_END_CALL_H

#ifdef __cplusplus
extern          "C" {
#endif

#define NETSNMP_MODE_END_ALL_MODES -999

typedef struct netsnmp_mode_handler_list_s {
   struct netsnmp_mode_handler_list_s *next;
   int mode;
   netsnmp_mib_handler *callback_handler;
} netsnmp_mode_handler_list;

/*
 * The helper calls another handler after each mode has been
 * processed.
 */

/* public functions */
netsnmp_mib_handler *
netsnmp_get_mode_end_call_handler(netsnmp_mode_handler_list *endlist);

netsnmp_mode_handler_list *
netsnmp_mode_end_call_add_mode_callback(netsnmp_mode_handler_list *endlist,
                                        int mode,
                                        netsnmp_mib_handler *callbackh);

/* internal */
Netsnmp_Node_Handler netsnmp_mode_end_call_helper;

#ifdef __cplusplus
}
#endif
#endif
agent/mib_module_config.h000064400000107646147511501100011465 0ustar00/* This file is automatically generated by configure.  Do not modify by hand. */
/* Define if compiling with the agentx module files.  */
#define USING_AGENTX_MODULE 1
 
/* Define if compiling with the default_modules module files.  */
#define USING_DEFAULT_MODULES_MODULE 1
 
/* Define if compiling with the etherlike-mib module files.  */
#define USING_ETHERLIKE_MIB_MODULE 1
 
/* Define if compiling with the host module files.  */
#define USING_HOST_MODULE 1
 
/* Define if compiling with the ip-mib/ipAddressPrefixTable/ipAddressPrefixTable module files.  */
#define USING_IP_MIB_IPADDRESSPREFIXTABLE_IPADDRESSPREFIXTABLE_MODULE 1
 
/* Define if compiling with the ip-mib/ipDefaultRouterTable/ipDefaultRouterTable module files.  */
#define USING_IP_MIB_IPDEFAULTROUTERTABLE_IPDEFAULTROUTERTABLE_MODULE 1
 
/* Define if compiling with the ip-mib/ipIfStatsTable module files.  */
#define USING_IP_MIB_IPIFSTATSTABLE_MODULE 1
 
/* Define if compiling with the ip-mib/ipv4InterfaceTable module files.  */
#define USING_IP_MIB_IPV4INTERFACETABLE_MODULE 1
 
/* Define if compiling with the ip-mib/ipv6InterfaceTable module files.  */
#define USING_IP_MIB_IPV6INTERFACETABLE_MODULE 1
 
/* Define if compiling with the ip-mib/ipv6ScopeZoneIndexTable module files.  */
#define USING_IP_MIB_IPV6SCOPEZONEINDEXTABLE_MODULE 1
 
/* Define if compiling with the mibII/mta_sendmail module files.  */
#define USING_MIBII_MTA_SENDMAIL_MODULE 1
 
/* Define if compiling with the rmon-mib module files.  */
#define USING_RMON_MIB_MODULE 1
 
/* Define if compiling with the sctp-mib module files.  */
#define USING_SCTP_MIB_MODULE 1
 
/* Define if compiling with the smux module files.  */
#define USING_SMUX_MODULE 1
 
/* Define if compiling with the tcp-mib module files.  */
#define USING_TCP_MIB_MODULE 1
 
/* Define if compiling with the ucd-snmp/diskio module files.  */
#define USING_UCD_SNMP_DISKIO_MODULE 1
 
/* Define if compiling with the ucd-snmp/lmsensorsMib module files.  */
#define USING_UCD_SNMP_LMSENSORSMIB_MODULE 1
 
/* Define if compiling with the udp-mib module files.  */
#define USING_UDP_MIB_MODULE 1
 
/* Define if compiling with the snmpv3mibs module files.  */
#define USING_SNMPV3MIBS_MODULE 1
 
/* Define if compiling with the mibII module files.  */
#define USING_MIBII_MODULE 1
 
/* Define if compiling with the ucd_snmp module files.  */
#define USING_UCD_SNMP_MODULE 1
 
/* Define if compiling with the notification module files.  */
#define USING_NOTIFICATION_MODULE 1
 
/* Define if compiling with the notification-log-mib module files.  */
#define USING_NOTIFICATION_LOG_MIB_MODULE 1
 
/* Define if compiling with the target module files.  */
#define USING_TARGET_MODULE 1
 
/* Define if compiling with the agent_mibs module files.  */
#define USING_AGENT_MIBS_MODULE 1
 
/* Define if compiling with the disman/event module files.  */
#define USING_DISMAN_EVENT_MODULE 1
 
/* Define if compiling with the disman/schedule module files.  */
#define USING_DISMAN_SCHEDULE_MODULE 1
 
/* Define if compiling with the utilities module files.  */
#define USING_UTILITIES_MODULE 1
 
/* Define if compiling with the etherlike-mib/dot3StatsTable module files.  */
#define USING_ETHERLIKE_MIB_DOT3STATSTABLE_MODULE 1
 
/* Define if compiling with the host/hrh_storage module files.  */
#define USING_HOST_HRH_STORAGE_MODULE 1
 
/* Define if compiling with the host/hrh_filesys module files.  */
#define USING_HOST_HRH_FILESYS_MODULE 1
 
/* Define if compiling with the host/hrSWInstalledTable module files.  */
#define USING_HOST_HRSWINSTALLEDTABLE_MODULE 1
 
/* Define if compiling with the host/hrSWRunTable module files.  */
#define USING_HOST_HRSWRUNTABLE_MODULE 1
 
/* Define if compiling with the host/hr_system module files.  */
#define USING_HOST_HR_SYSTEM_MODULE 1
 
/* Define if compiling with the host/hr_device module files.  */
#define USING_HOST_HR_DEVICE_MODULE 1
 
/* Define if compiling with the host/hr_other module files.  */
#define USING_HOST_HR_OTHER_MODULE 1
 
/* Define if compiling with the host/hr_proc module files.  */
#define USING_HOST_HR_PROC_MODULE 1
 
/* Define if compiling with the host/hr_network module files.  */
#define USING_HOST_HR_NETWORK_MODULE 1
 
/* Define if compiling with the host/hr_print module files.  */
#define USING_HOST_HR_PRINT_MODULE 1
 
/* Define if compiling with the host/hr_disk module files.  */
#define USING_HOST_HR_DISK_MODULE 1
 
/* Define if compiling with the host/hr_partition module files.  */
#define USING_HOST_HR_PARTITION_MODULE 1
 
/* Define if compiling with the ip-mib/ipAddressTable/ipAddressTable module files.  */
#define USING_IP_MIB_IPADDRESSTABLE_IPADDRESSTABLE_MODULE 1
 
/* Define if compiling with the ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface module files.  */
#define USING_IP_MIB_IPADDRESSPREFIXTABLE_IPADDRESSPREFIXTABLE_INTERFACE_MODULE 1
 
/* Define if compiling with the ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access module files.  */
#define USING_IP_MIB_IPADDRESSPREFIXTABLE_IPADDRESSPREFIXTABLE_DATA_ACCESS_MODULE 1
 
/* Define if compiling with the ip-mib/data_access/defaultrouter module files.  */
#define USING_IP_MIB_DATA_ACCESS_DEFAULTROUTER_MODULE 1
 
/* Define if compiling with the ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_interface module files.  */
#define USING_IP_MIB_IPDEFAULTROUTERTABLE_IPDEFAULTROUTERTABLE_INTERFACE_MODULE 1
 
/* Define if compiling with the ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_access module files.  */
#define USING_IP_MIB_IPDEFAULTROUTERTABLE_IPDEFAULTROUTERTABLE_DATA_ACCESS_MODULE 1
 
/* Define if compiling with the ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_get module files.  */
#define USING_IP_MIB_IPDEFAULTROUTERTABLE_IPDEFAULTROUTERTABLE_DATA_GET_MODULE 1
 
/* Define if compiling with the ip-mib/data_access/systemstats module files.  */
#define USING_IP_MIB_DATA_ACCESS_SYSTEMSTATS_MODULE 1
 
/* Define if compiling with the ip-mib/ipIfStatsTable/ipIfStatsTable module files.  */
#define USING_IP_MIB_IPIFSTATSTABLE_IPIFSTATSTABLE_MODULE 1
 
/* Define if compiling with the ip-mib/ipIfStatsTable/ipIfStatsTable_interface module files.  */
#define USING_IP_MIB_IPIFSTATSTABLE_IPIFSTATSTABLE_INTERFACE_MODULE 1
 
/* Define if compiling with the ip-mib/ipIfStatsTable/ipIfStatsTable_data_access module files.  */
#define USING_IP_MIB_IPIFSTATSTABLE_IPIFSTATSTABLE_DATA_ACCESS_MODULE 1
 
/* Define if compiling with the ip-mib/ipv4InterfaceTable/ipv4InterfaceTable module files.  */
#define USING_IP_MIB_IPV4INTERFACETABLE_IPV4INTERFACETABLE_MODULE 1
 
/* Define if compiling with the ip-mib/ipv6InterfaceTable/ipv6InterfaceTable module files.  */
#define USING_IP_MIB_IPV6INTERFACETABLE_IPV6INTERFACETABLE_MODULE 1
 
/* Define if compiling with the ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable module files.  */
#define USING_IP_MIB_IPV6SCOPEZONEINDEXTABLE_IPV6SCOPEZONEINDEXTABLE_MODULE 1
 
/* Define if compiling with the rmon-mib/etherStatsTable module files.  */
#define USING_RMON_MIB_ETHERSTATSTABLE_MODULE 1
 
/* Define if compiling with the sctp-mib/sctpScalars module files.  */
#define USING_SCTP_MIB_SCTPSCALARS_MODULE 1
 
/* Define if compiling with the sctp-mib/sctpTables module files.  */
#define USING_SCTP_MIB_SCTPTABLES_MODULE 1
 
/* Define if compiling with the tcp-mib/tcpConnectionTable module files.  */
#define USING_TCP_MIB_TCPCONNECTIONTABLE_MODULE 1
 
/* Define if compiling with the tcp-mib/tcpListenerTable module files.  */
#define USING_TCP_MIB_TCPLISTENERTABLE_MODULE 1
 
/* Define if compiling with the util_funcs/header_simple_table module files.  */
#define USING_UTIL_FUNCS_HEADER_SIMPLE_TABLE_MODULE 1
 
/* Define if compiling with the hardware/sensors module files.  */
#define USING_HARDWARE_SENSORS_MODULE 1
 
/* Define if compiling with the udp-mib/udpEndpointTable module files.  */
#define USING_UDP_MIB_UDPENDPOINTTABLE_MODULE 1
 
/* Define if compiling with the snmpv3/snmpEngine module files.  */
#define USING_SNMPV3_SNMPENGINE_MODULE 1
 
/* Define if compiling with the snmpv3/snmpMPDStats module files.  */
#define USING_SNMPV3_SNMPMPDSTATS_MODULE 1
 
/* Define if compiling with the snmpv3/usmStats module files.  */
#define USING_SNMPV3_USMSTATS_MODULE 1
 
/* Define if compiling with the snmpv3/usmUser module files.  */
#define USING_SNMPV3_USMUSER_MODULE 1
 
/* Define if compiling with the mibII/system_mib module files.  */
#define USING_MIBII_SYSTEM_MIB_MODULE 1
 
/* Define if compiling with the mibII/sysORTable module files.  */
#define USING_MIBII_SYSORTABLE_MODULE 1
 
/* Define if compiling with the mibII/snmp_mib module files.  */
#define USING_MIBII_SNMP_MIB_MODULE 1
 
/* Define if compiling with the mibII/vacm_vars module files.  */
#define USING_MIBII_VACM_VARS_MODULE 1
 
/* Define if compiling with the mibII/setSerialNo module files.  */
#define USING_MIBII_SETSERIALNO_MODULE 1
 
/* Define if compiling with the mibII/at module files.  */
#define USING_MIBII_AT_MODULE 1
 
/* Define if compiling with the mibII/ifTable module files.  */
#define USING_MIBII_IFTABLE_MODULE 1
 
/* Define if compiling with the mibII/ip module files.  */
#define USING_MIBII_IP_MODULE 1
 
/* Define if compiling with the mibII/tcp module files.  */
#define USING_MIBII_TCP_MODULE 1
 
/* Define if compiling with the mibII/icmp module files.  */
#define USING_MIBII_ICMP_MODULE 1
 
/* Define if compiling with the mibII/udp module files.  */
#define USING_MIBII_UDP_MODULE 1
 
/* Define if compiling with the mibII/ipv6 module files.  */
#define USING_MIBII_IPV6_MODULE 1
 
/* Define if compiling with the if-mib module files.  */
#define USING_IF_MIB_MODULE 1
 
/* Define if compiling with the ip-mib module files.  */
#define USING_IP_MIB_MODULE 1
 
/* Define if compiling with the ip-forward-mib module files.  */
#define USING_IP_FORWARD_MIB_MODULE 1
 
/* Define if compiling with the ucd-snmp/disk_hw module files.  */
#define USING_UCD_SNMP_DISK_HW_MODULE 1
 
/* Define if compiling with the ucd-snmp/proc module files.  */
#define USING_UCD_SNMP_PROC_MODULE 1
 
/* Define if compiling with the ucd-snmp/versioninfo module files.  */
#define USING_UCD_SNMP_VERSIONINFO_MODULE 1
 
/* Define if compiling with the ucd-snmp/pass module files.  */
#define USING_UCD_SNMP_PASS_MODULE 1
 
/* Define if compiling with the ucd-snmp/pass_persist module files.  */
#define USING_UCD_SNMP_PASS_PERSIST_MODULE 1
 
/* Define if compiling with the ucd-snmp/loadave module files.  */
#define USING_UCD_SNMP_LOADAVE_MODULE 1
 
/* Define if compiling with the agent/extend module files.  */
#define USING_AGENT_EXTEND_MODULE 1
 
/* Define if compiling with the ucd-snmp/errormib module files.  */
#define USING_UCD_SNMP_ERRORMIB_MODULE 1
 
/* Define if compiling with the ucd-snmp/file module files.  */
#define USING_UCD_SNMP_FILE_MODULE 1
 
/* Define if compiling with the ucd-snmp/dlmod module files.  */
#define USING_UCD_SNMP_DLMOD_MODULE 1
 
/* Define if compiling with the ucd-snmp/proxy module files.  */
#define USING_UCD_SNMP_PROXY_MODULE 1
 
/* Define if compiling with the ucd-snmp/logmatch module files.  */
#define USING_UCD_SNMP_LOGMATCH_MODULE 1
 
/* Define if compiling with the ucd-snmp/memory module files.  */
#define USING_UCD_SNMP_MEMORY_MODULE 1
 
/* Define if compiling with the ucd-snmp/vmstat module files.  */
#define USING_UCD_SNMP_VMSTAT_MODULE 1
 
/* Define if compiling with the notification/snmpNotifyTable module files.  */
#define USING_NOTIFICATION_SNMPNOTIFYTABLE_MODULE 1
 
/* Define if compiling with the snmp-notification-mib/snmpNotifyFilterTable module files.  */
#define USING_SNMP_NOTIFICATION_MIB_SNMPNOTIFYFILTERTABLE_MODULE 1
 
/* Define if compiling with the notification/snmpNotifyFilterProfileTable module files.  */
#define USING_NOTIFICATION_SNMPNOTIFYFILTERPROFILETABLE_MODULE 1
 
/* Define if compiling with the notification-log-mib/notification_log module files.  */
#define USING_NOTIFICATION_LOG_MIB_NOTIFICATION_LOG_MODULE 1
 
/* Define if compiling with the target/snmpTargetAddrEntry module files.  */
#define USING_TARGET_SNMPTARGETADDRENTRY_MODULE 1
 
/* Define if compiling with the target/snmpTargetParamsEntry module files.  */
#define USING_TARGET_SNMPTARGETPARAMSENTRY_MODULE 1
 
/* Define if compiling with the target/target module files.  */
#define USING_TARGET_TARGET_MODULE 1
 
/* Define if compiling with the target/target_counters module files.  */
#define USING_TARGET_TARGET_COUNTERS_MODULE 1
 
/* Define if compiling with the agent/nsTransactionTable module files.  */
#define USING_AGENT_NSTRANSACTIONTABLE_MODULE 1
 
/* Define if compiling with the agent/nsModuleTable module files.  */
#define USING_AGENT_NSMODULETABLE_MODULE 1
 
/* Define if compiling with the agent/nsDebug module files.  */
#define USING_AGENT_NSDEBUG_MODULE 1
 
/* Define if compiling with the agent/nsCache module files.  */
#define USING_AGENT_NSCACHE_MODULE 1
 
/* Define if compiling with the agent/nsLogging module files.  */
#define USING_AGENT_NSLOGGING_MODULE 1
 
/* Define if compiling with the agent/nsVacmAccessTable module files.  */
#define USING_AGENT_NSVACMACCESSTABLE_MODULE 1
 
/* Define if compiling with the disman/event/mteScalars module files.  */
#define USING_DISMAN_EVENT_MTESCALARS_MODULE 1
 
/* Define if compiling with the disman/event/mteTrigger module files.  */
#define USING_DISMAN_EVENT_MTETRIGGER_MODULE 1
 
/* Define if compiling with the disman/event/mteTriggerTable module files.  */
#define USING_DISMAN_EVENT_MTETRIGGERTABLE_MODULE 1
 
/* Define if compiling with the disman/event/mteTriggerDeltaTable module files.  */
#define USING_DISMAN_EVENT_MTETRIGGERDELTATABLE_MODULE 1
 
/* Define if compiling with the disman/event/mteTriggerExistenceTable module files.  */
#define USING_DISMAN_EVENT_MTETRIGGEREXISTENCETABLE_MODULE 1
 
/* Define if compiling with the disman/event/mteTriggerBooleanTable module files.  */
#define USING_DISMAN_EVENT_MTETRIGGERBOOLEANTABLE_MODULE 1
 
/* Define if compiling with the disman/event/mteTriggerThresholdTable module files.  */
#define USING_DISMAN_EVENT_MTETRIGGERTHRESHOLDTABLE_MODULE 1
 
/* Define if compiling with the disman/event/mteTriggerConf module files.  */
#define USING_DISMAN_EVENT_MTETRIGGERCONF_MODULE 1
 
/* Define if compiling with the disman/event/mteEvent module files.  */
#define USING_DISMAN_EVENT_MTEEVENT_MODULE 1
 
/* Define if compiling with the disman/event/mteEventTable module files.  */
#define USING_DISMAN_EVENT_MTEEVENTTABLE_MODULE 1
 
/* Define if compiling with the disman/event/mteEventSetTable module files.  */
#define USING_DISMAN_EVENT_MTEEVENTSETTABLE_MODULE 1
 
/* Define if compiling with the disman/event/mteEventNotificationTable module files.  */
#define USING_DISMAN_EVENT_MTEEVENTNOTIFICATIONTABLE_MODULE 1
 
/* Define if compiling with the disman/event/mteEventConf module files.  */
#define USING_DISMAN_EVENT_MTEEVENTCONF_MODULE 1
 
/* Define if compiling with the disman/event/mteObjects module files.  */
#define USING_DISMAN_EVENT_MTEOBJECTS_MODULE 1
 
/* Define if compiling with the disman/event/mteObjectsTable module files.  */
#define USING_DISMAN_EVENT_MTEOBJECTSTABLE_MODULE 1
 
/* Define if compiling with the disman/event/mteObjectsConf module files.  */
#define USING_DISMAN_EVENT_MTEOBJECTSCONF_MODULE 1
 
/* Define if compiling with the disman/schedule/schedCore module files.  */
#define USING_DISMAN_SCHEDULE_SCHEDCORE_MODULE 1
 
/* Define if compiling with the disman/schedule/schedConf module files.  */
#define USING_DISMAN_SCHEDULE_SCHEDCONF_MODULE 1
 
/* Define if compiling with the disman/schedule/schedTable module files.  */
#define USING_DISMAN_SCHEDULE_SCHEDTABLE_MODULE 1
 
/* Define if compiling with the utilities/override module files.  */
#define USING_UTILITIES_OVERRIDE_MODULE 1
 
/* Define if compiling with the etherlike-mib/data_access/dot3stats module files.  */
#define USING_ETHERLIKE_MIB_DATA_ACCESS_DOT3STATS_MODULE 1
 
/* Define if compiling with the etherlike-mib/dot3StatsTable/dot3StatsTable module files.  */
#define USING_ETHERLIKE_MIB_DOT3STATSTABLE_DOT3STATSTABLE_MODULE 1
 
/* Define if compiling with the etherlike-mib/dot3StatsTable/dot3StatsTable_data_get module files.  */
#define USING_ETHERLIKE_MIB_DOT3STATSTABLE_DOT3STATSTABLE_DATA_GET_MODULE 1
 
/* Define if compiling with the etherlike-mib/dot3StatsTable/dot3StatsTable_data_set module files.  */
#define USING_ETHERLIKE_MIB_DOT3STATSTABLE_DOT3STATSTABLE_DATA_SET_MODULE 1
 
/* Define if compiling with the etherlike-mib/dot3StatsTable/dot3StatsTable_data_access module files.  */
#define USING_ETHERLIKE_MIB_DOT3STATSTABLE_DOT3STATSTABLE_DATA_ACCESS_MODULE 1
 
/* Define if compiling with the etherlike-mib/dot3StatsTable/dot3StatsTable_interface module files.  */
#define USING_ETHERLIKE_MIB_DOT3STATSTABLE_DOT3STATSTABLE_INTERFACE_MODULE 1
 
/* Define if compiling with the hardware/memory module files.  */
#define USING_HARDWARE_MEMORY_MODULE 1
 
/* Define if compiling with the hardware/fsys module files.  */
#define USING_HARDWARE_FSYS_MODULE 1
 
/* Define if compiling with the host/data_access/swinst module files.  */
#define USING_HOST_DATA_ACCESS_SWINST_MODULE 1
 
/* Define if compiling with the host/data_access/swrun module files.  */
#define USING_HOST_DATA_ACCESS_SWRUN_MODULE 1
 
/* Define if compiling with the host/hrSWRunPerfTable module files.  */
#define USING_HOST_HRSWRUNPERFTABLE_MODULE 1
 
/* Define if compiling with the hardware/cpu module files.  */
#define USING_HARDWARE_CPU_MODULE 1
 
/* Define if compiling with the util_funcs module files.  */
#define USING_UTIL_FUNCS_MODULE 1
 
/* Define if compiling with the if-mib/data_access/interface module files.  */
#define USING_IF_MIB_DATA_ACCESS_INTERFACE_MODULE 1
 
/* Define if compiling with the ip-mib/data_access/ipaddress module files.  */
#define USING_IP_MIB_DATA_ACCESS_IPADDRESS_MODULE 1
 
/* Define if compiling with the ip-mib/ipAddressTable/ipAddressTable_interface module files.  */
#define USING_IP_MIB_IPADDRESSTABLE_IPADDRESSTABLE_INTERFACE_MODULE 1
 
/* Define if compiling with the ip-mib/ipAddressTable/ipAddressTable_data_access module files.  */
#define USING_IP_MIB_IPADDRESSTABLE_IPADDRESSTABLE_DATA_ACCESS_MODULE 1
 
/* Define if compiling with the ip-mib/data_access/defaultrouter_common module files.  */
#define USING_IP_MIB_DATA_ACCESS_DEFAULTROUTER_COMMON_MODULE 1
 
/* Define if compiling with the ip-mib/data_access/defaultrouter_linux module files.  */
#define USING_IP_MIB_DATA_ACCESS_DEFAULTROUTER_LINUX_MODULE 1
 
/* Define if compiling with the ip-mib/data_access/systemstats_common module files.  */
#define USING_IP_MIB_DATA_ACCESS_SYSTEMSTATS_COMMON_MODULE 1
 
/* Define if compiling with the ip-mib/data_access/systemstats_linux module files.  */
#define USING_IP_MIB_DATA_ACCESS_SYSTEMSTATS_LINUX_MODULE 1
 
/* Define if compiling with the ip-mib/ipIfStatsTable/ipIfStatsTable_data_get module files.  */
#define USING_IP_MIB_IPIFSTATSTABLE_IPIFSTATSTABLE_DATA_GET_MODULE 1
 
/* Define if compiling with the if-mib/ifTable/ifTable_interface module files.  */
#define USING_IF_MIB_IFTABLE_IFTABLE_INTERFACE_MODULE 1
 
/* Define if compiling with the if-mib/ifTable/ifTable_data_access module files.  */
#define USING_IF_MIB_IFTABLE_IFTABLE_DATA_ACCESS_MODULE 1
 
/* Define if compiling with the if-mib/ifTable/ifTable module files.  */
#define USING_IF_MIB_IFTABLE_IFTABLE_MODULE 1
 
/* Define if compiling with the ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_interface module files.  */
#define USING_IP_MIB_IPV4INTERFACETABLE_IPV4INTERFACETABLE_INTERFACE_MODULE 1
 
/* Define if compiling with the ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_data_access module files.  */
#define USING_IP_MIB_IPV4INTERFACETABLE_IPV4INTERFACETABLE_DATA_ACCESS_MODULE 1
 
/* Define if compiling with the ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_interface module files.  */
#define USING_IP_MIB_IPV6INTERFACETABLE_IPV6INTERFACETABLE_INTERFACE_MODULE 1
 
/* Define if compiling with the ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_data_access module files.  */
#define USING_IP_MIB_IPV6INTERFACETABLE_IPV6INTERFACETABLE_DATA_ACCESS_MODULE 1
 
/* Define if compiling with the ip-mib/data_access/ipv6scopezone module files.  */
#define USING_IP_MIB_DATA_ACCESS_IPV6SCOPEZONE_MODULE 1
 
/* Define if compiling with the ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_interface module files.  */
#define USING_IP_MIB_IPV6SCOPEZONEINDEXTABLE_IPV6SCOPEZONEINDEXTABLE_INTERFACE_MODULE 1
 
/* Define if compiling with the ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_data_access module files.  */
#define USING_IP_MIB_IPV6SCOPEZONEINDEXTABLE_IPV6SCOPEZONEINDEXTABLE_DATA_ACCESS_MODULE 1
 
/* Define if compiling with the rmon-mib/data_access/etherstats module files.  */
#define USING_RMON_MIB_DATA_ACCESS_ETHERSTATS_MODULE 1
 
/* Define if compiling with the rmon-mib/etherStatsTable/etherStatsTable module files.  */
#define USING_RMON_MIB_ETHERSTATSTABLE_ETHERSTATSTABLE_MODULE 1
 
/* Define if compiling with the rmon-mib/etherStatsTable/etherStatsTable_data_get module files.  */
#define USING_RMON_MIB_ETHERSTATSTABLE_ETHERSTATSTABLE_DATA_GET_MODULE 1
 
/* Define if compiling with the rmon-mib/etherStatsTable/etherStatsTable_data_set module files.  */
#define USING_RMON_MIB_ETHERSTATSTABLE_ETHERSTATSTABLE_DATA_SET_MODULE 1
 
/* Define if compiling with the rmon-mib/etherStatsTable/etherStatsTable_data_access module files.  */
#define USING_RMON_MIB_ETHERSTATSTABLE_ETHERSTATSTABLE_DATA_ACCESS_MODULE 1
 
/* Define if compiling with the rmon-mib/etherStatsTable/etherStatsTable_interface module files.  */
#define USING_RMON_MIB_ETHERSTATSTABLE_ETHERSTATSTABLE_INTERFACE_MODULE 1
 
/* Define if compiling with the sctp-mib/sctpScalars_common module files.  */
#define USING_SCTP_MIB_SCTPSCALARS_COMMON_MODULE 1
 
/* Define if compiling with the sctp-mib/sctpScalars_linux module files.  */
#define USING_SCTP_MIB_SCTPSCALARS_LINUX_MODULE 1
 
/* Define if compiling with the sctp-mib/sctpTables_common module files.  */
#define USING_SCTP_MIB_SCTPTABLES_COMMON_MODULE 1
 
/* Define if compiling with the sctp-mib/sctpAssocRemAddrTable module files.  */
#define USING_SCTP_MIB_SCTPASSOCREMADDRTABLE_MODULE 1
 
/* Define if compiling with the sctp-mib/sctpAssocLocalAddrTable module files.  */
#define USING_SCTP_MIB_SCTPASSOCLOCALADDRTABLE_MODULE 1
 
/* Define if compiling with the sctp-mib/sctpLookupLocalPortTable module files.  */
#define USING_SCTP_MIB_SCTPLOOKUPLOCALPORTTABLE_MODULE 1
 
/* Define if compiling with the sctp-mib/sctpLookupRemPortTable module files.  */
#define USING_SCTP_MIB_SCTPLOOKUPREMPORTTABLE_MODULE 1
 
/* Define if compiling with the sctp-mib/sctpLookupRemHostNameTable module files.  */
#define USING_SCTP_MIB_SCTPLOOKUPREMHOSTNAMETABLE_MODULE 1
 
/* Define if compiling with the sctp-mib/sctpLookupRemPrimIPAddrTable module files.  */
#define USING_SCTP_MIB_SCTPLOOKUPREMPRIMIPADDRTABLE_MODULE 1
 
/* Define if compiling with the sctp-mib/sctpLookupRemIPAddrTable module files.  */
#define USING_SCTP_MIB_SCTPLOOKUPREMIPADDRTABLE_MODULE 1
 
/* Define if compiling with the sctp-mib/sctpAssocTable module files.  */
#define USING_SCTP_MIB_SCTPASSOCTABLE_MODULE 1
 
/* Define if compiling with the sctp-mib/sctpTables_linux module files.  */
#define USING_SCTP_MIB_SCTPTABLES_LINUX_MODULE 1
 
/* Define if compiling with the util_funcs/get_pid_from_inode module files.  */
#define USING_UTIL_FUNCS_GET_PID_FROM_INODE_MODULE 1
 
/* Define if compiling with the tcp-mib/data_access/tcpConn module files.  */
#define USING_TCP_MIB_DATA_ACCESS_TCPCONN_MODULE 1
 
/* Define if compiling with the tcp-mib/tcpConnectionTable/tcpConnectionTable module files.  */
#define USING_TCP_MIB_TCPCONNECTIONTABLE_TCPCONNECTIONTABLE_MODULE 1
 
/* Define if compiling with the tcp-mib/tcpListenerTable/tcpListenerTable module files.  */
#define USING_TCP_MIB_TCPLISTENERTABLE_TCPLISTENERTABLE_MODULE 1
 
/* Define if compiling with the hardware/sensors/hw_sensors module files.  */
#define USING_HARDWARE_SENSORS_HW_SENSORS_MODULE 1
 
/* Define if compiling with the hardware/sensors/lmsensors_v3 module files.  */
#define USING_HARDWARE_SENSORS_LMSENSORS_V3_MODULE 1
 
/* Define if compiling with the udp-mib/udpEndpointTable/udpEndpointTable module files.  */
#define USING_UDP_MIB_UDPENDPOINTTABLE_UDPENDPOINTTABLE_MODULE 1
 
/* Define if compiling with the util_funcs/header_generic module files.  */
#define USING_UTIL_FUNCS_HEADER_GENERIC_MODULE 1
 
/* Define if compiling with the mibII/updates module files.  */
#define USING_MIBII_UPDATES_MODULE 1
 
/* Define if compiling with the mibII/vacm_context module files.  */
#define USING_MIBII_VACM_CONTEXT_MODULE 1
 
/* Define if compiling with the mibII/data_access/at_linux module files.  */
#define USING_MIBII_DATA_ACCESS_AT_LINUX_MODULE 1
 
/* Define if compiling with the mibII/data_access/at_unix module files.  */
#define USING_MIBII_DATA_ACCESS_AT_UNIX_MODULE 1
 
/* Define if compiling with the if-mib/ifTable module files.  */
#define USING_IF_MIB_IFTABLE_MODULE 1
 
/* Define if compiling with the mibII/kernel_linux module files.  */
#define USING_MIBII_KERNEL_LINUX_MODULE 1
 
/* Define if compiling with the mibII/ipAddr module files.  */
#define USING_MIBII_IPADDR_MODULE 1
 
/* Define if compiling with the mibII/var_route module files.  */
#define USING_MIBII_VAR_ROUTE_MODULE 1
 
/* Define if compiling with the mibII/route_write module files.  */
#define USING_MIBII_ROUTE_WRITE_MODULE 1
 
/* Define if compiling with the mibII/tcpTable module files.  */
#define USING_MIBII_TCPTABLE_MODULE 1
 
/* Define if compiling with the mibII/udpTable module files.  */
#define USING_MIBII_UDPTABLE_MODULE 1
 
/* Define if compiling with the if-mib/ifXTable module files.  */
#define USING_IF_MIB_IFXTABLE_MODULE 1
 
/* Define if compiling with the ip-mib/ipAddressTable module files.  */
#define USING_IP_MIB_IPADDRESSTABLE_MODULE 1
 
/* Define if compiling with the ip-mib/ipAddressPrefixTable module files.  */
#define USING_IP_MIB_IPADDRESSPREFIXTABLE_MODULE 1
 
/* Define if compiling with the ip-mib/ipDefaultRouterTable module files.  */
#define USING_IP_MIB_IPDEFAULTROUTERTABLE_MODULE 1
 
/* Define if compiling with the ip-mib/inetNetToMediaTable module files.  */
#define USING_IP_MIB_INETNETTOMEDIATABLE_MODULE 1
 
/* Define if compiling with the ip-mib/ipSystemStatsTable module files.  */
#define USING_IP_MIB_IPSYSTEMSTATSTABLE_MODULE 1
 
/* Define if compiling with the ip-mib/ip_scalars module files.  */
#define USING_IP_MIB_IP_SCALARS_MODULE 1
 
/* Define if compiling with the ip-forward-mib/ipCidrRouteTable module files.  */
#define USING_IP_FORWARD_MIB_IPCIDRROUTETABLE_MODULE 1
 
/* Define if compiling with the ip-forward-mib/inetCidrRouteTable module files.  */
#define USING_IP_FORWARD_MIB_INETCIDRROUTETABLE_MODULE 1
 
/* Define if compiling with the util_funcs/restart module files.  */
#define USING_UTIL_FUNCS_RESTART_MODULE 1
 
/* Define if compiling with the ucd-snmp/pass_common module files.  */
#define USING_UCD_SNMP_PASS_COMMON_MODULE 1
 
/* Define if compiling with the notification/snmpNotifyTable_data module files.  */
#define USING_NOTIFICATION_SNMPNOTIFYTABLE_DATA_MODULE 1
 
/* Define if compiling with the header_complex module files.  */
#define USING_HEADER_COMPLEX_MODULE 1
 
/* Define if compiling with the snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_storage module files.  */
#define USING_SNMP_NOTIFICATION_MIB_SNMPNOTIFYFILTERTABLE_SNMPNOTIFYFILTERTABLE_DATA_STORAGE_MODULE 1
 
/* Define if compiling with the snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable module files.  */
#define USING_SNMP_NOTIFICATION_MIB_SNMPNOTIFYFILTERTABLE_SNMPNOTIFYFILTERTABLE_MODULE 1
 
/* Define if compiling with the notification/snmpNotifyFilterProfileTable_data module files.  */
#define USING_NOTIFICATION_SNMPNOTIFYFILTERPROFILETABLE_DATA_MODULE 1
 
/* Define if compiling with the target/snmpTargetAddrEntry_data module files.  */
#define USING_TARGET_SNMPTARGETADDRENTRY_DATA_MODULE 1
 
/* Define if compiling with the target/snmpTargetParamsEntry_data module files.  */
#define USING_TARGET_SNMPTARGETPARAMSENTRY_DATA_MODULE 1
 
/* Define if compiling with the etherlike-mib/data_access/dot3stats_linux module files.  */
#define USING_ETHERLIKE_MIB_DATA_ACCESS_DOT3STATS_LINUX_MODULE 1
 
/* Define if compiling with the hardware/memory/hw_mem module files.  */
#define USING_HARDWARE_MEMORY_HW_MEM_MODULE 1
 
/* Define if compiling with the hardware/memory/memory_linux module files.  */
#define USING_HARDWARE_MEMORY_MEMORY_LINUX_MODULE 1
 
/* Define if compiling with the hardware/fsys/hw_fsys module files.  */
#define USING_HARDWARE_FSYS_HW_FSYS_MODULE 1
 
/* Define if compiling with the hardware/fsys/fsys_mntent module files.  */
#define USING_HARDWARE_FSYS_FSYS_MNTENT_MODULE 1
 
/* Define if compiling with the host/data_access/swinst_rpm module files.  */
#define USING_HOST_DATA_ACCESS_SWINST_RPM_MODULE 1
 
/* Define if compiling with the host/data_access/swrun_procfs_status module files.  */
#define USING_HOST_DATA_ACCESS_SWRUN_PROCFS_STATUS_MODULE 1
 
/* Define if compiling with the hardware/cpu/cpu module files.  */
#define USING_HARDWARE_CPU_CPU_MODULE 1
 
/* Define if compiling with the hardware/cpu/cpu_linux module files.  */
#define USING_HARDWARE_CPU_CPU_LINUX_MODULE 1
 
/* Define if compiling with the if-mib/data_access/interface_linux module files.  */
#define USING_IF_MIB_DATA_ACCESS_INTERFACE_LINUX_MODULE 1
 
/* Define if compiling with the if-mib/data_access/interface_ioctl module files.  */
#define USING_IF_MIB_DATA_ACCESS_INTERFACE_IOCTL_MODULE 1
 
/* Define if compiling with the ip-mib/data_access/ipaddress_common module files.  */
#define USING_IP_MIB_DATA_ACCESS_IPADDRESS_COMMON_MODULE 1
 
/* Define if compiling with the ip-mib/data_access/ipaddress_linux module files.  */
#define USING_IP_MIB_DATA_ACCESS_IPADDRESS_LINUX_MODULE 1
 
/* Define if compiling with the ip-mib/data_access/ipv6scopezone_common module files.  */
#define USING_IP_MIB_DATA_ACCESS_IPV6SCOPEZONE_COMMON_MODULE 1
 
/* Define if compiling with the ip-mib/data_access/ipv6scopezone_linux module files.  */
#define USING_IP_MIB_DATA_ACCESS_IPV6SCOPEZONE_LINUX_MODULE 1
 
/* Define if compiling with the rmon-mib/data_access/etherstats_linux module files.  */
#define USING_RMON_MIB_DATA_ACCESS_ETHERSTATS_LINUX_MODULE 1
 
/* Define if compiling with the tcp-mib/data_access/tcpConn_common module files.  */
#define USING_TCP_MIB_DATA_ACCESS_TCPCONN_COMMON_MODULE 1
 
/* Define if compiling with the tcp-mib/data_access/tcpConn_linux module files.  */
#define USING_TCP_MIB_DATA_ACCESS_TCPCONN_LINUX_MODULE 1
 
/* Define if compiling with the tcp-mib/tcpConnectionTable/tcpConnectionTable_interface module files.  */
#define USING_TCP_MIB_TCPCONNECTIONTABLE_TCPCONNECTIONTABLE_INTERFACE_MODULE 1
 
/* Define if compiling with the tcp-mib/tcpConnectionTable/tcpConnectionTable_data_access module files.  */
#define USING_TCP_MIB_TCPCONNECTIONTABLE_TCPCONNECTIONTABLE_DATA_ACCESS_MODULE 1
 
/* Define if compiling with the tcp-mib/tcpListenerTable/tcpListenerTable_interface module files.  */
#define USING_TCP_MIB_TCPLISTENERTABLE_TCPLISTENERTABLE_INTERFACE_MODULE 1
 
/* Define if compiling with the tcp-mib/tcpListenerTable/tcpListenerTable_data_access module files.  */
#define USING_TCP_MIB_TCPLISTENERTABLE_TCPLISTENERTABLE_DATA_ACCESS_MODULE 1
 
/* Define if compiling with the udp-mib/data_access/udp_endpoint module files.  */
#define USING_UDP_MIB_DATA_ACCESS_UDP_ENDPOINT_MODULE 1
 
/* Define if compiling with the udp-mib/udpEndpointTable/udpEndpointTable_interface module files.  */
#define USING_UDP_MIB_UDPENDPOINTTABLE_UDPENDPOINTTABLE_INTERFACE_MODULE 1
 
/* Define if compiling with the udp-mib/udpEndpointTable/udpEndpointTable_data_access module files.  */
#define USING_UDP_MIB_UDPENDPOINTTABLE_UDPENDPOINTTABLE_DATA_ACCESS_MODULE 1
 
/* Define if compiling with the if-mib/ifXTable/ifXTable module files.  */
#define USING_IF_MIB_IFXTABLE_IFXTABLE_MODULE 1
 
/* Define if compiling with the ip-mib/data_access/arp module files.  */
#define USING_IP_MIB_DATA_ACCESS_ARP_MODULE 1
 
/* Define if compiling with the ip-mib/inetNetToMediaTable/inetNetToMediaTable module files.  */
#define USING_IP_MIB_INETNETTOMEDIATABLE_INETNETTOMEDIATABLE_MODULE 1
 
/* Define if compiling with the ip-mib/inetNetToMediaTable/inetNetToMediaTable_interface module files.  */
#define USING_IP_MIB_INETNETTOMEDIATABLE_INETNETTOMEDIATABLE_INTERFACE_MODULE 1
 
/* Define if compiling with the ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access module files.  */
#define USING_IP_MIB_INETNETTOMEDIATABLE_INETNETTOMEDIATABLE_DATA_ACCESS_MODULE 1
 
/* Define if compiling with the ip-mib/ipSystemStatsTable/ipSystemStatsTable module files.  */
#define USING_IP_MIB_IPSYSTEMSTATSTABLE_IPSYSTEMSTATSTABLE_MODULE 1
 
/* Define if compiling with the ip-mib/ipSystemStatsTable/ipSystemStatsTable_interface module files.  */
#define USING_IP_MIB_IPSYSTEMSTATSTABLE_IPSYSTEMSTATSTABLE_INTERFACE_MODULE 1
 
/* Define if compiling with the ip-mib/ipSystemStatsTable/ipSystemStatsTable_data_access module files.  */
#define USING_IP_MIB_IPSYSTEMSTATSTABLE_IPSYSTEMSTATSTABLE_DATA_ACCESS_MODULE 1
 
/* Define if compiling with the ip-mib/data_access/scalars_common module files.  */
#define USING_IP_MIB_DATA_ACCESS_SCALARS_COMMON_MODULE 1
 
/* Define if compiling with the ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable module files.  */
#define USING_IP_FORWARD_MIB_IPCIDRROUTETABLE_IPCIDRROUTETABLE_MODULE 1
 
/* Define if compiling with the ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable module files.  */
#define USING_IP_FORWARD_MIB_INETCIDRROUTETABLE_INETCIDRROUTETABLE_MODULE 1
 
/* Define if compiling with the snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_interface module files.  */
#define USING_SNMP_NOTIFICATION_MIB_SNMPNOTIFYFILTERTABLE_SNMPNOTIFYFILTERTABLE_INTERFACE_MODULE 1
 
/* Define if compiling with the snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access module files.  */
#define USING_SNMP_NOTIFICATION_MIB_SNMPNOTIFYFILTERTABLE_SNMPNOTIFYFILTERTABLE_DATA_ACCESS_MODULE 1
 
/* Define if compiling with the ip-mib/data_access/ipaddress_ioctl module files.  */
#define USING_IP_MIB_DATA_ACCESS_IPADDRESS_IOCTL_MODULE 1
 
/* Define if compiling with the udp-mib/data_access/udp_endpoint_common module files.  */
#define USING_UDP_MIB_DATA_ACCESS_UDP_ENDPOINT_COMMON_MODULE 1
 
/* Define if compiling with the udp-mib/data_access/udp_endpoint_linux module files.  */
#define USING_UDP_MIB_DATA_ACCESS_UDP_ENDPOINT_LINUX_MODULE 1
 
/* Define if compiling with the if-mib/ifXTable/ifXTable_interface module files.  */
#define USING_IF_MIB_IFXTABLE_IFXTABLE_INTERFACE_MODULE 1
 
/* Define if compiling with the if-mib/ifXTable/ifXTable_data_access module files.  */
#define USING_IF_MIB_IFXTABLE_IFXTABLE_DATA_ACCESS_MODULE 1
 
/* Define if compiling with the ip-mib/data_access/arp_common module files.  */
#define USING_IP_MIB_DATA_ACCESS_ARP_COMMON_MODULE 1
 
/* Define if compiling with the ip-mib/data_access/arp_netlink module files.  */
#define USING_IP_MIB_DATA_ACCESS_ARP_NETLINK_MODULE 1
 
/* Define if compiling with the ip-mib/data_access/scalars_linux module files.  */
#define USING_IP_MIB_DATA_ACCESS_SCALARS_LINUX_MODULE 1
 
/* Define if compiling with the ip-forward-mib/data_access/route module files.  */
#define USING_IP_FORWARD_MIB_DATA_ACCESS_ROUTE_MODULE 1
 
/* Define if compiling with the ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_interface module files.  */
#define USING_IP_FORWARD_MIB_IPCIDRROUTETABLE_IPCIDRROUTETABLE_INTERFACE_MODULE 1
 
/* Define if compiling with the ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_data_access module files.  */
#define USING_IP_FORWARD_MIB_IPCIDRROUTETABLE_IPCIDRROUTETABLE_DATA_ACCESS_MODULE 1
 
/* Define if compiling with the ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_interface module files.  */
#define USING_IP_FORWARD_MIB_INETCIDRROUTETABLE_INETCIDRROUTETABLE_INTERFACE_MODULE 1
 
/* Define if compiling with the ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_data_access module files.  */
#define USING_IP_FORWARD_MIB_INETCIDRROUTETABLE_INETCIDRROUTETABLE_DATA_ACCESS_MODULE 1
 
/* Define if compiling with the ip-forward-mib/data_access/route_common module files.  */
#define USING_IP_FORWARD_MIB_DATA_ACCESS_ROUTE_COMMON_MODULE 1
 
/* Define if compiling with the ip-forward-mib/data_access/route_linux module files.  */
#define USING_IP_FORWARD_MIB_DATA_ACCESS_ROUTE_LINUX_MODULE 1
 
/* Define if compiling with the ip-forward-mib/data_access/route_ioctl module files.  */
#define USING_IP_FORWARD_MIB_DATA_ACCESS_ROUTE_IOCTL_MODULE 1
 
agent/struct.h000064400000002430147511501100007331 0ustar00#ifndef UCD_SNMP_STRUCT
#define UCD_SNMP_STRUCT

#define STRMAX 1024
#define SHPROC 1
#define EXECPROC 2
#define PASSTHRU 3
#define PASSTHRU_PERSIST 4
#define MIBMAX 30

struct extensible {
    char            name[STRMAX];
    char           *command;
    char            fixcmd[STRMAX];
    int             type;
    int             result;
    char            output[STRMAX];
    struct extensible *next;
    oid             miboid[MIBMAX];
    size_t          miblen;
    int             mibpriority;
    netsnmp_pid_t   pid;
#if defined(WIN32)
    HANDLE          tid;                /* WIN32 thread */
#endif
#ifdef USING_SINGLE_COMMON_PASSPERSIST_INSTANCE
    struct extensible *passpersist_inst;
#endif /* USING_SINGLE_COMMON_PASSPERSIST_INSTANCE */
};

#if HAVE_PCRE_H
/* Pointer to pcre struct. Abstract pcre native pointer so all *.c files */
/* do not have to include pcre.h */
struct real_pcre;
typedef struct real_pcre *netsnmp_regex_ptr;
#endif

struct myproc {
    char            name[STRMAX];
#if HAVE_PCRE_H
    netsnmp_regex_ptr regexp;
#endif
    char            fixcmd[STRMAX];
    int             min;
    int             max;
    struct myproc  *next;
};

/*
 * struct mibinfo 
 * {
 * int numid;
 * unsigned long mibid[10];
 * char *name;
 * void (*handle) ();
 * };
 */

#endif
agent/snmp_vars.h000064400000011130147511501100010012 0ustar00/*
 * Definitions for SNMP (RFC 1067) agent variable finder.
 *
 */

#ifndef _SNMP_VARS_H_
#define _SNMP_VARS_H_

#ifdef __cplusplus
extern          "C" {
#endif

/* Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 */
/***********************************************************
	Copyright 1988, 1989 by Carnegie Mellon University
	Copyright 1989	TGV, Incorporated

		      All Rights Reserved

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of CMU and TGV not be used
in advertising or publicity pertaining to distribution of the software
without specific, written prior permission.

CMU AND TGV DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
EVENT SHALL CMU OR TGV BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
/*
 * Portions of this file are copyrighted by:
 * Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */

    struct variable;

    /**
     * Duplicates a variable.
     *
     * @return Pointer to the duplicate variable upon success; NULL upon
     *   failure.
     *
     * @see struct variable
     * @see struct variable1
     * @see struct variable2
     * @see struct variable3
     * @see struct variable4
     * @see struct variable7
     * @see struct variable8
     * @see struct variable13
     */
    struct variable *netsnmp_duplicate_variable(const struct variable *var);

    /*
     * Function pointer called by the master agent for writes. 
     */
    typedef int     (WriteMethod) (int action,
                                   u_char * var_val,
                                   u_char var_val_type,
                                   size_t var_val_len,
                                   u_char * statP,
                                   oid * name, size_t length);

    /*
     * Function pointer called by the master agent for mib information retrieval 
     */
    typedef u_char *(FindVarMethod) (struct variable * vp,
                                     oid * name,
                                     size_t * length,
                                     int exact,
                                     size_t * var_len,
                                     WriteMethod ** write_method);

    /*
     * Function pointer called by the master agent for setting up subagent requests 
     */
    typedef int     (AddVarMethod) (netsnmp_agent_session *asp,
                                    netsnmp_variable_list * vbp);

    struct nlist;

    extern long     long_return;
    extern u_char   return_buf[];

    extern oid      nullOid[];
    extern int      nullOidLen;

#define INST	0xFFFFFFFF      /* used to fill out the instance field of the variables table */

    struct variable {
        u_char          magic;  /* passed to function as a hint */
        char            type;   /* type of variable */
        /*
         * See important comment in snmp_vars.c relating to acl 
         */
        u_short         acl;    /* access control list for variable */
        FindVarMethod  *findVar;        /* function that finds variable */
        u_char          namelen;        /* length of above */
        oid             name[MAX_OID_LEN];      /* object identifier of variable */
    };

    int             init_agent(const char *);
    void            shutdown_agent(void);

    int             should_init(const char *module_name);
    void            add_to_init_list(char *module_list);

#ifdef USING_AGENTX_SUBAGENT_MODULE
    void            netsnmp_enable_subagent(void);
#endif

#ifndef _AGENT_REGISTRY_H
#include <net-snmp/agent/agent_handler.h>
#include <net-snmp/agent/var_struct.h>
#include <net-snmp/agent/agent_registry.h>
#endif

    /*
     * fail overloads non-negative integer value. it must be -1 ! 
     */
#define MATCH_FAILED	(-1)
#define MATCH_SUCCEEDED	0

#ifdef __cplusplus
}
#endif
#endif                          /* _SNMP_VARS_H_ */
agent/multiplexer.h000064400000001717147511501100010366 0ustar00#ifndef NETSNMP_MULTIPLEXER_H
#define NETSNMP_MULTIPLEXER_H

#ifdef __cplusplus
extern          "C" {
#endif

/*
 * The multiplexer helper 
 */

/** @name multiplexer
 *  @{ */

/** @struct netsnmp_mib_handler_methods
 *  Defines the subhandlers to be called by the multiplexer helper
 */
typedef struct netsnmp_mib_handler_methods_s {
   /** called when a GET request is received */
    netsnmp_mib_handler *get_handler;
   /** called when a GETNEXT request is received */
    netsnmp_mib_handler *getnext_handler;
   /** called when a GETBULK request is received */
    netsnmp_mib_handler *getbulk_handler;
   /** called when a SET request is received */
    netsnmp_mib_handler *set_handler;
} netsnmp_mib_handler_methods;

/** @} */

netsnmp_mib_handler
    *netsnmp_get_multiplexer_handler(netsnmp_mib_handler_methods *);

Netsnmp_Node_Handler netsnmp_multiplexer_helper_handler;

#ifdef __cplusplus
}
#endif
#endif                          /* NETSNMP_MULTIPLEXER_H */
agent/util_funcs/MIB_STATS_CACHE_TIMEOUT.h000064400000000523147511501100013637 0ustar00/*
 * util_funcs/MIB_STATS_CACHE_TIMEOUT.h:  utilitiy functions for extensible
 * groups.
 */
#ifndef _MIBGROUP_UTIL_FUNCS_MIB_STATS_CACHE_TIMEOUT_H
#define _MIBGROUP_UTIL_FUNCS_MIB_STATS_CACHE_TIMEOUT_H

#ifndef MIB_STATS_CACHE_TIMEOUT
#define MIB_STATS_CACHE_TIMEOUT 5
#endif

#endif /* _MIBGROUP_UTIL_FUNCS_MIB_STATS_CACHE_TIMEOUT_H */
agent/util_funcs/get_pid_from_inode.h000064400000001354147511501100014000 0ustar00/*
 * util_funcs/get_pid_from_inode.h:  utilitiy function to retrieve the pid
 * that controls a given inode on linux.
 */
#ifndef NETSNMP_MIBGROUP_UTIL_FUNCS_GET_PID_FROM_INODE_H
#define NETSNMP_MIBGROUP_UTIL_FUNCS_GET_PID_FROM_INODE_H

#ifndef linux
config_error(get_pid_from_inode is only suppored on linux)
#endif

#define _LARGEFILE64_SOURCE 1

#if HAVE_DIRENT_H
#include <dirent.h>
#else
# define dirent direct
# if HAVE_SYS_NDIR_H
#  include <sys/ndir.h>
# endif
# if HAVE_SYS_DIR_H
#  include <sys/dir.h>
# endif
# if HAVE_NDIR_H
#  include <ndir.h>
# endif
#endif

#include <sys/types.h>

void netsnmp_get_pid_from_inode_init(void);
pid_t netsnmp_get_pid_from_inode(ino64_t);

#endif /* NETSNMP_MIBGROUP_UTIL_FUNCS_GET_PID_FROM_INODE_H */
agent/util_funcs/header_simple_table.h000064400000000670147511501100014134 0ustar00/*
 * util_funcs/header_simple_table.h:  utilitiy functions for extensible
 * groups.
 */
#ifndef _MIBGROUP_UTIL_FUNCS_HEADER_SIMPLE_TABLE_H
#define _MIBGROUP_UTIL_FUNCS_HEADER_SIMPLE_TABLE_H

#ifdef __cplusplus
extern "C" {
#endif

int header_simple_table(struct variable *, oid *, size_t *, int, size_t *,
                        WriteMethod **, int);

#ifdef __cplusplus
}
#endif

#endif /* _MIBGROUP_UTIL_FUNCS_HEADER_SIMPLE_TABLE_H */
agent/util_funcs/restart.h000064400000000477147511501100011655 0ustar00#ifndef _MIBGROUP_UTIL_FUNCS_RESTART_H
#define _MIBGROUP_UTIL_FUNCS_RESTART_H

#ifdef __cplusplus
extern "C" {
#endif

extern char **argvrestartp, *argvrestartname, *argvrestart;

RETSIGTYPE      restart_doit(int);
WriteMethod     restart_hook;

#ifdef __cplusplus
}
#endif

#endif /* _MIBGROUP_UTIL_FUNCS_RESTART_H */
agent/util_funcs/header_generic.h000064400000000623147511501100013106 0ustar00/*
 *  util_funcs/header_generic.h:  utilitiy functions for extensible groups.
 */
#ifndef _MIBGROUP_UTIL_FUNCS_HEADER_GENERIC_H
#define _MIBGROUP_UTIL_FUNCS_HEADER_GENERIC_H

#ifdef __cplusplus
extern "C" {
#endif

int header_generic(struct variable *, oid *, size_t *, int, size_t *,
                   WriteMethod **);

#ifdef __cplusplus
}
#endif

#endif /* _MIBGROUP_UTIL_FUNCS_HEADER_GENERIC_H */
agent/util_funcs/Exit.h000064400000000433147511501100011072 0ustar00/*
 *  Exit.h:  verbose terminaion routine
 */
#ifndef _MIBGROUP_UTIL_FUNCS_EXIT_H
#define _MIBGROUP_UTIL_FUNCS_EXIT_H

#ifdef __cplusplus
extern "C" {
#endif

void            Exit(int);

#ifdef __cplusplus
}
#endif

#endif                          /* _MIBGROUP_UTIL_FUNCS_EXIT_H */
agent/util_funcs.h000064400000006366147511501100010174 0ustar00/*
 *  util_funcs.h:  utilitiy functions for extensible groups.
 */
#ifndef _MIBGROUP_UTIL_FUNCS_H
#define _MIBGROUP_UTIL_FUNCS_H

config_require(util_funcs/header_generic)
config_require(util_funcs/header_simple_table)

#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "util_funcs/header_generic.h"
#include "util_funcs/header_simple_table.h"

#ifdef __cplusplus
extern "C" {
#endif

#include "struct.h"

typedef struct prefix_info
{
   struct prefix_info *next_info;
   unsigned long ipAddressPrefixOnLinkFlag;
   unsigned long ipAddressPrefixAutonomousFlag;
   char in6p[40];
}prefix_cbx;
#ifndef WIN32
typedef struct 
{
 prefix_cbx **list_head;
}netsnmp_prefix_listen_info;
#endif
int             shell_command(struct extensible *);
int             exec_command(struct extensible *);
struct extensible *get_exten_instance(struct extensible *, size_t);
int             get_exec_output(struct extensible *);
#if defined(WIN32) && !defined(cygwin)
int             get_exec_pipes(char *cmd, int *fdIn, int *fdOut, HANDLE *pid);
#else
int             get_exec_pipes(char *cmd, int *fdIn, int *fdOut, pid_t *pid);
#endif
WriteMethod     clear_cache;
void            print_mib_oid(oid *, size_t);
void            sprint_mib_oid(char *, const oid *, size_t);
int             checkmib(struct variable *, oid *, size_t *, int, size_t *,
                         WriteMethod ** write_method, int);
char           *find_field(char *, int);
int             parse_miboid(const char *, oid *);
void            string_append_int(char *, int);
void            wait_on_exec(struct extensible *);
const char     *make_tempfile(void);

prefix_cbx *net_snmp_create_prefix_info(unsigned long OnLinkFlag,
                                        unsigned long AutonomousFlag,
                                        char *in6ptr);
#ifndef WIN32
int net_snmp_find_prefix_info(prefix_cbx **head,
                              char *address,
                              prefix_cbx *node_to_find);
int net_snmp_update_prefix_info(prefix_cbx **head,
                                prefix_cbx *node_to_update);
int net_snmp_search_update_prefix_info(prefix_cbx **head,
                                       prefix_cbx *node_to_use,
                                       int functionality);
int net_snmp_delete_prefix_info(prefix_cbx **head,
                                char *address);
#endif
#define NIP6(addr) \
        ntohs((addr).s6_addr16[0]), \
        ntohs((addr).s6_addr16[1]), \
        ntohs((addr).s6_addr16[2]), \
        ntohs((addr).s6_addr16[3]), \
        ntohs((addr).s6_addr16[4]), \
        ntohs((addr).s6_addr16[5]), \
        ntohs((addr).s6_addr16[6]), \
        ntohs((addr).s6_addr16[7])

#define     satosin(x)      ((struct sockaddr_in *) &(x))
#define     SOCKADDR(x)     (satosin(x)->sin_addr.s_addr)

#include "util_funcs/MIB_STATS_CACHE_TIMEOUT.h"

typedef void   *mib_table_t;
typedef int     (RELOAD) (mib_table_t);
typedef int     (COMPARE) (const void *, const void *);
mib_table_t     Initialise_Table(int, int, RELOAD*, COMPARE*);
int             Search_Table(mib_table_t, void *, int);
int             Add_Entry(mib_table_t, void *);
void           *Retrieve_Table_Data(mib_table_t, int *);

#ifdef __cplusplus
}
#endif

#endif                          /* _MIBGROUP_UTIL_FUNCS_H */
agent/bulk_to_next.h000064400000001063147511501100010503 0ustar00/*
 * bulk_to_next.h 
 */
#ifndef BULK_TO_NEXT_H
#define BULK_TO_NEXT_H

#ifdef __cplusplus
extern          "C" {
#endif


/*
 * The helper merely intercepts GETBULK requests and converts them to
 * * GETNEXT reequests.
 */


netsnmp_mib_handler *netsnmp_get_bulk_to_next_handler(void);
void            netsnmp_init_bulk_to_next_helper(void);
void            netsnmp_bulk_to_next_fix_requests(netsnmp_request_info
                                                  *requests);

Netsnmp_Node_Handler netsnmp_bulk_to_next_helper;

#ifdef __cplusplus
}
#endif
#endif
agent/table_data.h000064400000012736147511501100010077 0ustar00/*
 * table_iterator.h 
 */
#ifndef _TABLE_DATA_HANDLER_H_
#define _TABLE_DATA_HANDLER_H_

#ifdef __cplusplus
extern          "C" {
#endif

    /*
     * This helper is designed to completely automate the task of storing
     * tables of data within the agent that are not tied to external data
     * sources (like the kernel, hardware, or other processes, etc).  IE,
     * all rows within a table are expected to be added manually using
     * functions found below.
     */

#define TABLE_DATA_NAME "table_data"
#define TABLE_DATA_ROW  "table_data"
#define TABLE_DATA_TABLE "table_data_table"

    typedef struct netsnmp_table_row_s {
        netsnmp_variable_list *indexes; /* stored permanently if store_indexes = 1 */
        oid            *index_oid;
        size_t          index_oid_len;
        void           *data;   /* the data to store */

        struct netsnmp_table_row_s *next, *prev;        /* if used in a list */
    } netsnmp_table_row;

    typedef struct netsnmp_table_data_s {
        netsnmp_variable_list *indexes_template;        /* containing only types */
        char           *name;   /* if !NULL, it's registered globally */
        int             flags;  /* not currently used */
        int             store_indexes;
        netsnmp_table_row *first_row;
        netsnmp_table_row *last_row;
    } netsnmp_table_data;

/* =================================
 * Table Data API: Table maintenance
 * ================================= */

    void       netsnmp_table_data_generate_index_oid( netsnmp_table_row  *row);

    netsnmp_table_data *netsnmp_create_table_data(const char *name);
    netsnmp_table_row  *netsnmp_create_table_data_row(void);
    netsnmp_table_row  *netsnmp_table_data_clone_row( netsnmp_table_row  *row);
    void               *netsnmp_table_data_delete_row(netsnmp_table_row  *row);
    int                 netsnmp_table_data_add_row(   netsnmp_table_data *table,
                                                      netsnmp_table_row  *row);
    void
       netsnmp_table_data_replace_row(netsnmp_table_data *table,
                                      netsnmp_table_row *origrow,
                                      netsnmp_table_row *newrow);
    netsnmp_table_row *netsnmp_table_data_remove_row(netsnmp_table_data *table,
                                                     netsnmp_table_row  *row);
    void   *netsnmp_table_data_remove_and_delete_row(netsnmp_table_data *table,
                                                     netsnmp_table_row  *row);
    void    netsnmp_table_data_delete_table( netsnmp_table_data *table );

/* =================================
 * Table Data API: MIB maintenance
 * ================================= */

    netsnmp_mib_handler *
        netsnmp_get_table_data_handler(netsnmp_table_data           *table);

    int netsnmp_register_table_data(netsnmp_handler_registration    *reginfo,
                                    netsnmp_table_data              *table,
                                    netsnmp_table_registration_info *table_info);
    int netsnmp_register_read_only_table_data(
                                    netsnmp_handler_registration    *reginfo,
                                    netsnmp_table_data              *table,
                                    netsnmp_table_registration_info *table_info);
    Netsnmp_Node_Handler netsnmp_table_data_helper_handler;

    netsnmp_table_data *netsnmp_extract_table(    netsnmp_request_info *);
    netsnmp_table_row  *netsnmp_extract_table_row(netsnmp_request_info *);
    void          *netsnmp_extract_table_row_data(netsnmp_request_info *);
    void netsnmp_insert_table_row(netsnmp_request_info *, netsnmp_table_row *);

    int netsnmp_table_data_build_result(netsnmp_handler_registration *reginfo,
                                        netsnmp_agent_request_info   *reqinfo,
                                        netsnmp_request_info         *request,
                                        netsnmp_table_row *row, int column,
                                        u_char type, u_char * result_data,
                                        size_t result_data_len);

/* =================================
 * Table Data API: Row operations
 * ================================= */

    netsnmp_table_row *netsnmp_table_data_get_first_row(
                                              netsnmp_table_data    *table);
    netsnmp_table_row *netsnmp_table_data_get_next_row(
                                              netsnmp_table_data    *table,
                                              netsnmp_table_row     *row);

    netsnmp_table_row *netsnmp_table_data_get(netsnmp_table_data    *table,
                                              netsnmp_variable_list *indexes);

    netsnmp_table_row *netsnmp_table_data_get_from_oid(
                                              netsnmp_table_data    *table,
                                              oid *  searchfor,
                                              size_t searchfor_len);

    int netsnmp_table_data_num_rows(netsnmp_table_data *table);


/* =================================
 * Table Data API: Index operations
 * ================================= */

#define netsnmp_table_data_add_index(thetable, type) snmp_varlist_add_variable(&thetable->indexes_template, NULL, 0, type, NULL, 0)
#define netsnmp_table_row_add_index(row, type, value, value_len) snmp_varlist_add_variable(&row->indexes, NULL, 0, type, (const u_char *) value, value_len)


#ifdef __cplusplus
}
#endif

#endif                          /* _TABLE_DATA_HANDLER_H_ */
agent/table_tdata.h000064400000015050147511501100010253 0ustar00/*
 * table_tdata.h 
 */
#ifndef _TABLE_TDATA_HANDLER_H_
#define _TABLE_TDATA_HANDLER_H_

#ifdef __cplusplus
extern          "C" {
#endif

    /*
     * This helper is designed to completely automate the task of storing
     * tables of data within the agent that are not tied to external data
     * sources (like the kernel, hardware, or other processes, etc).  IE,
     * all rows within a table are expected to be added manually using
     * functions found below.
     */

#define TABLE_TDATA_NAME  "table_tdata"
#define TABLE_TDATA_ROW   "table_tdata"
#define TABLE_TDATA_TABLE "table_tdata_table"

#define TDATA_FLAG_NO_STORE_INDEXES   0x01
#define TDATA_FLAG_NO_CONTAINER       0x02 /* user will provide container */

    /*
     * The (table-independent) per-row data structure
     * This is a wrapper round the table-specific per-row data
     *   structure, which is referred to as a "table entry"
     *
     * It should be regarded as an opaque, private data structure,
     *   and shouldn't be accessed directly.
     */
    typedef struct netsnmp_tdata_row_s {
        netsnmp_index   oid_index;      /* table_container index format */
        netsnmp_variable_list *indexes; /* stored permanently if store_indexes = 1 */
        void           *data;   /* the data to store */
    } netsnmp_tdata_row;

    /*
     * The data structure to hold a complete table.
     *
     * This should be regarded as an opaque, private data structure,
     *   and shouldn't be accessed directly.
     */
    typedef struct netsnmp_tdata_s {
        netsnmp_variable_list *indexes_template;        /* containing only types */
        char           *name;   /* if !NULL, it's registered globally */
        int             flags;  /* This field may legitimately be accessed by external code */
        netsnmp_container *container;
    } netsnmp_tdata;

/* Backwards compatability with the previous (poorly named) data structures */
typedef  struct netsnmp_tdata_row_s netsnmp_table_data2row;
typedef  struct netsnmp_tdata_s     netsnmp_table_data2;


/* ============================
 * TData API: Table maintenance
 * ============================ */

    netsnmp_tdata     *netsnmp_tdata_create_table(const char *name, long flags);
    void               netsnmp_tdata_delete_table(netsnmp_tdata *table);
    netsnmp_tdata_row *netsnmp_tdata_create_row(void);
    netsnmp_tdata_row *netsnmp_tdata_clone_row( netsnmp_tdata_row *row);
    int                netsnmp_tdata_copy_row(  netsnmp_tdata_row *dst_row,
                                                netsnmp_tdata_row *src_row);
    void           *netsnmp_tdata_delete_row(   netsnmp_tdata_row *row);

    int             netsnmp_tdata_add_row(      netsnmp_tdata     *table,
                                                netsnmp_tdata_row *row);
    void            netsnmp_tdata_replace_row(  netsnmp_tdata     *table,
                                                netsnmp_tdata_row *origrow,
                                                netsnmp_tdata_row *newrow);
    netsnmp_tdata_row *netsnmp_tdata_remove_row(netsnmp_tdata     *table,
                                                netsnmp_tdata_row *row);
    void   *netsnmp_tdata_remove_and_delete_row(netsnmp_tdata     *table,
                                                netsnmp_tdata_row *row);


/* ============================
 * TData API: MIB maintenance
 * ============================ */

    netsnmp_mib_handler *netsnmp_get_tdata_handler(netsnmp_tdata *table);

    int netsnmp_tdata_register(  netsnmp_handler_registration    *reginfo,
                                 netsnmp_tdata                   *table,
                                 netsnmp_table_registration_info *table_info);
    int netsnmp_tdata_unregister(netsnmp_handler_registration    *reginfo);

    netsnmp_tdata      *netsnmp_tdata_extract_table(    netsnmp_request_info *);
    netsnmp_container  *netsnmp_tdata_extract_container(netsnmp_request_info *);
    netsnmp_tdata_row  *netsnmp_tdata_extract_row(      netsnmp_request_info *);
    void               *netsnmp_tdata_extract_entry(    netsnmp_request_info *);

    void netsnmp_insert_tdata_row(netsnmp_request_info *, netsnmp_tdata_row *);
    void netsnmp_remove_tdata_row(netsnmp_request_info *, netsnmp_tdata_row *);


/* ============================
 * TData API: Row operations
 * ============================ */

    void * netsnmp_tdata_row_entry( netsnmp_tdata_row *row );
    netsnmp_tdata_row *netsnmp_tdata_row_first(netsnmp_tdata     *table);
    netsnmp_tdata_row *netsnmp_tdata_row_get(  netsnmp_tdata     *table,
                                               netsnmp_tdata_row *row);
    netsnmp_tdata_row *netsnmp_tdata_row_next( netsnmp_tdata     *table,
                                               netsnmp_tdata_row *row);

    netsnmp_tdata_row *netsnmp_tdata_row_get_byidx(netsnmp_tdata      *table,
                                                netsnmp_variable_list *indexes);
    netsnmp_tdata_row *netsnmp_tdata_row_get_byoid(netsnmp_tdata      *table,
                                                oid   *searchfor,
                                                size_t searchfor_len);
    netsnmp_tdata_row *netsnmp_tdata_row_next_byidx(netsnmp_tdata     *table,
                                                netsnmp_variable_list *indexes);
    netsnmp_tdata_row *netsnmp_tdata_row_next_byoid(netsnmp_tdata     *table,
                                                oid   *searchfor,
                                                size_t searchfor_len);

    int netsnmp_tdata_row_count(netsnmp_tdata *table);


/* ============================
 * TData API: Index operations
 * ============================ */

#define netsnmp_tdata_add_index(thetable, type) snmp_varlist_add_variable(&thetable->indexes_template, NULL, 0, type, NULL, 0)
#define netsnmp_tdata_row_add_index(row, type, value, value_len) snmp_varlist_add_variable(&row->indexes, NULL, 0, type, (const u_char *) value, value_len)

    int netsnmp_tdata_compare_idx(        netsnmp_tdata_row     *row,
                                          netsnmp_variable_list *indexes);
    int netsnmp_tdata_compare_oid(        netsnmp_tdata_row     *row,
                                          oid *compareto, size_t compareto_len);
    int netsnmp_tdata_compare_subtree_idx(netsnmp_tdata_row     *row,
                                          netsnmp_variable_list *indexes);
    int netsnmp_tdata_compare_subtree_oid(netsnmp_tdata_row     *row,
                                          oid *compareto, size_t compareto_len);


#ifdef __cplusplus
}
#endif

#endif                          /* _TABLE_TDATA_HANDLER_H_ */
agent/all_helpers.h000064400000002277147511501100010310 0ustar00#ifndef ALL_HANDLERS_H
#define ALL_HANDLERS_H

#ifdef __cplusplus
extern          "C" {
#endif

#include <net-snmp/agent/instance.h>
#include <net-snmp/agent/baby_steps.h>
#include <net-snmp/agent/scalar.h>
#include <net-snmp/agent/scalar_group.h>
#include <net-snmp/agent/watcher.h>
#include <net-snmp/agent/multiplexer.h>
#include <net-snmp/agent/null.h>
#include <net-snmp/agent/debug_handler.h>
#include <net-snmp/agent/cache_handler.h>
#include <net-snmp/agent/old_api.h>
#include <net-snmp/agent/read_only.h>
#include <net-snmp/agent/row_merge.h>
#include <net-snmp/agent/serialize.h>
#include <net-snmp/agent/bulk_to_next.h>
#include <net-snmp/agent/mode_end_call.h>
/*
 * #include <net-snmp/agent/set_helper.h> 
 */
#include <net-snmp/agent/table.h>
#include <net-snmp/agent/table_data.h>
#include <net-snmp/agent/table_dataset.h>
#include <net-snmp/agent/table_tdata.h>
#include <net-snmp/agent/table_iterator.h>
#include <net-snmp/agent/table_container.h>
#include <net-snmp/agent/table_array.h> 

#include <net-snmp/agent/mfd.h>
#include <net-snmp/agent/snmp_get_statistic.h>


void            netsnmp_init_helpers(void);

#ifdef __cplusplus
}
#endif
#endif                          /* ALL_HANDLERS_H */
agent/agent_handler.h000064400000026467147511501100010620 0ustar00/* Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 */
/*
 * Portions of this file are copyrighted by:
 * Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */
#ifndef AGENT_HANDLER_H
#define AGENT_HANDLER_H

#ifdef __cplusplus
extern          "C" {
#endif

/** @file agent_handler.h
 *
 *  @addtogroup handler
 *
 * @{
 */

struct netsnmp_handler_registration_s;

/*
 * per mib handler flags.
 * NOTE: Lower bits are reserved for the agent handler's use.
 *       The high 4 bits (31-28) are reserved for use by the handler.
 */
#define MIB_HANDLER_AUTO_NEXT                   0x00000001
#define MIB_HANDLER_AUTO_NEXT_OVERRIDE_ONCE     0x00000002
#define MIB_HANDLER_INSTANCE                    0x00000004

#define MIB_HANDLER_CUSTOM4                     0x10000000
#define MIB_HANDLER_CUSTOM3                     0x20000000
#define MIB_HANDLER_CUSTOM2                     0x40000000
#define MIB_HANDLER_CUSTOM1                     0x80000000


/** @typedef struct netsnmp_mib_handler_s netsnmp_mib_handler
 * Typedefs the netsnmp_mib_handler_s struct into  netsnmp_mib_handler */

/** @struct netsnmp_mib_handler_s
 *  the mib handler structure to be registered
 */
typedef struct netsnmp_mib_handler_s {
        char           *handler_name;
	/** for handler's internal use */
        void           *myvoid; 
        /** for agent_handler's internal use */
        int             flags;

        /** if you add more members, you probably also want to update */
        /** _clone_handler in agent_handler.c. */
	
        int             (*access_method) (struct netsnmp_mib_handler_s *,
                                          struct
                                          netsnmp_handler_registration_s *,
                                          struct
                                          netsnmp_agent_request_info_s *,
                                          struct netsnmp_request_info_s *);
        /** data clone hook for myvoid
         *  deep copy the myvoid member - default is to copy the pointer
         *  This method is only called if myvoid != NULL
         *  myvoid is the current myvoid pointer.
         *  returns NULL on failure
         */
        void *(*data_clone)(void *myvoid);
        /** data free hook for myvoid
         *  delete the myvoid member - default is to do nothing
         *  This method is only called if myvoid != NULL
         */
        void (*data_free)(void *myvoid); /**< data free hook for myvoid */

        struct netsnmp_mib_handler_s *next;
        struct netsnmp_mib_handler_s *prev;
} netsnmp_mib_handler;

/*
 * per registration flags
 */
#define HANDLER_CAN_GETANDGETNEXT     0x01       /* must be able to do both */
#define HANDLER_CAN_SET               0x02           /* implies create, too */
#define HANDLER_CAN_GETBULK           0x04
#define HANDLER_CAN_NOT_CREATE        0x08         /* auto set if ! CAN_SET */
#define HANDLER_CAN_BABY_STEP         0x10
#define HANDLER_CAN_STASH             0x20


#define HANDLER_CAN_RONLY   (HANDLER_CAN_GETANDGETNEXT)
#define HANDLER_CAN_RWRITE  (HANDLER_CAN_GETANDGETNEXT | HANDLER_CAN_SET)
#define HANDLER_CAN_SET_ONLY (HANDLER_CAN_SET | HANDLER_CAN_NOT_CREATE)
#define HANDLER_CAN_DEFAULT (HANDLER_CAN_RONLY | HANDLER_CAN_NOT_CREATE)

/** @typedef struct netsnmp_handler_registration_s netsnmp_handler_registration
 * Typedefs the netsnmp_handler_registration_s struct into netsnmp_handler_registration  */

/** @struct netsnmp_handler_registration_s
 *  Root registration info.
 *  The variables handlerName, contextName, and rootoid need to be allocated
 *  on the heap, when the registration structure is unregistered using
 *  unregister_mib_context() the code attempts to free them.
 */
typedef struct netsnmp_handler_registration_s {

	/** for mrTable listings, and other uses */
        char           *handlerName;
	/** NULL = default context */
        char           *contextName;    

        /**
         * where are we registered at? 
         */
        oid            *rootoid;
        size_t          rootoid_len;

        /**
         * handler details 
         */
        netsnmp_mib_handler *handler;
        int             modes;

        /**
         * more optional stuff 
         */
        int             priority;
        int             range_subid;
        oid             range_ubound;
        int             timeout;
        int             global_cacheid;

        /**
         * void ptr for registeree
         */
        void *          my_reg_void;

} netsnmp_handler_registration;

/*
 * function handler definitions 
 */

typedef int (Netsnmp_Node_Handler) (netsnmp_mib_handler *handler,
    /** pointer to registration struct */
    netsnmp_handler_registration *reginfo,
    /** pointer to current transaction */
    netsnmp_agent_request_info *reqinfo,
    netsnmp_request_info *requests);

    typedef struct netsnmp_handler_args_s {
        netsnmp_mib_handler *handler;
        netsnmp_handler_registration *reginfo;
        netsnmp_agent_request_info *reqinfo;
        netsnmp_request_info *requests;
    } netsnmp_handler_args;

    typedef struct netsnmp_delegated_cache_s {
        int             transaction_id;
        netsnmp_mib_handler *handler;
        netsnmp_handler_registration *reginfo;
        netsnmp_agent_request_info *reqinfo;
        netsnmp_request_info *requests;
        void           *localinfo;
    } netsnmp_delegated_cache;

    /*
     * handler API functions 
     */
    void            netsnmp_init_handler_conf(void);
    int             netsnmp_register_handler(netsnmp_handler_registration
                                             *reginfo);
    int             netsnmp_unregister_handler(netsnmp_handler_registration
                                               *reginfo);
    int            
        netsnmp_register_handler_nocallback(netsnmp_handler_registration
                                            *reginfo);
    int             netsnmp_inject_handler(netsnmp_handler_registration
                                           *reginfo,
                                           netsnmp_mib_handler *handler);
    int
        netsnmp_inject_handler_before(netsnmp_handler_registration *reginfo,
                                      netsnmp_mib_handler *handler,
                                      const char *before_what);
    netsnmp_mib_handler
        *netsnmp_find_handler_by_name(netsnmp_handler_registration
                                      *reginfo, const char *name);
    void          
        *netsnmp_find_handler_data_by_name(netsnmp_handler_registration
                                           *reginfo, const char *name);
    int             netsnmp_call_handlers(netsnmp_handler_registration
                                          *reginfo,
                                          netsnmp_agent_request_info
                                          *reqinfo,
                                          netsnmp_request_info *requests);
    int             netsnmp_call_handler(netsnmp_mib_handler *next_handler,
                                         netsnmp_handler_registration
                                         *reginfo,
                                         netsnmp_agent_request_info
                                         *reqinfo,
                                         netsnmp_request_info *requests);
    int             netsnmp_call_next_handler(netsnmp_mib_handler *current,
                                              netsnmp_handler_registration
                                              *reginfo,
                                              netsnmp_agent_request_info
                                              *reqinfo,
                                              netsnmp_request_info
                                              *requests);
    int             netsnmp_call_next_handler_one_request(netsnmp_mib_handler *current,
                                                          netsnmp_handler_registration *reginfo,
                                                          netsnmp_agent_request_info *reqinfo,
                                                          netsnmp_request_info *requests);
    
    netsnmp_mib_handler *netsnmp_create_handler(const char *name,
                                                Netsnmp_Node_Handler *
                                                handler_access_method);
    netsnmp_handler_registration *
    netsnmp_handler_registration_create(const char *name,
                                        netsnmp_mib_handler *handler,
                                        const oid * reg_oid, size_t reg_oid_len,
                                        int modes);
    netsnmp_handler_registration *
    netsnmp_create_handler_registration(const char *name, Netsnmp_Node_Handler*
                                        handler_access_method,
                                        const oid *reg_oid, size_t reg_oid_len,
                                        int modes);

    netsnmp_delegated_cache
        *netsnmp_create_delegated_cache(netsnmp_mib_handler *,
                                        netsnmp_handler_registration *,
                                        netsnmp_agent_request_info *,
                                        netsnmp_request_info *, void *);
    void netsnmp_free_delegated_cache(netsnmp_delegated_cache *dcache);
    netsnmp_delegated_cache
        *netsnmp_handler_check_cache(netsnmp_delegated_cache *dcache);
    void            netsnmp_register_handler_by_name(const char *,
                                                     netsnmp_mib_handler
                                                     *);

    void            netsnmp_clear_handler_list(void);

    void
        netsnmp_request_add_list_data(netsnmp_request_info *request,
                                      netsnmp_data_list *node);
    int netsnmp_request_remove_list_data(netsnmp_request_info *request,
                                         const char *name);

    int
        netsnmp_request_remove_list_data(netsnmp_request_info *request,
                                         const char *name);

    void    *netsnmp_request_get_list_data(netsnmp_request_info
                                                  *request,
                                                  const char *name);

    void
              netsnmp_free_request_data_set(netsnmp_request_info *request);

    void
             netsnmp_free_request_data_sets(netsnmp_request_info *request);

    void            netsnmp_handler_free(netsnmp_mib_handler *);
    netsnmp_mib_handler *netsnmp_handler_dup(netsnmp_mib_handler *);
    netsnmp_handler_registration
        *netsnmp_handler_registration_dup(netsnmp_handler_registration *);
    void           
        netsnmp_handler_registration_free(netsnmp_handler_registration *);

#define REQUEST_IS_DELEGATED     1
#define REQUEST_IS_NOT_DELEGATED 0
    void           
        netsnmp_handler_mark_requests_as_delegated(netsnmp_request_info *,
                                                   int);
    void           *netsnmp_handler_get_parent_data(netsnmp_request_info *,
                                                    const char *);

#ifdef __cplusplus
}
#endif

#endif                          /* AGENT_HANDLER_H */
/** @} */
agent/ds_agent.h000064400000010243147511501100007572 0ustar00#ifndef NETSNMP_DS_AGENT_H
#define NETSNMP_DS_AGENT_H
/*
 * defines agent's default store registrations 
 */
/*
 * Note:
 *    If new ds_agent entries are added to this header file,
 *    then remember to run 'perl/agent/default_store/gen' to
 *    update the corresponding perl interface.
 *
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 */

/*
 * booleans 
 */
#define NETSNMP_DS_AGENT_VERBOSE        0       /* 1 if verbose output desired */
#define NETSNMP_DS_AGENT_ROLE           1       /* 0 if master, 1 if client */
#define NETSNMP_DS_AGENT_NO_ROOT_ACCESS 2       /* 1 if we can't get root access */
#define NETSNMP_DS_AGENT_AGENTX_MASTER  3       /* 1 if AgentX desired */
#define NETSNMP_DS_AGENT_QUIT_IMMEDIATELY 4     /* 1 to never start the agent */
#define NETSNMP_DS_AGENT_DISABLE_PERL   5       /* 1 to never enable perl */
#define NETSNMP_DS_AGENT_NO_CONNECTION_WARNINGS 6 /* 1 = !see !connect msgs */
#define NETSNMP_DS_AGENT_LEAVE_PIDFILE  7       /* 1 = leave PID file on exit */
#define NETSNMP_DS_AGENT_NO_CACHING     8       /* 1 = disable netsnmp_cache */
#define NETSNMP_DS_AGENT_STRICT_DISMAN  9       /* 1 = "correct" object ordering */
#define NETSNMP_DS_AGENT_DONT_RETAIN_NOTIFICATIONS 10   /* 1 = disable trap logging */
#define NETSNMP_DS_AGENT_DONT_LOG_TCPWRAPPERS_CONNECTS 12   /* 1 = disable logging */
#define NETSNMP_DS_APP_DONT_LOG         NETSNMP_DS_AGENT_DONT_RETAIN_NOTIFICATIONS /* compat */
#define NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES    13   /* 1 = don't store NFS entries in hrStorageTable */
#define NETSNMP_DS_AGENT_REALSTORAGEUNITS 14    /* 1 = use real allocation units in hrStorageTable, 0 = recalculate it to fit 32bits */

   /* Repeated from "apps/snmptrapd_ds.h" */
#define NETSNMP_DS_APP_NUMERIC_IP       16
#define NETSNMP_DS_APP_NO_AUTHORIZATION 17

#define NETSNMP_DS_AGENT_DISKIO_NO_FD   18      /* 1 = don't report /dev/fd*   entries in diskIOTable */
#define NETSNMP_DS_AGENT_DISKIO_NO_LOOP 19      /* 1 = don't report /dev/loop* entries in diskIOTable */
#define NETSNMP_DS_AGENT_DISKIO_NO_RAM  20      /* 1 = don't report /dev/ram*  entries in diskIOTable */

/* WARNING: The trap receiver also uses DS flags and must not conflict with these!
 * If you define additional boolean entries, check in "apps/snmptrapd_ds.h" first */

/*
 * strings 
 */
#define NETSNMP_DS_AGENT_PROGNAME 0     /* argv[0] */
#define NETSNMP_DS_AGENT_X_SOCKET 1     /* AF_UNIX or ip:port socket addr */
#define NETSNMP_DS_AGENT_PORTS    2     /* localhost:9161,tcp:localhost:9161... */
#define NETSNMP_DS_AGENT_INTERNAL_SECNAME  3    /* used by disman/mteTriggerTable. */
#define NETSNMP_DS_AGENT_PERL_INIT_FILE    4    /* used by embedded perl */
#define NETSNMP_DS_SMUX_SOCKET    5     /* ip:port socket addr */
#define NETSNMP_DS_NOTIF_LOG_CTX  6     /* "" | "snmptrapd" */
#define NETSNMP_DS_AGENT_TRAP_ADDR      7     /* used as v1 trap agent address */

/*
 * integers 
 */
#define NETSNMP_DS_AGENT_FLAGS    0     /* session.flags */
#define NETSNMP_DS_AGENT_USERID   1
#define NETSNMP_DS_AGENT_GROUPID  2
#define NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL 3 /* ping master every SECONDS */
#define NETSNMP_DS_AGENT_AGENTX_TIMEOUT  4
#define NETSNMP_DS_AGENT_AGENTX_RETRIES  5
#define NETSNMP_DS_AGENT_X_SOCK_PERM     6      /* permissions for the */
#define NETSNMP_DS_AGENT_X_DIR_PERM      7      /*     AgentX socket   */
#define NETSNMP_DS_AGENT_X_SOCK_USER     8      /* ownership for the   */
#define NETSNMP_DS_AGENT_X_SOCK_GROUP    9      /*     AgentX socket   */
#define NETSNMP_DS_AGENT_CACHE_TIMEOUT  10      /* default cache timeout */
#define NETSNMP_DS_AGENT_INTERNAL_VERSION  11   /* used by internal queries */
#define NETSNMP_DS_AGENT_INTERNAL_SECLEVEL 12   /* used by internal queries */
#define NETSNMP_DS_AGENT_MAX_GETBULKREPEATS 13 /* max getbulk repeats */
#define NETSNMP_DS_AGENT_MAX_GETBULKRESPONSES 14   /* max getbulk respones */
#define NETSNMP_DS_AGENT_AVG_BULKVARBINDSIZE 15 /* avg varbind size estimate */
#define NETSNMP_DS_AGENT_PDU_STATS_MAX       16 /* size of top N array*/
#define NETSNMP_DS_AGENT_PDU_STATS_THRESHOLD 17 /* minimum threshold time */
#endif
agent/snmp_agent.h000064400000030777147511501100010157 0ustar00/* Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 */
/*
 * Portions of this file are copyrighted by:
 * Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 *
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */
/*
 * @file snmp_agent.h
 *
 * @addtogroup agent
 * @addtogroup table
 * External definitions for functions and variables in snmp_agent.c.
 *
 * @{
 */

#ifndef SNMP_AGENT_H
#define SNMP_AGENT_H

#ifdef __cplusplus
extern          "C" {
#endif

#include <net-snmp/library/snmp_impl.h>
#include <net-snmp/library/tools.h>
#include <net-snmp/library/data_list.h>

#define SNMP_MAX_PDU_SIZE 64000 /* local constraint on PDU size sent by agent
                                 * (see also SNMP_MAX_MSG_SIZE in snmp_api.h) */

#define SNMP_AGENT_FLAGS_NONE                   0x0
#define SNMP_AGENT_FLAGS_CANCEL_IN_PROGRESS     0x1

    /*
     * If non-zero, causes the addresses of peers to be logged when receptions
     * occur.  
     */

    extern int      log_addresses;

    /*
     * How many ticks since we last aged the address cache entries.  
     */

    extern int      lastAddrAge;

    /** @typedef struct netsnmp_request_info_s netsnmp_request_info
     * Typedefs the netsnmp_request_info_s struct into
     * netsnmp_request_info*/
    /** @struct netsnmp_request_info_s
     * The netsnmp request info structure.
     */
    typedef struct netsnmp_request_info_s {
	/**
	 * variable bindings
 	 */
        netsnmp_variable_list *requestvb;

 	/**
 	 * can be used to pass information on a per-request basis from a
 	 * helper to the later handlers 
 	 */
        netsnmp_data_list *parent_data;

       /*
        * pointer to the agent_request_info for this request
        */
       struct netsnmp_agent_request_info_s *agent_req_info;

 	/** don't free, reference to (struct tree)->end */
        oid            *range_end;
        size_t          range_end_len;

       /*
        * flags
        */
        int             delegated;
        int             processed;
        int             inclusive;

        int             status;
 	/** index in original pdu */
        int             index;
 
       /** get-bulk */
        int             repeat;
        int             orig_repeat;
        netsnmp_variable_list *requestvb_start;

       /* internal use */
        struct netsnmp_request_info_s *next;
        struct netsnmp_request_info_s *prev;
        struct netsnmp_subtree_s      *subtree;
    } netsnmp_request_info;

    typedef struct netsnmp_set_info_s {
        int             action;
        void           *stateRef;

        /*
         * don't use yet: 
         */
        void          **oldData;
        int             setCleanupFlags;
#define AUTO_FREE_STATEREF 0x01 /* calls free(stateRef) */
#define AUTO_FREE_OLDDATA  0x02 /* calls free(*oldData) */
#define AUTO_UNDO          0x03 /* ... */
    } netsnmp_set_info;

    typedef struct netsnmp_tree_cache_s {
        struct netsnmp_subtree_s *subtree;
        netsnmp_request_info *requests_begin;
        netsnmp_request_info *requests_end;
    } netsnmp_tree_cache;

#define MODE_GET              SNMP_MSG_GET
#define MODE_GETNEXT          SNMP_MSG_GETNEXT
#define MODE_GETBULK          SNMP_MSG_GETBULK
#define MODE_GET_STASH        SNMP_MSG_INTERNAL_GET_STASH
#ifndef NETSNMP_NO_WRITE_SUPPORT
#define MODE_IS_GET(x)        ((x >= 128) && (x != -1)  && (x != SNMP_MSG_SET))
#else /* NETSNMP_NO_WRITE_SUPPORT */
#define MODE_IS_GET(x)        ((x >= 128) && (x != -1))
#endif /* NETSNMP_NO_WRITE_SUPPORT */

    /* #define MODE_IS_GET(x)        ((x == SNMP_MSG_GET) || (x == SNMP_MSG_GETNEXT) || (x == SNMP_MSG_GETBULK) || (x == SNMP_MSG_INTERNAL_GET_STASH)) */

#ifndef NETSNMP_NO_WRITE_SUPPORT
#define MODE_SET_BEGIN        SNMP_MSG_INTERNAL_SET_BEGIN
#define MODE_SET_RESERVE1     SNMP_MSG_INTERNAL_SET_RESERVE1
#define MODE_SET_RESERVE2     SNMP_MSG_INTERNAL_SET_RESERVE2
#define MODE_SET_ACTION       SNMP_MSG_INTERNAL_SET_ACTION
#define MODE_SET_COMMIT       SNMP_MSG_INTERNAL_SET_COMMIT
#define MODE_SET_FREE         SNMP_MSG_INTERNAL_SET_FREE
#define MODE_SET_UNDO         SNMP_MSG_INTERNAL_SET_UNDO
#define MODE_IS_SET(x)         ((x < 128) || (x == -1) || (x == SNMP_MSG_SET))
    /* #define MODE_IS_SET(x)         (!MODE_IS_GET(x)) */
#endif /* NETSNMP_NO_WRITE_SUPPORT */

#define MODE_BSTEP_PRE_REQUEST   SNMP_MSG_INTERNAL_PRE_REQUEST
#define MODE_BSTEP_POST_REQUEST  SNMP_MSG_INTERNAL_POST_REQUEST

#define MODE_BSTEP_OBJECT_LOOKUP       SNMP_MSG_INTERNAL_OBJECT_LOOKUP
#ifndef NETSNMP_NO_WRITE_SUPPORT
#define MODE_BSTEP_CHECK_VALUE         SNMP_MSG_INTERNAL_CHECK_VALUE
#define MODE_BSTEP_ROW_CREATE          SNMP_MSG_INTERNAL_ROW_CREATE
#define MODE_BSTEP_UNDO_SETUP          SNMP_MSG_INTERNAL_UNDO_SETUP
#define MODE_BSTEP_SET_VALUE           SNMP_MSG_INTERNAL_SET_VALUE
#define MODE_BSTEP_CHECK_CONSISTENCY   SNMP_MSG_INTERNAL_CHECK_CONSISTENCY
#define MODE_BSTEP_UNDO_SET            SNMP_MSG_INTERNAL_UNDO_SET
#define MODE_BSTEP_COMMIT              SNMP_MSG_INTERNAL_COMMIT
#define MODE_BSTEP_UNDO_COMMIT         SNMP_MSG_INTERNAL_UNDO_COMMIT
#define MODE_BSTEP_IRREVERSIBLE_COMMIT SNMP_MSG_INTERNAL_IRREVERSIBLE_COMMIT
#define MODE_BSTEP_UNDO_CLEANUP        SNMP_MSG_INTERNAL_UNDO_CLEANUP
#endif /* NETSNMP_NO_WRITE_SUPPORT */

/** @typedef struct netsnmp_agent_request_info_s netsnmp_agent_request_info
 * Typedefs the netsnmp_agent_request_info_s struct into
 * netsnmp_agent_request_info
 */

/** @struct netsnmp_agent_request_info_s
 * The agent transaction request structure
 */
    typedef struct netsnmp_agent_request_info_s {
        int             mode;
 	/** pdu contains authinfo, eg */
/*        netsnmp_pdu    *pdu;    */
        struct netsnmp_agent_session_s *asp;    /* may not be needed */
        /*
         * can be used to pass information on a per-pdu basis from a
         * helper to the later handlers 
         */
        netsnmp_data_list *agent_data;
    } netsnmp_agent_request_info;

    typedef struct netsnmp_cachemap_s {
        int             globalid;
        int             cacheid;
        struct netsnmp_cachemap_s *next;
    } netsnmp_cachemap;

    typedef struct netsnmp_agent_session_s {
        int             mode;
        netsnmp_session *session;
        netsnmp_pdu    *pdu;
        netsnmp_pdu    *orig_pdu;
        int             rw;
        int             exact;
        int             status;
        int             index;
        int             oldmode;

        struct netsnmp_agent_session_s *next;

        /*
         * new API pointers 
         */
        netsnmp_agent_request_info *reqinfo;
        netsnmp_request_info *requests;
        netsnmp_tree_cache *treecache;
        netsnmp_variable_list **bulkcache;
        int             treecache_len;  /* length of cache array */
        int             treecache_num;  /* number of current cache entries */
        netsnmp_cachemap *cache_store;
        int             vbcount;
        int             flags;
    } netsnmp_agent_session;

    /*
     * Address cache handling functions.  
     */

    void            netsnmp_addrcache_initialise(void);
    void            netsnmp_addrcache_destroy(void);
    void            netsnmp_addrcache_age(void);


    /*
     * config file parsing routines 
     */
    int             handle_snmp_packet(int, netsnmp_session *, int,
                                       netsnmp_pdu *, void *);
    void            snmp_agent_parse_config(char *, char *);
    netsnmp_agent_session *init_agent_snmp_session(netsnmp_session *,
                                                   netsnmp_pdu *);
    void            free_agent_snmp_session(netsnmp_agent_session *);
    void           
        netsnmp_remove_and_free_agent_snmp_session(netsnmp_agent_session
                                                   *asp);
#ifdef SNMP_NEED_REQUEST_LIST
    void           
        netsnmp_free_agent_snmp_session_by_session(netsnmp_session * sess,
                                                   void (*free_request)
                                                   (netsnmp_request_list
                                                    *));
#endif
    int             getNextSessID(void);
    void            dump_sess_list(void);
    int             init_master_agent(void);
    void            shutdown_master_agent(void);
    int             agent_check_and_process(int block);
    void            netsnmp_check_delegated_requests(void);
    void            netsnmp_check_outstanding_agent_requests(void);

    int             netsnmp_request_set_error(netsnmp_request_info *request,
                                              int error_value);
    int             netsnmp_check_requests_error(netsnmp_request_info *reqs);
    int             netsnmp_check_all_requests_error(netsnmp_agent_session *asp,
                                                     int look_for_specific);
    int
        netsnmp_set_all_requests_error(netsnmp_agent_request_info *reqinfo,
                                       netsnmp_request_info *requests,
                                       int error_value);
    int netsnmp_request_set_error_idx(netsnmp_request_info *requests,
                                       int error_value, int idx);
    int
        netsnmp_request_set_error_all(netsnmp_request_info *requests,
                                       int error_value);
    
    /** deprecated, use netsnmp_request_set_error instead */
    int             netsnmp_set_request_error(netsnmp_agent_request_info
                                              *reqinfo,
                                              netsnmp_request_info
                                              *request, int error_value);
    /** deprecated, use netsnmp_request_set_error instead */
    int             netsnmp_set_mode_request_error(int mode,
                                                   netsnmp_request_info
                                                   *request,
                                                   int error_value);

    u_long          netsnmp_marker_uptime(marker_t pm);
    u_long          netsnmp_timeval_uptime(struct timeval *tv);
    const_marker_t  netsnmp_get_agent_starttime(void);
    uint64_t        netsnmp_get_agent_runtime(void);
    void            netsnmp_set_agent_starttime(marker_t s);
    u_long          netsnmp_get_agent_uptime(void);
    void            netsnmp_set_agent_uptime(u_long hsec);
    int             netsnmp_check_transaction_id(int transaction_id);
    int             netsnmp_agent_check_packet(netsnmp_session *,
                                               struct netsnmp_transport_s
                                               *, void *, int);
    int             netsnmp_agent_check_parse(netsnmp_session *,
                                              netsnmp_pdu *, int);
    int             netsnmp_allocate_globalcacheid(void);

    int netsnmp_remove_delegated_requests_for_session(netsnmp_session *sess);

    /*
     * Register and de-register agent NSAPs.  
     */

    struct netsnmp_transport_s;

    int             netsnmp_register_agent_nsap(struct netsnmp_transport_s
                                                *t);
    void            netsnmp_deregister_agent_nsap(int handle);

    int             netsnmp_agent_listen_on(const char *port);

    void
        netsnmp_agent_add_list_data(netsnmp_agent_request_info *agent,
                                    netsnmp_data_list *node);

    int
        netsnmp_agent_remove_list_data(netsnmp_agent_request_info *ari,
                                       const char * name);

    void *
            netsnmp_agent_get_list_data(netsnmp_agent_request_info
                                        *agent, const char *name);

    void
            netsnmp_free_agent_data_set(netsnmp_agent_request_info *agent);

    void
           netsnmp_free_agent_data_sets(netsnmp_agent_request_info *agent);
    void
        netsnmp_free_agent_request_info(netsnmp_agent_request_info *ari);


#ifndef NETSNMP_NO_PDU_STATS
    /*
     * pdu stats
     */
    typedef struct netsnmp_pdu_stats_s {
        u_long          processing_time; /* ms */
        time_t          timestamp; /* date/time */
        netsnmp_pdu    *pdu;
    } netsnmp_pdu_stats;

    netsnmp_container * netsnmp_get_pdu_stats(void);

#endif /* NETSNMP_NO_PDU_STATS */


#ifdef __cplusplus
}
#endif
#endif
/** @} */
agent/watcher.h000064400000012664147511501100007454 0ustar00/*
 * watcher.h 
 */
#ifndef NETSNMP_WATCHER_H
#define NETSNMP_WATCHER_H

#ifdef __cplusplus
extern "C" {
#endif

/** @ingroup watcher
 *  @{
 */

/*
 * if handler flag has this bit set, the timestamp will be
 * treated as a pointer to the timestamp. If this bit is
 * not set (the default), the timestamp is a struct timeval
 * that must be compared to the agent starttime.
 */
#define NETSNMP_WATCHER_DIRECT MIB_HANDLER_CUSTOM1

/** The size of the watched object is constant.
 *  @hideinitializer
 */
#define WATCHER_FIXED_SIZE     0x01
/** The maximum size of the watched object is stored in max_size.
 *  If WATCHER_SIZE_STRLEN is set then it is supposed that max_size + 1
 *  bytes could be stored in the buffer.
 *  @hideinitializer
 */
#define WATCHER_MAX_SIZE       0x02
/** If set then the variable data_size_p points to is supposed to hold the
 *  current size of the watched object and will be updated on writes.
 *  @hideinitializer
 *  @since Net-SNMP 5.5
 */
#define WATCHER_SIZE_IS_PTR    0x04
/** If set then data is suppposed to be a zero-terminated character array
 *  and both data_size and data_size_p are ignored. Additionally \\0 is a
 *  forbidden character in the data set.
 *  @hideinitializer
 *  @since Net-SNMP 5.5
 */
#define WATCHER_SIZE_STRLEN    0x08
/** If set then size is in units of object identifiers.
 *  This is useful if you have an OID and tracks the OID_LENGTH of it as
 *  opposed to it's size.
 *  @hideinitializer
 *  @since Net-SNMP 5.5.1
 */
#define WATCHER_SIZE_UNIT_OIDS 0x10

typedef struct netsnmp_watcher_info_s {
    void     *data;
    size_t    data_size;
    size_t    max_size;
    u_char    type;
    int       flags;
    size_t   *data_size_p;
} netsnmp_watcher_info;

/** @} */

int netsnmp_register_watched_instance( netsnmp_handler_registration *reginfo,
                                       netsnmp_watcher_info         *winfo);
int netsnmp_register_watched_instance2(netsnmp_handler_registration *reginfo,
                                       netsnmp_watcher_info         *winfo);
int netsnmp_register_watched_scalar(   netsnmp_handler_registration *reginfo,
                                       netsnmp_watcher_info         *winfo);
int netsnmp_register_watched_scalar2(  netsnmp_handler_registration *reginfo,
                                       netsnmp_watcher_info         *winfo);
int netsnmp_register_watched_timestamp(netsnmp_handler_registration *reginfo,
                                       marker_t timestamp);
int netsnmp_watched_timestamp_register(netsnmp_mib_handler *whandler,
                                       netsnmp_handler_registration *reginfo,
                                       marker_t timestamp);
int netsnmp_register_watched_spinlock(netsnmp_handler_registration *reginfo,
                                      int *spinlock);    

/*
 * Convenience registration calls
 */

int netsnmp_register_ulong_scalar(const char *name,
                              const oid * reg_oid, size_t reg_oid_len,
                              u_long * it,
                              Netsnmp_Node_Handler * subhandler);
int netsnmp_register_read_only_ulong_scalar(const char *name,
                              const oid * reg_oid, size_t reg_oid_len,
                              u_long * it,
                              Netsnmp_Node_Handler * subhandler);
int netsnmp_register_long_scalar(const char *name,
                              const oid * reg_oid, size_t reg_oid_len,
                              long * it,
                              Netsnmp_Node_Handler * subhandler);
int netsnmp_register_read_only_long_scalar(const char *name,
                              const oid * reg_oid, size_t reg_oid_len,
                              long * it,
                              Netsnmp_Node_Handler * subhandler);
int netsnmp_register_int_scalar(const char *name,
                              const oid * reg_oid, size_t reg_oid_len,
                              int * it,
                              Netsnmp_Node_Handler * subhandler);
int netsnmp_register_read_only_int_scalar(const char *name,
                              const oid * reg_oid, size_t reg_oid_len,
                              int * it,
                              Netsnmp_Node_Handler * subhandler);
int netsnmp_register_read_only_counter32_scalar(const char *name,
                              const oid * reg_oid, size_t reg_oid_len,
                              u_long * it,
                              Netsnmp_Node_Handler * subhandler);

#define WATCHER_HANDLER_NAME "watcher"

netsnmp_mib_handler  *netsnmp_get_watcher_handler(void);

netsnmp_watcher_info *
netsnmp_init_watcher_info(netsnmp_watcher_info *, void *, size_t, u_char, int);

netsnmp_watcher_info *
netsnmp_init_watcher_info6(netsnmp_watcher_info *,
			   void *, size_t, u_char, int, size_t, size_t*);

netsnmp_watcher_info *
netsnmp_create_watcher_info(void *, size_t, u_char, int);

netsnmp_watcher_info *
netsnmp_create_watcher_info6(void *, size_t, u_char, int, size_t, size_t*);

netsnmp_watcher_info *
netsnmp_clone_watcher_info(netsnmp_watcher_info *winfo);
void
netsnmp_owns_watcher_info(netsnmp_mib_handler *handler);

Netsnmp_Node_Handler  netsnmp_watcher_helper_handler;

netsnmp_mib_handler  *netsnmp_get_watched_timestamp_handler(void);
Netsnmp_Node_Handler  netsnmp_watched_timestamp_handler;

netsnmp_mib_handler  *netsnmp_get_watched_spinlock_handler(void);
Netsnmp_Node_Handler  netsnmp_watched_spinlock_handler;

#ifdef __cplusplus
}
#endif

#endif /** NETSNMP_WATCHER_H */
agent/row_merge.h000064400000002507147511501100010000 0ustar00#ifndef ROW_MERGE_H
#define ROW_MERGE_H

/*
 * This row_merge helper splits a whole bunch of requests into chunks
 * based on the row index that they refer to, and passes all requests
 * for a given row to the lower handlers.
 */

#ifdef __cplusplus
extern          "C" {
#endif

    typedef struct netsnmp_row_merge_status_x {
       char                  count;    /* number of requests */
       char                  rows;     /* number of rows (unique indexes) */
       char                  current;  /* current row number */
       char                  reserved; /* reserver for future use */

       netsnmp_request_info  **saved_requests; /* internal use */
       char                  *saved_status;    /* internal use */
    } netsnmp_row_merge_status;

    netsnmp_mib_handler *netsnmp_get_row_merge_handler(int);
    int   netsnmp_register_row_merge(netsnmp_handler_registration *reginfo);
    void  netsnmp_init_row_merge(void);

    int netsnmp_row_merge_status_first(netsnmp_handler_registration *reginfo,
                                       netsnmp_agent_request_info *reqinfo);
    int netsnmp_row_merge_status_last(netsnmp_handler_registration *reginfo,
                                      netsnmp_agent_request_info *reqinfo);

    Netsnmp_Node_Handler netsnmp_row_merge_helper_handler;

#ifdef __cplusplus
}
#endif
#endif
agent/scalar_group.h000064400000001727147511501100010476 0ustar00/*
 * scalar.h 
 */
#ifndef NETSNMP_SCALAR_GROUP_H
#define NETSNMP_SCALAR_GROUP_H

#ifdef __cplusplus
extern "C" {
#endif

/*
 * The scalar group helper is designed to implement a group of
 * scalar objects all in one go, making use of the scalar and
 * instance helpers.
 *
 * GETNEXTs are auto-converted to a GET.  Non-valid GETs are dropped.
 * The client-provided handler just needs to check the OID name to
 * see which object is being requested, but can otherwise assume that
 * things are fine.
 */

typedef struct netsnmp_scalar_group_s {
    oid lbound;		/* XXX - or do we need a more flexible arrangement? */
    oid ubound;
} netsnmp_scalar_group;

int netsnmp_register_scalar_group(netsnmp_handler_registration *reginfo,
	                          oid first, oid last);
netsnmp_mib_handler *netsnmp_get_scalar_group_handler(oid first, oid last);
Netsnmp_Node_Handler netsnmp_scalar_group_helper_handler;

#ifdef __cplusplus
}
#endif

#endif /** NETSNMP_SCALAR_GROUP_H */
agent/agent_registry.h000064400000014436147511501100011044 0ustar00#ifndef AGENT_REGISTRY_H
#define AGENT_REGISTRY_H

/***********************************************************************/
/*
 * new version2 agent handler API structures 
 */
/***********************************************************************/

#include <net-snmp/agent/snmp_agent.h>
#include <net-snmp/library/fd_event_manager.h>

#ifdef __cplusplus
extern          "C" {
#endif

/***********************************************************************/
    /*
     * requests api definitions 
     */
/***********************************************************************/

    /*
     * the structure of parameters passed to registered ACM modules 
     */
struct view_parameters {
    netsnmp_pdu    *pdu;
    oid            *name;
    size_t          namelen;
    int             test;
    int             errorcode;		/*  Do not change unless you're
					    specifying an error, as it starts
					    in a success state.  */
    int             check_subtree;
};

struct register_parameters {
    oid                          *name;
    size_t                        namelen;
    int                           priority;
    int                           range_subid;
    oid                           range_ubound;
    int                           timeout;
    u_char                        flags;
    const char                   *contextName;
    netsnmp_session              *session;
    netsnmp_handler_registration *reginfo;
};

typedef struct subtree_context_cache_s {
    const char				*context_name;
    struct netsnmp_subtree_s		*first_subtree;
    struct subtree_context_cache_s	*next;
} subtree_context_cache;



void             setup_tree		  (void);
void             shutdown_tree    (void);
void             dump_registry(void);


netsnmp_subtree *netsnmp_subtree_find	  (const oid *, size_t,
					   netsnmp_subtree *,
					   const char *context_name);

netsnmp_subtree *netsnmp_subtree_find_next(const oid *, size_t,
					   netsnmp_subtree *,
					   const char *context_name);

netsnmp_subtree *netsnmp_subtree_find_prev(const oid *, size_t,
					   netsnmp_subtree *,
					   const char *context_name);

netsnmp_subtree *netsnmp_subtree_find_first(const char *context_name);

netsnmp_session *get_session_for_oid	   (const oid *, size_t, 
					    const char *context_name);

subtree_context_cache *get_top_context_cache(void);

void netsnmp_set_lookup_cache_size(int newsize);
int netsnmp_get_lookup_cache_size(void);

#define MIB_REGISTERED_OK		 0
#define MIB_DUPLICATE_REGISTRATION	-1
#define MIB_REGISTRATION_FAILED		-2
#define MIB_UNREGISTERED_OK		 0
#define MIB_NO_SUCH_REGISTRATION	-1
#define MIB_UNREGISTRATION_FAILED	-2
#define DEFAULT_MIB_PRIORITY		127

int             register_mib		   (const char *,
                                            const struct variable *,
					    size_t, size_t, const oid *,
					    size_t);

int             register_mib_priority	   (const char *,
                                            const struct variable *,
					    size_t, size_t, const oid *, size_t,
					    int);

int             register_mib_range	   (const char *,
                                            const struct variable *,
					    size_t, size_t, const oid *,
					    size_t, int, int, oid,
					    netsnmp_session *);

int		register_mib_context	   (const char *,
                                            const struct variable *,
					    size_t, size_t, const oid *, size_t,
					    int, int, oid, netsnmp_session *,
					    const char *, int, int);

int	netsnmp_register_mib_table_row	   (const char *,
                                            const struct variable *,
					    size_t, size_t, oid *,
					    size_t, int, int, netsnmp_session *,
					    const char *, int, int);

int		unregister_mib		   (oid *, size_t);

int             unregister_mib_priority	   (oid *, size_t, int);
int             unregister_mib_range	   (oid *, size_t, int, int, oid);
int             unregister_mib_context	   (oid *, size_t, int, int, oid,
					    const char *);
void            clear_context              (void);
void            unregister_mibs_by_session (netsnmp_session *);
int     netsnmp_unregister_mib_table_row   (oid *mibloc, size_t mibloclen,
					    int priority, int var_subid,
					    oid range_ubound,
					    const char *context);

int             compare_tree		   (const oid *, size_t, 
					    const oid *, size_t);
int             in_a_view		   (oid *, size_t *, 
					    netsnmp_pdu *, int);
int             check_access		   (netsnmp_pdu *pdu);
int             netsnmp_acm_check_subtree  (netsnmp_pdu *, oid *, size_t);
void            register_mib_reattach	   (void);
void            register_mib_detach	   (void);

/*
 * REGISTER_MIB(): This macro simply loads register_mib with less pain:
 * 
 * descr:   A short description of the mib group being loaded.
 * var:     The variable structure to load.
 * vartype: The variable structure used to define it (variable[2, 4, ...])
 * theoid:  An *initialized* *exact length* oid pointer.
 *          (sizeof(theoid) *must* return the number of elements!) 
 */

#define REGISTER_MIB(descr, var, vartype, theoid)                       \
    if (register_mib(descr, (const struct variable *) var,              \
                     sizeof(struct vartype),                            \
                     sizeof(var)/sizeof(struct vartype),                \
                     theoid, sizeof(theoid)/sizeof(oid)) !=             \
        MIB_REGISTERED_OK)                                              \
	DEBUGMSGTL(("register_mib", "%s registration failed\n", descr));


#define NUM_EXTERNAL_SIGS 32
#define SIG_REGISTERED_OK		 0
#define SIG_REGISTRATION_FAILED		-2
#define SIG_UNREGISTERED_OK		 0

extern int      external_signal_scheduled[NUM_EXTERNAL_SIGS];
extern void     (*external_signal_handler[NUM_EXTERNAL_SIGS])(int);

int             register_signal(int, void (*func)(int));
int             unregister_signal(int);



/*
 * internal API.  Don't use this.  Use netsnmp_register_handler instead 
 */

struct netsnmp_handler_registration_s;

int             netsnmp_register_mib(const char *, struct variable *,
				     size_t, size_t, oid *, size_t,
				     int, int, oid, netsnmp_session *,
				     const char *, int, int,
				     struct netsnmp_handler_registration_s *,
				     int);

#ifdef __cplusplus
}
#endif

#endif                          /* AGENT_REGISTRY_H */
agent/instance.h000064400000014176147511501100007623 0ustar00/*
 * instance.h 
 */
#ifndef NETSNMP_INSTANCE_H
#define NETSNMP_INSTANCE_H

#ifdef __cplusplus
extern "C" {
#endif

/*
 * The instance helper is designed to simplify the task of adding simple
 * * instances to the mib tree.
 */

/*
 * GETNEXTs are auto-converted to a GET.
 * * non-valid GETs are dropped.
 * * The client can assume that if you're called for a GET, it shouldn't
 * * have to check the oid at all.  Just answer.
 */

int
netsnmp_register_instance(netsnmp_handler_registration * reginfo);

int            
netsnmp_register_read_only_instance(netsnmp_handler_registration *reginfo);

#define INSTANCE_HANDLER_NAME "instance"

netsnmp_mib_handler *netsnmp_get_instance_handler(void);

int
netsnmp_register_read_only_ulong_instance(const char * name,
                                          const oid * reg_oid,
                                          size_t reg_oid_len,
                                          u_long * it,
                                          Netsnmp_Node_Handler * subhandler);
int
netsnmp_register_ulong_instance(const char * name,
                                const oid * reg_oid,
                                size_t reg_oid_len,
                                u_long * it,
                                Netsnmp_Node_Handler * subhandler);
int
netsnmp_register_read_only_counter32_instance(const char *name,
                                              const oid * reg_oid,
                                              size_t reg_oid_len,
                                              u_long * it,
                                              Netsnmp_Node_Handler *subhandler);
int
netsnmp_register_read_only_long_instance(const char *name,
                                         const oid * reg_oid,
                                         size_t reg_oid_len,
                                         long *it,
                                         Netsnmp_Node_Handler * subhandler);
int
netsnmp_register_long_instance(const char *name,
                               const oid * reg_oid,
                               size_t reg_oid_len,
                               long *it,
                               Netsnmp_Node_Handler * subhandler);

int
netsnmp_register_read_only_int_instance(const char *name,
                                        const oid * reg_oid,
                                        size_t reg_oid_len, int *it,
                                        Netsnmp_Node_Handler * subhandler);

int
netsnmp_register_int_instance(const char *name,
                              const oid * reg_oid,
                              size_t reg_oid_len, int *it,
                              Netsnmp_Node_Handler * subhandler);

/* identical functions that register a in a particular context */
int
netsnmp_register_read_only_ulong_instance_context(const char *name,
                                                  const oid * reg_oid,
                                                  size_t reg_oid_len,
                                                  u_long * it,
                                                  Netsnmp_Node_Handler
                                                  * subhandler,
                                                  const char *contextName);
int
netsnmp_register_ulong_instance_context(const char *name,
                                        const oid * reg_oid,
                                        size_t reg_oid_len,
                                        u_long * it,
                                        Netsnmp_Node_Handler * subhandler,
                                        const char *contextName);
int
netsnmp_register_read_only_counter32_instance_context(const char *name,
                                                      const oid * reg_oid,
                                                      size_t reg_oid_len,
                                                      u_long * it,
                                                      Netsnmp_Node_Handler
                                                      * subhandler,
                                                      const char *contextName);
int
netsnmp_register_read_only_long_instance_context(const char *name,
                                                 const oid * reg_oid,
                                                 size_t reg_oid_len,
                                                 long *it,
                                                 Netsnmp_Node_Handler
                                                 * subhandler,
                                                 const char *contextName);
int
netsnmp_register_long_instance_context(const char *name,
                                       const oid * reg_oid,
                                       size_t reg_oid_len,
                                       long *it,
                                       Netsnmp_Node_Handler * subhandler,
                                       const char *contextName);

int
netsnmp_register_read_only_int_instance_context(const char *name,
                                                const oid * reg_oid,
                                                size_t reg_oid_len, int *it,
                                                Netsnmp_Node_Handler *
                                                subhandler,
                                                const char *contextName);

int
netsnmp_register_int_instance_context(const char *name,
                                      const oid * reg_oid,
                                      size_t reg_oid_len, int *it,
                                      Netsnmp_Node_Handler * subhandler,
                                      const char *contextName);

int
netsnmp_register_num_file_instance(const char *name,
                                   const oid * reg_oid, size_t reg_oid_len,
                                   const char *file_name, int asn_type, int mode,
                                   Netsnmp_Node_Handler * subhandler,
                                   const char *contextName);

Netsnmp_Node_Handler netsnmp_instance_helper_handler;
Netsnmp_Node_Handler netsnmp_instance_num_file_handler;

#ifdef __cplusplus
}
#endif

#endif /** NETSNMP_INSTANCE_H */
agent/mib_modules.h000064400000000654147511501100010312 0ustar00#ifndef MIB_MODULES_H
#define MIB_MODULES_H

#ifdef __cplusplus
extern          "C" {
#endif

#define DO_INITIALIZE   1
#define DONT_INITIALIZE 0

struct module_init_list {
    char           *module_name;
    struct module_init_list *next;
};

void            add_to_init_list(char *module_list);
int             should_init(const char *module_name);
void            init_mib_modules(void);

#ifdef __cplusplus
}
#endif
#endif
agent/debug_handler.h000064400000000510147511501100010565 0ustar00#ifndef DEBUG_HANDLER_H
#define DEBUG_HANDLER_H

#ifdef __cplusplus
extern          "C" {
#endif

netsnmp_mib_handler *netsnmp_get_debug_handler(void);
void            netsnmp_init_debug_helper(void);

Netsnmp_Node_Handler netsnmp_debug_helper;

#ifdef __cplusplus
}
#endif
#endif                          /* DEBUG_HANDLER_H */
agent/mib_module_includes.h000064400000034743147511501100012023 0ustar00/* This file is automatically generated by configure.  Do not modify by hand. */
/*#include "mibgroup/agentx.h"*/
/*#include "mibgroup/default_modules.h"*/
/*#include "mibgroup/etherlike-mib.h"*/
/*#include "mibgroup/host.h"*/
#include "mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.h"
#include "mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable.h"
/*#include "mibgroup/ip-mib/ipIfStatsTable.h"*/
/*#include "mibgroup/ip-mib/ipv4InterfaceTable.h"*/
/*#include "mibgroup/ip-mib/ipv6InterfaceTable.h"*/
/*#include "mibgroup/ip-mib/ipv6ScopeZoneIndexTable.h"*/
#include "mibgroup/mibII/mta_sendmail.h"
/*#include "mibgroup/rmon-mib.h"*/
/*#include "mibgroup/sctp-mib.h"*/
/*#include "mibgroup/smux.h"*/
/*#include "mibgroup/tcp-mib.h"*/
#include "mibgroup/ucd-snmp/diskio.h"
#include "mibgroup/ucd-snmp/lmsensorsMib.h"
/*#include "mibgroup/udp-mib.h"*/
/*#include "mibgroup/snmpv3mibs.h"*/
/*#include "mibgroup/mibII.h"*/
/*#include "mibgroup/ucd_snmp.h"*/
/*#include "mibgroup/notification.h"*/
/*#include "mibgroup/notification-log-mib.h"*/
/*#include "mibgroup/target.h"*/
/*#include "mibgroup/agent_mibs.h"*/
/*#include "mibgroup/disman/event.h"*/
/*#include "mibgroup/disman/schedule.h"*/
/*#include "mibgroup/utilities.h"*/
/*#include "mibgroup/etherlike-mib/dot3StatsTable.h"*/
#include "mibgroup/host/hrh_storage.h"
#include "mibgroup/host/hrh_filesys.h"
#include "mibgroup/host/hrSWInstalledTable.h"
#include "mibgroup/host/hrSWRunTable.h"
#include "mibgroup/host/hr_system.h"
#include "mibgroup/host/hr_device.h"
#include "mibgroup/host/hr_other.h"
#include "mibgroup/host/hr_proc.h"
#include "mibgroup/host/hr_network.h"
#include "mibgroup/host/hr_print.h"
#include "mibgroup/host/hr_disk.h"
#include "mibgroup/host/hr_partition.h"
#include "mibgroup/ip-mib/ipAddressTable/ipAddressTable.h"
/*#include "mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface.h"*/
/*#include "mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.h"*/
/*#include "mibgroup/ip-mib/data_access/defaultrouter.h"*/
/*#include "mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_interface.h"*/
/*#include "mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_access.h"*/
/*#include "mibgroup/ip-mib/ipDefaultRouterTable/ipDefaultRouterTable_data_get.h"*/
/*#include "mibgroup/ip-mib/data_access/systemstats.h"*/
#include "mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable.h"
/*#include "mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_interface.h"*/
/*#include "mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_access.h"*/
#include "mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable.h"
#include "mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable.h"
#include "mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable.h"
/*#include "mibgroup/rmon-mib/etherStatsTable.h"*/
#include "mibgroup/sctp-mib/sctpScalars.h"
/*#include "mibgroup/sctp-mib/sctpTables.h"*/
/*#include "mibgroup/tcp-mib/tcpConnectionTable.h"*/
/*#include "mibgroup/tcp-mib/tcpListenerTable.h"*/
/*#include "mibgroup/util_funcs/header_simple_table.h"*/
/*#include "mibgroup/hardware/sensors.h"*/
/*#include "mibgroup/udp-mib/udpEndpointTable.h"*/
#include "mibgroup/snmpv3/snmpEngine.h"
#include "mibgroup/snmpv3/snmpMPDStats.h"
#include "mibgroup/snmpv3/usmStats.h"
#include "mibgroup/snmpv3/usmUser.h"
#include "mibgroup/mibII/system_mib.h"
#include "mibgroup/mibII/sysORTable.h"
#include "mibgroup/mibII/snmp_mib.h"
#include "mibgroup/mibII/vacm_vars.h"
#include "mibgroup/mibII/setSerialNo.h"
#include "mibgroup/mibII/at.h"
/*#include "mibgroup/mibII/ifTable.h"*/
#include "mibgroup/mibII/ip.h"
#include "mibgroup/mibII/tcp.h"
#include "mibgroup/mibII/icmp.h"
#include "mibgroup/mibII/udp.h"
#include "mibgroup/mibII/ipv6.h"
/*#include "mibgroup/if-mib.h"*/
/*#include "mibgroup/ip-mib.h"*/
/*#include "mibgroup/ip-forward-mib.h"*/
#include "mibgroup/ucd-snmp/disk_hw.h"
#include "mibgroup/ucd-snmp/proc.h"
#include "mibgroup/ucd-snmp/versioninfo.h"
#include "mibgroup/ucd-snmp/pass.h"
#include "mibgroup/ucd-snmp/pass_persist.h"
#include "mibgroup/ucd-snmp/loadave.h"
#include "mibgroup/agent/extend.h"
#include "mibgroup/ucd-snmp/errormib.h"
#include "mibgroup/ucd-snmp/file.h"
#include "mibgroup/ucd-snmp/dlmod.h"
#include "mibgroup/ucd-snmp/proxy.h"
#include "mibgroup/ucd-snmp/logmatch.h"
#include "mibgroup/ucd-snmp/memory.h"
#include "mibgroup/ucd-snmp/vmstat.h"
#include "mibgroup/notification/snmpNotifyTable.h"
/*#include "mibgroup/snmp-notification-mib/snmpNotifyFilterTable.h"*/
#include "mibgroup/notification/snmpNotifyFilterProfileTable.h"
#include "mibgroup/notification-log-mib/notification_log.h"
#include "mibgroup/target/snmpTargetAddrEntry.h"
#include "mibgroup/target/snmpTargetParamsEntry.h"
/*#include "mibgroup/target/target.h"*/
#include "mibgroup/target/target_counters.h"
#include "mibgroup/agent/nsTransactionTable.h"
#include "mibgroup/agent/nsModuleTable.h"
#include "mibgroup/agent/nsDebug.h"
#include "mibgroup/agent/nsCache.h"
#include "mibgroup/agent/nsLogging.h"
#include "mibgroup/agent/nsVacmAccessTable.h"
#include "mibgroup/disman/event/mteScalars.h"
#include "mibgroup/disman/event/mteTrigger.h"
#include "mibgroup/disman/event/mteTriggerTable.h"
#include "mibgroup/disman/event/mteTriggerDeltaTable.h"
#include "mibgroup/disman/event/mteTriggerExistenceTable.h"
#include "mibgroup/disman/event/mteTriggerBooleanTable.h"
#include "mibgroup/disman/event/mteTriggerThresholdTable.h"
#include "mibgroup/disman/event/mteTriggerConf.h"
#include "mibgroup/disman/event/mteEvent.h"
#include "mibgroup/disman/event/mteEventTable.h"
#include "mibgroup/disman/event/mteEventSetTable.h"
#include "mibgroup/disman/event/mteEventNotificationTable.h"
#include "mibgroup/disman/event/mteEventConf.h"
#include "mibgroup/disman/event/mteObjects.h"
#include "mibgroup/disman/event/mteObjectsTable.h"
#include "mibgroup/disman/event/mteObjectsConf.h"
#include "mibgroup/disman/schedule/schedCore.h"
#include "mibgroup/disman/schedule/schedConf.h"
#include "mibgroup/disman/schedule/schedTable.h"
#include "mibgroup/utilities/override.h"
/*#include "mibgroup/etherlike-mib/data_access/dot3stats.h"*/
#include "mibgroup/etherlike-mib/dot3StatsTable/dot3StatsTable.h"
/*#include "mibgroup/etherlike-mib/dot3StatsTable/dot3StatsTable_data_get.h"*/
/*#include "mibgroup/etherlike-mib/dot3StatsTable/dot3StatsTable_data_set.h"*/
/*#include "mibgroup/etherlike-mib/dot3StatsTable/dot3StatsTable_data_access.h"*/
/*#include "mibgroup/etherlike-mib/dot3StatsTable/dot3StatsTable_interface.h"*/
/*#include "mibgroup/hardware/memory.h"*/
/*#include "mibgroup/hardware/fsys.h"*/
#include "mibgroup/host/data_access/swinst.h"
#include "mibgroup/host/data_access/swrun.h"
#include "mibgroup/host/hrSWRunPerfTable.h"
/*#include "mibgroup/hardware/cpu.h"*/
/*#include "mibgroup/util_funcs.h"*/
#include "mibgroup/if-mib/data_access/interface.h"
/*#include "mibgroup/ip-mib/data_access/ipaddress.h"*/
/*#include "mibgroup/ip-mib/ipAddressTable/ipAddressTable_interface.h"*/
/*#include "mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.h"*/
/*#include "mibgroup/ip-mib/data_access/defaultrouter_common.h"*/
/*#include "mibgroup/ip-mib/data_access/defaultrouter_linux.h"*/
/*#include "mibgroup/ip-mib/data_access/systemstats_common.h"*/
/*#include "mibgroup/ip-mib/data_access/systemstats_linux.h"*/
/*#include "mibgroup/ip-mib/ipIfStatsTable/ipIfStatsTable_data_get.h"*/
/*#include "mibgroup/if-mib/ifTable/ifTable_interface.h"*/
/*#include "mibgroup/if-mib/ifTable/ifTable_data_access.h"*/
#include "mibgroup/if-mib/ifTable/ifTable.h"
/*#include "mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_interface.h"*/
/*#include "mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_data_access.h"*/
/*#include "mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_interface.h"*/
/*#include "mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_data_access.h"*/
/*#include "mibgroup/ip-mib/data_access/ipv6scopezone.h"*/
/*#include "mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_interface.h"*/
/*#include "mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_data_access.h"*/
/*#include "mibgroup/rmon-mib/data_access/etherstats.h"*/
#include "mibgroup/rmon-mib/etherStatsTable/etherStatsTable.h"
/*#include "mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_get.h"*/
/*#include "mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_set.h"*/
/*#include "mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_access.h"*/
/*#include "mibgroup/rmon-mib/etherStatsTable/etherStatsTable_interface.h"*/
/*#include "mibgroup/sctp-mib/sctpScalars_common.h"*/
/*#include "mibgroup/sctp-mib/sctpScalars_linux.h"*/
/*#include "mibgroup/sctp-mib/sctpTables_common.h"*/
#include "mibgroup/sctp-mib/sctpAssocRemAddrTable.h"
#include "mibgroup/sctp-mib/sctpAssocLocalAddrTable.h"
#include "mibgroup/sctp-mib/sctpLookupLocalPortTable.h"
#include "mibgroup/sctp-mib/sctpLookupRemPortTable.h"
#include "mibgroup/sctp-mib/sctpLookupRemHostNameTable.h"
#include "mibgroup/sctp-mib/sctpLookupRemPrimIPAddrTable.h"
#include "mibgroup/sctp-mib/sctpLookupRemIPAddrTable.h"
#include "mibgroup/sctp-mib/sctpAssocTable.h"
/*#include "mibgroup/sctp-mib/sctpTables_linux.h"*/
/*#include "mibgroup/util_funcs/get_pid_from_inode.h"*/
/*#include "mibgroup/tcp-mib/data_access/tcpConn.h"*/
#include "mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable.h"
#include "mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable.h"
#include "mibgroup/hardware/sensors/hw_sensors.h"
/*#include "mibgroup/hardware/sensors/lmsensors_v3.h"*/
#include "mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.h"
/*#include "mibgroup/util_funcs/header_generic.h"*/
/*#include "mibgroup/mibII/updates.h"*/
#include "mibgroup/mibII/vacm_context.h"
/*#include "mibgroup/mibII/data_access/at_linux.h"*/
/*#include "mibgroup/mibII/data_access/at_unix.h"*/
/*#include "mibgroup/if-mib/ifTable.h"*/
/*#include "mibgroup/mibII/kernel_linux.h"*/
/*#include "mibgroup/mibII/ipAddr.h"*/
#include "mibgroup/mibII/var_route.h"
/*#include "mibgroup/mibII/route_write.h"*/
#include "mibgroup/mibII/tcpTable.h"
#include "mibgroup/mibII/udpTable.h"
/*#include "mibgroup/if-mib/ifXTable.h"*/
/*#include "mibgroup/ip-mib/ipAddressTable.h"*/
/*#include "mibgroup/ip-mib/ipAddressPrefixTable.h"*/
/*#include "mibgroup/ip-mib/ipDefaultRouterTable.h"*/
/*#include "mibgroup/ip-mib/inetNetToMediaTable.h"*/
/*#include "mibgroup/ip-mib/ipSystemStatsTable.h"*/
#include "mibgroup/ip-mib/ip_scalars.h"
/*#include "mibgroup/ip-forward-mib/ipCidrRouteTable.h"*/
/*#include "mibgroup/ip-forward-mib/inetCidrRouteTable.h"*/
/*#include "mibgroup/util_funcs/restart.h"*/
/*#include "mibgroup/ucd-snmp/pass_common.h"*/
#include "mibgroup/notification/snmpNotifyTable_data.h"
/*#include "mibgroup/header_complex.h"*/
#include "mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_storage.h"
#include "mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable.h"
#include "mibgroup/notification/snmpNotifyFilterProfileTable_data.h"
#include "mibgroup/target/snmpTargetAddrEntry_data.h"
#include "mibgroup/target/snmpTargetParamsEntry_data.h"
/*#include "mibgroup/etherlike-mib/data_access/dot3stats_linux.h"*/
#include "mibgroup/hardware/memory/hw_mem.h"
/*#include "mibgroup/hardware/memory/memory_linux.h"*/
#include "mibgroup/hardware/fsys/hw_fsys.h"
/*#include "mibgroup/hardware/fsys/fsys_mntent.h"*/
/*#include "mibgroup/host/data_access/swinst_rpm.h"*/
/*#include "mibgroup/host/data_access/swrun_procfs_status.h"*/
#include "mibgroup/hardware/cpu/cpu.h"
#include "mibgroup/hardware/cpu/cpu_linux.h"
/*#include "mibgroup/if-mib/data_access/interface_linux.h"*/
/*#include "mibgroup/if-mib/data_access/interface_ioctl.h"*/
/*#include "mibgroup/ip-mib/data_access/ipaddress_common.h"*/
/*#include "mibgroup/ip-mib/data_access/ipaddress_linux.h"*/
/*#include "mibgroup/ip-mib/data_access/ipv6scopezone_common.h"*/
/*#include "mibgroup/ip-mib/data_access/ipv6scopezone_linux.h"*/
/*#include "mibgroup/rmon-mib/data_access/etherstats_linux.h"*/
/*#include "mibgroup/tcp-mib/data_access/tcpConn_common.h"*/
/*#include "mibgroup/tcp-mib/data_access/tcpConn_linux.h"*/
/*#include "mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_interface.h"*/
/*#include "mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_data_access.h"*/
/*#include "mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_interface.h"*/
/*#include "mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_data_access.h"*/
/*#include "mibgroup/udp-mib/data_access/udp_endpoint.h"*/
/*#include "mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_interface.h"*/
/*#include "mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.h"*/
#include "mibgroup/if-mib/ifXTable/ifXTable.h"
/*#include "mibgroup/ip-mib/data_access/arp.h"*/
#include "mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable.h"
/*#include "mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_interface.h"*/
/*#include "mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.h"*/
#include "mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable.h"
/*#include "mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_interface.h"*/
/*#include "mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_data_access.h"*/
/*#include "mibgroup/ip-mib/data_access/scalars_common.h"*/
#include "mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable.h"
#include "mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable.h"
/*#include "mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_interface.h"*/
/*#include "mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access.h"*/
/*#include "mibgroup/ip-mib/data_access/ipaddress_ioctl.h"*/
/*#include "mibgroup/udp-mib/data_access/udp_endpoint_common.h"*/
/*#include "mibgroup/udp-mib/data_access/udp_endpoint_linux.h"*/
/*#include "mibgroup/if-mib/ifXTable/ifXTable_interface.h"*/
/*#include "mibgroup/if-mib/ifXTable/ifXTable_data_access.h"*/
/*#include "mibgroup/ip-mib/data_access/arp_common.h"*/
/*#include "mibgroup/ip-mib/data_access/arp_netlink.h"*/
/*#include "mibgroup/ip-mib/data_access/scalars_linux.h"*/
/*#include "mibgroup/ip-forward-mib/data_access/route.h"*/
/*#include "mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_interface.h"*/
/*#include "mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_data_access.h"*/
/*#include "mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_interface.h"*/
/*#include "mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_data_access.h"*/
/*#include "mibgroup/ip-forward-mib/data_access/route_common.h"*/
/*#include "mibgroup/ip-forward-mib/data_access/route_linux.h"*/
/*#include "mibgroup/ip-forward-mib/data_access/route_ioctl.h"*/
agent/table_iterator.h000064400000015410147511501100011007 0ustar00/* Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 */
/*
 * Portions of this file are copyrighted by:
 * Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */
/**
 * @file table_iterator.h
 * @addtogroup table_iterator
 * @{
 */
#ifndef _TABLE_ITERATOR_HANDLER_H_
#define _TABLE_ITERATOR_HANDLER_H_

#ifdef __cplusplus
extern          "C" {
#endif

    struct netsnmp_iterator_info_s;

    typedef netsnmp_variable_list *
               (Netsnmp_First_Data_Point) (void **loop_context,
                                           void **data_context,
                                           netsnmp_variable_list *,
                                           struct netsnmp_iterator_info_s *);
    typedef netsnmp_variable_list *
               (Netsnmp_Next_Data_Point)  (void **loop_context,
                                           void **data_context,
                                           netsnmp_variable_list *,
                                           struct netsnmp_iterator_info_s *);
    typedef void *(Netsnmp_Make_Data_Context) (void *loop_context,
                                             struct netsnmp_iterator_info_s *);
    typedef void  (Netsnmp_Free_Loop_Context) (void *,
                                             struct netsnmp_iterator_info_s *);
    typedef void  (Netsnmp_Free_Data_Context) (void *,
                                             struct netsnmp_iterator_info_s *);

    /** @typedef struct netsnmp_iterator_info_s netsnmp_iterator_info
     * Typedefs the netsnmp_iterator_info_s struct into netsnmp_iterator_info */

    /** @struct netsnmp_iterator_info_s

     * Holds iterator information containing functions which should be
       called by the iterator_handler to loop over your data set and
       sort it in a SNMP specific manner.
       
       The netsnmp_iterator_info typedef can be used instead of directly calling this struct if you would prefer.
     */
    typedef struct netsnmp_iterator_info_s {
       /** Number of handlers that own this data structure. */
       int refcnt;

       /** Responsible for: returning the first set of "index" data, a
           loop-context pointer, and optionally a data context
           pointer */
        Netsnmp_First_Data_Point *get_first_data_point;

       /** Given the previous loop context, this should return the
           next loop context, associated index set and optionally a
           data context */
        Netsnmp_Next_Data_Point *get_next_data_point;

       /** If a data context wasn't supplied by the
           get_first_data_point or get_next_data_point functions and
           the make_data_context pointer is defined, it will be called
           to convert a loop context into a data context. */
        Netsnmp_Make_Data_Context *make_data_context;

       /** A function which should free the loop context.  This
           function is called at *each* iteration step, which is
           not-optimal for speed purposes.  The use of
           free_loop_context_at_end instead is strongly
           encouraged. This can be set to NULL to avoid its usage. */
        Netsnmp_Free_Loop_Context *free_loop_context;

       /** Frees a data context.  This will be called at any time a
           data context needs to be freed.  This may be at the same
           time as a correspondng loop context is freed, or much much
           later.  Multiple data contexts may be kept in existence at
           any time. */
       Netsnmp_Free_Data_Context *free_data_context;

       /** Frees a loop context at the end of the entire iteration
           sequence.  Generally, this would free the loop context
           allocated by the get_first_data_point function (which would
           then be updated by each call to the get_next_data_point
           function).  It is not called until the get_next_data_point
           function returns a NULL */
        Netsnmp_Free_Loop_Context *free_loop_context_at_end;

       /** This can be used by client handlers to store any
           information they need */
        void           *myvoid;
        int             flags;
#define NETSNMP_ITERATOR_FLAG_SORTED	0x01
#define NETSNMP_HANDLER_OWNS_IINFO	0x02

       /** A pointer to the netsnmp_table_registration_info object
           this iterator is registered along with. */
        netsnmp_table_registration_info *table_reginfo;

        /* Experimental extension - Use At Your Own Risk
           (these two fields may change/disappear without warning) */
        Netsnmp_First_Data_Point *get_row_indexes;
        netsnmp_variable_list *indexes;
    } netsnmp_iterator_info;

#define TABLE_ITERATOR_NAME "table_iterator"

/* ============================
 * Iterator API: Table maintenance
 * ============================ */
        /* N/A */

/* ============================
 * Iterator API: MIB maintenance
 * ============================ */

    void   netsnmp_handler_owns_iterator_info(netsnmp_mib_handler *h);
    netsnmp_mib_handler
          *netsnmp_get_table_iterator_handler(netsnmp_iterator_info *iinfo);
    int netsnmp_register_table_iterator(netsnmp_handler_registration *reginfo,
                                        netsnmp_iterator_info *iinfo);
    void  netsnmp_iterator_delete_table(netsnmp_iterator_info *iinfo);

    void *netsnmp_extract_iterator_context(netsnmp_request_info *);
    void   netsnmp_insert_iterator_context(netsnmp_request_info *, void *);

    Netsnmp_Node_Handler netsnmp_table_iterator_helper_handler;

#define netsnmp_register_table_iterator2(reginfo, iinfo)        \
    (((iinfo)->flags |= NETSNMP_HANDLER_OWNS_IINFO),           \
        netsnmp_register_table_iterator((reginfo), (iinfo)))


/* ============================
 * Iterator API: Row operations
 * ============================ */

void *netsnmp_iterator_row_first(      netsnmp_iterator_info *);
void *netsnmp_iterator_row_get(        netsnmp_iterator_info *, void *);
void *netsnmp_iterator_row_next(       netsnmp_iterator_info *, void *);
void *netsnmp_iterator_row_get_byidx(  netsnmp_iterator_info *,
                                       netsnmp_variable_list *);
void *netsnmp_iterator_row_next_byidx( netsnmp_iterator_info *,
                                       netsnmp_variable_list *);
void *netsnmp_iterator_row_get_byoid(  netsnmp_iterator_info *, oid *, size_t);
void *netsnmp_iterator_row_next_byoid( netsnmp_iterator_info *, oid *, size_t);
int   netsnmp_iterator_row_count(      netsnmp_iterator_info *);


/* ============================
 * Iterator API: Index operations
 * ============================ */

#ifdef __cplusplus
}
#endif

#endif                          /* _TABLE_ITERATOR_HANDLER_H_ */
/** @} */
agent/snmp_get_statistic.h000064400000001504147511501100011711 0ustar00#ifndef SNMP_GET_STATISTIC_H
#define SNMP_GET_STATISTIC_H

/** Registers a scalar group with statistics from @ref snmp_get_statistic.
 *  as reginfo.[start, start + end - begin].
 *  @param reginfo registration to register the items under
 *  @param start offset to the begin item
 *  @param begin first snmp_get_statistic key to return
 *  @param end last snmp_get_statistic key to return
 */
int
netsnmp_register_statistic_handler(netsnmp_handler_registration *reginfo,
                                   oid start, int begin, int end);

#define NETSNMP_REGISTER_STATISTIC_HANDLER(reginfo, start, stat)        \
  netsnmp_register_statistic_handler(reginfo, start,                    \
                                     STAT_ ## stat ## _STATS_START,     \
                                     STAT_ ## stat ## _STATS_END)

#endif
agent/stash_to_next.h000064400000000571147511501100010673 0ustar00/*
 * stash_to_next.h 
 */
#ifndef STASH_TO_NEXT_H
#define STASH_TO_NEXT_H

#ifdef __cplusplus
extern          "C" {
#endif


/*
 * The helper merely intercepts GETSTASH requests and converts them to
 * GETNEXT reequests.
 */


netsnmp_mib_handler *netsnmp_get_stash_to_next_handler(void);
Netsnmp_Node_Handler netsnmp_stash_to_next_helper;

#ifdef __cplusplus
}
#endif
#endif
agent/agent_trap.h000064400000011454147511501100010137 0ustar00#ifndef AGENT_TRAP_H
#define AGENT_TRAP_H

/*
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */
#ifdef __cplusplus
extern          "C" {
#endif

struct agent_add_trap_args {
    netsnmp_session *ss;
    int             confirm;
    const char      *nameData; /* notification target addr name */
    int             nameLen;
    const char      *tagData; /* notification tag */
    int             tagLen;
    const char      *profileData; /* filter profile */
    int             profileLen;
    int             rc;
};

void            init_traps(void);
void            send_easy_trap(int, int);
void            send_trap_pdu(netsnmp_pdu *);
void            send_v2trap(netsnmp_variable_list *);
void            send_v3trap(netsnmp_variable_list *vars, const char *context);
void            send_trap_vars(int, int, netsnmp_variable_list *);
void            send_trap_vars_with_context(int trap, int specific, 
                                            netsnmp_variable_list *vars,
                                            const char *context);
void            send_enterprise_trap_vars(int trap, int specific,
                                          const oid * enterprise,
                                          int enterprise_length,
                                          netsnmp_variable_list * vars);
int             netsnmp_send_traps(int trap, int specific,
                          const oid * enterprise, int enterprise_length,
                          netsnmp_variable_list * vars,
                          /* flags are currently unused */
                          const char * context, int flags);
void            snmpd_parse_config_authtrap(const char *, char *);
void            snmpd_parse_config_trapsink(const char *, char *);
void            snmpd_parse_config_trap2sink(const char *, char *);
void            snmpd_parse_config_informsink(const char *, char *);
void            snmpd_parse_config_trapsess(const char *, char *);
void            snmpd_free_trapsinks(void);
void            snmpd_parse_config_trapcommunity(const char *, char *);
void            snmpd_free_trapcommunity(void);
void            send_trap_to_sess(netsnmp_session * sess,
                                  netsnmp_pdu *template_pdu);

int             create_trap_session(char *, u_short, char *, int, int);
int             create_trap_session_with_src(const char *, const char *,
                                             const char *, const char *,
                                             int, int);
int             add_trap_session(netsnmp_session *, int, int, int);
int             remove_trap_session(netsnmp_session *);
netsnmp_session *netsnmp_create_v1v2_notification_session(const char *,
                                                          const char*,
                                                          const char *,
                                                          const char *,
                                                          int, int,
                                                          const char *,
                                                          const char *,
                                                          const char*);
netsnmp_session *netsnmp_create_v3user_notification_session(const char *dst,
                                                            const char *user,
                                                            int lvl,
                                                            const char *ctx,
                                                            int pdutype,
                                                            const u_char *eid,
                                                            size_t eidl,
                                                            const char *src,
                                                            const char *name,
                                                            const char *tag,
                                                            const char *prof);
int             netsnmp_add_notification_session(netsnmp_session *, int, int,
                                                 int, const char*, const char*,
                                                 const char*);
void            netsnmp_unregister_notification(const char *, u_char);

int             netsnmp_build_trap_oid(netsnmp_pdu *pdu, oid *, size_t *);

void                   convert_v2_to_v1(netsnmp_variable_list *, netsnmp_pdu *);
netsnmp_variable_list *convert_v1_to_v2(netsnmp_pdu *);
netsnmp_pdu    *convert_v2pdu_to_v1(netsnmp_pdu *);
netsnmp_pdu    *convert_v1pdu_to_v2(netsnmp_pdu *);

#ifdef __cplusplus
}
#endif
#endif                          /* AGENT_TRAP_H */
agent/var_struct.h000064400000011650147511501100010205 0ustar00#ifndef VAR_STRUCT_H
#define VAR_STRUCT_H
/*
 * The subtree structure contains a subtree prefix which applies to
 * all variables in the associated variable list.
 *
 * By converting to a tree of subtree structures, entries can
 * now be subtrees of another subtree in the structure. i.e:
 * 1.2
 * 1.2.0
 */

#define UCD_REGISTRY_OID_MAX_LEN	128

/*
 * subtree flags 
 */
#define FULLY_QUALIFIED_INSTANCE    0x01
#define SUBTREE_ATTACHED	    	0x02

typedef struct netsnmp_subtree_s {
    oid		   *name_a;	/* objid prefix of registered subtree */
    u_char          namelen;    /* number of subid's in name above */
    oid            *start_a;	/* objid of start of covered range */
    u_char          start_len;  /* number of subid's in start name */
    oid            *end_a;	/* objid of end of covered range   */
    u_char          end_len;    /* number of subid's in end name */
    struct variable *variables; /* pointer to variables array */
    int             variables_len;      /* number of entries in above array */
    int             variables_width;    /* sizeof each variable entry */
    char           *label_a;	/* calling module's label */
    netsnmp_session *session;
    u_char          flags;
    u_char          priority;
    int             timeout;
    struct netsnmp_subtree_s *next;       /* List of 'sibling' subtrees */
    struct netsnmp_subtree_s *prev;       /* (doubly-linked list) */
    struct netsnmp_subtree_s *children;   /* List of 'child' subtrees */
    int             range_subid;
    oid             range_ubound;
    netsnmp_handler_registration *reginfo;      /* new API */
    int             cacheid;
    int             global_cacheid;
    size_t          oid_off;
} netsnmp_subtree;

/*
 * This is a new variable structure that doesn't have as much memory
 * tied up in the object identifier.  It's elements have also been re-arranged
 * so that the name field can be variable length.  Any number of these
 * structures can be created with lengths tailor made to a particular
 * application.  The first 5 elements of the structure must remain constant.
 */
struct variable1 {
    u_char          magic;      /* passed to function as a hint */
    u_char          type;       /* type of variable */
    u_short         acl;        /* access control list for variable */
    FindVarMethod  *findVar;    /* function that finds variable */
    u_char          namelen;    /* length of name below */
    oid             name[1];    /* object identifier of variable */
};

struct variable2 {
    u_char          magic;      /* passed to function as a hint */
    u_char          type;       /* type of variable */
    u_short         acl;        /* access control list for variable */
    FindVarMethod  *findVar;    /* function that finds variable */
    u_char          namelen;    /* length of name below */
    oid             name[2];    /* object identifier of variable */
};

struct variable3 {
    u_char          magic;      /* passed to function as a hint */
    u_char          type;       /* type of variable */
    u_short         acl;        /* access control list for variable */
    FindVarMethod  *findVar;    /* function that finds variable */
    u_char          namelen;    /* length of name below */
    oid             name[3];    /* object identifier of variable */
};

struct variable4 {
    u_char          magic;      /* passed to function as a hint */
    u_char          type;       /* type of variable */
    u_short         acl;        /* access control list for variable */
    FindVarMethod  *findVar;    /* function that finds variable */
    u_char          namelen;    /* length of name below */
    oid             name[4];    /* object identifier of variable */
};

struct variable7 {
    u_char          magic;      /* passed to function as a hint */
    u_char          type;       /* type of variable */
    u_short         acl;        /* access control list for variable */
    FindVarMethod  *findVar;    /* function that finds variable */
    u_char          namelen;    /* length of name below */
    oid             name[7];    /* object identifier of variable */
};

struct variable8 {
    u_char          magic;      /* passed to function as a hint */
    u_char          type;       /* type of variable */
    u_short         acl;        /* access control list for variable */
    FindVarMethod  *findVar;    /* function that finds variable */
    u_char          namelen;    /* length of name below */
    oid             name[8];    /* object identifier of variable */
};

struct variable13 {
    u_char          magic;      /* passed to function as a hint */
    u_char          type;       /* type of variable */
    u_short         acl;        /* access control list for variable */
    FindVarMethod  *findVar;    /* function that finds variable */
    u_char          namelen;    /* length of name below */
    oid             name[13];   /* object identifier of variable */
};
#endif                          /* VAR_STRUCT_H */
agent/read_only.h000064400000001034147511501100007760 0ustar00#ifndef READ_ONLY_H
#define READ_ONLY_H

#ifdef __cplusplus
extern          "C" {
#endif

/*
 * read_only.h 
 */

/*
 * The helper merely intercepts SET requests and handles them early on
 * making everything read-only (no SETs are actually permitted).
 * Useful as a helper to handlers that are implementing MIBs with no
 * SET support.
 */


netsnmp_mib_handler *netsnmp_get_read_only_handler(void);
void            netsnmp_init_read_only_helper(void);

Netsnmp_Node_Handler netsnmp_read_only_helper;


#ifdef __cplusplus
}
#endif
#endif
agent/agent_sysORTable.h000064400000001545147511501100011220 0ustar00#ifndef AGENT_SYSORTABLE_H
#define AGENT_SYSORTABLE_H

#ifdef __cplusplus
extern          "C" {
#endif

struct sysORTable;

extern void     init_agent_sysORTable(void);
extern void     shutdown_agent_sysORTable(void);

extern void     netsnmp_sysORTable_foreach(void (*)(const struct sysORTable*,
                                                    void*),
                                           void*);

extern int      register_sysORTable(oid *, size_t, const char *);
extern int      unregister_sysORTable(oid *, size_t);
extern int      register_sysORTable_sess(oid *, size_t, const char *,
                                         netsnmp_session *);
extern int      unregister_sysORTable_sess(oid *, size_t, netsnmp_session *);
extern void     unregister_sysORTable_by_session(netsnmp_session *);

#ifdef __cplusplus
}
#endif

#endif /* AGENT_SYSORTABLE_H */
agent/table_container.h000064400000007726147511501100011153 0ustar00/*
 * table_container.h
 * $Id$
 */
#ifndef _TABLE_CONTAINER_HANDLER_H_
#define _TABLE_CONTAINER_HANDLER_H_

#ifdef __cplusplus
extern          "C" {
#endif

    /*
     * The table container helper is designed to simplify the task of
     * writing a table handler for the net-snmp agent when the data being
     * accessed is accessible via a netsnmp_container.
     * 
     * Functionally, it is a specialized version of the more
     * generic table helper but easies the burden of GETNEXT processing by
     * retrieving the appropriate row for each index through
     * function calls which should be supplied by the module that wishes
     * help.  The module the table_container helps should, afterwards,
     * never be called for the case of "MODE_GETNEXT" and only for the GET
     * and SET related modes instead.
     */
    
#include <net-snmp/library/container.h>
#include <net-snmp/agent/table.h>
    
#define TABLE_CONTAINER_ROW       "table_container:row"
#define TABLE_CONTAINER_CONTAINER "table_container:container"
    
#define TABLE_CONTAINER_KEY_NETSNMP_INDEX         1 /* default */
#define TABLE_CONTAINER_KEY_VARBIND_INDEX         2
#define TABLE_CONTAINER_KEY_VARBIND_RAW           3

/* ====================================
 * Container Table API: MIB maintenance
 * ==================================== */

    /*
     * get an injectable container table handler
     */
    netsnmp_mib_handler *
    netsnmp_container_table_handler_get(netsnmp_table_registration_info *tabreq,
                                        netsnmp_container *container,
                                        char key_type);
    /*
     * register a container table
     */
    int            
    netsnmp_container_table_register(netsnmp_handler_registration *reginfo,
                                     netsnmp_table_registration_info *tabreq,
                                     netsnmp_container *container,
                                     char key_type);
    int            
    netsnmp_container_table_unregister(netsnmp_handler_registration *reginfo);
    
    /** retrieve the container used by the table_container helper */
    netsnmp_container*
    netsnmp_container_table_container_extract(netsnmp_request_info *request);

    /** find the context data used by the table_container helper */
#ifdef NETSNMP_USE_INLINE
    NETSNMP_STATIC_INLINE void *
    netsnmp_container_table_row_extract(netsnmp_request_info *request)
    {
        /*
         * NOTE: this function must match in table_container.c and table_container.h.
         *       if you change one, change them both!
         */
        return netsnmp_request_get_list_data(request, TABLE_CONTAINER_ROW);
    }

    NETSNMP_STATIC_INLINE void *
    netsnmp_container_table_extract_context(netsnmp_request_info *request)
    {
        /*
         * NOTE: this function must match in table_container.c and table_container.h.
         *       if you change one, change them both!
         */
        return netsnmp_request_get_list_data(request, TABLE_CONTAINER_ROW);
    }
#else
    void *
    netsnmp_container_table_row_extract(netsnmp_request_info *request);
    void *
    netsnmp_container_table_extract_context(netsnmp_request_info *request);
#endif /* inline */

    void netsnmp_container_table_row_insert(netsnmp_request_info *request,
                                            netsnmp_index *row);
    void netsnmp_container_table_row_remove(netsnmp_request_info *request,
                                            netsnmp_index        *row);

/* ===================================
 * Container Table API: Row operations
 * =================================== */

    void *
    netsnmp_container_table_find_next_row(netsnmp_request_info *request,
                                          netsnmp_table_request_info *tblreq,
                                          netsnmp_container *container,
                                          char key_type );
#ifdef __cplusplus
}
#endif

#endif                          /* _TABLE_CONTAINER_HANDLER_H_ */
agent/mfd.h000064400000005176147511501100006565 0ustar00/*
 * MIBs For Dummies header
 *
 * $Id$
 */
#ifndef NETSNMP_MFD_H
#define NETSNMP_MFD_H

/***********************************************************************
 *
 * return codes
 *
 **********************************************************************/

/*----------------------------------------------------------------------
 * general success/failure
 */
#define MFD_SUCCESS              SNMP_ERR_NOERROR
#define MFD_ERROR                SNMP_ERR_GENERR

/*
 * object not currently available
 */
#define MFD_SKIP                 SNMP_NOSUCHINSTANCE

/*
 * no more data in table (get-next)
 */
#define MFD_END_OF_DATA          SNMP_ENDOFMIBVIEW

/*----------------------------------------------------------------------
 * set processing errors
 */
/*
 * row creation errors
 */
#define MFD_CANNOT_CREATE_NOW    SNMP_ERR_INCONSISTENTNAME
#define MFD_CANNOT_CREATE_EVER   SNMP_ERR_NOCREATION

/*
 * not writable or resource unavailable
 */
#define MFD_NOT_WRITABLE         SNMP_ERR_NOTWRITABLE
#define MFD_RESOURCE_UNAVAILABLE SNMP_ERR_RESOURCEUNAVAILABLE

/*
 * new value errors
 */
#define MFD_NOT_VALID_NOW        SNMP_ERR_INCONSISTENTVALUE
#define MFD_NOT_VALID_EVER       SNMP_ERR_WRONGVALUE


/***********************************************************************
 *
 * rowreq flags
 *
 **********************************************************************/

/*----------------------------------------------------------------------
 * 8 flags resevered for the user
 */
#define MFD_ROW_FLAG_USER_1            0x00000001 /* user flag 1 */
#define MFD_ROW_FLAG_USER_2            0x00000002 /* user flag 2 */
#define MFD_ROW_FLAG_USER_3            0x00000004 /* user flag 3 */
#define MFD_ROW_FLAG_USER_4            0x00000008 /* user flag 4 */
#define MFD_ROW_FLAG_USER_5            0x00000010 /* user flag 5 */
#define MFD_ROW_FLAG_USER_6            0x00000020 /* user flag 6 */
#define MFD_ROW_FLAG_USER_7            0x00000040 /* user flag 7 */
#define MFD_ROW_FLAG_USER_8            0x00000080 /* user flag 8 */
#define MFD_ROW_FLAG_USER_MASK         0x000000ff /* user flag mask */

/*----------------------------------------------------------------------
 * MFD flags
 *
 * grow left to right, in case we want to add more user flags later
 */
#define MFD_ROW_MASK                   0xffffff00 /* mask to clear user flags */
#define MFD_ROW_CREATED                0x80000000 /* newly created row */
#define MFD_ROW_DATA_FROM_USER         0x40000000 /* we didn't allocate data */
#define MFD_ROW_DELETED                0x20000000 /* deleted row */
#define MFD_ROW_DIRTY                  0x10000000 /* changed row */


#endif                          /* NETSNMP_MFD_H */
agent/table_dataset.h000064400000017347147511501100010616 0ustar00/*
 * table_iterator.h 
 */
#ifndef _TABLE_DATA_SET_HANDLER_H_
#define _TABLE_DATA_SET_HANDLER_H_

#ifdef __cplusplus
extern          "C" {
#endif

    /*
     * This helper is designed to completely automate the task of storing
     * tables of data within the agent that are not tied to external data
     * sources (like the kernel, hardware, or other processes, etc).  IE,
     * all rows within a table are expected to be added manually using
     * functions found below.
     */

    void netsnmp_init_table_dataset(void);

#define TABLE_DATA_SET_NAME "netsnmp_table_data_set"

    /*
     * return SNMP_ERR_NOERROR or some SNMP specific protocol error id 
     */
    typedef int     (Netsnmp_Value_Change_Ok) (char *old_value,
                                               size_t old_value_len,
                                               char *new_value,
                                               size_t new_value_len,
                                               void *mydata);

    /*
     * stored within a given row 
     */
    typedef struct netsnmp_table_data_set_storage_s {
        unsigned int    column;

        /*
         * info about it? 
         */
        char            writable;
        Netsnmp_Value_Change_Ok *change_ok_fn;
        void           *my_change_data;

        /*
         * data actually stored 
         */
        u_char          type;
        union {                 /* value of variable */
            void           *voidp;
            long           *integer;
            u_char         *string;
            oid            *objid;
            u_char         *bitstring;
            struct counter64 *counter64;
#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
            float          *floatVal;
            double         *doubleVal;
#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
        } data;
        u_long          data_len;

        struct netsnmp_table_data_set_storage_s *next;
    } netsnmp_table_data_set_storage;

    typedef struct netsnmp_table_data_set_s {
        netsnmp_table_data *table;
        netsnmp_table_data_set_storage *default_row;
        int             allow_creation; /* set to 1 to allow creation of new rows */
        unsigned int    rowstatus_column;
    } netsnmp_table_data_set;


/* ============================
 * DataSet API: Table maintenance
 * ============================ */

    netsnmp_table_data_set *netsnmp_create_table_data_set(const char *);
    netsnmp_table_row *netsnmp_table_data_set_clone_row( netsnmp_table_row *row);
    void netsnmp_table_dataset_delete_all_data(
                            netsnmp_table_data_set_storage *data);
    void netsnmp_table_dataset_delete_row(netsnmp_table_row *row);

    void netsnmp_table_dataset_add_row(netsnmp_table_data_set
                                                  *table,
                                                  netsnmp_table_row *row);
    void
        netsnmp_table_dataset_replace_row(netsnmp_table_data_set *table,
                                          netsnmp_table_row *origrow,
                                          netsnmp_table_row *newrow);
    void netsnmp_table_dataset_remove_row(netsnmp_table_data_set
                                                     *table,
                                                     netsnmp_table_row *row);
    void
        netsnmp_table_dataset_remove_and_delete_row(netsnmp_table_data_set
                                                    *table,
                                                    netsnmp_table_row *row);
    void netsnmp_delete_table_data_set(netsnmp_table_data_set *table_set);

/* ============================
 * DataSet API: Default row operations
 * ============================ */

    /*
     * to set, add column, type, (writable) ? 1 : 0 
     */
    /*
     * default value, if not NULL, is the default value used in row
     * creation.  It is copied into the storage template (free your
     * calling argument). 
     */
    int netsnmp_table_set_add_default_row(netsnmp_table_data_set *,
                                          unsigned int, int, int,
                                          void  *default_value,
                                          size_t default_value_len);
    void netsnmp_table_set_multi_add_default_row(netsnmp_table_data_set *,
                                                ...);


/* ============================
 * DataSet API: MIB maintenance
 * ============================ */

    netsnmp_mib_handler
        *netsnmp_get_table_data_set_handler(netsnmp_table_data_set *);
    Netsnmp_Node_Handler netsnmp_table_data_set_helper_handler;
    int netsnmp_register_table_data_set(netsnmp_handler_registration *,
                                        netsnmp_table_data_set *,
                                        netsnmp_table_registration_info *);
    netsnmp_table_data_set
        *netsnmp_extract_table_data_set(netsnmp_request_info *request);
    netsnmp_table_data_set_storage
        *netsnmp_extract_table_data_set_column(netsnmp_request_info *,
                                               unsigned int);
    netsnmp_oid_stash_node **
    netsnmp_table_dataset_get_or_create_stash(netsnmp_agent_request_info *ari,
                                              netsnmp_table_data_set *tds,
                                              netsnmp_table_request_info *tri);
    netsnmp_table_row *
    netsnmp_table_dataset_get_newrow(netsnmp_request_info *request,
                                     netsnmp_agent_request_info *reqinfo,
                                     int rootoid_len,
                                     netsnmp_table_data_set *datatable,
                                     netsnmp_table_request_info *table_info);


/* ============================
 * DataSet API: Config-based operations
 * ============================ */

    void netsnmp_register_auto_data_table(netsnmp_table_data_set *table_set,
                                          char *registration_name);
    void netsnmp_unregister_auto_data_table(netsnmp_table_data_set *table_set,
					    char *registration_name);
    void netsnmp_config_parse_table_set(const char *token, char *line);
    void netsnmp_config_parse_add_row(  const char *token, char *line);


/* ============================
 * DataSet API: Row operations
 * ============================ */

    netsnmp_table_row *netsnmp_table_data_set_get_first_row(netsnmp_table_data_set *table);
    netsnmp_table_row *netsnmp_table_data_set_get_next_row( netsnmp_table_data_set *table,
                                                            netsnmp_table_row      *row);
    int netsnmp_table_set_num_rows(netsnmp_table_data_set *table);


/* ============================
 * DataSet API: Column operations
 * ============================ */

    netsnmp_table_data_set_storage
        *netsnmp_table_data_set_find_column(netsnmp_table_data_set_storage *,
                                            unsigned int);
    int  netsnmp_mark_row_column_writable(  netsnmp_table_row *row,
                                            int column, int writable);
    int  netsnmp_set_row_column(            netsnmp_table_row *,
                                            unsigned int, int, const void *,
                                            size_t);

/* ============================
 * DataSet API: Index operations
 * ============================ */

    void netsnmp_table_dataset_add_index(netsnmp_table_data_set
                                                    *table, u_char type);
    void netsnmp_table_set_add_indexes(netsnmp_table_data_set *tset, ...);

#ifdef __cplusplus
}
#endif

#define netsnmp_table_row_add_column(row, type, value, value_len) snmp_varlist_add_variable(&row->indexes, NULL, 0, type, (u_char *) value, value_len)

#endif                          /* _TABLE_DATA_SET_HANDLER_H_ */
agent/table.h000064400000016537147511501100007111 0ustar00/* Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 */
/*
 * Portions of this file are copyrighted by:
 * Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */
/*
 * Portions of this file are copyrighted by:
 * Copyright (C) 2007 Apple, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */
/*
 * @file table.h
 *
 * @addtogroup table
 *
 * @{
 */
#ifndef _TABLE_HANDLER_H_
#define _TABLE_HANDLER_H_

#ifdef __cplusplus
extern          "C" {
#endif

/**
 * The table helper is designed to simplify the task of writing a
 * table handler for the net-snmp agent.  You should create a normal
 * handler and register it using the netsnmp_register_table() function
 * instead of the netsnmp_register_handler() function.
 */

/**
 * Notes:
 *
 *   1) illegal indexes automatically get handled for get/set cases.
 *      Simply check to make sure the value is type ASN_NULL before
 *      you answer a request.
 */
	
/**
 * used as an index to parent_data lookups 
 */
#define TABLE_HANDLER_NAME "table"

/** @typedef struct netsnmp_column_info_t netsnmp_column_info
 * Typedefs the netsnmp_column_info_t struct into netsnmp_column_info */

/**
 * @struct netsnmp_column_info_t
 * column info struct.  OVERLAPPING RANGES ARE NOT SUPPORTED.
 */
    typedef struct netsnmp_column_info_t {
        char            isRange;
 	/** only useful if isRange == 0 */
        char            list_count;

        union {
            unsigned int    range[2];
            unsigned int   *list;
        } details;

        struct netsnmp_column_info_t *next;

    } netsnmp_column_info;

/** @typedef struct netsnmp_table_registration_info_s netsnmp_table_registration_info
  * Typedefs the netsnmp_table_registration_info_s  struct into
  * netsnmp_table_registration_info */

/**
 * @struct netsnmp_table_registration_info_s
 * Table registration structure.
 */
    typedef struct netsnmp_table_registration_info_s {
 	/** list of varbinds with only 'type' set */
        netsnmp_variable_list *indexes;
 	/** calculated automatically */
        unsigned int    number_indexes;

       /**
        * the minimum columns number. If there are columns
        * in-between which are not valid, use valid_columns to get
        * automatic column range checking.
        */
        unsigned int    min_column;
 	/** the maximum columns number */
        unsigned int    max_column;

 	/** more details on columns */
        netsnmp_column_info *valid_columns;

    } netsnmp_table_registration_info;

/** @typedef struct netsnmp_table_request_info_s netsnmp_table_request_info
  * Typedefs the netsnmp_table_request_info_s  struct into
  * netsnmp_table_request_info */

/**
 * @struct netsnmp_table_request_info_s
 * The table request info structure.
 */
    typedef struct netsnmp_table_request_info_s {
 	/** 0 if OID not long enough */
        unsigned int    colnum;
        /** 0 if failure to parse any */
        unsigned int    number_indexes;
 	/** contents freed by helper upon exit */
        netsnmp_variable_list *indexes;

        oid             index_oid[MAX_OID_LEN];
        size_t          index_oid_len;
        netsnmp_table_registration_info *reg_info;
    } netsnmp_table_request_info;

    netsnmp_mib_handler
        *netsnmp_get_table_handler(netsnmp_table_registration_info
                                   *tabreq);
    void  netsnmp_handler_owns_table_info(netsnmp_mib_handler *handler);
    void  netsnmp_registration_owns_table_info(netsnmp_handler_registration *reg);
    int   netsnmp_register_table(  netsnmp_handler_registration    *reginfo,
                                   netsnmp_table_registration_info *tabreq);
    int   netsnmp_unregister_table(netsnmp_handler_registration    *reginfo);
    int   netsnmp_table_build_oid( netsnmp_handler_registration    *reginfo,
                                   netsnmp_request_info            *reqinfo,
                                   netsnmp_table_request_info   *table_info);
    int            
        netsnmp_table_build_oid_from_index(netsnmp_handler_registration
                                           *reginfo,
                                           netsnmp_request_info *reqinfo,
                                           netsnmp_table_request_info
                                           *table_info);
    int             netsnmp_table_build_result(netsnmp_handler_registration
                                               *reginfo,
                                               netsnmp_request_info
                                               *reqinfo,
                                               netsnmp_table_request_info
                                               *table_info, u_char type,
                                               u_char * result,
                                               size_t result_len);
    int            
        netsnmp_update_variable_list_from_index(netsnmp_table_request_info
                                                *);
    int            
        netsnmp_update_indexes_from_variable_list
        (netsnmp_table_request_info *tri);
    netsnmp_table_registration_info
        *netsnmp_find_table_registration_info(netsnmp_handler_registration
                                              *reginfo);
    netsnmp_table_registration_info *
        netsnmp_table_registration_info_clone(netsnmp_table_registration_info *tri);
    void netsnmp_table_registration_info_free(netsnmp_table_registration_info *);

    netsnmp_index * netsnmp_table_index_find_next_row(netsnmp_container *c,
                                                      netsnmp_table_request_info *tblreq);

    unsigned int    netsnmp_closest_column(unsigned int current,
                                           netsnmp_column_info
                                           *valid_columns);

    Netsnmp_Node_Handler table_helper_handler;

#define netsnmp_table_helper_add_index(tinfo, type) snmp_varlist_add_variable(&tinfo->indexes, NULL, 0, (u_char)type, NULL, 0);

    void           
        netsnmp_table_helper_add_indexes(netsnmp_table_registration_info
                                         *tinfo, ...);

    int netsnmp_check_getnext_reply(netsnmp_request_info *request,
                                    oid * prefix, size_t prefix_len,
                                    netsnmp_variable_list * newvar,
                                    netsnmp_variable_list ** outvar);

    netsnmp_table_request_info
        *netsnmp_extract_table_info(netsnmp_request_info *);
    netsnmp_oid_stash_node
        **netsnmp_table_get_or_create_row_stash(netsnmp_agent_request_info
                                                *reqinfo,
                                                const u_char *
                                                storage_name);
	unsigned int
		netsnmp_table_next_column(netsnmp_table_request_info *table_info);


    int   netsnmp_sparse_table_register(netsnmp_handler_registration    *reginfo,
                                        netsnmp_table_registration_info *tabreq);

    netsnmp_mib_handler *netsnmp_sparse_table_handler_get(void);

#ifdef __cplusplus
}
#endif

#endif                          /* _TABLE_HANDLER_H_ */
/** @} */
agent/scalar.h000064400000001417147511501100007256 0ustar00/*
 * scalar.h 
 */
#ifndef NETSNMP_SCALAR_H
#define NETSNMP_SCALAR_H

#ifdef __cplusplus
extern "C" {
#endif

/*
 * The scalar helper is designed to simplify the task of adding simple
 * scalar objects to the mib tree.
 */

/*
 * GETNEXTs are auto-converted to a GET.
 * * non-valid GETs are dropped.
 * * The client can assume that if you're called for a GET, it shouldn't
 * * have to check the oid at all.  Just answer.
 */

int netsnmp_register_scalar(netsnmp_handler_registration *reginfo);
int netsnmp_register_read_only_scalar(netsnmp_handler_registration *reginfo);

#define SCALAR_HANDLER_NAME "scalar"

netsnmp_mib_handler *netsnmp_get_scalar_handler(void);

Netsnmp_Node_Handler netsnmp_scalar_helper_handler;

#ifdef __cplusplus
}
#endif

#endif /** NETSNMP_SCALAR_H */
agent/stash_cache.h000064400000002630147511501100010254 0ustar00#ifndef STASH_CACHE_H
#define STASH_CACHE_H

#include <net-snmp/library/oid_stash.h>
#include <net-snmp/library/tools.h>

#define STASH_CACHE_NAME "stash_cache"

typedef struct netsnmp_stash_cache_info_s {
   int                      cache_valid;
   marker_t                 cache_time;
   netsnmp_oid_stash_node  *cache;
   int                      cache_length;
} netsnmp_stash_cache_info;

typedef struct netsnmp_stash_cache_data_s {
   void              *data;
   size_t             data_len;
   u_char             data_type;
} netsnmp_stash_cache_data;

/* function prototypes */
void netsnmp_init_stash_cache_helper(void);
netsnmp_mib_handler *netsnmp_get_bare_stash_cache_handler(void);
netsnmp_mib_handler *netsnmp_get_stash_cache_handler(void);
netsnmp_mib_handler *netsnmp_get_timed_bare_stash_cache_handler(int timeout,
                                           oid *rootoid, size_t rootoid_len);
netsnmp_mib_handler *netsnmp_get_timed_stash_cache_handler(int timeout,
                                           oid *rootoid, size_t rootoid_len);
Netsnmp_Node_Handler netsnmp_stash_cache_helper;
netsnmp_oid_stash_node  **netsnmp_extract_stash_cache(netsnmp_agent_request_info *reqinfo);
int netsnmp_stash_cache_update(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests, netsnmp_stash_cache_info *cinfo);


#endif /* STASH_CACHE_H */
agent/net-snmp-agent-includes.h000064400000001364147511501100012453 0ustar00/*
 * A simple helpful wrapper to include lots of agent specific include
 * * files for people wanting to embed and snmp agent into an external
 * * application
 */
#ifndef NET_SNMP_AGENT_INCLUDES_H
#define NET_SNMP_AGENT_INCLUDES_H

#include <net-snmp/agent/mib_module_config.h>
#include <net-snmp/agent/agent_module_config.h>

#include <net-snmp/agent/snmp_agent.h>
#include <net-snmp/agent/snmp_vars.h>
#include <net-snmp/agent/ds_agent.h>
#include <net-snmp/agent/agent_handler.h>
#include <net-snmp/agent/agent_read_config.h>
#include <net-snmp/agent/agent_trap.h>
#include <net-snmp/agent/agent_handler.h>
#include <net-snmp/agent/all_helpers.h>
#include <net-snmp/agent/var_struct.h>

#endif                          /* NET_SNMP_AGENT_INCLUDES_H */
agent/null.h000064400000000720147511501100006757 0ustar00#ifndef AGENT_NULL_H
#define AGENT_NULL_H

#ifdef __cplusplus
extern          "C" {
#endif

/*
 * null.h 
 */

/*
 * literally does nothing and is used as a final handler for
 * "do-nothing" nodes that must exist solely for mib tree storage
 * usage..
 */

int      netsnmp_register_null(oid *, size_t);
int      netsnmp_register_null_context(oid *, size_t, const char *contextName);

Netsnmp_Node_Handler netsnmp_null_handler;

#ifdef __cplusplus
}
#endif
#endif
agent/serialize.h000064400000001130147511501100007770 0ustar00#ifndef SERIALIZE_H
#define SERIALIZE_H

/*
 * The serialized helper merely calls its clients multiple times for a
 * * given request set, so they don't have to loop through the requests
 * * themselves.
 */

#ifdef __cplusplus
extern          "C" {
#endif

    netsnmp_mib_handler *netsnmp_get_serialize_handler(void);
    int             netsnmp_register_serialize(netsnmp_handler_registration
                                               *reginfo);
    void            netsnmp_init_serialize(void);

    Netsnmp_Node_Handler netsnmp_serialize_helper_handler;

#ifdef __cplusplus
}
#endif
#endif
agent/sysORTable.h000064400000004633147511501100010043 0ustar00#ifndef NETSNMP_SYSORTABLE_H
#define NETSNMP_SYSORTABLE_H

struct sysORTable {
    char            *OR_descr;
    oid             *OR_oid;
    size_t           OR_oidlen;
    netsnmp_session *OR_sess;
    u_long           OR_uptime;
};

struct register_sysOR_parameters {
    char            *descr;
    oid             *name;
    size_t           namelen;
};

#define SYS_ORTABLE_REGISTERED_OK              0
#define SYS_ORTABLE_REGISTRATION_FAILED       -1
#define SYS_ORTABLE_UNREGISTERED_OK            0
#define SYS_ORTABLE_NO_SUCH_REGISTRATION      -1

#include <net-snmp/agent/agent_callbacks.h>

#define REGISTER_SYSOR_TABLE(theoid, len, descr)           \
  do {                                                     \
    struct sysORTable t;                                   \
    t.OR_descr = NETSNMP_REMOVE_CONST(char *, descr);      \
    t.OR_oid = theoid;                                     \
    t.OR_oidlen = len;                                     \
    t.OR_sess = NULL;                                      \
    t.OR_uptime = 0;                                       \
    snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,         \
                        SNMPD_CALLBACK_REQ_REG_SYSOR, &t); \
  } while(0);

#define REGISTER_SYSOR_ENTRY(theoid, descr)                     \
  REGISTER_SYSOR_TABLE(theoid, sizeof(theoid) / sizeof(oid),    \
                       descr)

#define UNREGISTER_SYSOR_TABLE(theoid, len)                     \
  do {                                                          \
    struct sysORTable t;                                        \
    t.OR_descr = NULL;                                          \
    t.OR_oid = theoid;                                          \
    t.OR_oidlen = len;                                          \
    t.OR_sess = NULL;                                           \
    t.OR_uptime = 0;                                            \
    snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,              \
                        SNMPD_CALLBACK_REQ_UNREG_SYSOR, &t);    \
  } while(0);

#define UNREGISTER_SYSOR_ENTRY(theoid)                          \
  UNREGISTER_SYSOR_TABLE(theoid, sizeof(theoid) / sizeof(oid))

#define UNREGISTER_SYSOR_SESS(sess)                             \
  snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,                \
                      SNMPD_CALLBACK_REQ_UNREG_SYSOR_SESS,      \
                      sess);


#endif /* NETSNMP_SYSORTABLE_H */
net-snmp-config-x86_64.h000064400000237657147511501100010674 0ustar00/* include/net-snmp/net-snmp-config.h.  Generated from net-snmp-config.h.in by configure.  */
/* include/net-snmp/net-snmp-config.h.in.  Generated from configure.ac by autoheader.  */

/*
 * net-snmp configuration header file
 *
 * NOTE: DO NOT EDIT include/net-snmp/net-snmp-config.h.in as your changes
 *       will be overwritten. This content is in acconfig.h and merged
 *       into include/net-snmp/net-snmp-config.h.in by autoheader.
 */
/* Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 */
/*
 * Portions of this file are copyrighted by:
 * Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 *
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */

#ifndef NET_SNMP_CONFIG_H
#define NET_SNMP_CONFIG_H


/* ********* NETSNMP_MARK_BEGIN_AUTOCONF_DEFINITIONS ********* */
/*
 * put all autoconf-specific definitions below here
 *
 */
#ifndef NETSNMP_NO_AUTOCONF_DEFINITIONS

/* definitions added by configure on-the-fly */

#define config_error(x)

#define config_warning(x)

#define config_belongs_in(x)

#define config_exclude(x)

#define config_arch_require(x,y)

#define config_version_require(x)

#define config_require(x)

#define config_add_mib(x)

#define config_parse_dot_conf(w,x,y,z)

/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */

/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
   systems. This function is required for `alloca.c' support on those systems.
   */
/* #undef CRAY_STACKSEG_END */

/* Define to 1 if using `alloca.c'. */
/* #undef C_ALLOCA */

/* location of swap device */
/* #undef DMEM_LOC */

/* Define if you want local DNSSEC validation support */
/* #undef DNSSEC_LOCAL_VALIDATION */

/* Environment separator character surrounded by double quotes. */
#define ENV_SEPARATOR ":"

/* Environment separator character surrounded by single quotes. */
#define ENV_SEPARATOR_CHAR ':'

/* location of mount table list */
#define ETC_MNTTAB "/etc/mtab"

/* Define to 1 if you have the `AES_cfb128_encrypt' function. */
#define HAVE_AES_CFB128_ENCRYPT 1

/* Define to 1 if you have `alloca', as a function or macro. */
#define HAVE_ALLOCA 1

/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
   */
#define HAVE_ALLOCA_H 1

/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1

/* Define to 1 if you have the <asm/page.h> header file. */
/* #undef HAVE_ASM_PAGE_H */

/* Define to 1 if you have the <asm/types.h> header file. */
#define HAVE_ASM_TYPES_H 1

/* Define to 1 if you have the `ASN1_STRING_get0_data' function. */
#define HAVE_ASN1_STRING_GET0_DATA 1

/* Define to 1 if you have the `asprintf' function. */
#define HAVE_ASPRINTF 1

/* Define to 1 if you have the `cgetnext' function. */
/* #undef HAVE_CGETNEXT */

/* Define to 1 if you have the `chown' function. */
#define HAVE_CHOWN 1

/* Define to 1 if you have the `clock_gettime' library */
#define HAVE_CLOCK_GETTIME 1

/* Define to 1 if you have the `closedir' function. */
#define HAVE_CLOSEDIR 1

/* Define to 1 if you have the `closesocket' function. */
/* #undef HAVE_CLOSESOCKET */

/* Define to 1 if you have the <com_err.h> header file. */
#define HAVE_COM_ERR_H 1

/* Define to 1 if the system has the type `Counter64'. */
/* #undef HAVE_COUNTER64 */

/* Define to 1 if you have the <curses.h> header file. */
/* #undef HAVE_CURSES_H */

/* Define to 1 if you have the declaration of `sensors_get_all_subfeatures',
   and to 0 if you don't. */
#define HAVE_DECL_SENSORS_GET_ALL_SUBFEATURES 1

/* define to 1 if you have IRE_CACHE defined in <inet/ip.h> header file. */
/* #undef HAVE_DEFINED_IRE_CACHE */

/* define if you have devstat_getdevs() */
/* #undef HAVE_DEVSTAT_GETDEVS */

/* Define to 1 if you have the `DH_get0_key' function. */
#define HAVE_DH_GET0_KEY 1

/* Define to 1 if you have the `DH_get0_pqg' function. */
#define HAVE_DH_GET0_PQG 1

/* Define to 1 if you have the `DH_set0_pqg' function. */
#define HAVE_DH_SET0_PQG 1

/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
   */
#define HAVE_DIRENT_H 1

/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1

/* Define to 1 if you have the `dlopen' function. */
#define HAVE_DLOPEN 1

/* Define to 1 if you have the <dmalloc.h> header file. */
/* #undef HAVE_DMALLOC_H */

/* Set if the dpkg-query command is available */
/* #undef HAVE_DPKG_QUERY */

/* Define to 1 if you have the `DTLSv1_method' function. */
#define HAVE_DTLSV1_METHOD 1

/* Define to 1 if you have the `DTLS_method' function. */
#define HAVE_DTLS_METHOD 1

/* Define to 1 if you have the <err.h> header file. */
#define HAVE_ERR_H 1

/* Define to 1 if you have the <et/com_err.h> header file. */
#define HAVE_ET_COM_ERR_H 1

/* Define to 1 if you have the `eval_pv' function. */
/* #undef HAVE_EVAL_PV */

/* Define to 1 if you have the `EVP_MD_CTX_create' function. */
/* #undef HAVE_EVP_MD_CTX_CREATE */

/* Define to 1 if you have the `EVP_MD_CTX_destroy' function. */
/* #undef HAVE_EVP_MD_CTX_DESTROY */

/* Define to 1 if you have the `EVP_MD_CTX_free' function. */
#define HAVE_EVP_MD_CTX_FREE 1

/* Define to 1 if you have the `EVP_MD_CTX_new' function. */
#define HAVE_EVP_MD_CTX_NEW 1

/* Define if you have EVP_sha224/256 in openssl */
#define HAVE_EVP_SHA224 /**/

/* Define if you have EVP_sha384/512 in openssl */
#define HAVE_EVP_SHA384 /**/

/* Define to 1 if you have the `execv' function. */
#define HAVE_EXECV 1

/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1

/* Define to 1 if you have the `fgetc_unlocked' function. */
#define HAVE_FGETC_UNLOCKED 1

/* Define to 1 if you have the `flockfile' function. */
#define HAVE_FLOCKFILE 1

/* Define to 1 if you have the `fork' function. */
#define HAVE_FORK 1

/* Define to 1 if you have the `forkall' function. */
/* #undef HAVE_FORKALL */

/* Define to 1 if you have the <fstab.h> header file. */
#define HAVE_FSTAB_H 1

/* Define to 1 if you have the `fsync' function. */
#define HAVE_FSYNC 1

/* Define to 1 if you have the `funlockfile' function. */
#define HAVE_FUNLOCKFILE 1

/* Define to 1 if you have the `gai_strerror' function. */
#define HAVE_GAI_STRERROR 1

/* Define to 1 if you have the `getaddrinfo' function. */
#define HAVE_GETADDRINFO 1

/* define if you have getdevs() */
/* #undef HAVE_GETDEVS */

/* Define to 1 if you have the `getdtablesize' function. */
#define HAVE_GETDTABLESIZE 1

/* Define to 1 if you have the `getfsstat' function. */
/* #undef HAVE_GETFSSTAT */

/* Define to 1 if you have the `getgrnam' function. */
#define HAVE_GETGRNAM 1

/* Define to 1 if you have the `gethostbyaddr' function. */
#define HAVE_GETHOSTBYADDR 1

/* Define to 1 if you have the `gethostbyname' function. */
#define HAVE_GETHOSTBYNAME 1

/* Define to 1 if you have the `gethostbyname2' function. */
#define HAVE_GETHOSTBYNAME2 1

/* Define to 1 if you have the `gethostname' function. */
#define HAVE_GETHOSTNAME 1

/* Define to 1 if you have the `getipnodebyname' function. */
/* #undef HAVE_GETIPNODEBYNAME */

/* Define to 1 if you have the `getloadavg' function. */
#define HAVE_GETLOADAVG 1

/* Define to 1 if you have the `getmntent' function. */
#define HAVE_GETMNTENT 1

/* Define to 1 if you have the `getopt' function. */
#define HAVE_GETOPT 1

/* Define to 1 if you have the <getopt.h> header file. */
#define HAVE_GETOPT_H 1

/* Define to 1 if you have the `getpagesize' function. */
#define HAVE_GETPAGESIZE 1

/* Define to 1 if you have the `getpid' function. */
#define HAVE_GETPID 1

/* Define to 1 if you have the `getpwnam' function. */
#define HAVE_GETPWNAM 1

/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1

/* Define to 1 if you have the `getvfsstat' function. */
/* #undef HAVE_GETVFSSTAT */

/* Define to 1 if you have the <grp.h> header file. */
#define HAVE_GRP_H 1

/* Define to 1 if you have the `hasmntopt' function. */
#define HAVE_HASMNTOPT 1

/* Define to 1 if you have the headerGet function. */
#define HAVE_HEADERGET 1

/* Define to 1 if you have the `if_freenameindex' function. */
#define HAVE_IF_FREENAMEINDEX 1

/* Define to 1 if you have the `if_indextoname' function. */
#define HAVE_IF_INDEXTONAME 1

/* Define to 1 if you have the `if_nameindex' function. */
#define HAVE_IF_NAMEINDEX 1

/* Define to 1 if you have the `if_nametoindex' function. */
#define HAVE_IF_NAMETOINDEX 1

/* Define to 1 if you have the <inet/common.h> header file. */
/* #undef HAVE_INET_COMMON_H */

/* Define to 1 if you have the <inet/ip.h> header file. */
/* #undef HAVE_INET_IP_H */

/* Define to 1 if you have the <inet/mib2.h> header file. */
/* #undef HAVE_INET_MIB2_H */

/* Define to 1 if you have the `inet_ntop' function. */
#define HAVE_INET_NTOP 1

/* Define to 1 if you have the `inet_pton' function. */
#define HAVE_INET_PTON 1

/* Define to 1 if you have the `initgroups' function. */
#define HAVE_INITGROUPS 1

/* Define to 1 if the system has the type `intmax_t'. */
#define HAVE_INTMAX_T 1

/* Define to 1 if the system has the type `intptr_t'. */
#define HAVE_INTPTR_T 1

/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1

/* Define to 1 if the system has the type `in_addr_t'. */
#define HAVE_IN_ADDR_T 1

/* Define to 1 if you have the <ioctls.h> header file. */
/* #undef HAVE_IOCTLS_H */

/* Define to 1 if you have the <io.h> header file. */
/* #undef HAVE_IO_H */

/* Define to 1 if you have the <iphlpapi.h> header file. */
/* #undef HAVE_IPHLPAPI_H */

/* Set if IP_PKTINFO is usable */
#define HAVE_IP_PKTINFO 1

/* Set if IP_RECVDSTADDR is usable */
/* #undef HAVE_IP_RECVDSTADDR */

/* Define to 1 if you have the `kinfo_get_cpus' function. */
/* #undef HAVE_KINFO_GET_CPUS */

/* Define if you have /dev/kmem */
/* #undef HAVE_KMEM */

/* Define to 1 if you have the `knlist' function. */
/* #undef HAVE_KNLIST */

/* Define to 1 if you have the `krb5_auth_con_getrecvsubkey' function. */
/* #undef HAVE_KRB5_AUTH_CON_GETRECVSUBKEY */

/* Define to 1 if you have the `krb5_auth_con_getsendsubkey' function. */
/* #undef HAVE_KRB5_AUTH_CON_GETSENDSUBKEY */

/* Define to 1 if you have the <kstat.h> header file. */
/* #undef HAVE_KSTAT_H */

/* Define to 1 if you have the `kvm_getfile2' function. */
/* #undef HAVE_KVM_GETFILE2 */

/* Define to 1 if you have the `kvm_getfiles' function. */
/* #undef HAVE_KVM_GETFILES */

/* Define to 1 if you have the `kvm_getproc2' function. */
/* #undef HAVE_KVM_GETPROC2 */

/* Define to 1 if you have the `kvm_getprocs' function. */
/* #undef HAVE_KVM_GETPROCS */

/* Define to 1 if you have the `kvm_getswapinfo' function. */
/* #undef HAVE_KVM_GETSWAPINFO */

/* Define to 1 if you have the <kvm.h> header file. */
/* #undef HAVE_KVM_H */

/* Define to 1 if you have the `kvm_openfiles' function. */
/* #undef HAVE_KVM_OPENFILES */

/* Define to 1 if you have the OpenSSL library (-lcrypto or -leay32). */
#define HAVE_LIBCRYPTO 1

/* Define to 1 if you have the `elf' library (-lelf). */
/* #undef HAVE_LIBELF */

/* Define to 1 if you have the `mld' library (-lmld). */
/* #undef HAVE_LIBMLD */

/* Define to 1 if <netlink/netlink.h> provides the libnl3 API */
/* #undef HAVE_LIBNL3 */

/* define if you have libnm */
/* #undef HAVE_LIBNM */

/* Define to 1 if you have the `nsl' library (-lnsl). */
/* #undef HAVE_LIBNSL */

/* Define to 1 if you have the <libperfstat.h> header file. */
/* #undef HAVE_LIBPERFSTAT_H */

/* Define to 1 if you have the `pkcs11' library (-lpkcs11). */
/* #undef HAVE_LIBPKCS11 */

/* define if you have BSD pkg-ng */
/* #undef HAVE_LIBPKG */

/* Define to 1 if you have the `pthread' library (-lpthread). */
/* #undef HAVE_LIBPTHREAD */

/* Define to 1 if you have the `rpm' library (-lrpm). */
#define HAVE_LIBRPM 1

/* Define to 1 if you have the `RSAglue' library (-lRSAglue). */
/* #undef HAVE_LIBRSAGLUE */

/* Define to 1 if you have the `rsaref' library (-lrsaref). */
/* #undef HAVE_LIBRSAREF */

/* Define to 1 if you have the `sres' library (-lsres). */
/* #undef HAVE_LIBSRES */

/* Define to 1 if you have the `ssh2' library (-lssh2). */
/* #undef HAVE_LIBSSH2 */

/* Define to 1 if you have the `ssl' library (-lssl). */
#define HAVE_LIBSSL 1

/* Define to 1 if your `ssl' library supports DTLS (-lssl). */
#define HAVE_LIBSSL_DTLS 1

/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1

/* Define to 1 if you have the <linux/ethtool.h> header file. */
#define HAVE_LINUX_ETHTOOL_H 1

/* Define if __u8 .. __u64 must be declared explicitly before including
   <linux/ethtool.h> */
/* #undef HAVE_LINUX_ETHTOOL_NEEDS_U64 */

/* Define to 1 if you have the <linux/hdreg.h> header file. */
#define HAVE_LINUX_HDREG_H 1

/* Define to 1 if you have the <linux/netlink.h> header file. */
#define HAVE_LINUX_NETLINK_H 1

/* Define to 1 if you have the <linux/rtnetlink.h> header file. */
#define HAVE_LINUX_RTNETLINK_H 1

/* Define to 1 if you have the <linux/tasks.h> header file. */
/* #undef HAVE_LINUX_TASKS_H */

/* Define if load_defaults() is available in libmysqlclient */
/* #undef HAVE_LOAD_DEFAULTS */

/* Define to 1 if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1

/* Define to 1 if you have the `localtime_r' function. */
#define HAVE_LOCALTIME_R 1

/* Define to 1 if the system has the type `long long int'. */
#define HAVE_LONG_LONG_INT 1

/* Set if the lpstat command is available */
/* #undef HAVE_LPSTAT */

/* Define to 1 if you have the `lrand48' function. */
#define HAVE_LRAND48 1

/* Define to 1 if you have the `lseek64' function. */
#define HAVE_LSEEK64 1

/* Define to 1 if you have the <machine/param.h> header file. */
/* #undef HAVE_MACHINE_PARAM_H */

/* Define to 1 if you have the <machine/pte.h> header file. */
/* #undef HAVE_MACHINE_PTE_H */

/* Define to 1 if you have the <machine/types.h> header file. */
/* #undef HAVE_MACHINE_TYPES_H */

/* Define to 1 if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 1

/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1

/* Define to 1 if the system has the type `mib2_ipIfStatsEntry_t'. */
/* #undef HAVE_MIB2_IPIFSTATSENTRY_T */

/* Define to 1 if you have the `mkstemp' function. */
#define HAVE_MKSTEMP 1

/* Define to 1 if you have the `mktime' function. */
#define HAVE_MKTIME 1

/* Define to 1 if you have the <mntent.h> header file. */
#define HAVE_MNTENT_H 1

/* Define to 1 if you have the <mtab.h> header file. */
/* #undef HAVE_MTAB_H */

/* Define if mysql_init() is available in libmysqlclient */
#define HAVE_MYSQL_INIT 1

/* Define if MY_INIT() is availabe in libmysqlclient */
/* #undef HAVE_MY_INIT */

/* Define if having my_load_defaults() */
/* #undef HAVE_MY_LOAD_DEFAULTS */

/* Define to 1 if you have the <nbutil.h> header file. */
/* #undef HAVE_NBUTIL_H */

/* Define to 1 if you have the <ncurses/curses.h> header file. */
/* #undef HAVE_NCURSES_CURSES_H */

/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */

/* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1

/* Define to 1 if you have the <netinet6/in6_pcb.h> header file. */
/* #undef HAVE_NETINET6_IN6_PCB_H */

/* Define to 1 if you have the <netinet6/in6_var.h> header file. */
/* #undef HAVE_NETINET6_IN6_VAR_H */

/* Define to 1 if you have the <netinet6/ip6_var.h> header file. */
/* #undef HAVE_NETINET6_IP6_VAR_H */

/* Define to 1 if you have the <netinet6/nd6.h> header file. */
/* #undef HAVE_NETINET6_ND6_H */

/* Define to 1 if you have the <netinet6/tcp6_fsm.h> header file. */
/* #undef HAVE_NETINET6_TCP6_FSM_H */

/* Define to 1 if you have the <netinet6/tcp6.h> header file. */
/* #undef HAVE_NETINET6_TCP6_H */

/* Define to 1 if you have the <netinet6/tcp6_timer.h> header file. */
/* #undef HAVE_NETINET6_TCP6_TIMER_H */

/* Define to 1 if you have the <netinet6/tcp6_var.h> header file. */
/* #undef HAVE_NETINET6_TCP6_VAR_H */

/* Define to 1 if you have the <netinet/icmp6.h> header file. */
#define HAVE_NETINET_ICMP6_H 1

/* Define to 1 if you have the <netinet/icmp_var.h> header file. */
/* #undef HAVE_NETINET_ICMP_VAR_H */

/* Define to 1 if you have the <netinet/if_ether.h> header file. */
#define HAVE_NETINET_IF_ETHER_H 1

/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1

/* Define to 1 if you have the <netinet/in_pcb.h> header file. */
/* #undef HAVE_NETINET_IN_PCB_H */

/* Define to 1 if you have the <netinet/in_systm.h> header file. */
#define HAVE_NETINET_IN_SYSTM_H 1

/* Define to 1 if you have the <netinet/in_var.h> header file. */
/* #undef HAVE_NETINET_IN_VAR_H */

/* Define to 1 if you have the <netinet/ip6.h> header file. */
#define HAVE_NETINET_IP6_H 1

/* Define to 1 if you have the <netinet/ip.h> header file. */
#define HAVE_NETINET_IP_H 1

/* Define to 1 if you have the <netinet/ip_icmp.h> header file. */
#define HAVE_NETINET_IP_ICMP_H 1

/* Define to 1 if you have the <netinet/ip_var.h> header file. */
/* #undef HAVE_NETINET_IP_VAR_H */

/* Define to 1 if you have the <netinet/tcpip.h> header file. */
/* #undef HAVE_NETINET_TCPIP_H */

/* Define to 1 if you have the <netinet/tcp_fsm.h> header file. */
/* #undef HAVE_NETINET_TCP_FSM_H */

/* Define to 1 if you have the <netinet/tcp.h> header file. */
#define HAVE_NETINET_TCP_H 1

/* Define to 1 if you have the <netinet/tcp_timer.h> header file. */
/* #undef HAVE_NETINET_TCP_TIMER_H */

/* Define to 1 if you have the <netinet/tcp_var.h> header file. */
/* #undef HAVE_NETINET_TCP_VAR_H */

/* Define to 1 if you have the <netinet/udp.h> header file. */
#define HAVE_NETINET_UDP_H 1

/* Define to 1 if you have the <netinet/udp_var.h> header file. */
/* #undef HAVE_NETINET_UDP_VAR_H */

/* Define to 1 if you have the <netipx/ipx.h> header file. */
#define HAVE_NETIPX_IPX_H 1

/* Define to 1 if you have the <netlink/netlink.h> header file. */
/* #undef HAVE_NETLINK_NETLINK_H */

/* Define to 1 if you have the <net/if_arp.h> header file. */
#define HAVE_NET_IF_ARP_H 1

/* Define to 1 if you have the <net/if_dl.h> header file. */
/* #undef HAVE_NET_IF_DL_H */

/* Define to 1 if you have the <net/if.h> header file. */
#define HAVE_NET_IF_H 1

/* Define to 1 if you have the <net/if_mib.h> header file. */
/* #undef HAVE_NET_IF_MIB_H */

/* Define to 1 if you have the <net/if_types.h> header file. */
/* #undef HAVE_NET_IF_TYPES_H */

/* Define to 1 if you have the <net/if_var.h> header file. */
/* #undef HAVE_NET_IF_VAR_H */

/* Define to 1 if you have the <net/route.h> header file. */
#define HAVE_NET_ROUTE_H 1

/* Define to 1 if the system has the type `nfds_t'. */
#define HAVE_NFDS_T 1

/* Define to 1 if you have the `nlist' function. */
/* #undef HAVE_NLIST */

/* Define to 1 if you have the `nlist64' function. */
/* #undef HAVE_NLIST64 */

/* Define to 1 if you have the <nlist.h> header file. */
#define HAVE_NLIST_H 1

/* Define to 1 if the system has the type `off64_t'. */
#define HAVE_OFF64_T 1

/* Define to 1 if you have the `opendir' function. */
#define HAVE_OPENDIR 1

/* Define to 1 if you have the <openssl/aes.h> header file. */
#define HAVE_OPENSSL_AES_H 1

/* Define to 1 if you have the <openssl/des.h> header file. */
#define HAVE_OPENSSL_DES_H 1

/* Define to 1 if you have the <openssl/dh.h> header file. */
#define HAVE_OPENSSL_DH_H 1

/* Define to 1 if you have the <openssl/evp.h> header file. */
#define HAVE_OPENSSL_EVP_H 1

/* Define to 1 if you have the <openssl/hmac.h> header file. */
#define HAVE_OPENSSL_HMAC_H 1

/* Define to 1 if you have the <osreldate.h> header file. */
/* #undef HAVE_OSRELDATE_H */

/* Define to 1 if you have the <pcap/pcap.h> header file. */
/* #undef HAVE_PCAP_PCAP_H */

/* define if you have pci_lookup_name() */
/* #undef HAVE_PCI_LOOKUP_NAME */

/* Define to 1 if you have the <pci/pci.h> header file. */
/* #undef HAVE_PCI_PCI_H */

/* Define to 1 if you have <pcre.h>. */
/* #undef HAVE_PCRE_H */

/* on aix, if you have perfstat */
/* #undef HAVE_PERFSTAT */

/* Define to 1 if you have `the perl_eval_pv' function. */
/* #undef HAVE_PERL_EVAL_PV_LC */

/* Define to 1 if you have the `Perl_eval_pv' function. */
#define HAVE_PERL_EVAL_PV_UC 1

/* Define to 1 if you have the <picl.h> header file. */
/* #undef HAVE_PICL_H */

/* define if you have pkginfo */
/* #undef HAVE_PKGINFO */

/* Define to 1 if you have the <pkginfo.h> header file. */
/* #undef HAVE_PKGINFO_H */

/* Define to 1 if you have the <pkglocs.h> header file. */
/* #undef HAVE_PKGLOCS_H */

/* Define to 1 if you have the <pkg.h> header file. */
/* #undef HAVE_PKG_H */

/* Define to 1 if you have the `poll' function. */
#define HAVE_POLL 1

/* Define to 1 if you have the `pread64' function. */
#define HAVE_PREAD64 1

/* Set if /etc/printcap exists */
#define HAVE_PRINTCAP 1

/* Define if prioritynames variable is declared in <syslog.h> */
#define HAVE_PRIORITYNAMES 1

/* Define to 1 if you have the <pthread.h> header file. */
#define HAVE_PTHREAD_H 1

/* Define to 1 if you have the <pwd.h> header file. */
#define HAVE_PWD_H 1

/* Define to 1 if you have the `rand' function. */
#define HAVE_RAND 1

/* Define to 1 if you have the `random' function. */
#define HAVE_RANDOM 1

/* Define to 1 if you have the `readdir' function. */
#define HAVE_READDIR 1

/* Define to 1 if you have the `regcomp' function. */
#define HAVE_REGCOMP 1

/* Define to 1 if you have the <regex.h> header file. */
#define HAVE_REGEX_H 1

/* Define to 1 if you have the `rpmGetPath' function. */
#define HAVE_RPMGETPATH 1

/* Define to 1 if you have the <rpm/header.h> header file. */
#define HAVE_RPM_HEADER_H 1

/* Define to 1 if you have the <rpm/rpmfileutil.h> header file. */
#define HAVE_RPM_RPMFILEUTIL_H 1

/* Define to 1 if you have the <rpm/rpmlib.h> header file. */
#define HAVE_RPM_RPMLIB_H 1

/* Define to 1 if you have the <rpm/rpmts.h> header file. */
#define HAVE_RPM_RPMTS_H 1

/* Define to 1 if you have the <search.h> header file. */
#define HAVE_SEARCH_H 1

/* Define to 1 if you have the <security/cryptoki.h> header file. */
/* #undef HAVE_SECURITY_CRYPTOKI_H */

/* Define to 1 if you have the `select' function. */
#define HAVE_SELECT 1

/* Define to 1 if you have the <sensors/sensors.h> header file. */
#define HAVE_SENSORS_SENSORS_H 1

/* Define to 1 if you have the `setenv' function. */
#define HAVE_SETENV 1

/* Define to 1 if you have the `setgid' function. */
#define HAVE_SETGID 1

/* Define to 1 if you have the `setgroups' function. */
#define HAVE_SETGROUPS 1

/* Define to 1 if you have the `setitimer' function. */
#define HAVE_SETITIMER 1

/* Define to 1 if you have the `setlocale' function. */
#define HAVE_SETLOCALE 1

/* Define to 1 if you have the `setmntent' function. */
#define HAVE_SETMNTENT 1

/* Define to 1 if you have the `setsid' function. */
#define HAVE_SETSID 1

/* Define to 1 if you have the `setuid' function. */
#define HAVE_SETUID 1

/* Define to 1 if you have the <sgtty.h> header file. */
#define HAVE_SGTTY_H 1

/* Define to 1 if you have the `sigaction' function. */
#define HAVE_SIGACTION 1

/* Define to 1 if you have the `sigalrm' function. */
/* #undef HAVE_SIGALRM */

/* Define to 1 if you have the `sigblock' function. */
#define HAVE_SIGBLOCK 1

/* Define to 1 if you have the `sighold' function. */
#define HAVE_SIGHOLD 1

/* Define if SIGHUP is defined in <signal.h>. */
#define HAVE_SIGHUP 1

/* Define to 1 if you have the `signal' function. */
#define HAVE_SIGNAL 1

/* Define to 1 if you have the `sigprocmask' function. */
#define HAVE_SIGPROCMASK 1

/* Define to 1 if you have the `sigset' function. */
#define HAVE_SIGSET 1

/* Define to 1 if you have the `snprintf' function. */
#define HAVE_SNPRINTF 1

/* Define to 1 if you have the `socket' function. */
#define HAVE_SOCKET 1

/* Define to 1 if the system has the type `socklen_t'. */
#define HAVE_SOCKLEN_T 1

/* Define to 1 if you have the `srand' function. */
#define HAVE_SRAND 1

/* Define to 1 if you have the `srand48' function. */
#define HAVE_SRAND48 1

/* Define to 1 if you have the `srandom' function. */
#define HAVE_SRANDOM 1

/* Define to 1 if the system has the type `ssize_t'. */
#define HAVE_SSIZE_T 1

/* Define to 1 if you have the `SSL_library_init' function. */
/* #undef HAVE_SSL_LIBRARY_INIT */

/* Define to 1 if you have the `SSL_load_error_strings' function. */
/* #undef HAVE_SSL_LOAD_ERROR_STRINGS */

/* Define to 1 if you have the `statfs' function. */
#define HAVE_STATFS 1

/* Define to 1 if you have the `statvfs' function. */
#define HAVE_STATVFS 1

/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1

/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1

/* Define to 1 if you have the `stime' function. */
#define HAVE_STIME 1

/* Define to 1 if you have the `strcasestr' function. */
#define HAVE_STRCASESTR 1

/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1

/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1

/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1

/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1

/* Define to 1 if you have the `strlcat' function. */
/* #undef HAVE_STRLCAT */

/* Define to 1 if you have the `strlcpy' function. */
/* #undef HAVE_STRLCPY */

/* Define to 1 if you have the `strncasecmp' function. */
#define HAVE_STRNCASECMP 1

/* Define to 1 if you have the `strtok_r' function. */
#define HAVE_STRTOK_R 1

/* Define to 1 if you have the `strtol' function. */
#define HAVE_STRTOL 1

/* Define to 1 if you have the `strtoul' function. */
#define HAVE_STRTOUL 1

/* Define to 1 if you have the `strtoull' function. */
#define HAVE_STRTOULL 1

/* Define to 1 if `at_next' is a member of `struct arphd'. */
/* #undef HAVE_STRUCT_ARPHD_AT_NEXT */

/* Define to 1 if `weak_key' is a member of `struct des_ks_struct'. */
/* #undef HAVE_STRUCT_DES_KS_STRUCT_WEAK_KEY */

/* Define to 1 if `d_type' is a member of `struct dirent'. */
#define HAVE_STRUCT_DIRENT_D_TYPE 1

/* Define to 1 if `speed_hi' is a member of `struct ethtool_cmd'. */
#define HAVE_STRUCT_ETHTOOL_CMD_SPEED_HI 1

/* Define to 1 if `ifa_next' is a member of `struct ifaddr'. */
#define HAVE_STRUCT_IFADDR_IFA_NEXT 1

/* Define to 1 if `if_addrhead.tqh_first' is a member of `struct ifnet'. */
/* #undef HAVE_STRUCT_IFNET_IF_ADDRHEAD_TQH_FIRST */

/* Define to 1 if `if_addrlist' is a member of `struct ifnet'. */
/* #undef HAVE_STRUCT_IFNET_IF_ADDRLIST */

/* Define to 1 if `if_baudrate' is a member of `struct ifnet'. */
/* #undef HAVE_STRUCT_IFNET_IF_BAUDRATE */

/* Define to 1 if `if_baudrate.ifs_value' is a member of `struct ifnet'. */
/* #undef HAVE_STRUCT_IFNET_IF_BAUDRATE_IFS_VALUE */

/* Define to 1 if `if_ibytes' is a member of `struct ifnet'. */
#define HAVE_STRUCT_IFNET_IF_IBYTES 1

/* Define to 1 if `if_imcasts' is a member of `struct ifnet'. */
/* #undef HAVE_STRUCT_IFNET_IF_IMCASTS */

/* Define to 1 if `if_iqdrops' is a member of `struct ifnet'. */
#define HAVE_STRUCT_IFNET_IF_IQDROPS 1

/* Define to 1 if `if_lastchange.tv_nsec' is a member of `struct ifnet'. */
/* #undef HAVE_STRUCT_IFNET_IF_LASTCHANGE_TV_NSEC */

/* Define to 1 if `if_lastchange.tv_sec' is a member of `struct ifnet'. */
/* #undef HAVE_STRUCT_IFNET_IF_LASTCHANGE_TV_SEC */

/* Define to 1 if `if_mtu' is a member of `struct ifnet'. */
#define HAVE_STRUCT_IFNET_IF_MTU 1

/* Define to 1 if `if_noproto' is a member of `struct ifnet'. */
/* #undef HAVE_STRUCT_IFNET_IF_NOPROTO */

/* Define to 1 if `if_obytes' is a member of `struct ifnet'. */
#define HAVE_STRUCT_IFNET_IF_OBYTES 1

/* Define to 1 if `if_omcasts' is a member of `struct ifnet'. */
/* #undef HAVE_STRUCT_IFNET_IF_OMCASTS */

/* Define to 1 if `if_speed' is a member of `struct ifnet'. */
#define HAVE_STRUCT_IFNET_IF_SPEED 1

/* Define to 1 if `if_type' is a member of `struct ifnet'. */
#define HAVE_STRUCT_IFNET_IF_TYPE 1

/* Define to 1 if `if_xname' is a member of `struct ifnet'. */
/* #undef HAVE_STRUCT_IFNET_IF_XNAME */

/* Define to 1 if `ip6s_exthdrtoolong ' is a member of `struct ip6stat'. */
/* #undef HAVE_STRUCT_IP6STAT_IP6S_EXTHDRTOOLONG_ */

/* Define to 1 if `ips_cantforward' is a member of `struct ipstat'. */
/* #undef HAVE_STRUCT_IPSTAT_IPS_CANTFORWARD */

/* Define to 1 if `ips_cantfrag' is a member of `struct ipstat'. */
/* #undef HAVE_STRUCT_IPSTAT_IPS_CANTFRAG */

/* Define to 1 if `ips_delivered' is a member of `struct ipstat'. */
/* #undef HAVE_STRUCT_IPSTAT_IPS_DELIVERED */

/* Define to 1 if `ips_fragdropped' is a member of `struct ipstat'. */
/* #undef HAVE_STRUCT_IPSTAT_IPS_FRAGDROPPED */

/* Define to 1 if `ips_fragmented' is a member of `struct ipstat'. */
/* #undef HAVE_STRUCT_IPSTAT_IPS_FRAGMENTED */

/* Define to 1 if `ips_fragtimeout' is a member of `struct ipstat'. */
/* #undef HAVE_STRUCT_IPSTAT_IPS_FRAGTIMEOUT */

/* Define to 1 if `ips_localout' is a member of `struct ipstat'. */
/* #undef HAVE_STRUCT_IPSTAT_IPS_LOCALOUT */

/* Define to 1 if `ips_noproto' is a member of `struct ipstat'. */
/* #undef HAVE_STRUCT_IPSTAT_IPS_NOPROTO */

/* Define to 1 if `ips_noroute' is a member of `struct ipstat'. */
/* #undef HAVE_STRUCT_IPSTAT_IPS_NOROUTE */

/* Define to 1 if `ips_odropped' is a member of `struct ipstat'. */
/* #undef HAVE_STRUCT_IPSTAT_IPS_ODROPPED */

/* Define to 1 if `ips_ofragments' is a member of `struct ipstat'. */
/* #undef HAVE_STRUCT_IPSTAT_IPS_OFRAGMENTS */

/* Define to 1 if `ips_reassembled' is a member of `struct ipstat'. */
/* #undef HAVE_STRUCT_IPSTAT_IPS_REASSEMBLED */

/* Define to 1 if `m_clfree' is a member of `struct mbstat'. */
/* #undef HAVE_STRUCT_MBSTAT_M_CLFREE */

/* Define to 1 if `m_clusters' is a member of `struct mbstat'. */
/* #undef HAVE_STRUCT_MBSTAT_M_CLUSTERS */

/* Define to 1 if `m_mbufs' is a member of `struct mbstat'. */
/* #undef HAVE_STRUCT_MBSTAT_M_MBUFS */

/* Define to 1 if `n_value' is a member of `struct nlist64'. */
/* #undef HAVE_STRUCT_NLIST64_N_VALUE */

/* Define to 1 if `n_value' is a member of `struct nlist'. */
#define HAVE_STRUCT_NLIST_N_VALUE 1

/* Define to 1 if `rt_dst' is a member of `struct rtentry'. */
#define HAVE_STRUCT_RTENTRY_RT_DST 1

/* Define to 1 if `rt_hash' is a member of `struct rtentry'. */
/* #undef HAVE_STRUCT_RTENTRY_RT_HASH */

/* Define to 1 if `rt_next' is a member of `struct rtentry'. */
/* #undef HAVE_STRUCT_RTENTRY_RT_NEXT */

/* Define to 1 if `rt_refcnt' is a member of `struct rtentry'. */
/* #undef HAVE_STRUCT_RTENTRY_RT_REFCNT */

/* Define to 1 if `rt_unit' is a member of `struct rtentry'. */
/* #undef HAVE_STRUCT_RTENTRY_RT_UNIT */

/* Define to 1 if `rt_use' is a member of `struct rtentry'. */
/* #undef HAVE_STRUCT_RTENTRY_RT_USE */

/* Define to 1 if `sa_sigaction' is a member of `struct sigaction'. */
#define HAVE_STRUCT_SIGACTION_SA_SIGACTION 1

/* Define to 1 if `sin6_scope_id' is a member of `struct sockaddr_in6'. */
#define HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID 1

/* Define to 1 if `sa_len' is a member of `struct sockaddr'. */
/* #undef HAVE_STRUCT_SOCKADDR_SA_LEN */

/* Define to 1 if `sa_union.sa_generic.sa_family2' is a member of `struct
   sockaddr'. */
/* #undef HAVE_STRUCT_SOCKADDR_SA_UNION_SA_GENERIC_SA_FAMILY2 */

/* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */
#define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1

/* Define to 1 if `__ss_family' is a member of `struct sockaddr_storage'. */
/* #undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */

/* Define to 1 if `f_favail' is a member of `struct statfs'. */
/* #undef HAVE_STRUCT_STATFS_F_FAVAIL */

/* Define to 1 if `f_ffree' is a member of `struct statfs'. */
#define HAVE_STRUCT_STATFS_F_FFREE 1

/* Define to 1 if `f_files' is a member of `struct statfs'. */
#define HAVE_STRUCT_STATFS_F_FILES 1

/* Define to 1 if `f_flags' is a member of `struct statfs'. */
#define HAVE_STRUCT_STATFS_F_FLAGS 1

/* Define to 1 if `f_frsize' is a member of `struct statfs'. */
#define HAVE_STRUCT_STATFS_F_FRSIZE 1

/* Define to 1 if `f_files' is a member of `struct statvfs'. */
#define HAVE_STRUCT_STATVFS_F_FILES 1

/* Define to 1 if `f_frsize' is a member of `struct statvfs'. */
#define HAVE_STRUCT_STATVFS_F_FRSIZE 1

/* Define to 1 if `mnt_dir' is a member of `struct statvfs'. */
/* #undef HAVE_STRUCT_STATVFS_MNT_DIR */

/* Define to 1 if `sw_nblksenabled' is a member of `struct swdevt'. */
/* #undef HAVE_STRUCT_SWDEVT_SW_NBLKSENABLED */

/* Define to 1 if `tcp_rcvmemdrop' is a member of `struct tcpstat'. */
/* #undef HAVE_STRUCT_TCPSTAT_TCP_RCVMEMDROP */

/* Define to 1 if `tz_dsttime' is a member of `struct timezone'. */
#define HAVE_STRUCT_TIMEZONE_TZ_DSTTIME 1

/* Define to 1 if `tm_isdst' is a member of `struct time'. */
/* #undef HAVE_STRUCT_TIME_TM_ISDST */

/* Define to 1 if `tm_gmtoff' is a member of `struct tm'. */
#define HAVE_STRUCT_TM_TM_GMTOFF 1

/* Define to 1 if `udps_discard' is a member of `struct udpstat'. */
/* #undef HAVE_STRUCT_UDPSTAT_UDPS_DISCARD */

/* Define to 1 if `udps_fullsock' is a member of `struct udpstat'. */
/* #undef HAVE_STRUCT_UDPSTAT_UDPS_FULLSOCK */

/* Define to 1 if `udps_ipackets' is a member of `struct udpstat'. */
/* #undef HAVE_STRUCT_UDPSTAT_UDPS_IPACKETS */

/* Define to 1 if `udps_noport' is a member of `struct udpstat'. */
/* #undef HAVE_STRUCT_UDPSTAT_UDPS_NOPORT */

/* Define to 1 if `udps_noportbcast' is a member of `struct udpstat'. */
/* #undef HAVE_STRUCT_UDPSTAT_UDPS_NOPORTBCAST */

/* Define to 1 if `udps_opackets' is a member of `struct udpstat'. */
/* #undef HAVE_STRUCT_UDPSTAT_UDPS_OPACKETS */

/* Define to 1 if `pgswapin' is a member of `struct uvmexp'. */
/* #undef HAVE_STRUCT_UVMEXP_PGSWAPIN */

/* Define to 1 if you have the `sysconf' function. */
#define HAVE_SYSCONF 1

/* Define to 1 if you have the <syslog.h> header file. */
#define HAVE_SYSLOG_H 1

/* Define to 1 if you have the `system' function. */
#define HAVE_SYSTEM 1

/* Define to 1 if you have the <sys/cdefs.h> header file. */
#define HAVE_SYS_CDEFS_H 1

/* Define to 1 if you have the <sys/conf.h> header file. */
/* #undef HAVE_SYS_CONF_H */

/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
   */
/* #undef HAVE_SYS_DIR_H */

/* Define to 1 if you have the <sys/diskio.h> header file. */
/* #undef HAVE_SYS_DISKIO_H */

/* Define to 1 if you have the <sys/disklabel.h> header file. */
/* #undef HAVE_SYS_DISKLABEL_H */

/* Define to 1 if you have the <sys/dkio.h> header file. */
/* #undef HAVE_SYS_DKIO_H */

/* Define to 1 if you have the <sys/dkstat.h> header file. */
/* #undef HAVE_SYS_DKSTAT_H */

/* Define to 1 if you have the <sys/dmap.h> header file. */
/* #undef HAVE_SYS_DMAP_H */

/* Define to 1 if you have the <sys/file.h> header file. */
#define HAVE_SYS_FILE_H 1

/* Define to 1 if you have the <sys/filio.h> header file. */
/* #undef HAVE_SYS_FILIO_H */

/* Define to 1 if you have the <sys/fixpoint.h> header file. */
/* #undef HAVE_SYS_FIXPOINT_H */

/* Define to 1 if you have the <sys/fs.h> header file. */
/* #undef HAVE_SYS_FS_H */

/* Define to 1 if you have the <sys/hashing.h> header file. */
/* #undef HAVE_SYS_HASHING_H */

/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1

/* Define to 1 if you have the <sys/loadavg.h> header file. */
/* #undef HAVE_SYS_LOADAVG_H */

/* Define to 1 if you have the <sys/mbuf.h> header file. */
/* #undef HAVE_SYS_MBUF_H */

/* Define to 1 if you have the <sys/mntent.h> header file. */
/* #undef HAVE_SYS_MNTENT_H */

/* Define to 1 if you have the <sys/mnttab.h> header file. */
/* #undef HAVE_SYS_MNTTAB_H */

/* Define to 1 if you have the <sys/mount.h> header file. */
#define HAVE_SYS_MOUNT_H 1

/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
   */
/* #undef HAVE_SYS_NDIR_H */

/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1

/* Define to 1 if you have the <sys/poll.h> header file. */
#define HAVE_SYS_POLL_H 1

/* Define to 1 if you have the <sys/pool.h> header file. */
/* #undef HAVE_SYS_POOL_H */

/* Define to 1 if you have the <sys/proc.h> header file. */
/* #undef HAVE_SYS_PROC_H */

/* Define to 1 if you have the <sys/protosw.h> header file. */
/* #undef HAVE_SYS_PROTOSW_H */

/* Define to 1 if you have the <sys/pstat.h> header file. */
/* #undef HAVE_SYS_PSTAT_H */

/* Define to 1 if you have the <sys/queue.h> header file. */
#define HAVE_SYS_QUEUE_H 1

/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1

/* Define to 1 if you have the <sys/sema.h> header file. */
/* #undef HAVE_SYS_SEMA_H */

/* Define to 1 if you have the <sys/socketvar.h> header file. */
#define HAVE_SYS_SOCKETVAR_H 1

/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1

/* Define to 1 if you have the <sys/sockio.h> header file. */
/* #undef HAVE_SYS_SOCKIO_H */

/* Define to 1 if you have the <sys/statfs.h> header file. */
#define HAVE_SYS_STATFS_H 1

/* Define to 1 if you have the <sys/statvfs.h> header file. */
#define HAVE_SYS_STATVFS_H 1

/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1

/* Define to 1 if you have the <sys/stream.h> header file. */
/* #undef HAVE_SYS_STREAM_H */

/* Define to 1 if you have the <sys/swap.h> header file. */
#define HAVE_SYS_SWAP_H 1

/* Define to 1 if you have the <sys/sysctl.h> header file. */
#define HAVE_SYS_SYSCTL_H 1

/* Define to 1 if you have the <sys/sysget.h> header file. */
/* #undef HAVE_SYS_SYSGET_H */

/* Define to 1 if you have the <sys/syslog.h> header file. */
#define HAVE_SYS_SYSLOG_H 1

/* Define to 1 if you have the <sys/sysmacros.h> header file. */
#define HAVE_SYS_SYSMACROS_H 1

/* Define to 1 if you have the <sys/sysmp.h> header file. */
/* #undef HAVE_SYS_SYSMP_H */

/* Define to 1 if you have the <sys/systemcfg.h> header file. */
/* #undef HAVE_SYS_SYSTEMCFG_H */

/* Define to 1 if you have the <sys/systeminfo.h> header file. */
/* #undef HAVE_SYS_SYSTEMINFO_H */

/* Define to 1 if you have the <sys/tcpipstats.h> header file. */
/* #undef HAVE_SYS_TCPIPSTATS_H */

/* Define to 1 if you have the <sys/timeb.h> header file. */
#define HAVE_SYS_TIMEB_H 1

/* Define to 1 if you have the <sys/timeout.h> header file. */
/* #undef HAVE_SYS_TIMEOUT_H */

/* Define to 1 if you have the <sys/times.h> header file. */
#define HAVE_SYS_TIMES_H 1

/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1

/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1

/* Define to 1 if you have the <sys/uio.h> header file. */
#define HAVE_SYS_UIO_H 1

/* Define to 1 if you have the <sys/un.h> header file. */
#define HAVE_SYS_UN_H 1

/* Define to 1 if you have the <sys/user.h> header file. */
#define HAVE_SYS_USER_H 1

/* Define to 1 if you have the <sys/utsname.h> header file. */
#define HAVE_SYS_UTSNAME_H 1

/* Define to 1 if you have the <sys/vfs.h> header file. */
#define HAVE_SYS_VFS_H 1

/* Define to 1 if you have the <sys/vmmac.h> header file. */
/* #undef HAVE_SYS_VMMAC_H */

/* Define to 1 if you have the <sys/vmmeter.h> header file. */
/* #undef HAVE_SYS_VMMETER_H */

/* Define to 1 if you have the <sys/vmparam.h> header file. */
/* #undef HAVE_SYS_VMPARAM_H */

/* Define to 1 if you have the <sys/vmsystm.h> header file. */
/* #undef HAVE_SYS_VMSYSTM_H */

/* Define to 1 if you have the <sys/vm.h> header file. */
/* #undef HAVE_SYS_VM_H */

/* Define to 1 if you have the <sys/vnode.h> header file. */
/* #undef HAVE_SYS_VNODE_H */

/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
#define HAVE_SYS_WAIT_H 1

/* Define to 1 if you have the `tcgetattr' function. */
#define HAVE_TCGETATTR 1

/* Define to 1 if you have the `times' function. */
#define HAVE_TIMES 1

/* Define if a timezone variable is declared in <sys/time.h> */
#define HAVE_TIMEZONE_VARIABLE 1

/* Define to 1 if you have the `TLSv1_method' function. */
#define HAVE_TLSV1_METHOD 1

/* Define to 1 if you have the `TLS_method' function. */
#define HAVE_TLS_METHOD 1

/* Define to 1 if you have the <ufs/ffs/fs.h> header file. */
/* #undef HAVE_UFS_FFS_FS_H */

/* Define to 1 if you have the <ufs/fs.h> header file. */
/* #undef HAVE_UFS_FS_H */

/* Define to 1 if you have the <ufs/ufs/dinode.h> header file. */
/* #undef HAVE_UFS_UFS_DINODE_H */

/* Define to 1 if you have the <ufs/ufs/inode.h> header file. */
/* #undef HAVE_UFS_UFS_INODE_H */

/* Define to 1 if you have the <ufs/ufs/quota.h> header file. */
/* #undef HAVE_UFS_UFS_QUOTA_H */

/* Define to 1 if the system has the type `uintmax_t'. */
#define HAVE_UINTMAX_T 1

/* Define to 1 if the system has the type `uintptr_t'. */
#define HAVE_UINTPTR_T 1

/* Define to 1 if you have the `uname' function. */
#define HAVE_UNAME 1

/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1

/* Define to 1 if the system has the type `unsigned long long int'. */
#define HAVE_UNSIGNED_LONG_LONG_INT 1

/* Define to 1 if you have the `usleep' function. */
#define HAVE_USLEEP 1

/* Define to 1 if you have the <utmpx.h> header file. */
#define HAVE_UTMPX_H 1

/* Define to 1 if you have the <utsname.h> header file. */
/* #undef HAVE_UTSNAME_H */

/* Define to 1 if you have the <uvm/uvm_extern.h> header file. */
/* #undef HAVE_UVM_UVM_EXTERN_H */

/* Define to 1 if you have the <uvm/uvm_param.h> header file. */
/* #undef HAVE_UVM_UVM_PARAM_H */

/* Define to 1 if you have the <valgrind/memcheck.h> header file. */
/* #undef HAVE_VALGRIND_MEMCHECK_H */

/* Define to 1 if you have the <valgrind/valgrind.h> header file. */
/* #undef HAVE_VALGRIND_VALGRIND_H */

/* Define to 1 if you have the <validator/validator-config.h> header file. */
/* #undef HAVE_VALIDATOR_VALIDATOR_CONFIG_H */

/* Define to 1 if you have the <vm/swap_pager.h> header file. */
/* #undef HAVE_VM_SWAP_PAGER_H */

/* Define to 1 if you have the <vm/vm_extern.h> header file. */
/* #undef HAVE_VM_VM_EXTERN_H */

/* Define to 1 if you have the <vm/vm.h> header file. */
/* #undef HAVE_VM_VM_H */

/* Define to 1 if you have the <vm/vm_param.h> header file. */
/* #undef HAVE_VM_VM_PARAM_H */

/* Define to 1 if you have the `vsnprintf' function. */
#define HAVE_VSNPRINTF 1

/* Define to 1 if you have the <windows.h> header file. */
/* #undef HAVE_WINDOWS_H */

/* Define to 1 if you have the <winsock2.h> header file. */
/* #undef HAVE_WINSOCK2_H */

/* Define to 1 if you have the <winsock.h> header file. */
/* #undef HAVE_WINSOCK_H */

/* Define to 1 if you have the <ws2tcpip.h> header file. */
/* #undef HAVE_WS2TCPIP_H */

/* Define to 1 if you have the `X509_get_signature_nid' function. */
#define HAVE_X509_GET_SIGNATURE_NID 1

/* Define to 1 if you have the `X509_NAME_ENTRY_get_data' function. */
#define HAVE_X509_NAME_ENTRY_GET_DATA 1

/* Define to 1 if you have the `X509_NAME_ENTRY_get_object' function. */
#define HAVE_X509_NAME_ENTRY_GET_OBJECT 1

/* Define to 1 if you have the <xti.h> header file. */
/* #undef HAVE_XTI_H */

/* location of UNIX kernel */
#define KERNEL_LOC "unknown"

/* Path to the lpstat command */
/* #undef LPSTAT_PATH */

/* Define to the sub-directory in which libtool stores uninstalled libraries.
   */
#define LT_OBJDIR ".libs/"

/* define if agentx transport is to use domain sockets only */
/* #undef NETSNMP_AGENTX_DOM_SOCK_ONLY */

/* Unix domain socket for AgentX master-subagent communication */
#define NETSNMP_AGENTX_SOCKET "/var/agentx/master"

/* Used to make the compiler issue a warning about deprecated functions and
   variables */
#define NETSNMP_ATTRIBUTE_DEPRECATED __attribute__((deprecated))

/* Used to suppress compiler warnings about unused functions and variables */
#define NETSNMP_ATTRIBUTE_UNUSED __attribute__((unused))

/* Define if static inline functions are unsupported */
/* #undef NETSNMP_BROKEN_INLINE */

/* "Define if crytography support is possible" */
#define NETSNMP_CAN_DO_CRYPTO 1

/* sysctl works to get boottime, etc... */
/* #undef NETSNMP_CAN_USE_SYSCTL */

/* configure options specified */
#define NETSNMP_CONFIGURE_OPTIONS " '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-static' '--enable-shared' '--enable-as-needed' '--enable-blumenthal-aes' '--enable-embedded-perl' '--enable-ipv6' '--enable-local-smux' '--enable-mfd-rewrites' '--enable-ucd-snmp-compatibility' '--sysconfdir=/etc' '--with-cflags=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' '--with-ldflags=-Wl,-z,relro -Wl,-z,now -lm' '--with-logfile=/var/log/snmpd.log' '--with-mib-modules=host agentx smux      ucd-snmp/diskio tcp-mib udp-mib mibII/mta_sendmail      ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable      ip-mib/ipAddressPrefixTable/ipAddressPrefixTable      ip-mib/ipDefaultRouterTable/ipDefaultRouterTable      ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable      sctp-mib rmon-mib etherlike-mib ucd-snmp/lmsensorsMib' '--with-mysql' '--with-openssl' '--with-persistent-directory=/var/lib/net-snmp' '--with-perl-modules=INSTALLDIRS=vendor' '--with-pic' '--with-security-modules=tsm' '--with-sys-location=Unknown' '--with-systemd' '--with-temp-file-pattern=/run/net-snmp/snmp-tmp-XXXXXX' '--with-transports=DTLSUDP TLSTCP' '--with-sys-contact=root@localhost' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' 'LDFLAGS=-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'"

/* if defined daemons will use syslog when no log destination is defined */
/* #undef NETSNMP_DAEMONS_DEFAULT_LOG_SYSLOG */

/* default location to look for mibs to load using the above tokens and/or
   those in the MIBS envrionment variable */
#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/share/snmp/mibs"

/* default mib files to load, specified by path. */
/* #undef NETSNMP_DEFAULT_MIBFILES */

/* Define if no agent is built */
/* #undef NETSNMP_DISABLE_AGENT */

/* Define if no apps are built */
/* #undef NETSNMP_DISABLE_APPS */

/* Define if DES encryption should not be supported */
/* #undef NETSNMP_DISABLE_DES */

/* Define if MD5 authentication should not be supported */
/* #undef NETSNMP_DISABLE_MD5 */

/* Define if mib loading and parsing code should not be included */
/* #undef NETSNMP_DISABLE_MIB_LOADING */

/* Define if SNMP SET support should be disabled */
/* #undef NETSNMP_DISABLE_SET_SUPPORT */

/* Define if SNMPv1 code should not be included */
/* #undef NETSNMP_DISABLE_SNMPV1 */

/* Define if SNMPv2c code should not be included */
/* #undef NETSNMP_DISABLE_SNMPV2C */

/* Define if AES-192/AES-256 encryption should be supported */
#define NETSNMP_DRAFT_BLUMENTHAL_AES_04 1

/* Define if you are embedding perl in the main agent. */
#define NETSNMP_EMBEDDED_PERL 1

/* define if you want to enable IPv6 support */
#define NETSNMP_ENABLE_IPV6 1

/* define if you want to restrict SMUX connections to localhost by default */
#define NETSNMP_ENABLE_LOCAL_SMUX 1

/* Define if you want to build MFD module rewrites */
#define NETSNMP_ENABLE_MFD_REWRITES 1

/* define if you want to compile support for both authentication and privacy
   support. */
#define NETSNMP_ENABLE_SCAPI_AUTHPRIV 1

/* testing code sections. */
/* #undef NETSNMP_ENABLE_TESTING_CODE */

/* if defined always use default auth/priv protocol when creating usmUsers */
/* #undef NETSNMP_FORCE_SYSTEM_V3_AUTHPRIV */

/* Should evaluate to the name of the current function if defined */
#define NETSNMP_FUNCTION __func__

/* ifnet needs to have _KERNEL defined */
/* #undef NETSNMP_IFNET_NEEDS_KERNEL */

/* ifnet needs to have _KERNEL_STRUCTURES defined */
/* #undef NETSNMP_IFNET_NEEDS_KERNEL_STRUCTURES */

/* Define if you want to remove all non-essential code features. */
/* #undef NETSNMP_MINIMAL_CODE */

/* Define if you want to only support sending notifications */
/* #undef NETSNMP_NOTIFY_ONLY */

/* Define to suppress inclusion of deprecated functions */
/* #undef NETSNMP_NO_DEPRECATED_FUNCTIONS */

/* If you don't want the agent to report on variables it doesn't have data for
   */
#define NETSNMP_NO_DUMMY_VALUES 1

/* If we don't want to use kmem. */
/* #undef NETSNMP_NO_KMEM_USAGE */

/* Define if you want to remove all listening support from the code */
/* #undef NETSNMP_NO_LISTEN_SUPPORT */

/* If you don't have root access don't exit upon kmem errors */
/* #undef NETSNMP_NO_ROOT_ACCESS */

/* If you don't want to integrate with systemd. */
/* #undef NETSNMP_NO_SYSTEMD */

/* Define if you want to remove all SET/write access from the code */
/* #undef NETSNMP_NO_WRITE_SUPPORT */

/* umask permissions to set up persistent files with */
#define NETSNMP_PERSISTENT_MASK 077

/* Size prefix to use to printf a uint32_t */
#define NETSNMP_PRI32 ""

/* Size prefix to use to printf a size_t or ssize_t */
#define NETSNMP_PRIz "l"

/* Define to 1 if you want to build with reentrant/threaded code (incomplete).
   */
/* #undef NETSNMP_REENTRANT */

/* define if you do not want snmptrapd to register as an AgentX subagent */
/* #undef NETSNMP_SNMPTRAPD_DISABLE_AGENTX */

/* Pattern of temporary files */
#define NETSNMP_TEMP_FILE_PATTERN "/run/net-snmp/snmp-tmp-XXXXXX"

/* "Define if internal cryptography code should be used" */
/* #undef NETSNMP_USE_INTERNAL_CRYPTO */

/* define if you are using the MD5 code ... */
/* #undef NETSNMP_USE_INTERNAL_MD5 */

/* Define this if you're using Heimdal Kerberos */
/* #undef NETSNMP_USE_KERBEROS_HEIMDAL */

/* Define this if we're using the new MIT crypto API */
/* #undef NETSNMP_USE_KERBEROS_MIT */

/* define if you are using the mysql code for snmptrapd ... */
#define NETSNMP_USE_MYSQL 1

/* Define if you are using the codeS11 library ... */
/* #undef NETSNMP_USE_PKCS11 */

/* Define this if you have lm_sensors v3 or later */
#define NETSNMP_USE_SENSORS_V3 1

/* Should we compile to use special opaque types: float, double, counter64,
   i64, ui64, union? */
#define NETSNMP_WITH_OPAQUE_SPECIAL_TYPES 1

/* Define to the address where bug reports for this package should be sent. */
#ifndef PACKAGE_BUGREPORT
#define PACKAGE_BUGREPORT "net-snmp-coders@lists.sourceforge.net"
#endif

/* Define to the full name of this package. */
#ifndef PACKAGE_NAME
#define PACKAGE_NAME "Net-SNMP"
#endif

/* Define to the full name and version of this package. */
#ifndef PACKAGE_STRING
#define PACKAGE_STRING "Net-SNMP 5.8"
#endif

/* Define to the one symbol short name of this package. */
#ifndef PACKAGE_TARNAME
#define PACKAGE_TARNAME "net-snmp"
#endif

/* Define to the home page for this package. */
#define PACKAGE_URL ""

/* Define to the version of this package. */
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "5.8"
#endif

/* Command to generate ps output, the final column must be the process name
   withOUT arguments */
#define PSCMD "/usr/bin/ps -e"

/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void

/* define rtentry to ortentry on SYSV machines (alphas) */
#define RTENTRY struct rtentry

/* Use BSD 4.4 routing table entries? */
/* #undef RTENTRY_4_4 */

/* Qualifier for second argument of the appverify_cookie_cb() callback
   function */
#define SECOND_APPVERIFY_COOKIE_CB_ARG_QUALIFIER const

/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT 4

/* The size of `intmax_t', as computed by sizeof. */
#define SIZEOF_INTMAX_T 8

/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG 8

/* The size of `long long', as computed by sizeof. */
#define SIZEOF_LONG_LONG 8

/* The size of `short', as computed by sizeof. */
#define SIZEOF_SHORT 2

/* The size of `sockaddr_un.sun_path', as computed by sizeof. */
#define SIZEOF_SOCKADDR_UN_SUN_PATH 108

/* If using the C implementation of alloca, define if you know the
   direction of stack growth for your system; otherwise it will be
   automatically deduced at runtime.
	STACK_DIRECTION > 0 => grows toward higher addresses
	STACK_DIRECTION < 0 => grows toward lower addresses
	STACK_DIRECTION = 0 => direction of growth unknown */
/* #undef STACK_DIRECTION */

/* Define if statfs takes 2 args and the second argument has type struct
   fs_data. [Ultrix] */
/* #undef STAT_STATFS_FS_DATA */

/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1

/* define if SIOCGIFADDR exists in sys/ioctl.h */
#define SYS_IOCTL_H_HAS_SIOCGIFADDR 1

/* Define if the TCP timer constants in <netinet/tcp_timer.h> depend on the
   integer variable 'hz'. [FreeBSD 4.x] */
/* #undef TCPTV_NEEDS_HZ */

/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1

/* Where is the uname command */
#define UNAMEPROG "/usr/bin/uname"

/* Enable extensions on AIX 3, Interix.  */
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
/* Enable GNU extensions on systems that have them.  */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
/* Enable threading extensions on Solaris.  */
#ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
#endif
/* Enable extensions on HP NonStop.  */
#ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1
#endif
/* Enable general extensions on Solaris.  */
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif


/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
   significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
#  define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
/* #  undef WORDS_BIGENDIAN */
# endif
#endif

/* Define to 1 if on MINIX. */
/* #undef _MINIX */

/* Define to 2 if the system does not provide POSIX.1 features except with
   this defined. */
/* #undef _POSIX_1_SOURCE */

/* Define to 1 if you need to in order for `stat' and other things to work. */
/* #undef _POSIX_SOURCE */

/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
   #define below would cause a syntax error. */
/* #undef _UINT32_T */

/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
   #define below would cause a syntax error. */
/* #undef _UINT64_T */

/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
   #define below would cause a syntax error. */
/* #undef _UINT8_T */

/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */

/* Define to `__inline__' or `__inline' if that's what the C compiler
   calls it, or to nothing if 'inline' is not supported under any name.  */
#ifndef __cplusplus
/* #undef inline */
#endif

/* Define to the type of a signed integer type of width exactly 16 bits if
   such a type exists and the standard includes do not define it. */
/* #undef int16_t */

/* Define to the type of a signed integer type of width exactly 32 bits if
   such a type exists and the standard includes do not define it. */
/* #undef int32_t */

/* Define to the type of a signed integer type of width exactly 64 bits if
   such a type exists and the standard includes do not define it. */
/* #undef int64_t */

/* Define to the type of a signed integer type of width exactly 8 bits if such
   a type exists and the standard includes do not define it. */
/* #undef int8_t */

/* Define to the widest signed integer type if <stdint.h> and <inttypes.h> do
   not define. */
/* #undef intmax_t */

/* Define to the type of a signed integer type wide enough to hold a pointer,
   if such a type exists, and if the system does not define it. */
/* #undef intptr_t */

/* Define to `long int' if <sys/types.h> does not define. */
/* #undef off_t */

/* Define to `int' if <sys/types.h> does not define. */
/* #undef pid_t */

/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */

/* Define to the type of an unsigned integer type of width exactly 16 bits if
   such a type exists and the standard includes do not define it. */
/* #undef uint16_t */

/* Define to the type of an unsigned integer type of width exactly 32 bits if
   such a type exists and the standard includes do not define it. */
/* #undef uint32_t */

/* Define to the type of an unsigned integer type of width exactly 64 bits if
   such a type exists and the standard includes do not define it. */
/* #undef uint64_t */

/* Define to the type of an unsigned integer type of width exactly 8 bits if
   such a type exists and the standard includes do not define it. */
/* #undef uint8_t */

/* Define to the widest unsigned integer type if <stdint.h> and <inttypes.h>
   do not define. */
/* #undef uintmax_t */

/* Define to the type of an unsigned integer type wide enough to hold a
   pointer, if such a type exists, and if the system does not define it. */
/* #undef uintptr_t */

/* end of definitions added by configure on-the-fly */

/* If you have openssl 0.9.7 or above, you likely have AES support. */
#define NETSNMP_USE_OPENSSL 1
#if (defined(NETSNMP_USE_OPENSSL) && defined(HAVE_OPENSSL_AES_H) && defined(HAVE_AES_CFB128_ENCRYPT)) || defined(NETSNMP_USE_INTERNAL_CRYPTO)
#define HAVE_AES 1
#endif

/* define signal if DNE */

#ifndef HAVE_SIGNAL
#ifdef HAVE_SIGSET
#define signal(a,b) sigset(a,b)
#endif
#endif

#ifdef HAVE_DMALLOC_H
#define DMALLOC_FUNC_CHECK
#endif

#endif /* NETSNMP_NO_AUTOCONF_DEFINITIONS */




/* ********* NETSNMP_MARK_BEGIN_CLEAN_NAMESPACE ********* */
/* 
 * put all new net-snmp-specific definitions here
 *
 * all definitions MUST have a NETSNMP_ prefix
 *
 */

/* Default (SNMP) version number for the tools to use */
#define NETSNMP_DEFAULT_SNMP_VERSION 3

/* don't change these values! */
#define NETSNMP_SNMPV1      0xAAAA       /* readable by anyone */
#define NETSNMP_SNMPV2ANY   0xA000       /* V2 Any type (includes NoAuth) */
#define NETSNMP_SNMPV2AUTH  0x8000       /* V2 Authenticated requests only */

/* default list of mibs to load */
#define NETSNMP_DEFAULT_MIBS ":SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB:HOST-RESOURCES-MIB:NOTIFICATION-LOG-MIB:DISMAN-EVENT-MIB:DISMAN-SCHEDULE-MIB:EtherLike-MIB:HOST-RESOURCES-TYPES:MTA-MIB:NETWORK-SERVICES-MIB:RMON-MIB:SCTP-MIB:UCD-DISKIO-MIB:LM-SENSORS-MIB:UCD-SNMP-MIB:UCD-DEMO-MIB:SNMP-TARGET-MIB:NET-SNMP-AGENT-MIB:SNMP-FRAMEWORK-MIB:SNMP-MPD-MIB:SNMP-USER-BASED-SM-MIB:SNMP-VIEW-BASED-ACM-MIB:SNMP-COMMUNITY-MIB:IPV6-ICMP-MIB:IPV6-MIB:IPV6-TCP-MIB:IPV6-UDP-MIB:IP-FORWARD-MIB:NET-SNMP-PASS-MIB:NET-SNMP-EXTEND-MIB:UCD-DLMOD-MIB:SNMP-NOTIFICATION-MIB:SNMPv2-TM:NET-SNMP-VACM-MIB"

/* debugging stuff */
/* if defined, we optimize the code to exclude all debugging calls. */
/* #undef NETSNMP_NO_DEBUGGING */
/* ignore the -D flag and always print debugging information */
#define NETSNMP_ALWAYS_DEBUG 0

/* reverse encoding BER packets is both faster and more efficient in space. */
#define NETSNMP_USE_REVERSE_ASNENCODING       1
#define NETSNMP_DEFAULT_ASNENCODING_DIRECTION 1 /* 1 = reverse, 0 = forwards */

/* PERSISTENT_DIRECTORY: If defined, the library is capabile of saving
   persisant information to this directory in the form of configuration
   lines: PERSISTENT_DIRECTORY/NAME.persistent.conf */
#define NETSNMP_PERSISTENT_DIRECTORY "/var/lib/net-snmp"

/* AGENT_DIRECTORY_MODE: the mode the agents should use to create
   directories with. Since the data stored here is probably sensitive, it
   probably should be read-only by root/administrator. */
#define NETSNMP_AGENT_DIRECTORY_MODE 0700

/* MAX_PERSISTENT_BACKUPS:
 *   The maximum number of persistent backups the library will try to
 *   read from the persistent cache directory.  If an application fails to
 *   close down successfully more than this number of times, data will be lost.
 */
#define NETSNMP_MAX_PERSISTENT_BACKUPS 10

/* define the system type include file here */
#define NETSNMP_SYSTEM_INCLUDE_FILE "net-snmp/system/linux.h"

/* define the machine (cpu) type include file here */
#define NETSNMP_MACHINE_INCLUDE_FILE "net-snmp/machine/generic.h"

/* define the UDP buffer defaults undefined means use the OS buffers
 * by default */
/* #undef NETSNMP_DEFAULT_SERVER_SEND_BUF */
/* #undef NETSNMP_DEFAULT_SERVER_RECV_BUF */
/* #undef NETSNMP_DEFAULT_CLIENT_SEND_BUF */
/* #undef NETSNMP_DEFAULT_CLIENT_RECV_BUF */

/* net-snmp's major path names */
#define SNMPLIBPATH "/usr/lib64/snmp"
#define SNMPSHAREPATH "/usr/share/snmp"
#define SNMPCONFPATH "/etc/snmp"
#define SNMPDLMODPATH "/usr/lib64/snmp/dlmod"

/* NETSNMP_LOGFILE:  If defined it closes stdout/err/in and opens this in 
   out/err's place.  (stdin is closed so that sh scripts won't wait for it) */
#define NETSNMP_LOGFILE "/var/log/snmpd.log"

/* default system contact */
#define NETSNMP_SYS_CONTACT "root@localhost"

/* system location */
#define NETSNMP_SYS_LOC "Unknown"

/* Use libwrap to handle allow/deny hosts? */
/* #undef NETSNMP_USE_LIBWRAP */

/* Mib-2 tree Info */
/* These are the system information variables. */

#define NETSNMP_VERS_DESC   "unknown"             /* overridden at run time */
#define NETSNMP_SYS_NAME    "unknown"             /* overridden at run time */

/* comment out the second define to turn off functionality for any of
   these: (See README for details) */

/*   proc PROCESSNAME [MAX] [MIN] */
#define NETSNMP_PROCMIBNUM 2

/*   exec/shell NAME COMMAND      */
#define NETSNMP_SHELLMIBNUM 8

/*   swap MIN                     */
#define NETSNMP_MEMMIBNUM 4

/*   disk DISK MINSIZE            */
#define NETSNMP_DISKMIBNUM 9

/*   load 1 5 15                  */
#define NETSNMP_LOADAVEMIBNUM 10

/* which version are you using? This mibloc will tell you */
#define NETSNMP_VERSIONMIBNUM 100

/* Reports errors the agent runs into */
/* (typically its "can't fork, no mem" problems) */
#define NETSNMP_ERRORMIBNUM 101

/* The sub id of EXTENSIBLEMIB returned to queries of
   .iso.org.dod.internet.mgmt.mib-2.system.sysObjectID.0 */
#define NETSNMP_AGENTID 250

/* This ID is returned after the AGENTID above.  IE, the resulting
   value returned by a query to sysObjectID is
   EXTENSIBLEMIB.AGENTID.???, where ??? is defined below by OSTYPE */

#define NETSNMP_HPUX9ID 1
#define NETSNMP_SUNOS4ID 2 
#define NETSNMP_SOLARISID 3
#define NETSNMP_OSFID 4
#define NETSNMP_ULTRIXID 5
#define NETSNMP_HPUX10ID 6
#define NETSNMP_NETBSD1ID 7
#define NETSNMP_FREEBSDID 8
#define NETSNMP_IRIXID 9
#define NETSNMP_LINUXID 10
#define NETSNMP_BSDIID 11
#define NETSNMP_OPENBSDID 12
#define NETSNMP_WIN32ID 13
#define NETSNMP_HPUX11ID 14
#define NETSNMP_AIXID 15
#define NETSNMP_MACOSXID 16
#define NETSNMP_DRAGONFLYID 17
#define NETSNMP_UNKNOWNID 255

#ifdef hpux9
#define NETSNMP_OSTYPE NETSNMP_HPUX9ID
#endif
#ifdef hpux10
#define NETSNMP_OSTYPE NETSNMP_HPUX10ID
#endif
#ifdef hpux11
#define NETSNMP_OSTYPE NETSNMP_HPUX11ID
#endif
#ifdef sunos4
#define NETSNMP_OSTYPE NETSNMP_SUNOS4ID
#endif
#ifdef solaris2
#define NETSNMP_OSTYPE NETSNMP_SOLARISID
#endif
#if defined(osf3) || defined(osf4) || defined(osf5)
#define NETSNMP_OSTYPE NETSNMP_OSFID
#endif
#ifdef ultrix4
#define NETSNMP_OSTYPE NETSNMP_ULTRIXID
#endif
#if defined(netbsd1) || defined(netbsd2)
#define NETSNMP_OSTYPE NETSNMP_NETBSD1ID
#endif
#if defined(__FreeBSD__)
#define NETSNMP_OSTYPE NETSNMP_FREEBSDID
#endif
#if defined(__DragonFly__)
#define NETSNMP_OSTYPE NETSNMP_DRAGONFLYID
#endif
#if defined(irix6) || defined(irix5)
#define NETSNMP_OSTYPE NETSNMP_IRIXID
#endif
#ifdef linux
#define NETSNMP_OSTYPE NETSNMP_LINUXID
#endif
#if defined(bsdi2) || defined(bsdi3) || defined(bsdi4)
#define NETSNMP_OSTYPE NETSNMP_BSDIID
#endif
#if defined(openbsd)
#define NETSNMP_OSTYPE NETSNMP_OPENBSDID
#endif
#ifdef WIN32
#define NETSNMP_OSTYPE NETSNMP_WIN32ID
#endif
#if defined(aix3) || defined(aix4) || defined(aix5) || defined(aix6) || defined(aix7)
#define NETSNMP_OSTYPE NETSNMP_AIXID
#endif
#if defined(darwin) && (darwin >= 8)
#define NETSNMP_OSTYPE NETSNMP_MACOSXID
#endif
/* unknown */
#ifndef NETSNMP_OSTYPE
#define NETSNMP_OSTYPE NETSNMP_UNKNOWNID
#endif

/* The enterprise number has been assigned by the IANA group.   */
/* Optionally, this may point to the location in the tree your  */
/* company/organization has been allocated.                     */
/* The assigned enterprise number for the NET_SNMP MIB modules. */
#define NETSNMP_ENTERPRISE_OID			8072
#define NETSNMP_ENTERPRISE_MIB			1,3,6,1,4,1,8072
#define NETSNMP_ENTERPRISE_DOT_MIB		1.3.6.1.4.1.8072
#define NETSNMP_ENTERPRISE_DOT_MIB_LENGTH	7

/* The assigned enterprise number for sysObjectID. */
#define NETSNMP_SYSTEM_MIB		1,3,6,1,4,1,8072,3,2,NETSNMP_OSTYPE
#define NETSNMP_SYSTEM_DOT_MIB		1.3.6.1.4.1.8072.3.2.NETSNMP_OSTYPE
#define NETSNMP_SYSTEM_DOT_MIB_LENGTH	10

/* The assigned enterprise number for notifications. */
#define NETSNMP_NOTIFICATION_MIB		1,3,6,1,4,1,8072,4
#define NETSNMP_NOTIFICATION_DOT_MIB		1.3.6.1.4.1.8072.4
#define NETSNMP_NOTIFICATION_DOT_MIB_LENGTH	8

/* this is the location of the ucdavis mib tree.  It shouldn't be
   changed, as the places it is used are expected to be constant
   values or are directly tied to the UCD-SNMP-MIB. */
#define NETSNMP_UCDAVIS_OID		2021
#define NETSNMP_UCDAVIS_MIB		1,3,6,1,4,1,2021
#define NETSNMP_UCDAVIS_DOT_MIB		1.3.6.1.4.1.2021
#define NETSNMP_UCDAVIS_DOT_MIB_LENGTH	7

/* how long to wait (seconds) for error querys before reseting the error trap.*/
#define NETSNMP_ERRORTIMELENGTH 600 

/* Exec command to fix PROC problems */
/* %s will be replaced by the process name in error */

/* #define NETSNMP_PROCFIXCMD "/usr/bin/perl /local/scripts/fixproc %s" */

/* Exec command to fix EXEC problems */
/* %s will be replaced by the exec/script name in error */

/* #define NETSNMP_EXECFIXCMD "/usr/bin/perl /local/scripts/fixproc %s" */

/* Should exec output Cashing be used (speeds up things greatly), and
   if so, After how many seconds should the cache re-newed?  Note:
   Don't define CASHETIME to disable cashing completely */

#define NETSNMP_EXCACHETIME 30
#define NETSNMP_CACHEFILE ".snmp-exec-cache"
#define NETSNMP_MAXCACHESIZE (1500*80)   /* roughly 1500 lines max */

/* misc defaults */

/* default of 100 meg minimum if the minimum size is not specified in
   the config file */
#define NETSNMP_DEFDISKMINIMUMSPACE 100000

/* default maximum load average before error */
#define NETSNMP_DEFMAXLOADAVE 12.0

/* max times to loop reading output from execs. */
/* Because of sleep(1)s, this will also be time to wait (in seconds) for exec
   to finish */
#define NETSNMP_MAXREADCOUNT 100

/* Set if snmpgets should block and never timeout */
/* The original CMU code had this hardcoded as = 1 */
#define NETSNMP_SNMPBLOCK 1

/* How long to wait before restarting the agent after a snmpset to
   EXTENSIBLEMIB.VERSIONMIBNUM.VERRESTARTAGENT.  This is
   necessary to finish the snmpset reply before restarting. */
#define NETSNMP_RESTARTSLEEP 5

/* UNdefine to allow specifying zero-length community string */
/* #define NETSNMP_NO_ZEROLENGTH_COMMUNITY 1 */

/* Number of community strings to store */
#define NETSNMP_NUM_COMMUNITIES	5

/* internal define */
#define NETSNMP_LASTFIELD -1

/*  Pluggable transports.  */

/*  This is defined if support for the UDP/IP transport domain is
    available.   */
#define NETSNMP_TRANSPORT_UDP_DOMAIN 1

/*  This is defined if support for the shared UDP/IP transport domain is
    available.   */
/* #undef NETSNMP_TRANSPORT_UDPSHARED_DOMAIN */

/*  This is defined if support for the "callback" transport domain is
    available.   */
#define NETSNMP_TRANSPORT_CALLBACK_DOMAIN 1

/*  This is defined if support for the TCP/IP transport domain is
    available.  */
#define NETSNMP_TRANSPORT_TCP_DOMAIN 1

/*  This is defined if support for the Unix transport domain
    (a.k.a. "local IPC") is available.  */
#define NETSNMP_TRANSPORT_UNIX_DOMAIN 1

/*  This is defined if support for the AAL5 PVC transport domain is
    available.  */
/* #undef NETSNMP_TRANSPORT_AAL5PVC_DOMAIN */

/*  This is defined if support for the IPX transport domain is
    available.  */
/* #undef NETSNMP_TRANSPORT_IPX_DOMAIN */

/*  This is defined if support for the UDP/IPv6 transport domain is
    available.  */
#define NETSNMP_TRANSPORT_UDPIPV6_DOMAIN 1

/*  This is defined if support for the TCP/IPv6 transport domain is
    available.  */
#define NETSNMP_TRANSPORT_TCPIPV6_DOMAIN 1

/*  This is defined if support for the TLS transport domain is
    available.   */
#define NETSNMP_TRANSPORT_TLSBASE_DOMAIN 1

/*  This is defined if support for the Alias transport domain is
    available.   */
#define NETSNMP_TRANSPORT_ALIAS_DOMAIN 1

/*  This is defined if support for the SSH transport domain is
    available.   */
/* #undef NETSNMP_TRANSPORT_SSH_DOMAIN */

/*  This is defined if support for the DTLS/UDP transport domain is
    available.   */
#define NETSNMP_TRANSPORT_DTLSUDP_DOMAIN 1

/*  This is defined if support for the TLS/TCP transport domain is
    available.   */
#define NETSNMP_TRANSPORT_TLSTCP_DOMAIN 1

/*  This is defined if support for stdin/out transport domain is available.   */
/* #undef NETSNMP_TRANSPORT_STD_DOMAIN */

/*  This is defined if support for the IPv4Base transport domain is available.   */
#define NETSNMP_TRANSPORT_IPV4BASE_DOMAIN 1

/* define this if the USM security module is available */
#define NETSNMP_SECMOD_USM 1

/* define this if the KSM (kerberos based snmp) security module is available */
/* #undef NETSNMP_SECMOD_KSM */

/* define this if the local security module is available */
/* #undef NETSNMP_SECMOD_LOCALSM */

/* define if configured as a "mini-agent" */
/* #undef NETSNMP_MINI_AGENT */

/* this is the location of the net-snmp mib tree.  It shouldn't be
   changed, as the places it is used are expected to be constant
   values or are directly tied to the UCD-SNMP-MIB. */
#define NETSNMP_OID		8072
#define NETSNMP_MIB		1,3,6,1,4,1,8072
#define NETSNMP_DOT_MIB		1.3.6.1.4.1.8072
#define NETSNMP_DOT_MIB_LENGTH	7

/* pattern for temporary file names */
#define NETSNMP_TEMP_FILE_PATTERN "/run/net-snmp/snmp-tmp-XXXXXX"

/*
 * this must be before the system/machine includes, to allow them to
 * override and turn off inlining. To do so, they should do the
 * following:
 *
 *    #undef NETSNMP_ENABLE_INLINE
 *    #define NETSNMP_ENABLE_INLINE 0
 *
 * A user having problems with their compiler can also turn off
 * the use of inline by defining NETSNMP_NO_INLINE via their cflags:
 *
 *    -DNETSNMP_NO_INLINE
 *
 * Header and source files should only test against NETSNMP_USE_INLINE:
 *
 *   #ifdef NETSNMP_USE_INLINE
 *   NETSNMP_INLINE function(int parm) { return parm -1; }
 *   #endif
 *
 * Functions which should be static, regardless of whether or not inline
 * is available or enabled should use the NETSNMP_STATIC_INLINE macro,
 * like so:
 *
 *    NETSNMP_STATIC_INLINE function(int parm) { return parm -1; }
 *
 * NOT like this:
 *
 *    static NETSNMP_INLINE function(int parm) { return parm -1; }
 *
 */
#ifdef NETSNMP_BROKEN_INLINE
#   define NETSNMP_ENABLE_INLINE 0
#else
#   define NETSNMP_ENABLE_INLINE 1
#endif

#include NETSNMP_SYSTEM_INCLUDE_FILE
#include NETSNMP_MACHINE_INCLUDE_FILE

#if NETSNMP_ENABLE_INLINE && !defined(NETSNMP_NO_INLINE)
#   define NETSNMP_USE_INLINE 1
#   ifndef NETSNMP_INLINE
#      define NETSNMP_INLINE __inline__
#   endif
#   ifndef NETSNMP_STATIC_INLINE
#      define NETSNMP_STATIC_INLINE static __inline__
#   endif
#else
#   define NETSNMP_INLINE 
#   define NETSNMP_STATIC_INLINE static
#endif

#ifndef NETSNMP_IMPORT
#  define NETSNMP_IMPORT extern
#endif

/* comment the next line if you are compiling with libsnmp.h 
   and are not using the UC-Davis SNMP library. */
#define UCD_SNMP_LIBRARY 1

/* final conclusion on nlist usage */
#if defined(HAVE_NLIST) && defined(HAVE_STRUCT_NLIST_N_VALUE) && !defined(NETSNMP_DONT_USE_NLIST) && !defined(NETSNMP_NO_KMEM_USAGE)
#define NETSNMP_CAN_USE_NLIST
#endif


/* ********* NETSNMP_MARK_BEGIN_LEGACY_DEFINITIONS *********/
/* 
 * existing definitions prior to Net-SNMP 5.4
 *
 * do not add anything new here
 *
 */

#ifndef NETSNMP_NO_LEGACY_DEFINITIONS

#ifdef NETSNMP_DEFAULT_SNMP_VERSION
# define DEFAULT_SNMP_VERSION NETSNMP_DEFAULT_SNMP_VERSION
#endif

#ifdef NETSNMP_SNMPV1
# define SNMPV1 NETSNMP_SNMPV1
#endif

#ifdef NETSNMP_SNMPV2ANY
# define SNMPV2ANY NETSNMP_SNMPV2ANY
#endif

#ifdef NETSNMP_SNMPV2AUTH
# define SNMPV2AUTH NETSNMP_SNMPV2AUTH
#endif

#ifdef NETSNMP_DEFAULT_MIBS
# define DEFAULT_MIBS NETSNMP_DEFAULT_MIBS
#endif

#ifdef NETSNMP_DEFAULT_MIBDIRS
# define DEFAULT_MIBDIRS NETSNMP_DEFAULT_MIBDIRS
#endif

#ifdef NETSNMP_DEFAULT_MIBFILES
# define DEFAULT_MIBFILES NETSNMP_DEFAULT_MIBFILES
#endif

#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
# define OPAQUE_SPECIAL_TYPES NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
#endif

#ifdef NETSNMP_ENABLE_SCAPI_AUTHPRIV
# define SCAPI_AUTHPRIV NETSNMP_ENABLE_SCAPI_AUTHPRIV
#endif

#ifdef NETSNMP_USE_INTERNAL_MD5
# define USE_INTERNAL_MD5 NETSNMP_USE_INTERNAL_MD5
#endif

#ifdef NETSNMP_USE_PKCS11
# define USE_PKCS NETSNMP_USE_PKCS11
#endif

#ifdef NETSNMP_USE_OPENSSL
# define USE_OPENSSL NETSNMP_USE_OPENSSL
#endif

#ifdef NETSNMP_NO_DEBUGGING
# define SNMP_NO_DEBUGGING NETSNMP_NO_DEBUGGING
#endif

#ifdef NETSNMP_ALWAYS_DEBUG
# define SNMP_ALWAYS_DEBUG NETSNMP_ALWAYS_DEBUG
#endif

#ifdef NETSNMP_USE_REVERSE_ASNENCODING
# define USE_REVERSE_ASNENCODING NETSNMP_USE_REVERSE_ASNENCODING
#endif
#ifdef NETSNMP_DEFAULT_ASNENCODING_DIRECTION
# define DEFAULT_ASNENCODING_DIRECTION NETSNMP_DEFAULT_ASNENCODING_DIRECTION
#endif

#define PERSISTENT_DIRECTORY NETSNMP_PERSISTENT_DIRECTORY
#define PERSISTENT_MASK NETSNMP_PERSISTENT_MASK
#define AGENT_DIRECTORY_MODE NETSNMP_AGENT_DIRECTORY_MODE
#define MAX_PERSISTENT_BACKUPS NETSNMP_MAX_PERSISTENT_BACKUPS
#define SYSTEM_INCLUDE_FILE NETSNMP_SYSTEM_INCLUDE_FILE
#define MACHINE_INCLUDE_FILE NETSNMP_MACHINE_INCLUDE_FILE

#ifdef NETSNMP_DEFAULT_SERVER_SEND_BUF
# define DEFAULT_SERVER_SEND_BUF NETSNMP_DEFAULT_SERVER_SEND_BUF
#endif
#ifdef NETSNMP_DEFAULT_SERVER_RECV_BUF
# define DEFAULT_SERVER_RECV_BUF NETSNMP_DEFAULT_SERVER_RECV_BUF
#endif
#ifdef NETSNMP_DEFAULT_CLIENT_SEND_BUF
# define DEFAULT_CLIENT_SEND_BUF NETSNMP_DEFAULT_CLIENT_SEND_BUF
#endif
#ifdef NETSNMP_DEFAULT_CLIENT_RECV_BUF
# define DEFAULT_CLIENT_RECV_BUF NETSNMP_DEFAULT_CLIENT_RECV_BUF
#endif

#ifdef NETSNMP_LOGFILE
# define LOGFILE NETSNMP_LOGFILE
#endif

#ifdef NETSNMP_SYS_CONTACT
# define SYS_CONTACT NETSNMP_SYS_CONTACT
#endif

#ifdef NETSNMP_SYS_LOC
# define SYS_LOC NETSNMP_SYS_LOC
#endif

#ifdef NETSNMP_USE_LIBWRAP
# define USE_LIBWRAP NETSNMP_USE_LIBWRAP
#endif

#ifdef NETSNMP_ENABLE_TESTING_CODE 
# define SNMP_TESTING_CODE NETSNMP_ENABLE_TESTING_CODE
#endif

#ifdef NETSNMP_NO_ROOT_ACCESS
# define NO_ROOT_ACCESS NETSNMP_NO_ROOT_ACCESS
#endif

#ifdef NETSNMP_NO_KMEM_USAGE
# define NO_KMEM_USAGE NETSNMP_NO_KMEM_USAGE
#endif

#ifdef NETSNMP_NO_DUMMY_VALUES
# define NO_DUMMY_VALUES NETSNMP_NO_DUMMY_VALUES
#endif

#define VERS_DESC     NETSNMP_VERS_DESC
#define SYS_NAME      NETSNMP_SYS_NAME

#define PROCMIBNUM    NETSNMP_PROCMIBNUM
#define SHELLMIBNUM   NETSNMP_SHELLMIBNUM
#define MEMMIBNUM     NETSNMP_MEMMIBNUM
#define DISKMIBNUM    NETSNMP_DISKMIBNUM

#define LOADAVEMIBNUM NETSNMP_LOADAVEMIBNUM
#define VERSIONMIBNUM NETSNMP_VERSIONMIBNUM
#define ERRORMIBNUM   NETSNMP_ERRORMIBNUM
#define AGENTID       NETSNMP_AGENTID

#define HPUX9ID       NETSNMP_HPUX9ID
#define SUNOS4ID      NETSNMP_SUNOS4ID
#define SOLARISID     NETSNMP_SOLARISID
#define OSFID         NETSNMP_OSFID
#define ULTRIXID      NETSNMP_ULTRIXID
#define HPUX10ID      NETSNMP_HPUX10ID
#define NETBSD1ID     NETSNMP_NETBSD1ID
#define FREEBSDID     NETSNMP_FREEBSDID
#define IRIXID        NETSNMP_IRIXID
#define LINUXID       NETSNMP_LINUXID
#define BSDIID        NETSNMP_BSDIID
#define OPENBSDID     NETSNMP_OPENBSDID
#define WIN32ID       NETSNMP_WIN32ID
#define HPUX11ID      NETSNMP_HPUX11ID
#define AIXID         NETSNMP_AIXID
#define MACOSXID      NETSNMP_MACOSXID
#define UNKNOWNID     NETSNMP_UNKNOWNID

#define ENTERPRISE_OID            NETSNMP_ENTERPRISE_OID
#define ENTERPRISE_MIB            NETSNMP_ENTERPRISE_MIB
#define ENTERPRISE_DOT_MIB        NETSNMP_ENTERPRISE_DOT_MIB
#define ENTERPRISE_DOT_MIB_LENGTH NETSNMP_ENTERPRISE_DOT_MIB_LENGTH

#define SYSTEM_MIB		  NETSNMP_SYSTEM_MIB
#define SYSTEM_DOT_MIB		  NETSNMP_SYSTEM_DOT_MIB
#define SYSTEM_DOT_MIB_LENGTH	  NETSNMP_SYSTEM_DOT_MIB_LENGTH

#define NOTIFICATION_MIB	    NETSNMP_NOTIFICATION_MIB	
#define NOTIFICATION_DOT_MIB	    NETSNMP_NOTIFICATION_DOT_MIB
#define NOTIFICATION_DOT_MIB_LENGTH NETSNMP_NOTIFICATION_DOT_MIB_LENGTH

#define UCDAVIS_OID		  NETSNMP_UCDAVIS_OID
#define UCDAVIS_MIB		  NETSNMP_UCDAVIS_MIB
#define UCDAVIS_DOT_MIB		  NETSNMP_UCDAVIS_DOT_MIB
#define UCDAVIS_DOT_MIB_LENGTH	  NETSNMP_UCDAVIS_DOT_MIB_LENGTH

#define ERRORTIMELENGTH NETSNMP_ERRORTIMELENGTH

#ifdef NETSNMP_PROCFIXCMD
# define PROCFIXCMD NETSNMP_PROCFIXCMD
#endif

#ifdef NETSNMP_EXECFIXCMD
# define EXECFIXCMD NETSNMP_EXECFIXCMD
#endif

#define EXCACHETIME  NETSNMP_EXCACHETIME
#define CACHEFILE    NETSNMP_CACHEFILE
#define MAXCACHESIZE NETSNMP_MAXCACHESIZE

#define DEFDISKMINIMUMSPACE NETSNMP_DEFDISKMINIMUMSPACE
#define DEFMAXLOADAVE NETSNMP_DEFMAXLOADAVE
#define MAXREADCOUNT NETSNMP_MAXREADCOUNT

#define SNMPBLOCK NETSNMP_SNMPBLOCK
#define RESTARTSLEEP NETSNMP_RESTARTSLEEP

#define NUM_COMMUNITIES	NETSNMP_NUM_COMMUNITIES

#ifdef NETSNMP_NO_ZEROLENGTH_COMMUNITY
# define NO_ZEROLENGTH_COMMUNITY NETSNMP_NO_ZEROLENGTH_COMMUNITY
#endif

#define LASTFIELD NETSNMP_LASTFIELD

#define CONFIGURE_OPTIONS NETSNMP_CONFIGURE_OPTIONS

#ifdef NETSNMP_TRANSPORT_UDP_DOMAIN
# define SNMP_TRANSPORT_UDP_DOMAIN NETSNMP_TRANSPORT_UDP_DOMAIN
#endif

#ifdef NETSNMP_TRANSPORT_CALLBACK_DOMAIN
# define SNMP_TRANSPORT_CALLBACK_DOMAIN NETSNMP_TRANSPORT_CALLBACK_DOMAIN
#endif

#ifdef NETSNMP_TRANSPORT_TCP_DOMAIN
# define SNMP_TRANSPORT_TCP_DOMAIN NETSNMP_TRANSPORT_TCP_DOMAIN
#endif

#ifdef NETSNMP_TRANSPORT_UNIX_DOMAIN
# define SNMP_TRANSPORT_UNIX_DOMAIN NETSNMP_TRANSPORT_UNIX_DOMAIN
#endif

#ifdef NETSNMP_TRANSPORT_AAL5PVC_DOMAIN
# define SNMP_TRANSPORT_AAL5PVC_DOMAIN NETSNMP_TRANSPORT_AAL5PVC_DOMAIN
#endif

#ifdef NETSNMP_TRANSPORT_IPX_DOMAIN
# define SNMP_TRANSPORT_IPX_DOMAIN NETSNMP_TRANSPORT_IPX_DOMAIN
#endif

#ifdef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
# define SNMP_TRANSPORT_UDPIPV6_DOMAIN NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
#endif

#ifdef NETSNMP_TRANSPORT_TCPIPV6_DOMAIN
# define SNMP_TRANSPORT_TCPIPV6_DOMAIN NETSNMP_TRANSPORT_TCPIPV6_DOMAIN
#endif

#ifdef NETSNMP_TRANSPORT_TLS_DOMAIN
# define SNMP_TRANSPORT_TLS_DOMAIN NETSNMP_TRANSPORT_TLS_DOMAIN
#endif

#ifdef NETSNMP_TRANSPORT_STD_DOMAIN
# define SNMP_TRANSPORT_STD_DOMAIN NETSNMP_TRANSPORT_STD_DOMAIN
#endif

#ifdef NETSNMP_SECMOD_USM
# define SNMP_SECMOD_USM NETSNMP_SECMOD_USM
#endif

#ifdef NETSNMP_SECMOD_KSM
# define SNMP_SECMOD_KSM NETSNMP_SECMOD_KSM
#endif

#ifdef NETSNMP_SECMOD_LOCALSM 
# define SNMP_SECMOD_LOCALSM NETSNMP_SECMOD_LOCALSM
#endif

#ifdef NETSNMP_REENTRANT
# define NS_REENTRANT NETSNMP_REENTRANT
#endif

#ifdef NETSNMP_ENABLE_IPV6
# define INET6 NETSNMP_ENABLE_IPV6
#endif

#ifdef NETSNMP_ENABLE_LOCAL_SMUX
# define LOCAL_SMUX NETSNMP_ENABLE_LOCAL_SMUX
#endif

#ifdef NETSNMP_AGENTX_DOM_SOCK_ONLY
# define AGENTX_DOM_SOCK_ONLY NETSNMP_AGENTX_DOM_SOCK_ONLY
#endif

#ifdef NETSNMP_SNMPTRAPD_DISABLE_AGENTX
# define SNMPTRAPD_DISABLE_AGENTX
#endif

#ifdef NETSNMP_USE_KERBEROS_MIT
# define MIT_NEW_CRYPTO NETSNMP_USE_KERBEROS_MIT
#endif

#ifdef NETSNMP_USE_KERBEROS_HEIMDAL
# define HEIMDAL NETSNMP_USE_KERBEROS_HEIMDAL
#endif

#ifdef NETSNMP_AGENTX_SOCKET
# define AGENTX_SOCKET NETSNMP_AGENTX_SOCKET
#endif

#ifdef NETSNMP_DISABLE_MIB_LOADING
# define DISABLE_MIB_LOADING NETSNMP_DISABLE_MIB_LOADING
#endif

#ifdef NETSNMP_DISABLE_SNMPV1
# define DISABLE_SNMPV1 NETSNMP_DISABLE_SNMPV1
#endif

#ifdef NETSNMP_DISABLE_SNMPV2C
# define DISABLE_SNMPV2C NETSNMP_DISABLE_SNMPV2C
#endif

#ifdef NETSNMP_DISABLE_SET_SUPPORT
# define DISABLE_SET_SUPPORT NETSNMP_DISABLE_SET_SUPPORT
#endif

#ifdef NETSNMP_DISABLE_DES
# define DISABLE_DES NETSNMP_DISABLE_DES
#endif

#ifdef NETSNMP_DISABLE_MD5
# define DISABLE_MD5 NETSNMP_DISABLE_MD5
#endif

#ifdef NETSNMP_DONT_USE_NLIST
# define DONT_USE_NLIST NETSNMP_DONT_USE_NLIST
#endif

#ifdef NETSNMP_CAN_USE_NLIST
# define CAN_USE_NLIST NETSNMP_CAN_USE_NLIST
#endif

#ifdef NETSNMP_CAN_USE_SYSCTL
# define CAN_USE_SYSCTL NETSNMP_CAN_USE_SYSCTL
#endif

#endif /* NETSNMP_NO_LEGACY_DEFINITIONS */


#endif /* NET_SNMP_CONFIG_H */
mib_api.h000064400000006624147511501100006320 0ustar00#ifndef NET_SNMP_MIB_API_H
#define NET_SNMP_MIB_API_H

    /**
     *  Library API routines concerned with MIB files and objects, and OIDs
     */

#include <net-snmp/types.h>

#ifdef __cplusplus
extern          "C" {
#endif

    /* Initialisation and Shutdown */
    NETSNMP_IMPORT
    int             add_mibdir(const char *);

    NETSNMP_IMPORT
    void            netsnmp_init_mib(void);
#ifndef NETSNMP_NO_LEGACY_DEFINITIONS
    NETSNMP_IMPORT
    void            init_mib(void);
    NETSNMP_IMPORT
    void            init_mib_internals(void);
#endif
    NETSNMP_IMPORT
    void            shutdown_mib(void);

     /* Reading and Parsing MIBs */
    NETSNMP_IMPORT
    struct tree    *netsnmp_read_module(const char *);
#ifndef NETSNMP_NO_LEGACY_DEFINITIONS
    NETSNMP_IMPORT
    struct tree    *read_module(const char *);
#endif

    NETSNMP_IMPORT
    struct tree    *read_mib(const char *);
    NETSNMP_IMPORT
    struct tree    *read_all_mibs(void);

    NETSNMP_IMPORT
    void            add_module_replacement(const char *, const char *,
                                           const char *, int);

         /* from ucd-compat.h */
    NETSNMP_IMPORT
    void            snmp_set_mib_warnings(int);
    NETSNMP_IMPORT
    void            snmp_set_mib_errors(int);
    NETSNMP_IMPORT
    void            snmp_set_save_descriptions(int);


     /* Searching the MIB Tree */
    NETSNMP_IMPORT
    int             read_objid(const char *, oid *, size_t *);
    NETSNMP_IMPORT
    oid            *snmp_parse_oid(const char *, oid *, size_t *);
    NETSNMP_IMPORT
    int             get_module_node(const char *, const char *, oid *, size_t *);

     /* Output */
    NETSNMP_IMPORT
    void            print_mib(FILE * fp);

    NETSNMP_IMPORT
    void            print_objid(const oid * objid, size_t objidlen);
    NETSNMP_IMPORT
    void           fprint_objid(FILE * fp,
                                const oid * objid, size_t objidlen);
    NETSNMP_IMPORT
    int           snprint_objid(char *buf, size_t buf_len,
                                const oid * objid, size_t objidlen);

    NETSNMP_IMPORT
    void            print_description(oid * objid, size_t objidlen, int width);
    NETSNMP_IMPORT
    void           fprint_description(FILE * fp,
                                oid * objid, size_t objidlen, int width);
    NETSNMP_IMPORT
    int           snprint_description(char *buf, size_t buf_len,
                                oid * objid, size_t objidlen, int width);

#ifdef __cplusplus
}
#endif

    /*
     *    Having extracted the main ("public API") calls relevant
     *  to this area of the Net-SNMP project, the next step is to
     *  identify the related "public internal API" routines.
     *
     *    In due course, these should probably be gathered
     *  together into a companion 'library/mib_api.h' header file.
     *  [Or some suitable name]
     *
     *    But for the time being, the expectation is that the
     *  traditional headers that provided the above definitions
     *  will probably also cover the relevant internal API calls.
     *  Hence they are listed here:
     */

#include <net-snmp/library/snmp_api.h>
#include <net-snmp/library/mib.h>
#ifndef NETSNMP_DISABLE_MIB_LOADING
#include <net-snmp/library/parse.h>
#endif
#include <net-snmp/library/callback.h>
#include <net-snmp/library/oid_stash.h>
#include <net-snmp/library/ucd_compat.h>

#endif                          /* NET_SNMP_MIB_API_H */
net-snmp-features.h000064400000001637147511501100010274 0ustar00#ifndef NETSNMP_FEATURES_H
#define NETSNMP_FEATURES_H

/* include files that are only needed if --enable-minimalist is on */
#ifdef NETSNMP_MINIMAL_CODE
#ifdef NETSNMP_FEATURE_CHECKING
#include <net-snmp/feature-details.h>
#else /* ! NETSNMP_FEATURE_CHECKING */
#include <net-snmp/library/features.h>
#ifndef NETSNMP_DISABLE_AGENT
#include <net-snmp/agent/features.h>
#include <net-snmp/agent/features-mibgroups.h>
#endif
#ifndef NETSNMP_DISABLE_APPS
#include <net-snmp/features-snmpnetstat.h>
#include <net-snmp/features-apps.h>
#endif
#endif /* ! NETSNMP_FEATURE_CHECKING */
#endif /* NETSNMP_MINIMAL_CODE */


/* prototypes always needed */
#ifndef NETSNMP_FEATURE_CHECKING
#define netsnmp_feature_provide(X)
#define netsnmp_feature_require(X)
#define netsnmp_feature_want(X)
#define netsnmp_feature_child_of(X, Y)
#endif

#define netsnmp_feature_unused(X) char netsnmp_feature_unused_ ## X

#endif /* NETSNMP_FEATURES_H */
utilities.h000064400000003764147511501100006735 0ustar00#ifndef NET_SNMP_UTILITIES_H
#define NET_SNMP_UTILITIES_H

    /**
     *  Library API routines not specifically concerned with SNMP directly,
     *    but used more generally within the library, agent and other applications.
     *
     *  This also includes "standard" system routines, which are missing on
     *    particular O/S distributiones.
     */

#ifndef NET_SNMP_CONFIG_H
#error "Please include <net-snmp/net-snmp-config.h> before this file"
#endif

#include <net-snmp/types.h>

    /*
     *  For the initial release, this will just refer to the
     *  relevant UCD header files.
     *    In due course, the routines relevant to this area of the
     *  API will be identified, and listed here directly.
     *
     *  But for the time being, this header file is a placeholder,
     *  to allow application writers to adopt the new header file names.
     */

#include <net-snmp/library/snmp_api.h>
#include <net-snmp/library/snmp_client.h>
#if HAVE_GETOPT_H
#include <getopt.h>
#else
#include <net-snmp/library/getopt.h>
#endif

#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>         /* for in_addr_t */
#endif
#include <net-snmp/library/system.h>
#include <net-snmp/library/tools.h>
#include <net-snmp/library/asn1.h>      /* for counter64 */
#include <net-snmp/library/int64.h>

#include <net-snmp/library/mt_support.h>
/*  #include <net-snmp/library/snmp_locking.h>  */
#include <net-snmp/library/snmp_alarm.h>
#include <net-snmp/library/callback.h>
#include <net-snmp/library/data_list.h>
#include <net-snmp/library/oid_stash.h>
#include <net-snmp/library/snmp.h>
#include <net-snmp/library/snmp_impl.h>
#include <net-snmp/library/snmp-tc.h>
#include <net-snmp/library/check_varbind.h>
#include <net-snmp/library/container.h>
#include <net-snmp/library/container_binary_array.h>
#include <net-snmp/library/container_list_ssll.h>
#include <net-snmp/library/container_iterator.h>

#include <net-snmp/library/snmp_assert.h>

#include <net-snmp/version.h>

#endif                          /* NET_SNMP_UTILITIES_H */
varbind_api.h000064400000010077147511501100007173 0ustar00#ifndef NET_SNMP_VARBIND_API_H
#define NET_SNMP_VARBIND_API_H

    /**
     *  Library API routines concerned with variable bindings and values.
     */

#include <net-snmp/types.h>

#ifdef __cplusplus
extern          "C" {
#endif

    /* Creation */
    NETSNMP_IMPORT
    netsnmp_variable_list *
       snmp_pdu_add_variable(netsnmp_pdu *pdu,
                                 const oid * name, size_t name_length,
                                 u_char type,
                                 const void * value, size_t len);
    NETSNMP_IMPORT
    netsnmp_variable_list *
       snmp_varlist_add_variable(netsnmp_variable_list ** varlist,
                                 const oid * name, size_t name_length,
                                 u_char type,
                                 const void * value, size_t len);
    NETSNMP_IMPORT
    netsnmp_variable_list *
       snmp_add_null_var(netsnmp_pdu *pdu,
                                 const oid * name, size_t name_length);
    NETSNMP_IMPORT
    netsnmp_variable_list *
       snmp_clone_varbind(netsnmp_variable_list * varlist);

    /* Setting Values */
    NETSNMP_IMPORT
    int             snmp_set_var_objid(netsnmp_variable_list * var,
                                       const oid * name, size_t name_length);
    NETSNMP_IMPORT
    int             snmp_set_var_value(netsnmp_variable_list * var,
                                       const void * value, size_t len);
    NETSNMP_IMPORT
    int             snmp_set_var_typed_value(netsnmp_variable_list * var,
                                       u_char type,
                                       const void * value, size_t len);
    NETSNMP_IMPORT
    int             snmp_set_var_typed_integer(netsnmp_variable_list * var,
                                       u_char type, long val);

     /* Output */
    NETSNMP_IMPORT
    void            print_variable(const oid * objid, size_t objidlen,
                                   const netsnmp_variable_list * variable);
    NETSNMP_IMPORT
    void           fprint_variable(FILE * fp,
                                   const oid * objid, size_t objidlen,
                                   const netsnmp_variable_list * variable);
    NETSNMP_IMPORT
    int           snprint_variable(char *buf, size_t buf_len,
                                   const oid * objid, size_t objidlen,
                                   const netsnmp_variable_list * variable);

    NETSNMP_IMPORT
    void             print_value(const oid * objid, size_t objidlen,
                                 const netsnmp_variable_list * variable);
    NETSNMP_IMPORT
    void            fprint_value(FILE * fp,
                                 const oid * objid, size_t objidlen,
                                 const netsnmp_variable_list * variable);
    NETSNMP_IMPORT
    int            snprint_value(char *buf, size_t buf_len,
                                 const oid * objid, size_t objidlen,
                                 const netsnmp_variable_list * variable);

           /* See mib_api.h for {,f,sn}print_objid */

    /* Deletion */
    NETSNMP_IMPORT
    void            snmp_free_var(    netsnmp_variable_list *var);     /* frees just this one */
    NETSNMP_IMPORT
    void            snmp_free_varbind(netsnmp_variable_list *varlist); /* frees all in list */

#ifdef __cplusplus
}
#endif

    /*
     *    Having extracted the main ("public API") calls relevant
     *  to this area of the Net-SNMP project, the next step is to
     *  identify the related "public internal API" routines.
     *
     *    In due course, these should probably be gathered
     *  together into a companion 'library/varbind_api.h' header file.
     *  [Or some suitable name]
     *
     *    But for the time being, the expectation is that the
     *  traditional headers that provided the above definitions
     *  will probably also cover the relevant internal API calls.
     *  Hence they are listed here:
     */
#include <net-snmp/library/snmp_api.h>
#include <net-snmp/library/snmp_client.h>
#include <net-snmp/library/mib.h>

#endif                          /* NET_SNMP_VARBIND_API_H */
system/svr5.h000064400000000722147511501100007134 0ustar00/*
 * used to minimally build SCO UnixWare 7.1.0 using CCS 3.2 compiler - YMMV 
 */

#include <net-snmp/system/generic.h>

/*
 * using CCS "cc", "configure" does not find this item 
 */
#define HAVE_GETHOSTBYNAME 1

/*
 * lie about this next define to avoid sa_len and sa_family MACROS !! 
 */
#define HAVE_STRUCT_SOCKADDR_SA_UNION_SA_GENERIC_SA_FAMILY2 1

/*
 * this header requires queue_t, not easily done without kernel headers 
 */
#undef HAVE_NETINET_IN_PCB_H
system/bsdi3.h000064400000000125147511501100007236 0ustar00#include "bsdi.h"
#define bsdi2 bsdi2             /* bsdi3 is a superset of bsdi2 */
system/darwin7.h000064400000000513147511501100007606 0ustar00#include <stdint.h>
#include "freebsd4.h"
#define darwin darwin
/*
 * Although Darwin does have an fstab.h file, getfsfile etc. always return null.
 * At least, as of 5.3.
 */
#undef HAVE_FSTAB_H

#define MBSTAT_SYMBOL "mbstat"
#undef TOTAL_MEMORY_SYMBOL

#define SWAPFILE_DIR "/private/var/vm"
#define SWAPFILE_PREFIX "swapfile"

system/freebsd10.h000064400000000132147511501100010003 0ustar00/* freebsd10 is a superset of freebsd9 */
#include "freebsd9.h"
#define freebsd9 freebsd9
system/irix.h000064400000001104147511501100007203 0ustar00/*
 * irix.h
 * 
 * Date Created:   Mon Feb 16 22:19:39 1998
 * Initial Author: Simon Leinen  <simon@switch.ch>
 */

#include <net-snmp/system/generic.h>

#undef TCP_TTL_SYMBOL
#define TCP_TTL_SYMBOL "tcp_ttl"

#undef IPSTAT_SYMBOL
#define NO_DOUBLE_ICMPSTAT
#undef ICMPSTAT_SYMBOL
#undef TCPSTAT_SYMBOL
#undef UDPSTAT_SYMBOL

#define _KMEMUSER 1

/*
 * don't define _KERNEL before including sys/unistd.h 
 */
#define NETSNMP_IFNET_NEEDS_KERNEL_LATE  1

#define STREAM_NEEDS_KERNEL_ISLANDS

#ifndef __GNUC__
#  undef NETSNMP_ENABLE_INLINE
#  define NETSNMP_ENABLE_INLINE 0
#endif
system/hpux.h000064400000003005147511501100007216 0ustar00#include "sysv.h"

#undef hpux
#define hpux hpux

#ifdef hpux11
#define NETSNMP_DONT_USE_NLIST 1
#endif

/* 
 * HP-UX needs _REENTRANT defined to pick up strtok_r.
 * Otherwise, at least for 64-bit code, strtok_r will not work 
 * and will make net-snmp segfault.
 */
#define _REENTRANT 1

#undef TCP_TTL_SYMBOL
#ifndef hpux11
#define TCP_TTL_SYMBOL "ipDefaultTTL"
#endif

#ifndef hpux11
/*
 * hpux specific 
 */
#define MIB_IPCOUNTER_SYMBOL "MIB_ipcounter"
#define MIB_TCPCOUNTER_SYMBOL "MIB_tcpcounter"
#define MIB_UDPCOUNTER_SYMBOL "MIB_udpcounter"
#endif

#if defined(hpux10) || defined(hpux11)
#undef SWDEVT_SYMBOL
#undef FSWDEVT_SYMBOL
#undef NSWAPFS_SYMBOL
#undef NSWAPDEV_SYMBOL
#undef LOADAVE_SYMBOL
#undef PROC_SYMBOL
#undef NPROC_SYMBOL
#undef TOTAL_MEMORY_SYMBOL
#undef MBSTAT_SYMBOL
#endif

#ifdef hpux11
#undef IPSTAT_SYMBOL
#undef TCP_SYMBOL
#undef TCPSTAT_SYMBOL
#undef UDB_SYMBOL
#undef UDPSTAT_SYMBOL
#undef ICMPSTAT_SYMBOL
#undef IP_FORWARDING_SYMBOL
#undef RTTABLES_SYMBOL
#undef RTHASHSIZE_SYMBOL
#undef RTHOST_SYMBOL
#undef RTNET_SYMBOL

#undef PHYSMEM_SYMBOL
#endif

#define rt_pad1 rt_refcnt

/*
 * disable inline for non-gcc compiler
 */
#ifndef __GNUC__
#  undef NETSNMP_ENABLE_INLINE
#  define NETSNMP_ENABLE_INLINE 0
#endif

/*
 * prevent sigaction being redefined to cma_sigaction
 * (causing build errors on HP-UX 10.20, at least)
 */
#ifdef hpux10
#ifndef _CMA_NOWRAPPERS_
#  define _CMA_NOWRAPPERS_ 1
#endif
#endif

/* define the extra mib modules that are supported */
#define NETSNMP_INCLUDE_HOST_RESOURCES
system/darwin17.h000064400000000046147511501100007670 0ustar00#include <net-snmp/system/darwin16.h>
system/mingw32msvc.h000064400000000351147511501100010412 0ustar00/*
 * This header is here to accomodate cross compiling for
 * Microsoft Windows on a linux host using MinGW. All changes
 * should be made to mingw32.h - Andy
 */
#ifndef mingw32
#define mingw32 mingw32
#endif

#include "mingw32.h"
system/solaris2.6.h000064400000000063147511501100010135 0ustar00#include "solaris.h"
#undef NETSNMP_DONT_USE_NLIST
system/openbsd.h000064400000000671147511501100007672 0ustar00#include "netbsd.h"

#define netbsd1 netbsd1         /* we're really close to this */
#define openbsd openbsd
#define UVM

#undef MBPOOL_SYMBOL
#undef MCLPOOL_SYMBOL
#undef TOTAL_MEMORY_SYMBOL

/* at least OpenBSD/SPARC 3.7 doesn't define this */
#ifndef UINT32_MAX
#define UINT32_MAX	(4294967295U)
#endif

/* define the extra mib modules that are supported */
#define NETSNMP_INCLUDE_HOST_RESOURCES
#define NETSNMP_INCLUDE_IFTABLE_REWRITES
system/mingw32.h000064400000004630147511501100007525 0ustar00/*
 * The Win32 API is maintained by the MinGW developers.
 * The licensing for the Win32 API is defined in the
 * MinGW file README.w32api, which states:

   "Unless otherwise stated in individual source files,

    THIS SOFTWARE IS NOT COPYRIGHTED

    This source code is offered for use in the public domain.  You may use,
    modify or distribute it freely.

    This source code is distributed in the hope that it will be useful but
    WITHOUT ANY WARRANTY.  ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
    DISCLAIMED.  This includes but is not limited to warranties of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
 
 */

/*
 * Make the getnameinfo() function available.
 * Note: according to MSDN getnameinfo() is available in ws2_32 on Windows 2000
 * and above. MinGW only makes getnameinfo() visible when setting _WIN32_WINNT
 * to 0x0501 (Windows XP) or higher, which is a bug in the MinGW 5.1.6 headers.
 */
#define _WIN32_WINNT 0x0501

#include <net-snmp/system/generic.h>

#ifdef HAVE_STDINT_H
#include <stdint.h>	/* uint32_t */
#endif

#undef bsdlike
#undef MBSTAT_SYMBOL
#undef TOTAL_MEMORY_SYMBOL
#undef HAVE_GETOPT_H
#undef HAVE_SOCKET
#undef HAVE_SIGNAL

/* Define if you have the gettimeofday function.  */
#define HAVE_GETTIMEOFDAY 1

/* Define if you have the gethostbyname function.  */
#define HAVE_GETHOSTBYNAME 1

/* Define if you have the gethostname function.  */
#define HAVE_GETHOSTNAME 1

/* Define if you have raise() instead of alarm() */
#define HAVE_RAISE 1

/* Define if you have the socket function.  */
#define HAVE_SOCKET 1

/* Define to 1 if you have the `execv' function. */
#undef HAVE_EXECV

/* Define to 1 if you have the `fork' function. */
#undef HAVE_FORK

/*
 * I'm sure there is a cleaner way to do this.
 * Probably should be in net_snmp_config.h and
 * set during config.
 */
#ifndef LOG_DAEMON
#define	LOG_DAEMON	(3<<3)	/* System daemons */
#endif

/* got socklen_t? */
#define HAVE_SOCKLEN_T 1

/* This was taken from the win32 config file - see licensing information above */
#define EADDRINUSE		WSAEADDRINUSE

/*
 * File io stuff. Odd that this is not defined by MinGW.
 * Maybe there is an M$ish way to do it.
 */
#define	F_SETFL		4
#define	O_NONBLOCK	0x4000  /* non blocking I/O (POSIX style) */

#ifndef HAVE_STRUCT_TIMEZONE_TZ_DSTTIME
/*
 * Older MinGW versions do not have struct timezone, so define it here.
 */
struct timezone {
	int tz_minuteswest;
	int tz_dsttime;
};
#endif

system/darwin16.h000064400000000046147511501100007667 0ustar00#include <net-snmp/system/darwin15.h>
system/freebsd11.h000064400000000136147511501100010010 0ustar00/* freebsd11 is a superset of freebsd10 */
#include "freebsd10.h"
#define freebsd10 freebsd10
system/freebsd2.h000064400000000273147511501100007732 0ustar00#include "freebsd.h"

/*
 * this is not good enough before freebsd3! 
 */
#undef HAVE_NET_IF_MIB_H
#undef PROC_SYMBOL
#undef NPROC_SYMBOL
#undef LOADAVE_SYMBOL
#undef TOTAL_MEMORY_SYMBOL
system/darwin14.h000064400000006610147511501100007670 0ustar00/*
 * While Darwin 10 (aka, Mac OS X 10.6 Snow Leopard) is "BSD-like", it differs
 * substantially enough to not warrant pretending it is a BSD flavor.
 * This first section are the vestigal BSD remnants.
 */
/* Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 */
/*
 * Portions of this file are copyrighted by:
 * Copyright (C) 2007 Apple, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */

/*
 * BSD systems use a different method of looking up sockaddr_in values 
 */
/* #define NEED_KLGETSA 1 */

#define CHECK_RT_FLAGS 1

/*
 * this is not good enough before freebsd3! 
 */
/* #undef HAVE_NET_IF_MIB_H */

/*
 * This section adds the relevant definitions from generic.h
 * (a file we don't include here)
 */

/*
 * udp_inpcb list symbol, e.g. for mibII/udpTable.c
 */
#define INP_NEXT_SYMBOL inp_next

/*
 * This section defines Mac OS X 10.5 (and later) specific additions.
 */
#define darwin 14
#ifndef darwin14
#   define darwin14 darwin
#endif

/*
 * Mac OS X should only use the modern API and definitions.
 */
#ifndef NETSNMP_NO_LEGACY_DEFINITIONS
#define NETSNMP_NO_LEGACY_DEFINITIONS 1
#endif

/*
 * looks like the IFTable stuff works better than the mibII versions
 */
 
#define NETSNMP_INCLUDE_IFTABLE_REWRITES

/*
 * use new host resources files as well
 */
#define NETSNMP_INCLUDE_HOST_RESOURCES
#define NETSNMP_INCLUDE_HRSWINST_REWRITES
#define NETSNMP_INCLUDE_HRSWRUN_REWRITES
#undef NETSNMP_INCLUDE_HRSWRUN_WRITE_SUPPORT
#define NETSNMP_CAN_GET_DISK_LABEL 1

/*
 * Enabling this restricts the compiler to mostly public APIs.
 */
#ifndef __APPLE_API_STRICT_CONFORMANCE
#define __APPLE_API_STRICT_CONFORMANCE 1
#endif
#ifndef __APPLE_API_UNSTABLE
#define __APPLE_API_UNSTABLE 1
#endif

/*
 * Darwin's tools are capable of building multiple architectures in one pass.
 * As a result, platform definitions should be deferred until compile time.
 */
#ifdef BYTE_ORDER
# undef WORDS_BIGENDIAN
# if BYTE_ORDER == BIG_ENDIAN
#  define WORDS_BIGENDIAN 1
# endif
#endif

/*
 * Although Darwin does have an fstab.h file, getfsfile etc. always return null.
 * At least, as of 5.3.
 */
#undef HAVE_FSTAB_H

#define SWAPFILE_DIR "/private/var/vm"
#define SWAPFILE_PREFIX "swapfile"

/*
 * These apparently used to be in netinet/tcp_timers.h, but went away in
 * 10.4.2. Define them here til we find out a way to get the real values.
 */
#define TCPTV_MIN       (  1*PR_SLOWHZ)         /* minimum allowable value */
#define TCPTV_REXMTMAX  ( 64*PR_SLOWHZ)         /* max allowable REXMT value */

/*
 * Because Mac OS X is built on Mach, it does not provide a BSD-compatible
 * VM statistics API.
 */
#define USE_MACH_HOST_STATISTICS 1

/*
 * This tells code that manipulates IPv6 that the structures are unified,
 * i.e., IPv4 and IPv6 use the same structs.
 * This should eventually be replaced with a configure directive.
 */
/* #define USE_UNIFIED_IPV6_STRUCTS 1 */
#undef STRUCT_in6pcb_HAS_inp_vflag

/*
 * utility macro used in several darwin specific files
 */
#define SNMP_CFRelease(x) do { if (x) { CFRelease(x); x = NULL; } } while(0)

/*
 * Mac OS X runs on both PPC and Intel hardware,
 *   which handle udpTable index values differently
 */
#include <TargetConditionals.h>
#ifdef TARGET_RT_LITTLE_ENDIAN
#define UDP_ADDRESSES_IN_HOST_ORDER 1
#endif
system/aix.h000064400000001026147511501100007014 0ustar00#include <net-snmp/system/generic.h>
#include <sys/select.h>
#undef TOTAL_MEMORY_SYMBOL
#undef NPROC_SYMBOL
#undef RTHASHSIZE_SYMBOL
#undef RTHOST_SYMBOL
#undef RTNET_SYMBOL

#undef RTTABLES_SYMBOL
#define RTTABLES_SYMBOL "rt_tables"

#ifndef __GNUC__
#  undef NETSNMP_ENABLE_INLINE
#  define NETSNMP_ENABLE_INLINE 0
#endif

/* define the extra mib modules that are supported */
#define NETSNMP_INCLUDE_HOST_RESOURCES

/* the legacy symbol NOACCESS clashes with the system headers. Remove it. */
#define NETSNMP_NO_LEGACY_DEFINITIONS
system/freebsd8.h000064400000000434147511501100007737 0ustar00/* freebsd8 is a superset of freebsd7 */
#include "freebsd7.h"
#define freebsd7 freebsd7

/*
 * Not completely sure when these fields got
 * added to FreeBSD, but FreeBSD 8 is about the oldest
 * one we care about, so add them here.
 */
#undef UTMP_HAS_NO_TYPE
#undef UTMP_HAS_NO_PID
system/cygwin.h000064400000000324147511501100007533 0ustar00#include <net-snmp/system/generic.h>

/* got socklen_t? */
#define HAVE_SOCKLEN_T 1

#ifdef HAVE_STDINT_H
#include <stdint.h>	/* uint32_t */
#endif

#undef bsdlike
#undef MBSTAT_SYMBOL
#undef TOTAL_MEMORY_SYMBOL
system/solaris2.5.h000064400000000117147511501100010134 0ustar00#include "solaris.h"
#undef _SLASH_PROC_METHOD_
#undef NETSNMP_DONT_USE_NLIST

system/solaris2.4.h000064400000000030147511501100010125 0ustar00#include "solaris2.5.h"
system/freebsd9.h000064400000000131147511501100007732 0ustar00/* freebsd9 is a superset of freebsd8 */
#include "freebsd8.h"
#define freebsd8 freebsd8
system/bsd.h000064400000000511147511501100007001 0ustar00#include <net-snmp/system/generic.h>

/*
 * the bsd route symbol adds an 's' at the end to this symbol name 
 */
#undef RTTABLES_SYMBOL
#define RTTABLES_SYMBOL "rt_tables"

/*
 * BSD systems use a different method of looking up sockaddr_in values 
 */
#define NEED_KLGETSA 1

#define UTMP_HAS_NO_TYPE 1
#define UTMP_HAS_NO_PID 1
system/darwin15.h000064400000000046147511501100007666 0ustar00#include <net-snmp/system/darwin14.h>
system/freebsd3.h000064400000000337147511501100007734 0ustar00#include "freebsd.h"

#define freebsd2 freebsd2       /* freebsd3 is a superset of freebsd2 */

#undef IFADDR_SYMBOL
#define IFADDR_SYMBOL "in_ifaddrhead"

#undef PROC_SYMBOL
#undef NPROC_SYMBOL

#undef TOTAL_MEMORY_SYMBOL
system/sysv.h000064400000000064147511501100007240 0ustar00#include <net-snmp/system/generic.h>
#define SYSV 1
system/freebsd12.h000064400000000136147511501100010011 0ustar00/* freebsd12 is a superset of freebsd11 */
#include "freebsd11.h"
#define freebsd11 freebsd11
system/freebsd7.h000064400000000131147511501100007730 0ustar00/* freebsd7 is a superset of freebsd6 */
#include "freebsd6.h"
#define freebsd6 freebsd6
system/darwin11.h000064400000006610147511501100007665 0ustar00/*
 * While Darwin 10 (aka, Mac OS X 10.6 Snow Leopard) is "BSD-like", it differs
 * substantially enough to not warrant pretending it is a BSD flavor.
 * This first section are the vestigal BSD remnants.
 */
/* Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 */
/*
 * Portions of this file are copyrighted by:
 * Copyright (C) 2007 Apple, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */

/*
 * BSD systems use a different method of looking up sockaddr_in values 
 */
/* #define NEED_KLGETSA 1 */

#define CHECK_RT_FLAGS 1

/*
 * this is not good enough before freebsd3! 
 */
/* #undef HAVE_NET_IF_MIB_H */

/*
 * This section adds the relevant definitions from generic.h
 * (a file we don't include here)
 */

/*
 * udp_inpcb list symbol, e.g. for mibII/udpTable.c
 */
#define INP_NEXT_SYMBOL inp_next

/*
 * This section defines Mac OS X 10.5 (and later) specific additions.
 */
#define darwin 11
#ifndef darwin11
#   define darwin11 darwin
#endif

/*
 * Mac OS X should only use the modern API and definitions.
 */
#ifndef NETSNMP_NO_LEGACY_DEFINITIONS
#define NETSNMP_NO_LEGACY_DEFINITIONS 1
#endif

/*
 * looks like the IFTable stuff works better than the mibII versions
 */
 
#define NETSNMP_INCLUDE_IFTABLE_REWRITES

/*
 * use new host resources files as well
 */
#define NETSNMP_INCLUDE_HOST_RESOURCES
#define NETSNMP_INCLUDE_HRSWINST_REWRITES
#define NETSNMP_INCLUDE_HRSWRUN_REWRITES
#undef NETSNMP_INCLUDE_HRSWRUN_WRITE_SUPPORT
#define NETSNMP_CAN_GET_DISK_LABEL 1

/*
 * Enabling this restricts the compiler to mostly public APIs.
 */
#ifndef __APPLE_API_STRICT_CONFORMANCE
#define __APPLE_API_STRICT_CONFORMANCE 1
#endif
#ifndef __APPLE_API_UNSTABLE
#define __APPLE_API_UNSTABLE 1
#endif

/*
 * Darwin's tools are capable of building multiple architectures in one pass.
 * As a result, platform definitions should be deferred until compile time.
 */
#ifdef BYTE_ORDER
# undef WORDS_BIGENDIAN
# if BYTE_ORDER == BIG_ENDIAN
#  define WORDS_BIGENDIAN 1
# endif
#endif

/*
 * Although Darwin does have an fstab.h file, getfsfile etc. always return null.
 * At least, as of 5.3.
 */
#undef HAVE_FSTAB_H

#define SWAPFILE_DIR "/private/var/vm"
#define SWAPFILE_PREFIX "swapfile"

/*
 * These apparently used to be in netinet/tcp_timers.h, but went away in
 * 10.4.2. Define them here til we find out a way to get the real values.
 */
#define TCPTV_MIN       (  1*PR_SLOWHZ)         /* minimum allowable value */
#define TCPTV_REXMTMAX  ( 64*PR_SLOWHZ)         /* max allowable REXMT value */

/*
 * Because Mac OS X is built on Mach, it does not provide a BSD-compatible
 * VM statistics API.
 */
#define USE_MACH_HOST_STATISTICS 1

/*
 * This tells code that manipulates IPv6 that the structures are unified,
 * i.e., IPv4 and IPv6 use the same structs.
 * This should eventually be replaced with a configure directive.
 */
/* #define USE_UNIFIED_IPV6_STRUCTS 1 */
#undef STRUCT_in6pcb_HAS_inp_vflag

/*
 * utility macro used in several darwin specific files
 */
#define SNMP_CFRelease(x) do { if (x) { CFRelease(x); x = NULL; } } while(0)

/*
 * Mac OS X runs on both PPC and Intel hardware,
 *   which handle udpTable index values differently
 */
#include <TargetConditionals.h>
#ifdef TARGET_RT_LITTLE_ENDIAN
#define UDP_ADDRESSES_IN_HOST_ORDER 1
#endif
system/kfreebsd.h000064400000000254147511501100010022 0ustar00#include "freebsd6.h"
#define freebsd6 freebsd6

#include <osreldate.h>
#define __FreeBSD_version __FreeBSD_kernel_version

#include <sys/queue.h>
#include <sys/_types.h>

system/linux.h000064400000000663147511501100007400 0ustar00#include "sysv.h"

#define NETSNMP_DONT_USE_NLIST 1

#undef NPROC_SYMBOL

#undef bsdlike

/* uncomment this to read process names from /proc/X/cmdline (like <= 5.0) */
/* #define USE_PROC_CMDLINE */

/*
 * red hat >= 5.0 doesn't have this 
 */
#ifndef MNTTYPE_PROC
#define MNTTYPE_PROC "proc"
#endif

/* define the extra mib modules that are supported */
#define NETSNMP_INCLUDE_HOST_RESOURCES
#define NETSNMP_INCLUDE_IFTABLE_REWRITES
system/dynix.h000064400000003643147511501100007375 0ustar00/*
 * dynix.h
 * 
 * Date Created: Sat Jan 12 10:50:50 BST 2002
 * Author:       Patrick Hess  <phess@hds.com>
 */

#include <net-snmp/system/generic.h>

/*
 * from s/sysv.h 
 */
#define SYSV 1

/*
 * to make these changes work... 
 */
/*
 * maybe I should have used _SEQUENT_ in all this code..  dunno 
 */
#define dynix dynix

#undef TOTAL_MEMORY_SYMBOL
#undef MBSTAT_SYMBOL

/*
 * Not enough alcohool in bloodstream [fmc] 
 */
#ifdef NPROC_SYMBOL
#undef NPROC_SYMBOL
#endif
/*
 * there might be a way to get NPROC...  this might work..  might not 
 */
/*
 * #define NPROC_SYMBOL "procNPROC" 
 */
#ifdef PROC_SYMBOL
#undef PROC_SYMBOL
#endif

/*
 * These definitions date from early BSD-based headers,
 *   and are included in modern NetBSD and OpenBSD distributions.
 * As such, the relevant copyright probably resides with UCB.
 */
#ifndef TCPTV_MIN
#define TCPTV_MIN       (1*PR_SLOWHZ)   /* minimum allowable value */
#endif
#ifndef TCPTV_REXMTMAX
#define TCPTV_REXMTMAX  (64*PR_SLOWHZ)  /* max allowable REXMT value */
#endif

/*
 * some of the system headers wanna include asm code...  let's not 
 */
#define __NO_ASM_MACRO 1

/*
 * Dynix doesn't seem to set this.  Guess I'll set it here 
 */
#ifndef L_SET
#define L_SET   SEEK_SET
#endif


/*
 * configure fails to detect these properly 
 */
/*
 * lives in libnsl.so 
 */
#define HAVE_GETHOSTNAME 1

/*
 * outta place...  lives in /usr/include/sys 
 */
#define  HAVE_NET_IF_DL_H 1

/*
 * got this library...  dunno why configure didn't find it 
 */
#define HAVE_LIBNSL 1

/*
 * My Dynix box has nearly 400 filesystems and well over 50 disks 
 */
/*
 * #define MAXDISKS 500  
 */

/*
 * lives in libsocket.so 
 */
#define HAVE_GETHOSTBYNAME 1

/*
 * Might as well include this here, since a significant
 * number of files seem to need it.  DTS 
 */
#if HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif

/* define the extra mib modules that are supported */
#define NETSNMP_INCLUDE_HOST_RESOURCES
system/openbsd4.h000064400000000130147511501100007744 0ustar00/* openbsd4 is a superset of openbsd3 */
#include "openbsd.h"
#define openbsd3 openbsd3
system/mips.h000064400000000062147511501100007202 0ustar00
#define NETSNMP_DONT_USE_NLIST 1

#undef bsdlike
system/ultrix4.h000064400000000246147511501100007651 0ustar00#include <net-snmp/system/generic.h>
#include <sys/types.h>

typedef int     ssize_t;

#undef TCP_TTL_SYMBOL
#define TCP_TTL_SYMBOL "tcp_ttl"

#undef RTTABLES_SYMBOL
system/netbsd.h000064400000003702147511501100007515 0ustar00#include "bsd.h"

#include <sys/param.h>

#define PCB_TABLE 1
#undef TCP_SYMBOL
#define TCP_SYMBOL "tcbtable"
#undef TCP_TTL_SYMBOL
#define TCP_TTL_SYMBOL "ip_defttl"
#undef UDB_SYMBOL
#define UDB_SYMBOL "udbtable"
#undef NPROC_SYMBOL
#undef PROC_SYMBOL

#define MBPOOL_SYMBOL	"mbpool"
#define MCLPOOL_SYMBOL	"mclpool"

/*
 * inp_next symbol 
 */
#define HAVE_INPCBTABLE 1
#undef INP_NEXT_SYMBOL
#undef INP_PREV_SYMBOL

#if __NetBSD_Version__ >= 700000001
#define INP_FIRST_SYMBOL inpt_queue.tqh_first
#define INP_NEXT_SYMBOL inp_queue.tqe_next
#define INP_PREV_SYMBOL inp_queue.tqe_prev
#else
#define INP_FIRST_SYMBOL inpt_queue.cqh_first
#define INP_NEXT_SYMBOL inp_queue.cqe_next
#define INP_PREV_SYMBOL inp_queue.cqe_prev
#endif

#if __NetBSD_Version__ >= 106300000       /* NetBSD 1.6ZD */            
#undef IFADDR_SYMBOL
#define IFADDR_SYMBOL "in_ifaddrhead"
#undef TOTAL_MEMORY_SYMBOL
#endif

#define UTMP_FILE _PATH_UTMP

#define UDP_ADDRESSES_IN_HOST_ORDER 1

#ifdef netbsdelf7
#define netbsd7
#define netbsdelf6
#endif
#ifdef netbsdelf6
#define netbsd6
#define netbsdelf5
#endif
#ifdef netbsdelf5
#define netbsd5
#define netbsdelf4
#endif
#ifdef netbsdelf4
#define netbsd4
#define netbsdelf3
#endif
#ifdef netbsdelf3
#define netbsd3
#endif

#if defined(netbsd8) && !defined(netbsd7)
#define netbsd7 netbsd7
#endif
#if defined(netbsd7) && !defined(netbsd6)
#define netbsd6 netbsd6
#endif
#if defined(netbsd6) && !defined(netbsd5)
#define netbsd5 netbsd5
#endif
#if defined(netbsd5) && !defined(netbsd4)
#define netbsd4 netbsd4
#endif
#if defined(netbsd4) && !defined(netbsd3)
#define netbsd3 netbsd3
#endif
#if defined(netbsd3) && !defined(netbsd2)
#define netbsd2 netbsd2
#endif
#ifndef netbsd1
#define netbsd1 netbsd1
#endif

#if __NetBSD_Version__ >= 499005800
#define NETBSD_STATS_VIA_SYSCTL
#endif /* __NetBSD_Version__ >= 499005800 */

/* define the extra mib modules that are supported */
#define NETSNMP_INCLUDE_HOST_RESOURCES
#define NETSNMP_INCLUDE_IFTABLE_REWRITES
system/openbsd5.h000064400000000546147511501100007760 0ustar00/* openbsd5 is a superset of all since openbsd3 */
#include "openbsd4.h"
#define openbsd4 openbsd4

#undef HAVE_NET_IF_VAR_H

#if OpenBSD >= 201605
#undef INP_FIRST_SYMBOL
#define INP_FIRST_SYMBOL inpt_queue.tqh_first
#undef INP_NEXT_SYMBOL
#define INP_NEXT_SYMBOL inp_queue.tqe_next
#undef INP_PREV_SYMBOL
#define INP_PREV_SYMBOL inp_queue.tqe_prev
#endif

system/darwin10.h000064400000006611147511501100007665 0ustar00/*
 * While Darwin 10 (aka, Mac OS X 10.6 Snow Leopard) is "BSD-like", it differs
 * substantially enough to not warrant pretending it is a BSD flavor.
 * This first section are the vestigal BSD remnants.
 */
/* Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 */
/*
 * Portions of this file are copyrighted by:
 * Copyright (C) 2007 Apple, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */

/*
 * BSD systems use a different method of looking up sockaddr_in values 
 */
/* #define NEED_KLGETSA 1 */

#define CHECK_RT_FLAGS 1

/*
 * this is not good enough before freebsd3! 
 */
/* #undef HAVE_NET_IF_MIB_H */

/*
 * This section adds the relevant definitions from generic.h
 * (a file we don't include here)
 */

/*
 * udp_inpcb list symbol, e.g. for mibII/udpTable.c
 */
#define INP_NEXT_SYMBOL inp_next

/*
 * This section defines Mac OS X 10.5 (and later) specific additions.
 */
#define darwin 10
#ifndef darwin10
#   define darwin10 darwin
#endif

/*
 * Mac OS X should only use the modern API and definitions.
 */
#ifndef NETSNMP_NO_LEGACY_DEFINITIONS
#define NETSNMP_NO_LEGACY_DEFINITIONS 1
#endif

/*
 * looks like the IFTable stuff works better than the mibII versions
 */
 
#define NETSNMP_INCLUDE_IFTABLE_REWRITES

/*
 * use new host resources files as well
 */
#define NETSNMP_INCLUDE_HOST_RESOURCES
#define NETSNMP_INCLUDE_HRSWINST_REWRITES
#define NETSNMP_INCLUDE_HRSWRUN_REWRITES
#undef NETSNMP_INCLUDE_HRSWRUN_WRITE_SUPPORT
#define NETSNMP_CAN_GET_DISK_LABEL 1

/*
 * Enabling this restricts the compiler to mostly public APIs.
 */
#ifndef __APPLE_API_STRICT_CONFORMANCE
#define __APPLE_API_STRICT_CONFORMANCE 1
#endif
#ifndef __APPLE_API_UNSTABLE
#define __APPLE_API_UNSTABLE 1
#endif

/*
 * Darwin's tools are capable of building multiple architectures in one pass.
 * As a result, platform definitions should be deferred until compile time.
 */
#ifdef BYTE_ORDER
# undef WORDS_BIGENDIAN
# if BYTE_ORDER == BIG_ENDIAN
#  define WORDS_BIGENDIAN 1
# endif
#endif

/*
 * Although Darwin does have an fstab.h file, getfsfile etc. always return null.
 * At least, as of 5.3.
 */
#undef HAVE_FSTAB_H

#define SWAPFILE_DIR "/private/var/vm"
#define SWAPFILE_PREFIX "swapfile"

/*
 * These apparently used to be in netinet/tcp_timers.h, but went away in
 * 10.4.2. Define them here til we find out a way to get the real values.
 */
#define TCPTV_MIN       (  1*PR_SLOWHZ)         /* minimum allowable value */
#define TCPTV_REXMTMAX  ( 64*PR_SLOWHZ)         /* max allowable REXMT value */

/*
 * Because Mac OS X is built on Mach, it does not provide a BSD-compatible
 * VM statistics API.
 */
#define USE_MACH_HOST_STATISTICS 1

/*
 * This tells code that manipulates IPv6 that the structures are unified,
 * i.e., IPv4 and IPv6 use the same structs.
 * This should eventually be replaced with a configure directive.
 */
/* #define USE_UNIFIED_IPV6_STRUCTS 1 */
#undef STRUCT_in6pcb_HAS_inp_vflag

/*
 * utility macro used in several darwin specific files
 */
#define SNMP_CFRelease(x) do { if (x) { CFRelease(x); x = NULL; } } while(0)

/*
 * Mac OS X runs on both PPC and Intel hardware,
 *   which handle udpTable index values differently
 */
#include <TargetConditionals.h>
#ifdef TARGET_RT_LITTLE_ENDIAN
#define UDP_ADDRESSES_IN_HOST_ORDER 1
#endif

system/freebsd6.h000064400000000131147511501100007727 0ustar00/* freebsd6 is a superset of freebsd5 */
#include "freebsd5.h"
#define freebsd5 freebsd5
system/sunos.h000064400000000373147511501100007406 0ustar00#include <net-snmp/system/generic.h>

typedef int     ssize_t;

#undef IP_FORWARDING_SYMBOL
#define IP_FORWARDING_SYMBOL "ip_forwarding"

#undef TCP_TTL_SYMBOL
#define TCP_TTL_SYMBOL "tcp_ttl"

#define UTMP_HAS_NO_TYPE 1
#define UTMP_FILE "/etc/utmp"
system/bsdi4.h000064400000000440147511501100007237 0ustar00#include "bsdi.h"
#define bsdi2 bsdi2             /* bsdi4 is a superset of bsdi2 */
#undef NPROC_SYMBOL
#undef PROC_SYMBOL

#define MNTTYPE_UFS	"ufs"
#define BerkelyFS	1
#define MNTTYPE_MSDOS	"msdos"
#define MNTTYPE_ISO9660 "cd9660"
#define MNTTYPE_NFS 	"nfs"
#define MNTTYPE_MFS 	"mfs"
system/bsdi.h000064400000000053147511501100007153 0ustar00#include "bsd.h"

#define CHECK_RT_FLAGS 1
system/solaris.h000064400000001561147511501100007713 0ustar00#include "sysv.h"

#undef bsdlike
#undef IP_FORWARDING_SYMBOL
#undef ICMPSTAT_SYMBOL
#undef TCPSTAT_SYMBOL
#undef TCP_SYMBOL
#undef UDPSTAT_SYMBOL
#undef UDB_SYMBOL
#undef RTTABLES_SYMBOL
#undef RTHASHSIZE_SYMBOL
#undef RTHOST_SYMBOL
#undef RTNET_SYMBOL
#undef IPSTAT_SYMBOL
#undef TCP_TTL_SYMBOL
#undef PROC_SYMBOL
#undef TOTAL_MEMORY_SYMBOL
#undef MBSTAT_SYMBOL

#define UDP_ADDRESSES_IN_HOST_ORDER 1
#define UDP_PORTS_IN_HOST_ORDER 1
#define TCP_PORTS_IN_HOST_ORDER 1

/* define the extra mib modules that are supported */
#define NETSNMP_INCLUDE_HOST_RESOURCES
#define NETSNMP_INCLUDE_IFTABLE_REWRITES

/* Solaris 2.6+ */
#define _SLASH_PROC_METHOD_ 1

/* Solaris 7+ */
#define NETSNMP_DONT_USE_NLIST 1

/*
 * NEW_MIB_COMPLIANT is a define used in Solaris 10U4+ to enable additional
 * MIB information (it affects the structs in <inet/mib2.h>)
 */ 
 
#define NEW_MIB_COMPLIANT
system/freebsd4.h000064400000000615147511501100007734 0ustar00#include "freebsd.h"

/*
 * freebsd4 is a superset of all since freebsd2
 */
#define freebsd2 freebsd2
#define freebsd3 freebsd3

#undef IFADDR_SYMBOL
#define IFADDR_SYMBOL "in_ifaddrhead"

#undef PROC_SYMBOL
#define PROC_SYMBOL "allproc"

#undef NPROC_SYMBOL
#define NPROC_SYMBOL "nprocs"

#undef TOTAL_MEMORY_SYMBOL

#undef MBSTAT_SYMBOL

#undef INP_NEXT_SYMBOL
#define INP_NEXT_SYMBOL inp_next
system/darwin12.h000064400000006610147511501100007666 0ustar00/*
 * While Darwin 10 (aka, Mac OS X 10.6 Snow Leopard) is "BSD-like", it differs
 * substantially enough to not warrant pretending it is a BSD flavor.
 * This first section are the vestigal BSD remnants.
 */
/* Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 */
/*
 * Portions of this file are copyrighted by:
 * Copyright (C) 2007 Apple, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */

/*
 * BSD systems use a different method of looking up sockaddr_in values 
 */
/* #define NEED_KLGETSA 1 */

#define CHECK_RT_FLAGS 1

/*
 * this is not good enough before freebsd3! 
 */
/* #undef HAVE_NET_IF_MIB_H */

/*
 * This section adds the relevant definitions from generic.h
 * (a file we don't include here)
 */

/*
 * udp_inpcb list symbol, e.g. for mibII/udpTable.c
 */
#define INP_NEXT_SYMBOL inp_next

/*
 * This section defines Mac OS X 10.5 (and later) specific additions.
 */
#define darwin 12
#ifndef darwin12
#   define darwin12 darwin
#endif

/*
 * Mac OS X should only use the modern API and definitions.
 */
#ifndef NETSNMP_NO_LEGACY_DEFINITIONS
#define NETSNMP_NO_LEGACY_DEFINITIONS 1
#endif

/*
 * looks like the IFTable stuff works better than the mibII versions
 */
 
#define NETSNMP_INCLUDE_IFTABLE_REWRITES

/*
 * use new host resources files as well
 */
#define NETSNMP_INCLUDE_HOST_RESOURCES
#define NETSNMP_INCLUDE_HRSWINST_REWRITES
#define NETSNMP_INCLUDE_HRSWRUN_REWRITES
#undef NETSNMP_INCLUDE_HRSWRUN_WRITE_SUPPORT
#define NETSNMP_CAN_GET_DISK_LABEL 1

/*
 * Enabling this restricts the compiler to mostly public APIs.
 */
#ifndef __APPLE_API_STRICT_CONFORMANCE
#define __APPLE_API_STRICT_CONFORMANCE 1
#endif
#ifndef __APPLE_API_UNSTABLE
#define __APPLE_API_UNSTABLE 1
#endif

/*
 * Darwin's tools are capable of building multiple architectures in one pass.
 * As a result, platform definitions should be deferred until compile time.
 */
#ifdef BYTE_ORDER
# undef WORDS_BIGENDIAN
# if BYTE_ORDER == BIG_ENDIAN
#  define WORDS_BIGENDIAN 1
# endif
#endif

/*
 * Although Darwin does have an fstab.h file, getfsfile etc. always return null.
 * At least, as of 5.3.
 */
#undef HAVE_FSTAB_H

#define SWAPFILE_DIR "/private/var/vm"
#define SWAPFILE_PREFIX "swapfile"

/*
 * These apparently used to be in netinet/tcp_timers.h, but went away in
 * 10.4.2. Define them here til we find out a way to get the real values.
 */
#define TCPTV_MIN       (  1*PR_SLOWHZ)         /* minimum allowable value */
#define TCPTV_REXMTMAX  ( 64*PR_SLOWHZ)         /* max allowable REXMT value */

/*
 * Because Mac OS X is built on Mach, it does not provide a BSD-compatible
 * VM statistics API.
 */
#define USE_MACH_HOST_STATISTICS 1

/*
 * This tells code that manipulates IPv6 that the structures are unified,
 * i.e., IPv4 and IPv6 use the same structs.
 * This should eventually be replaced with a configure directive.
 */
/* #define USE_UNIFIED_IPV6_STRUCTS 1 */
#undef STRUCT_in6pcb_HAS_inp_vflag

/*
 * utility macro used in several darwin specific files
 */
#define SNMP_CFRelease(x) do { if (x) { CFRelease(x); x = NULL; } } while(0)

/*
 * Mac OS X runs on both PPC and Intel hardware,
 *   which handle udpTable index values differently
 */
#include <TargetConditionals.h>
#ifdef TARGET_RT_LITTLE_ENDIAN
#define UDP_ADDRESSES_IN_HOST_ORDER 1
#endif
system/darwin8.h000064400000004314147511501100007612 0ustar00/*
 * While Darwin 8 (aka, Mac OS X 10.4 Tiger) is "BSD-like", it differs
 * substantially enough to not warrant pretending it is a BSD flavor.
 * This first section are the vestigal BSD remnants.
 */

/*
 * BSD systems use a different method of looking up sockaddr_in values 
 */
/* #define NEED_KLGETSA 1 */

#define CHECK_RT_FLAGS 1

/*
 * this is not good enough before freebsd3! 
 */
/* #undef HAVE_NET_IF_MIB_H */

/*
 * This section adds the relevant definitions from generic.h
 * (a file we don't include here)
 */

/*
 * udp_inpcb list symbol, e.g. for mibII/udpTable.c
 */
#define INP_NEXT_SYMBOL inp_next

/*
 * This section defines Mac OS X 10.4 (and later) specific additions.
 */
#define darwin 8

/*
 * Mac OS X should only use the modern API and definitions.
 */
#ifndef NETSNMP_NO_LEGACY_DEFINITIONS
#define NETSNMP_NO_LEGACY_DEFINITIONS 1
#endif

/*
 * (eventually) Enabling this forces the compiler to only use public APIs.
 */
/*#ifndef __APPLE_API_STRICT_CONFORMANCE
 *#define __APPLE_API_STRICT_CONFORMANCE 1
 *#endif
 */

/*
 * Darwin's tools are capable of building multiple architectures in one pass.
 * As a result, platform definitions should be deferred until compile time.
 */
#ifdef BYTE_ORDER
# undef WORDS_BIGENDIAN
# if BYTE_ORDER == BIG_ENDIAN
#  define WORDS_BIGENDIAN 1
# endif
#endif

/*
 * Although Darwin does have an fstab.h file, getfsfile etc. always return null.
 * At least, as of 5.3.
 */
#undef HAVE_FSTAB_H

#define SWAPFILE_DIR "/private/var/vm"
#define SWAPFILE_PREFIX "swapfile"

/*
 * These apparently used to be in netinet/tcp_timers.h, but went away in
 * 10.4.2. Define them here til we find out a way to get the real values.
 */
#define TCPTV_MIN       (  1*PR_SLOWHZ)         /* minimum allowable value */
#define TCPTV_REXMTMAX  ( 64*PR_SLOWHZ)         /* max allowable REXMT value */

/*
 * Because Mac OS X is built on Mach, it does not provide a BSD-compatible
 * VM statistics API.
 */
#define USE_MACH_HOST_STATISTICS 1

/*
 * This tells code that manipulates IPv6 that the structures are unified,
 * i.e., IPv4 and IPv6 use the same structs.
 * This should eventually be replaced with a configure directive.
 */
/* #define USE_UNIFIED_IPV6_STRUCTS 1 */
#undef STRUCT_in6pcb_HAS_inp_vflag

system/nto-qnx6.h000064400000001336147511501100007731 0ustar00#include "bsd.h"

#include <sys/param.h>

#define PCB_TABLE 1
#undef TCP_SYMBOL
#define TCP_SYMBOL "tcbtable"
#undef TCP_TTL_SYMBOL
#define TCP_TTL_SYMBOL "ip_defttl"
#undef UDB_SYMBOL
#define UDB_SYMBOL "udbtable"
#undef NPROC_SYMBOL
#undef PROC_SYMBOL

#define MBPOOL_SYMBOL	"mbpool"
#define MCLPOOL_SYMBOL	"mclpool"

/*
 * inp_next symbol 
 */
#undef INP_NEXT_SYMBOL
#define INP_NEXT_SYMBOL inp_queue.cqe_next
#undef INP_PREV_SYMBOL
#define INP_PREV_SYMBOL inp_queue.cqe_prev
#define HAVE_INPCBTABLE 1

#undef IFADDR_SYMBOL
#define IFADDR_SYMBOL "in_ifaddrhead"

#define UTMP_FILE _PATH_UTMP

#define UDP_ADDRESSES_IN_HOST_ORDER 1

/* define the extra mib modules that are supported */
/* #define NETSNMP_INCLUDE_HOST_RESOURCES */
system/solaris2.3.h000064400000000030147511501100010124 0ustar00#include "solaris2.5.h"
system/darwin.h000064400000000261147511501100007517 0ustar00#include "freebsd4.h"
#define darwin darwin
/*
 * Although Darwin does have an fstab.h file, getfsfile etc. always return null.
 * At least, as of 5.3.
 */
#undef HAVE_FSTAB_H

system/dragonfly.h000064400000000672147511501100010226 0ustar00#include "freebsd.h"

/*
 * dragonfly is a superset of freebsd4
 */
#define freebsd2 freebsd2
#define freebsd3 freebsd3
#define freebsd4 freebsd4
#define dragonfly dragonfly

#undef IFADDR_SYMBOL
#define IFADDR_SYMBOL "in_ifaddrhead"

#undef PROC_SYMBOL
#define PROC_SYMBOL "allproc"

#undef NPROC_SYMBOL
#define NPROC_SYMBOL "nprocs"

#undef TOTAL_MEMORY_SYMBOL

#undef MBSTAT_SYMBOL

#undef INP_NEXT_SYMBOL
#define INP_NEXT_SYMBOL inp_next
system/freebsd.h000064400000001025147511501100007644 0ustar00#include "bsd.h"

#define CHECK_RT_FLAGS 1

/*
 * udp_inpcb list symbol 
 */
#undef INP_NEXT_SYMBOL
#define INP_NEXT_SYMBOL inp_list.le_next

#undef INP_PREV_SYMBOL
#define INP_PREV_SYMBOL inp_list.le_prev

#undef TCP_TTL_SYMBOL
#define TCP_TTL_SYMBOL "ip_defttl"

#ifdef _PATH_UTMP
#define UTMP_FILE _PATH_UTMP
#else
#define UTMP_FILE "/var/run/utmp"
#endif

#define UDP_ADDRESSES_IN_HOST_ORDER 1

/* define the extra mib modules that are supported */
#define NETSNMP_INCLUDE_HOST_RESOURCES
#define NETSNMP_INCLUDE_IFTABLE_REWRITES
system/openbsd6.h000064400000000143147511501100007752 0ustar00/* openbsd6 is a superset of all since openbsd3 */
#include "openbsd5.h"
#define openbsd5 openbsd5
system/osf5.h000064400000001032147511501100007104 0ustar00#include <net-snmp/system/generic.h>

#define osf4 osf4

/* Needed by <sys/socket.h> to give us the correct sockaddr structures */
#ifndef _SOCKADDR_LEN
#define _SOCKADDR_LEN
#endif

#undef TCP_TTL_SYMBOL
#define TCP_TTL_SYMBOL "tcp_ttl"

/* var_route.c nlist symbols */
#undef RTTABLES_SYMBOL
#define RTTABLES_SYMBOL "rtable"
#undef RTHASHSIZE_SYMBOL
#define RTHASHSIZE_SYMBOL "rhash_size"

#ifndef __GNUC__
#  undef NETSNMP_ENABLE_INLINE
#  define NETSNMP_ENABLE_INLINE 0
#endif

#ifndef UINT32_MAX
#  define UINT32_MAX UINT_MAX
#endif
system/darwin9.h000064400000006531147511501100007616 0ustar00/*
 * While Darwin 9 (aka, Mac OS X 10.5 Leopard) is "BSD-like", it differs
 * substantially enough to not warrant pretending it is a BSD flavor.
 * This first section are the vestigal BSD remnants.
 */
/* Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 */
/*
 * Portions of this file are copyrighted by:
 * Copyright (C) 2007 Apple, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */

/*
 * BSD systems use a different method of looking up sockaddr_in values 
 */
/* #define NEED_KLGETSA 1 */

#define CHECK_RT_FLAGS 1

/*
 * this is not good enough before freebsd3! 
 */
/* #undef HAVE_NET_IF_MIB_H */

/*
 * This section adds the relevant definitions from generic.h
 * (a file we don't include here)
 */

/*
 * udp_inpcb list symbol, e.g. for mibII/udpTable.c
 */
#define INP_NEXT_SYMBOL inp_next

/*
 * This section defines Mac OS X 10.5 (and later) specific additions.
 */
#define darwin 9
#ifndef darwin9
#   define darwin9 darwin
#endif

/*
 * Mac OS X should only use the modern API and definitions.
 */
#ifndef NETSNMP_NO_LEGACY_DEFINITIONS
#define NETSNMP_NO_LEGACY_DEFINITIONS 1
#endif

/*
 * looks like the IFTable stuff works better than the mibII versions
 */
 
#define NETSNMP_INCLUDE_IFTABLE_REWRITES

/*
 * use new host resources files as well
 */
#define NETSNMP_INCLUDE_HRSWINST_REWRITES
#define NETSNMP_INCLUDE_HRSWRUN_REWRITES
#undef NETSNMP_INCLUDE_HRSWRUN_WRITE_SUPPORT
#define NETSNMP_CAN_GET_DISK_LABEL 1

/*
 * Enabling this restricts the compiler to mostly public APIs.
 */
#ifndef __APPLE_API_STRICT_CONFORMANCE
#define __APPLE_API_STRICT_CONFORMANCE 1
#endif
#ifndef __APPLE_API_UNSTABLE
#define __APPLE_API_UNSTABLE 1
#endif

/*
 * Darwin's tools are capable of building multiple architectures in one pass.
 * As a result, platform definitions should be deferred until compile time.
 */
#ifdef BYTE_ORDER
# undef WORDS_BIGENDIAN
# if BYTE_ORDER == BIG_ENDIAN
#  define WORDS_BIGENDIAN 1
# endif
#endif

/*
 * Although Darwin does have an fstab.h file, getfsfile etc. always return null.
 * At least, as of 5.3.
 */
#undef HAVE_FSTAB_H

#define SWAPFILE_DIR "/private/var/vm"
#define SWAPFILE_PREFIX "swapfile"

/*
 * These apparently used to be in netinet/tcp_timers.h, but went away in
 * 10.4.2. Define them here til we find out a way to get the real values.
 */
#define TCPTV_MIN       (  1*PR_SLOWHZ)         /* minimum allowable value */
#define TCPTV_REXMTMAX  ( 64*PR_SLOWHZ)         /* max allowable REXMT value */

/*
 * Because Mac OS X is built on Mach, it does not provide a BSD-compatible
 * VM statistics API.
 */
#define USE_MACH_HOST_STATISTICS 1

/*
 * This tells code that manipulates IPv6 that the structures are unified,
 * i.e., IPv4 and IPv6 use the same structs.
 * This should eventually be replaced with a configure directive.
 */
/* #define USE_UNIFIED_IPV6_STRUCTS 1 */
#undef STRUCT_in6pcb_HAS_inp_vflag

/*
 * utility macro used in several darwin specific files
 */
#define SNMP_CFRelease(x) do { if (x) { CFRelease(x); x = NULL; } } while(0)

/*
 * Mac OS X runs on both PPC and Intel hardware,
 *   which handle udpTable index values differently
 */
#include <TargetConditionals.h>
#ifdef TARGET_RT_LITTLE_ENDIAN
#define UDP_ADDRESSES_IN_HOST_ORDER 1
#endif

system/generic.h000064400000002526147511501100007655 0ustar00#ifndef __NET_SNMP_SYSTEM_GENERIC_H__
#define __NET_SNMP_SYSTEM_GENERIC_H__

#define bsdlike bsdlike

/*
 * nlist symbols in ip.c 
 */
#define IPSTAT_SYMBOL "ipstat"
#define IP_FORWARDING_SYMBOL "ipforwarding"
#define TCP_TTL_SYMBOL "tcpDefaultTTL"

/*
 * nlist symbols in interfaces.c 
 */
#define IFNET_SYMBOL "ifnet"
#define IFADDR_SYMBOL "in_ifaddr"

/*
 * load average lookup symbol 
 */
#define LOADAVE_SYMBOL "avenrun"

/*
 * nlist symbols in hr_proc.c and memory.c 
 */
#define PHYSMEM_SYMBOL "physmem"
#define TOTAL_MEMORY_SYMBOL "total"
#define MBSTAT_SYMBOL "mbstat"
#define SWDEVT_SYMBOL "swdevt"
#define FSWDEVT_SYMBOL "fswdevt"
#define NSWAPFS_SYMBOL "nswapfs"
#define NSWAPDEV_SYMBOL "nswapdev"

/*
 * process nlist symbols. 
 */
#define NPROC_SYMBOL "nproc"
#define PROC_SYMBOL "proc"

/*
 * icmp.c nlist symbols 
 */
#define ICMPSTAT_SYMBOL "icmpstat"

/*
 * tcp.c nlist symbols 
 */
#define TCPSTAT_SYMBOL "tcpstat"
#define TCP_SYMBOL "tcb"

/*
 * upd.c nlist symbols 
 */
#define UDPSTAT_SYMBOL "udpstat"
#define UDB_SYMBOL "udb"

/*
 * var_route.c nlist symbols 
 */
#define RTTABLES_SYMBOL "rt_table"
#define RTHASHSIZE_SYMBOL "rthashsize"
#define RTHOST_SYMBOL "rthost"
#define RTNET_SYMBOL "rtnet"

/*
 * udp_inpcb list symbol 
 */
#define INP_NEXT_SYMBOL inp_next
#define INP_PREV_SYMBOL inp_prev

#endif /* !__NET_SNMP_SYSTEM_GENERIC_H__ */
system/darwin13.h000064400000006610147511501100007667 0ustar00/*
 * While Darwin 10 (aka, Mac OS X 10.6 Snow Leopard) is "BSD-like", it differs
 * substantially enough to not warrant pretending it is a BSD flavor.
 * This first section are the vestigal BSD remnants.
 */
/* Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 */
/*
 * Portions of this file are copyrighted by:
 * Copyright (C) 2007 Apple, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */

/*
 * BSD systems use a different method of looking up sockaddr_in values 
 */
/* #define NEED_KLGETSA 1 */

#define CHECK_RT_FLAGS 1

/*
 * this is not good enough before freebsd3! 
 */
/* #undef HAVE_NET_IF_MIB_H */

/*
 * This section adds the relevant definitions from generic.h
 * (a file we don't include here)
 */

/*
 * udp_inpcb list symbol, e.g. for mibII/udpTable.c
 */
#define INP_NEXT_SYMBOL inp_next

/*
 * This section defines Mac OS X 10.5 (and later) specific additions.
 */
#define darwin 13
#ifndef darwin13
#   define darwin13 darwin
#endif

/*
 * Mac OS X should only use the modern API and definitions.
 */
#ifndef NETSNMP_NO_LEGACY_DEFINITIONS
#define NETSNMP_NO_LEGACY_DEFINITIONS 1
#endif

/*
 * looks like the IFTable stuff works better than the mibII versions
 */
 
#define NETSNMP_INCLUDE_IFTABLE_REWRITES

/*
 * use new host resources files as well
 */
#define NETSNMP_INCLUDE_HOST_RESOURCES
#define NETSNMP_INCLUDE_HRSWINST_REWRITES
#define NETSNMP_INCLUDE_HRSWRUN_REWRITES
#undef NETSNMP_INCLUDE_HRSWRUN_WRITE_SUPPORT
#define NETSNMP_CAN_GET_DISK_LABEL 1

/*
 * Enabling this restricts the compiler to mostly public APIs.
 */
#ifndef __APPLE_API_STRICT_CONFORMANCE
#define __APPLE_API_STRICT_CONFORMANCE 1
#endif
#ifndef __APPLE_API_UNSTABLE
#define __APPLE_API_UNSTABLE 1
#endif

/*
 * Darwin's tools are capable of building multiple architectures in one pass.
 * As a result, platform definitions should be deferred until compile time.
 */
#ifdef BYTE_ORDER
# undef WORDS_BIGENDIAN
# if BYTE_ORDER == BIG_ENDIAN
#  define WORDS_BIGENDIAN 1
# endif
#endif

/*
 * Although Darwin does have an fstab.h file, getfsfile etc. always return null.
 * At least, as of 5.3.
 */
#undef HAVE_FSTAB_H

#define SWAPFILE_DIR "/private/var/vm"
#define SWAPFILE_PREFIX "swapfile"

/*
 * These apparently used to be in netinet/tcp_timers.h, but went away in
 * 10.4.2. Define them here til we find out a way to get the real values.
 */
#define TCPTV_MIN       (  1*PR_SLOWHZ)         /* minimum allowable value */
#define TCPTV_REXMTMAX  ( 64*PR_SLOWHZ)         /* max allowable REXMT value */

/*
 * Because Mac OS X is built on Mach, it does not provide a BSD-compatible
 * VM statistics API.
 */
#define USE_MACH_HOST_STATISTICS 1

/*
 * This tells code that manipulates IPv6 that the structures are unified,
 * i.e., IPv4 and IPv6 use the same structs.
 * This should eventually be replaced with a configure directive.
 */
/* #define USE_UNIFIED_IPV6_STRUCTS 1 */
#undef STRUCT_in6pcb_HAS_inp_vflag

/*
 * utility macro used in several darwin specific files
 */
#define SNMP_CFRelease(x) do { if (x) { CFRelease(x); x = NULL; } } while(0)

/*
 * Mac OS X runs on both PPC and Intel hardware,
 *   which handle udpTable index values differently
 */
#include <TargetConditionals.h>
#ifdef TARGET_RT_LITTLE_ENDIAN
#define UDP_ADDRESSES_IN_HOST_ORDER 1
#endif
system/freebsd5.h000064400000000341147511501100007731 0ustar00/* freebsd5 is a superset of freebsd4 */
#include "freebsd4.h"
#define freebsd4 freebsd4

/* don't define _KERNEL on FreeBSD 5.3 even if configure thinks we need it */
#ifdef freebsd5
#undef NETSNMP_IFNET_NEEDS_KERNEL
#endif
session_api.h000064400000027157147511501100007240 0ustar00/*
 * Portions of this file are subject to the following copyright(s).  See
 * the Net-SNMP's COPYING file for more details and other copyrights
 * that may apply:
 *
 * Portions of this file are copyrighted by:
 * Copyright (c) 2016 VMware, Inc. All rights reserved.
 * Use is subject to license terms specified in the COPYING file
 * distributed with the Net-SNMP package.
 */

#ifndef NET_SNMP_SESSION_API_H
#define NET_SNMP_SESSION_API_H

    /**
     *  Library API routines concerned with specifying and using SNMP "sessions"
     *    including sending and receiving requests.
     */

#include <net-snmp/types.h>

#ifdef __cplusplus
extern          "C" {
#endif

    struct session_list;

    NETSNMP_IMPORT
    void            snmp_sess_init(netsnmp_session *);

    /*
     * netsnmp_session *snmp_open(session)
     *      netsnmp_session *session;
     *
     * Sets up the session with the snmp_session information provided
     * by the user.  Then opens and binds the necessary UDP port.
     * A handle to the created session is returned (this is different than
     * the pointer passed to snmp_open()).  On any error, NULL is returned
     * and snmp_errno is set to the appropriate error code.
     */
    NETSNMP_IMPORT
    netsnmp_session *snmp_open(netsnmp_session *);

    /*
     * int snmp_close(session)
     *     netsnmp_session *session;
     *
     * Close the input session.  Frees all data allocated for the session,
     * dequeues any pending requests, and closes any sockets allocated for
     * the session.  Returns 0 on error, 1 otherwise.
     *
     * snmp_close_sessions() does the same thing for all open sessions
     */
    NETSNMP_IMPORT
    int             snmp_close(netsnmp_session *);
    NETSNMP_IMPORT
    int             snmp_close_sessions(void);

    NETSNMP_IMPORT
    int
    _build_initial_pdu_packet(struct session_list *slp, netsnmp_pdu *pdu,
                              int bulk);

    /*
     * int snmp_send(session, pdu)
     *     netsnmp_session *session;
     *     netsnmp_pdu      *pdu;
     *
     * Sends the input pdu on the session after calling snmp_build to create
     * a serialized packet.  If necessary, set some of the pdu data from the
     * session defaults.  Add a request corresponding to this pdu to the list
     * of outstanding requests on this session, then send the pdu.
     * Returns the request id of the generated packet if applicable, otherwise 1.
     * (There is a special case: if the request id is 0, 1 will be returned).
     * On any error, 0 is returned.
     * The pdu is freed by snmp_send() unless a failure occured.
     */
    NETSNMP_IMPORT
    int             snmp_send(netsnmp_session *, netsnmp_pdu *);

    /*
     * int snmp_async_send(session, pdu, callback, cb_data)
     *     netsnmp_session *session;
     *     netsnmp_pdu      *pdu;
     *     netsnmp_callback callback;
     *     void   *cb_data;
     *
     * Sends the input pdu on the session after calling snmp_build to create
     * a serialized packet.  If necessary, set some of the pdu data from the
     * session defaults.  Add a request corresponding to this pdu to the list
     * of outstanding requests on this session and store callback and data,
     * then send the pdu.
     * Returns the request id of the generated packet if applicable, otherwise 1.
     * On any error, 0 is returned.
     * The pdu is freed by snmp_send() unless a failure occured.
     */
    NETSNMP_IMPORT
    int             snmp_async_send(netsnmp_session *, netsnmp_pdu *,
                                    netsnmp_callback, void *);


    /*
     * void snmp_read(fdset)
     *     fd_set  *fdset;
     *
     * Checks to see if any of the fd's set in the fdset belong to
     * snmp.  Each socket with it's fd set has a packet read from it
     * and snmp_parse is called on the packet received.  The resulting pdu
     * is passed to the callback routine for that session.  If the callback
     * routine returns successfully, the pdu and it's request are deleted.
     */
    NETSNMP_IMPORT
    void            snmp_read(fd_set *);

    /*
     * snmp_read2() is similar to snmp_read(), but accepts a pointer to a
     * large file descriptor set instead of a pointer to a regular file
     * descriptor set.
     */
    NETSNMP_IMPORT
    void            snmp_read2(netsnmp_large_fd_set *);


    NETSNMP_IMPORT
    int             snmp_synch_response(netsnmp_session *, netsnmp_pdu *,
                                        netsnmp_pdu **);

    /*
     * int snmp_select_info(numfds, fdset, timeout, block)
     * int *numfds;
     * fd_set   *fdset;
     * struct timeval *timeout;
     * int *block;
     *
     * Returns info about what snmp requires from a select statement.
     * numfds is the number of fds in the list that are significant.
     * All file descriptors opened for SNMP are OR'd into the fdset.
     * If activity occurs on any of these file descriptors, snmp_read
     * should be called with that file descriptor set.
     *
     * The timeout is the latest time that SNMP can wait for a timeout.  The
     * select should be done with the minimum time between timeout and any other
     * timeouts necessary.  This should be checked upon each invocation of select.
     * If a timeout is received, snmp_timeout should be called to check if the
     * timeout was for SNMP.  (snmp_timeout is idempotent)
     *
     * Block is 1 if the select is requested to block indefinitely, rather than
     * time out.  If block is input as 1, the timeout value will be treated as
     * undefined, but it must be available for setting in snmp_select_info.  On
     * return, if block is true, the value of timeout will be undefined.
     *
     * snmp_select_info returns the number of open sockets.  (i.e. The number
     * of sessions open)
     */
    NETSNMP_IMPORT
    int             snmp_select_info(int *, fd_set *, struct timeval *,
                                     int *);

    /*
     * snmp_select_info2() is similar to snmp_select_info(), but accepts a
     * pointer to a large file descriptor set instead of a pointer to a
     * regular file descriptor set.
     */
    NETSNMP_IMPORT
    int             snmp_select_info2(int *, netsnmp_large_fd_set *,
                                      struct timeval *, int *);

#define NETSNMP_SELECT_NOFLAGS  0x00
#define NETSNMP_SELECT_NOALARMS 0x01
    NETSNMP_IMPORT
    int             snmp_sess_select_info_flags(void *, int *, fd_set *,
                                                struct timeval *, int *, int);
    int             snmp_sess_select_info2_flags(void *, int *,
                                                 netsnmp_large_fd_set *,
                                                 struct timeval *, int *, int);

    /*
     * void snmp_timeout();
     *
     * snmp_timeout should be called whenever the timeout from snmp_select_info
     * expires, but it is idempotent, so snmp_timeout can be polled (probably a
     * cpu expensive proposition).  snmp_timeout checks to see if any of the
     * sessions have an outstanding request that has timed out.  If it finds one
     * (or more), and that pdu has more retries available, a new packet is formed
     * from the pdu and is resent.  If there are no more retries available, the
     * callback for the session is used to alert the user of the timeout.
     */

    NETSNMP_IMPORT
    void            snmp_timeout(void);

    /*
     * single session API.
     *
     * These functions perform similar actions as snmp_XX functions,
     * but operate on a single session only.
     *
     * Synopsis:
     
     void * sessp;
     netsnmp_session session, *ss;
     netsnmp_pdu *pdu, *response;
     
     snmp_sess_init(&session);
     session.retries = ...
     sessp = snmp_sess_open(&session);
     ss = snmp_sess_session(sessp);
     if (ss == NULL)
     exit(1);
     ...
     if (ss->community) free(ss->community);
     ss->community = strdup(gateway);
     ss->community_len = strlen(gateway);
     ...
     snmp_sess_synch_response(sessp, pdu, &response);
     ...
     snmp_sess_close(sessp);
     
     * See also:
     * snmp_sess_synch_response, in snmp_client.h.
     
     * Notes:
     *  1. Invoke snmp_sess_session after snmp_sess_open.
     *  2. snmp_sess_session return value is an opaque pointer.
     *  3. Do NOT free memory returned by snmp_sess_session.
     *  4. Replace snmp_send(ss,pdu) with snmp_sess_send(sessp,pdu)
     */

    NETSNMP_IMPORT
    void           *snmp_sess_open(netsnmp_session *);
    NETSNMP_IMPORT
    void           *snmp_sess_pointer(netsnmp_session *);
    NETSNMP_IMPORT
    netsnmp_session *snmp_sess_session(void *);
    NETSNMP_IMPORT
    netsnmp_session *snmp_sess_session_lookup(void *);
    NETSNMP_IMPORT
    netsnmp_session *snmp_sess_lookup_by_name(const char *paramName);

    /*
     * use return value from snmp_sess_open as void * parameter 
     */

    NETSNMP_IMPORT
    int             snmp_sess_send(void *, netsnmp_pdu *);
    NETSNMP_IMPORT
    int             snmp_sess_async_send(void *, netsnmp_pdu *,
                                         netsnmp_callback, void *);
    NETSNMP_IMPORT
    int             snmp_sess_select_info(void *, int *, fd_set *,
                                          struct timeval *, int *);
    NETSNMP_IMPORT
    int             snmp_sess_select_info2(void *, int *,
					   netsnmp_large_fd_set *,
                                           struct timeval *, int *);
    /*
     * Returns 0 if success, -1 if fail.
     */
    NETSNMP_IMPORT
    int             snmp_sess_read(void *, fd_set *);
    /*
     * Similar to snmp_sess_read(), but accepts a pointer to a large file
     * descriptor set instead of a pointer to a file descriptor set.
     */
    NETSNMP_IMPORT
    int             snmp_sess_read2(void *,
                                    netsnmp_large_fd_set *);
    NETSNMP_IMPORT
    void            snmp_sess_timeout(void *);
    NETSNMP_IMPORT
    int             snmp_sess_close(void *);

    NETSNMP_IMPORT
    int             snmp_sess_synch_response(void *, netsnmp_pdu *,
                                             netsnmp_pdu **);

#ifdef __cplusplus
}
#endif


    /*
     *    Having extracted the main ("public API") calls relevant
     *  to this area of the Net-SNMP project, the next step is to
     *  identify the related "public internal API" routines.
     *
     *    In due course, these should probably be gathered
     *  together into a companion 'library/session_api.h' header file.
     *  [Or some suitable name]
     *
     *    But for the time being, the expectation is that the
     *  traditional headers that provided the above definitions
     *  will probably also cover the relevant internal API calls.
     *  Hence they are listed here:
     */

#include <net-snmp/library/snmp_api.h>
#include <net-snmp/library/snmp_client.h>
#include <net-snmp/library/asn1.h>
#include <net-snmp/library/callback.h>

#include <net-snmp/library/snmp_transport.h>
#include <net-snmp/library/snmp_service.h>
#include <net-snmp/library/snmpCallbackDomain.h>
#ifdef NETSNMP_TRANSPORT_UNIX_DOMAIN
#include <net-snmp/library/snmpUnixDomain.h>
#endif
#ifdef NETSNMP_TRANSPORT_UDP_DOMAIN
#include <net-snmp/library/snmpUDPDomain.h>
#endif
#ifdef NETSNMP_TRANSPORT_TCP_DOMAIN
#include <net-snmp/library/snmpTCPDomain.h>
#endif
#ifdef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
#include <net-snmp/library/snmpUDPIPv6Domain.h>
#endif
#ifdef NETSNMP_TRANSPORT_TCPIPV6_DOMAIN
#include <net-snmp/library/snmpTCPIPv6Domain.h>
#endif
#ifdef NETSNMP_TRANSPORT_IPX_DOMAIN
#include <net-snmp/library/snmpIPXDomain.h>
#endif
#ifdef NETSNMP_TRANSPORT_AAL5PVC_DOMAIN
#include <net-snmp/library/snmpAAL5PVCDomain.h>
#endif

#include <net-snmp/library/ucd_compat.h>

#endif                          /* NET_SNMP_SESSION_API_H */
output_api.h000064400000015457147511501100007115 0ustar00#ifndef NET_SNMP_OUTPUT_API_H
#define NET_SNMP_OUTPUT_API_H

    /**
     *  Library API routines concerned with logging and message output
     *    (including error handling and debugging).
     */

#include <stdarg.h>	/* for va_list */
#include <net-snmp/types.h>
#include <net-snmp/library/netsnmp-attribute-format.h>

#ifdef __cplusplus
extern "C" {
#endif

    /* Error reporting */
    NETSNMP_IMPORT
    void    snmp_error(netsnmp_session *sess, int *clib_errorno,
                           int *snmp_errorno, char **errstring);
    NETSNMP_IMPORT
    void    snmp_sess_error(      void *sess, int *clib_errorno,
                           int *snmp_errorno, char **errstring);

    NETSNMP_IMPORT
    const char *snmp_api_errstring(int snmp_errorno);  /*  library errors */
    NETSNMP_IMPORT
    const char     *snmp_errstring(int snmp_errorno);  /* protocol errors */

    NETSNMP_IMPORT
    void    snmp_perror(const char *msg);   /* for parsing errors only */

    NETSNMP_IMPORT
    void    snmp_sess_perror(const char *msg, netsnmp_session *sess);
                                       /* for all other SNMP library errors */
    NETSNMP_IMPORT
    void    snmp_log_perror(const char *msg);
                                       /* for system library errors */

    /* Logging messages */

    NETSNMP_IMPORT
    int  snmp_log( int priority, const char *format, ...)
        NETSNMP_ATTRIBUTE_FORMAT(printf, 2, 3);
    NETSNMP_IMPORT
    int  snmp_vlog(int priority, const char *format, va_list ap);
    NETSNMP_IMPORT
    int  snmp_get_do_logging(    void);
    NETSNMP_IMPORT
    void netsnmp_logging_restart(void);
    NETSNMP_IMPORT
    void snmp_disable_log(       void);
    NETSNMP_IMPORT
    void shutdown_snmp_logging(  void);

#undef _LOG_ATTR

    /* Debug messages */
#ifndef NETSNMP_NO_DEBUGGING
#include <net-snmp/library/snmp_debug.h>	/* for internal macros */
#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
#define DEBUGTRACETOK(x)   do {if (_DBG_IF_) {__DBGTRACETOK(x);} }while(0)
#define DEBUGMSGL(x)       do {if (_DBG_IF_) {__DBGMSGL(x);} }while(0)
#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
#define DEBUGMSGSUBOID(x)  do {if (_DBG_IF_) {__DBGMSGSUBOID(x);} }while(0)
#define DEBUGMSGVAR(x)     do {if (_DBG_IF_) {__DBGMSGVAR(x);} }while(0)
#define DEBUGMSGOIDRANGE(x) do {if (_DBG_IF_) {__DBGMSGOIDRANGE(x);} }while(0)
#define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
#define DEBUGMSGHEXTLI(x)  do {if (_DBG_IF_) {__DBGMSGHEXTLI(x);} }while(0)
#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
#define DEBUGINDENTMORE()  do {if (_DBG_IF_) {__DBGINDENTMORE();} }while(0)
#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
#define DEBUGPRINTINDENT(token) \
	do {if (_DBG_IF_) {__DBGPRINTINDENT(token);} }while(0)
#define DEBUGDUMPHEADER(token,x) \
	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
#define DEBUGDUMPSECTION(token,x) \
	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
#define DEBUGDUMPSETUP(token,buf,len) \
	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
#define DEBUGMSG_NC(x)  do { __DBGMSG_NC(x); }while(0)
#define DEBUGMSGT_NC(x) do { __DBGMSGT_NC(x); }while(0)

#else        /* NETSNMP_NO_DEBUGGING := enable streamlining of the code */

NETSNMP_STATIC_INLINE void
netsnmp_debug_no_msg(const char *token, const char *fmt, ...)
{ }

NETSNMP_STATIC_INLINE void
netsnmp_debug_no_tracetok(const char *token)
{ }

NETSNMP_STATIC_INLINE void
netsnmp_debug_no_oid(const char *token, const oid *oid, size_t oid_len)
{ }

struct variable_list;

NETSNMP_STATIC_INLINE void
netsnmp_debug_no_var(const char *token, const struct variable_list *var)
{ }

NETSNMP_STATIC_INLINE void
netsnmp_debug_no_dumpsetup(const char *token, const void *buf, size_t len)
{ }

#define DEBUGMSG(x)			do { netsnmp_debug_no_msg x; } while (0)
#define DEBUGMSGT(x)			do { netsnmp_debug_no_msg x; } while (0)
#define DEBUGTRACE			do { } while (0)
#define DEBUGTRACETOK(x)                                \
    do { netsnmp_debug_no_tracetok(x); } while (0)
#define DEBUGMSGL(x)			do { netsnmp_debug_no_msg x; } while (0)
#define DEBUGMSGTL(x)			do { netsnmp_debug_no_msg x; } while (0)
#define DEBUGMSGOID(x)			do { netsnmp_debug_no_oid x; } while (0)
#define DEBUGMSGSUBOID(x)		do { netsnmp_debug_no_oid x; } while (0)
#define DEBUGMSGVAR(x)			do { netsnmp_debug_no_var x; } while (0)
#define DEBUGMSGOIDRANGE(x)
#define DEBUGMSGHEX(x)
#define DEBUGIF(x)        if(0)
#define DEBUGDUMP(t,b,l,p)
#define DEBUGINDENTMORE()
#define DEBUGINDENTLESS()
#define DEBUGINDENTADD(x)
#define DEBUGMSGHEXTLI(x)
#define DEBUGPRINTINDENT(token)
#define DEBUGDUMPHEADER(token,x)
#define DEBUGDUMPSECTION(token,x)
#define DEBUGDUMPSETUP(token, buf, len)                                 \
    do { netsnmp_debug_no_dumpsetup(token, buf, len); } while (0)

#define DEBUGMSG_NC(x)			do { netsnmp_debug_no_msg x; } while (0)
#define DEBUGMSGT_NC(x)			do { netsnmp_debug_no_msg x; } while (0)

#endif    /* NETSNMP_NO_DEBUGGING */

    NETSNMP_IMPORT
    void            debug_register_tokens(const char *tokens);
    NETSNMP_IMPORT
    int             debug_enable_token_logs (const char *token);
    NETSNMP_IMPORT
    int             debug_disable_token_logs (const char *token);
    NETSNMP_IMPORT
    int             debug_is_token_registered(const char *token);
    NETSNMP_IMPORT
    void            snmp_set_do_debugging(int);
    NETSNMP_IMPORT
    int             snmp_get_do_debugging(void);
#ifndef NETSNMP_DISABLE_DYNAMIC_LOG_LEVEL
    NETSNMP_IMPORT
    void            netsnmp_set_debug_log_level(int val);
    NETSNMP_IMPORT
    int             netsnmp_get_debug_log_level(void);
#endif /* NETSNMP_DISABLE_DYNAMIC_LOG_LEVEL */

    /*
     *    Having extracted the main ("public API") calls relevant
     *  to this area of the Net-SNMP project, the next step is to
     *  identify the related "public internal API" routines.
     *
     *    In due course, these should probably be gathered
     *  together into a companion 'library/output_api.h' header file.
     *  [Or some suitable name]
     *
     *    But for the time being, the expectation is that the
     *  traditional headers that provided the above definitions
     *  will probably also cover the relevant internal API calls.
     *  Hence they are listed here:
     */

#ifdef __cplusplus
}
#endif

#include <net-snmp/library/snmp_api.h>
#include <net-snmp/library/snmp_client.h>
#include <net-snmp/library/snmp_debug.h>
#include <net-snmp/library/snmp_logging.h>

#ifndef ERROR_MSG
#define ERROR_MSG(string)	snmp_set_detail(string)
#endif

#endif                          /* NET_SNMP_OUTPUT_API_H */
config_api.h000064400000007713147511501100007016 0ustar00#ifndef NET_SNMP_CONFIG_API_H
#define NET_SNMP_CONFIG_API_H

    /**
     *  Library API routines concerned with configuration and control
     *    of the behaviour of the library, agent and other applications.
     */

#include <net-snmp/types.h>

#ifdef __cplusplus
extern          "C" {
#endif

    /* Config Handlers */
    NETSNMP_IMPORT
    struct config_line *register_config_handler(const char *filePrefix,
                                                const char *token,
                                                void (*parser) (const char *, char *),
                                                void (*releaser) (void),
                                                const char *usageLine);
    NETSNMP_IMPORT
    struct config_line *register_const_config_handler(const char *filePrefix,
                                  const char *token,
                                  void (*parser) (const char *, const char *),
                                  void (*releaser) (void),
                                  const char *usageLine);
    NETSNMP_IMPORT
    struct config_line *register_prenetsnmp_mib_handler(const char *filePrefix,
                                                const char *token,
                                                void (*parser) (const char *, char *),
                                                void (*releaser) (void),
                                                const char *usageLine);
    NETSNMP_IMPORT
    void            unregister_config_handler(const char *filePrefix, const char *token);

    				/* Defined in mib.c, rather than read_config.c */
    void            register_mib_handlers(void);
    void            unregister_all_config_handlers(void);

    /* Application Handlers */
    NETSNMP_IMPORT
    struct config_line *register_app_config_handler(
                                                const char *token,
                                                void (*parser) (const char *, char *),
                                                void (*releaser) (void),
                                                const char *usageLine);

    NETSNMP_IMPORT
    struct config_line *register_app_prenetsnmp_mib_handler(
                                                const char *token,
                                                void (*parser) (const char *, char *),
                                                void (*releaser) (void),
                                                const char *usageLine);
    NETSNMP_IMPORT
    void            unregister_app_config_handler(                    const char *token);

    /* Reading Config Files */
    NETSNMP_IMPORT
    void            read_configs(void);
    NETSNMP_IMPORT
    void            read_premib_configs(void);

    /* Help Strings and Errors */
    NETSNMP_IMPORT
    void            read_config_print_usage(const char *lead);
    NETSNMP_IMPORT
    void            config_perror(const char *);
    NETSNMP_IMPORT
    void            config_pwarn(const char *);

#ifdef __cplusplus
}
#endif

    /*
     *    Having extracted the main ("public API") calls relevant
     *  to this area of the Net-SNMP project, the next step is to
     *  identify the related "public internal API" routines.
     *
     *    In due course, these should probably be gathered
     *  together into a companion 'library/config_api.h' header file.
     *  [Or some suitable name]
     *
     *    But for the time being, the expectation is that the
     *  traditional headers that provided the above definitions
     *  will probably also cover the relevant internal API calls.
     *  Hence they are listed here:
     */
#include <net-snmp/library/snmp_api.h>

#include <net-snmp/library/read_config.h>
#include <net-snmp/library/default_store.h>

#include <stdio.h>              /* for FILE definition */
#include <net-snmp/library/snmp_parse_args.h>
#include <net-snmp/library/snmp_enum.h>
#include <net-snmp/library/vacm.h>

#endif                          /* NET_SNMP_CONFIG_API_H */
machine/generic.h000064400000000055147511501100007730 0ustar00/*
 * chip specific definitions go here 
 */
net-snmp-includes.h000064400000003047147511501100010261 0ustar00#ifndef NET_SNMP_INCLUDES_H
#define NET_SNMP_INCLUDES_H

    /**
     *  Convenience header file to pull in the full
     *     Net-SNMP library API in one go, together with
     *     certain commonly-required system header files.
     */


    /*
     *  Common system header requirements
     */
#include <stdio.h>
#include <sys/types.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif

#ifndef NET_SNMP_CONFIG_H
#error "Please include <net-snmp/net-snmp-config.h> before this file"
#endif

#if HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif

#if HAVE_STDLIB_H
#include <stdlib.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif

#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
#  include <sys/time.h>
# else
#  include <time.h>
# endif
#endif

/*
 * Must be right after system headers, but before library code for best usage 
 */
#if HAVE_DMALLOC_H
#include <dmalloc.h>
#endif

  /*
   * The check for missing 'in_addr_t' is handled
   * within the main net-snmp-config.h file 
   */


    /*
     *  The full Net-SNMP API
     */
#include <net-snmp/definitions.h>
#include <net-snmp/types.h>

#include <net-snmp/library/getopt.h>
#include <net-snmp/utilities.h>
#include <net-snmp/session_api.h>
#include <net-snmp/pdu_api.h>
#include <net-snmp/mib_api.h>
#include <net-snmp/varbind_api.h>
#include <net-snmp/config_api.h>
#include <net-snmp/output_api.h>
#include <net-snmp/snmpv3_api.h>

#endif                          /* NET_SNMP_INCLUDES_H */
© 2025 GrazzMean