net-snmp  5.4.1
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 
00048     /*
00049      * Function pointer called by the master agent for writes. 
00050      */
00051     typedef int     (WriteMethod) (int action,
00052                                    u_char * var_val,
00053                                    u_char var_val_type,
00054                                    size_t var_val_len,
00055                                    u_char * statP,
00056                                    oid * name, size_t length);
00057 
00058     /*
00059      * Function pointer called by the master agent for mib information retrieval 
00060      */
00061     typedef u_char *(FindVarMethod) (struct variable * vp,
00062                                      oid * name,
00063                                      size_t * length,
00064                                      int exact,
00065                                      size_t * var_len,
00066                                      WriteMethod ** write_method);
00067 
00068     /*
00069      * Function pointer called by the master agent for setting up subagent requests 
00070      */
00071     typedef int     (AddVarMethod) (netsnmp_agent_session *asp,
00072                                     netsnmp_variable_list * vbp);
00073 
00074     struct nlist;
00075 
00076     extern long     long_return;
00077     extern u_char   return_buf[];
00078 
00079     extern oid      nullOid[];
00080     extern int      nullOidLen;
00081 
00082 #define INST    0xFFFFFFFF      /* used to fill out the instance field of the variables table */
00083 
00084     struct variable {
00085         u_char          magic;  /* passed to function as a hint */
00086         char            type;   /* type of variable */
00087         /*
00088          * See important comment in snmp_vars.c relating to acl 
00089          */
00090         u_short         acl;    /* access control list for variable */
00091         FindVarMethod  *findVar;        /* function that finds variable */
00092         u_char          namelen;        /* length of above */
00093         oid             name[MAX_OID_LEN];      /* object identifier of variable */
00094     };
00095 
00096     int             init_agent(const char *);
00097     void            shutdown_agent(void);
00098 
00099     int             should_init(const char *module_name);
00100     void            add_to_init_list(char *module_list);
00101 
00102 #ifdef USING_AGENTX_SUBAGENT_MODULE
00103     void            netsnmp_enable_subagent(void);
00104 #endif
00105 
00106 #ifndef _AGENT_REGISTRY_H
00107 #include <net-snmp/agent/agent_handler.h>
00108 #include <net-snmp/agent/var_struct.h>
00109 #include <net-snmp/agent/agent_registry.h>
00110 #endif
00111 
00112     /*
00113      * fail overloads non-negative integer value. it must be -1 ! 
00114      */
00115 #define MATCH_FAILED    (-1)
00116 #define MATCH_SUCCEEDED 0
00117 
00118 #ifdef __cplusplus
00119 }
00120 #endif
00121 #endif                          /* _SNMP_VARS_H_ */