net-snmp 5.7
snmp_vars.h
00001 /*
00002  * Definitions for SNMP (RFC 1067) agent variable finder.
00003  *
00004  */
00005 
00006 #ifndef _SNMP_VARS_H_
00007 #define _SNMP_VARS_H_
00008 
00009 #ifdef __cplusplus
00010 extern          "C" {
00011 #endif
00012 
00013 /* Portions of this file are subject to the following copyright(s).  See
00014  * the Net-SNMP's COPYING file for more details and other copyrights
00015  * that may apply:
00016  */
00017 /***********************************************************
00018         Copyright 1988, 1989 by Carnegie Mellon University
00019         Copyright 1989  TGV, Incorporated
00020 
00021                       All Rights Reserved
00022 
00023 Permission to use, copy, modify, and distribute this software and its
00024 documentation for any purpose and without fee is hereby granted,
00025 provided that the above copyright notice appear in all copies and that
00026 both that copyright notice and this permission notice appear in
00027 supporting documentation, and that the name of CMU and TGV not be used
00028 in advertising or publicity pertaining to distribution of the software
00029 without specific, written prior permission.
00030 
00031 CMU AND TGV DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
00032 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
00033 EVENT SHALL CMU OR TGV BE LIABLE FOR ANY SPECIAL, INDIRECT OR
00034 CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
00035 USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
00036 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00037 PERFORMANCE OF THIS SOFTWARE.
00038 ******************************************************************/
00039 /*
00040  * Portions of this file are copyrighted by:
00041  * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
00042  * Use is subject to license terms specified in the COPYING file
00043  * distributed with the Net-SNMP package.
00044  */
00045 
00046     struct variable;
00047 
00063     struct variable *netsnmp_duplicate_variable(struct variable *var);
00064 
00065     /*
00066      * Function pointer called by the master agent for writes. 
00067      */
00068     typedef int     (WriteMethod) (int action,
00069                                    u_char * var_val,
00070                                    u_char var_val_type,
00071                                    size_t var_val_len,
00072                                    u_char * statP,
00073                                    oid * name, size_t length);
00074 
00075     /*
00076      * Function pointer called by the master agent for mib information retrieval 
00077      */
00078     typedef u_char *(FindVarMethod) (struct variable * vp,
00079                                      oid * name,
00080                                      size_t * length,
00081                                      int exact,
00082                                      size_t * var_len,
00083                                      WriteMethod ** write_method);
00084 
00085     /*
00086      * Function pointer called by the master agent for setting up subagent requests 
00087      */
00088     typedef int     (AddVarMethod) (netsnmp_agent_session *asp,
00089                                     netsnmp_variable_list * vbp);
00090 
00091     struct nlist;
00092 
00093     extern long     long_return;
00094     extern u_char   return_buf[];
00095 
00096     extern oid      nullOid[];
00097     extern int      nullOidLen;
00098 
00099 #define INST    0xFFFFFFFF      /* used to fill out the instance field of the variables table */
00100 
00101     struct variable {
00102         u_char          magic;  /* passed to function as a hint */
00103         char            type;   /* type of variable */
00104         /*
00105          * See important comment in snmp_vars.c relating to acl 
00106          */
00107         u_short         acl;    /* access control list for variable */
00108         FindVarMethod  *findVar;        /* function that finds variable */
00109         u_char          namelen;        /* length of above */
00110         oid             name[MAX_OID_LEN];      /* object identifier of variable */
00111     };
00112 
00113     int             init_agent(const char *);
00114     void            shutdown_agent(void);
00115 
00116     int             should_init(const char *module_name);
00117     void            add_to_init_list(char *module_list);
00118 
00119 #ifdef USING_AGENTX_SUBAGENT_MODULE
00120     void            netsnmp_enable_subagent(void);
00121 #endif
00122 
00123 #ifndef _AGENT_REGISTRY_H
00124 #include <net-snmp/agent/agent_handler.h>
00125 #include <net-snmp/agent/var_struct.h>
00126 #include <net-snmp/agent/agent_registry.h>
00127 #endif
00128 
00129     /*
00130      * fail overloads non-negative integer value. it must be -1 ! 
00131      */
00132 #define MATCH_FAILED    (-1)
00133 #define MATCH_SUCCEEDED 0
00134 
00135 #ifdef __cplusplus
00136 }
00137 #endif
00138 #endif                          /* _SNMP_VARS_H_ */