shell bypass 403

GrazzMean Shell

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.147.73.110
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : library.zip
PK)6FZ��)Requests.phpnu�[���<?php
/**
 * Loads the old Requests class file when the autoloader
 * references the original PSR-0 Requests class.
 *
 * @deprecated 6.2.0
 * @package WordPress
 * @subpackage Requests
 * @since 6.2.0
 */

include_once ABSPATH . WPINC . '/class-requests.php';
PK��FZ�����	winpipe.hnu�[���/*
  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

PK��FZ��0r��snmpv3-security-includes.hnu�[���/* This file is automatically generated by configure.  Do not modify by hand. */
#include <net-snmp/library/snmptsm.h>
#include <net-snmp/library/snmpusm.h>
PK��FZyk#�F�Fcontainer.hnu�[���/* 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 */
PK��FZ*�p�snmpTCPBaseDomain.hnu�[���#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 */
PK��FZl�m
lcd_time.hnu�[���/*
 * 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 */
PK��FZ��a���data_list.hnu�[���/* 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
/** @} */
PK��FZ̙�KyysnmpIPv4BaseDomain.hnu�[���/* 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 */
PK��FZ�Ϥp��scapi.hnu�[���/*
 * 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 */
PK��FZx��ߠ�snmp_enum.hnu�[���#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 */
PK��FZPkܠsnmpTCPIPv6Domain.hnu�[���#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*/
PK��FZ���nRRcontainer_null.hnu�[���#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 */
PK��FZ�+�&��mt_support.hnu�[���/*
 * 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  */
PK��FZ-Y,�SSsnmpUnixDomain.hnu�[���#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*/
PK��FZ��%%snmpv3.hnu�[���/*
 * 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 */
PK��FZr����	�	container_iterator.hnu�[���/**
 * @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_ */
/** @} */
PK��FZ�يs,,
snmp_secmod.hnu�[���#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 */
PK��FZ�`~GGsnmpIPv6BaseDomain.hnu�[���/* 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 */

PK��FZ|7�%�%vacm.hnu�[���/*
 * 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 */
PK��FZ��*���system.hnu�[���#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 */
PK��FZ�v��oid_stash.hnu�[���#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 */
PK��FZ-��dir_utils.hnu�[���/* 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 */
PK��FZ����"�"parse.hnu�[���#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 */
PK��FZ�9��container_binary_array.hnu�[���/*
 * 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
PK��FZ��:��ucd_compat.hnu�[���/*
 *  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 */
PK��FZ��0�--snmp_service.hnu�[���#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 */
PK��FZ������getopt.hnu�[���#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
PK��FZç�$��
snmp_client.hnu�[���/*
 * 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 */
PK��FZp�h���snmpUDPIPv4BaseDomain.hnu�[���/* 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 */
PK��FZe�ds�1�1snmp_transport.hnu�[���#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*/
PK��FZev8��types.hnu�[���#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 */
PK��FZoN̔��snmpSocketBaseDomain.hnu�[���#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 */
PK��FZH&�$::snmpCallbackDomain.hnu�[���#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*/
PK��FZ#WC-�
�
md5.hnu�[���/*
 * ** **************************************************************************
 * ** 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 */
PK��FZ��r�KKasn1.hnu�[���#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 */
PK��FZn�C!C!cert_util.hnu�[���#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 */

PK��FZ�#��snmp_parse_args.hnu�[���#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
PK��FZ\��)�w�w
snmp_api.hnu�[���/* 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 */
PK��FZ��K�M?M?	snmpusm.hnu�[���/*
 * 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 */
PK��FZoxQ�
�

callback.hnu�[���/*
 * 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 */
PK��FZ�~��check_varbind.hnu�[���#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 */
PK��FZ�;9�D
D
READMEnu�[���One 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
PK��FZ�fƜ��snmpUDPDomain.hnu�[���#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*/
PK��FZFb	���
read_config.hnu�[���/*
 *  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 */
PK��FZ;�j���container_list_ssll.hnu�[���/*
 * 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 */
PK��FZS�
�&&snmpTLSTCPDomain.hnu�[���#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*/
PK��FZ�ģ_��snmpTLSBaseDomain.hnu�[���#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*/
PK��FZ�q����snmp_logging.hnu�[���#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 */
PK��FZ������snmp_impl.hnu�[���#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 */
PK��FZ���i�	�	snmp_alarm.hnu�[���#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 */
PK��FZvwinservice.hnu�[���#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 */

PK��FZ�a���4�4default_store.hnu�[���/* 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 */
/** @} */
PK��FZ�k�Cfd_event_manager.hnu�[���/**************************************************************************
 * 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
PK��FZ%��uusnmpTCPDomain.hnu�[���#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*/
PK��FZ0�$���snmpUDPBaseDomain.hnu�[���#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 */
PK��FZ�T�8��file_utils.hnu�[���#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 */
PK��FZ$)�PP	snmp-tc.hnu�[���#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 */
PK��FZb�s�>>oid.hnu�[���#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 */
PK��FZT��y	y	transform_oids.hnu�[���#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
PK��FZ����6�6snmp.hnu�[���#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 */
PK��FZ�y@�\\snmpDTLSUDPDomain.hnu�[���#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*/
PK��FZl���netsnmp-attribute-format.hnu�[���#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_ */
PK��FZ<����snmpAliasDomain.hnu�[���#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*/
PK��FZZ�!�#	#	
keytools.hnu�[���/*
 * 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 */
PK��FZ�D�**large_fd_set.hnu�[���/**
 * @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 */
PK��FZ���A&A&tools.hnu�[���/**
 * @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 */
/* @} */
PK��FZ7�1j��	snmptsm.hnu�[���/*
 * 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 */
PK��FZ-���
�
text_utils.hnu�[���#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 */
PK��FZͩ�W	factory.hnu�[���#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 */
PK��FZ��P��int64.hnu�[���#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
PK��FZD�e�k_k_mib.hnu�[���#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 */
PK��FZ��v�	�	snmpUDPIPv6Domain.hnu�[���#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*/
PK��FZ�Zy�1$1$snmp_debug.hnu�[���/*
 * 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 */
PK��FZw���
snmp_assert.hnu�[���#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 */
PK)6FZ��)Requests.phpnu�[���PK��FZ�����	Awinpipe.hnu�[���PK��FZ��0r��Msnmpv3-security-includes.hnu�[���PK��FZyk#�F�F4	container.hnu�[���PK��FZ*�p��OsnmpTCPBaseDomain.hnu�[���PK��FZl�m
8Rlcd_time.hnu�[���PK��FZ��a���xbdata_list.hnu�[���PK��FZ̙�KyyPrsnmpIPv4BaseDomain.hnu�[���PK��FZ�Ϥp��
wscapi.hnu�[���PK��FZx��ߠ�
�snmp_enum.hnu�[���PK��FZPkܠ�snmpTCPIPv6Domain.hnu�[���PK��FZ���nRR3�container_null.hnu�[���PK��FZ�+�&��ūmt_support.hnu�[���PK��FZ-Y,�SSгsnmpUnixDomain.hnu�[���PK��FZ��%%c�snmpv3.hnu�[���PK��FZr����	�	��container_iterator.hnu�[���PK��FZ�يs,,
��snmp_secmod.hnu�[���PK��FZ�`~GG	�snmpIPv6BaseDomain.hnu�[���PK��FZ|7�%�%��vacm.hnu�[���PK��FZ��*����system.hnu�[���PK��FZ�v���/oid_stash.hnu�[���PK��FZ-��<dir_utils.hnu�[���PK��FZ����"�"jDparse.hnu�[���PK��FZ�9���gcontainer_binary_array.hnu�[���PK��FZ��:���kucd_compat.hnu�[���PK��FZ��0�--�psnmp_service.hnu�[���PK��FZ������/tgetopt.hnu�[���PK��FZç�$��
-vsnmp_client.hnu�[���PK��FZp�h���"�snmpUDPIPv4BaseDomain.hnu�[���PK��FZe�ds�1�1A�snmp_transport.hnu�[���PK��FZev8��D�types.hnu�[���PK��FZoN̔���snmpSocketBaseDomain.hnu�[���PK��FZH&�$::I�snmpCallbackDomain.hnu�[���PK��FZ#WC-�
�
��md5.hnu�[���PK��FZ��r�KK��asn1.hnu�[���PK��FZn�C!C!�3cert_util.hnu�[���PK��FZ�#��XUsnmp_parse_args.hnu�[���PK��FZ\��)�w�w
hasnmp_api.hnu�[���PK��FZ��K�M?M?	2�snmpusm.hnu�[���PK��FZoxQ�
�

�callback.hnu�[���PK��FZ�~���#check_varbind.hnu�[���PK��FZ�;9�D
D
�+READMEnu�[���PK��FZ�fƜ��$9snmpUDPDomain.hnu�[���PK��FZFb	���
Fread_config.hnu�[���PK��FZ;�j���0_container_list_ssll.hnu�[���PK��FZS�
�&&TasnmpTLSTCPDomain.hnu�[���PK��FZ�ģ_���dsnmpTLSBaseDomain.hnu�[���PK��FZ�q�����psnmp_logging.hnu�[���PK��FZ��������snmp_impl.hnu�[���PK��FZ���i�	�	��snmp_alarm.hnu�[���PK��FZvx�winservice.hnu�[���PK��FZ�a���4�4˫default_store.hnu�[���PK��FZ�k�C��fd_event_manager.hnu�[���PK��FZ%��uu�snmpTCPDomain.hnu�[���PK��FZ0�$�����snmpUDPBaseDomain.hnu�[���PK��FZ�T�8����file_utils.hnu�[���PK��FZ$)�PP	�snmp-tc.hnu�[���PK��FZb�s�>>oid.hnu�[���PK��FZT��y	y	�transform_oids.hnu�[���PK��FZ����6�6?snmp.hnu�[���PK��FZ�y@�\\HSsnmpDTLSUDPDomain.hnu�[���PK��FZl����Vnetsnmp-attribute-format.hnu�[���PK��FZ<�����XsnmpAliasDomain.hnu�[���PK��FZZ�!�#	#	
�[keytools.hnu�[���PK��FZ�D�**	elarge_fd_set.hnu�[���PK��FZ���A&A&qztools.hnu�[���PK��FZ7�1j��	�snmptsm.hnu�[���PK��FZ-���
�
��text_utils.hnu�[���PK��FZͩ�W	~�factory.hnu�[���PK��FZ��P��ϸint64.hnu�[���PK��FZD�e�k_k_�mib.hnu�[���PK��FZ��v�	�	!snmpUDPIPv6Domain.hnu�[���PK��FZ�Zy�1$1$�+snmp_debug.hnu�[���PK��FZw���

Psnmp_assert.hnu�[���PKJJT;_
© 2025 GrazzMean