1 |
786 |
skrzyp |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// ./agent/current/include/snmp_vars.h
|
4 |
|
|
//
|
5 |
|
|
//
|
6 |
|
|
//==========================================================================
|
7 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
8 |
|
|
// -------------------------------------------
|
9 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
10 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
11 |
|
|
//
|
12 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
13 |
|
|
// the terms of the GNU General Public License as published by the Free
|
14 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
15 |
|
|
// version.
|
16 |
|
|
//
|
17 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
18 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
19 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
20 |
|
|
// for more details.
|
21 |
|
|
//
|
22 |
|
|
// You should have received a copy of the GNU General Public License
|
23 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
24 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
25 |
|
|
//
|
26 |
|
|
// As a special exception, if other files instantiate templates or use
|
27 |
|
|
// macros or inline functions from this file, or you compile this file
|
28 |
|
|
// and link it with other works to produce a work based on this file,
|
29 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
30 |
|
|
// the GNU General Public License. However the source code for this file
|
31 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
32 |
|
|
// General Public License v2.
|
33 |
|
|
//
|
34 |
|
|
// This exception does not invalidate any other reasons why a work based
|
35 |
|
|
// on this file might be covered by the GNU General Public License.
|
36 |
|
|
// -------------------------------------------
|
37 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
38 |
|
|
//####UCDSNMPCOPYRIGHTBEGIN####
|
39 |
|
|
//
|
40 |
|
|
// -------------------------------------------
|
41 |
|
|
//
|
42 |
|
|
// Portions of this software may have been derived from the UCD-SNMP
|
43 |
|
|
// project, <http://ucd-snmp.ucdavis.edu/> from the University of
|
44 |
|
|
// California at Davis, which was originally based on the Carnegie Mellon
|
45 |
|
|
// University SNMP implementation. Portions of this software are therefore
|
46 |
|
|
// covered by the appropriate copyright disclaimers included herein.
|
47 |
|
|
//
|
48 |
|
|
// The release used was version 4.1.2 of May 2000. "ucd-snmp-4.1.2"
|
49 |
|
|
// -------------------------------------------
|
50 |
|
|
//
|
51 |
|
|
//####UCDSNMPCOPYRIGHTEND####
|
52 |
|
|
//==========================================================================
|
53 |
|
|
//#####DESCRIPTIONBEGIN####
|
54 |
|
|
//
|
55 |
|
|
// Author(s): hmt
|
56 |
|
|
// Contributors: hmt
|
57 |
|
|
// Date: 2000-05-30
|
58 |
|
|
// Purpose: Port of UCD-SNMP distribution to eCos.
|
59 |
|
|
// Description:
|
60 |
|
|
//
|
61 |
|
|
//
|
62 |
|
|
//####DESCRIPTIONEND####
|
63 |
|
|
//
|
64 |
|
|
//==========================================================================
|
65 |
|
|
/********************************************************************
|
66 |
|
|
Copyright 1989, 1991, 1992 by Carnegie Mellon University
|
67 |
|
|
|
68 |
|
|
Derivative Work -
|
69 |
|
|
Copyright 1996, 1998, 1999, 2000 The Regents of the University of California
|
70 |
|
|
|
71 |
|
|
All Rights Reserved
|
72 |
|
|
|
73 |
|
|
Permission to use, copy, modify and distribute this software and its
|
74 |
|
|
documentation for any purpose and without fee is hereby granted,
|
75 |
|
|
provided that the above copyright notice appears in all copies and
|
76 |
|
|
that both that copyright notice and this permission notice appear in
|
77 |
|
|
supporting documentation, and that the name of CMU and The Regents of
|
78 |
|
|
the University of California not be used in advertising or publicity
|
79 |
|
|
pertaining to distribution of the software without specific written
|
80 |
|
|
permission.
|
81 |
|
|
|
82 |
|
|
CMU AND THE REGENTS OF THE UNIVERSITY OF CALIFORNIA DISCLAIM ALL
|
83 |
|
|
WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
|
84 |
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL CMU OR
|
85 |
|
|
THE REGENTS OF THE UNIVERSITY OF CALIFORNIA BE LIABLE FOR ANY SPECIAL,
|
86 |
|
|
INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
|
87 |
|
|
FROM THE LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
88 |
|
|
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
89 |
|
|
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
90 |
|
|
*********************************************************************/
|
91 |
|
|
/*
|
92 |
|
|
* Definitions for SNMP (RFC 1067) agent variable finder.
|
93 |
|
|
*
|
94 |
|
|
*/
|
95 |
|
|
|
96 |
|
|
#ifndef _SNMP_VARS_H_
|
97 |
|
|
#define _SNMP_VARS_H_
|
98 |
|
|
|
99 |
|
|
/***********************************************************
|
100 |
|
|
Copyright 1988, 1989 by Carnegie Mellon University
|
101 |
|
|
Copyright 1989 TGV, Incorporated
|
102 |
|
|
|
103 |
|
|
All Rights Reserved
|
104 |
|
|
|
105 |
|
|
Permission to use, copy, modify, and distribute this software and its
|
106 |
|
|
documentation for any purpose and without fee is hereby granted,
|
107 |
|
|
provided that the above copyright notice appear in all copies and that
|
108 |
|
|
both that copyright notice and this permission notice appear in
|
109 |
|
|
supporting documentation, and that the name of CMU and TGV not be used
|
110 |
|
|
in advertising or publicity pertaining to distribution of the software
|
111 |
|
|
without specific, written prior permission.
|
112 |
|
|
|
113 |
|
|
CMU AND TGV DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
114 |
|
|
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
115 |
|
|
EVENT SHALL CMU OR TGV BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
116 |
|
|
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
117 |
|
|
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
118 |
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
119 |
|
|
PERFORMANCE OF THIS SOFTWARE.
|
120 |
|
|
******************************************************************/
|
121 |
|
|
|
122 |
|
|
struct variable;
|
123 |
|
|
|
124 |
|
|
/* Function pointer called by the master agent for writes. */
|
125 |
|
|
typedef int (WriteMethod)(int action,
|
126 |
|
|
u_char *var_val,
|
127 |
|
|
u_char var_val_type,
|
128 |
|
|
size_t var_val_len,
|
129 |
|
|
u_char *statP,
|
130 |
|
|
oid *name,
|
131 |
|
|
size_t length);
|
132 |
|
|
|
133 |
|
|
/* Function pointer called by the master agent for mib information retrieval */
|
134 |
|
|
typedef u_char *(FindVarMethod)(struct variable *vp,
|
135 |
|
|
oid *name,
|
136 |
|
|
size_t *length,
|
137 |
|
|
int exact,
|
138 |
|
|
size_t *var_len,
|
139 |
|
|
WriteMethod **write_method);
|
140 |
|
|
|
141 |
|
|
/* Function pointer called by the master agent for setting up subagent requests */
|
142 |
|
|
struct agent_snmp_session;
|
143 |
|
|
typedef int (AddVarMethod)(struct agent_snmp_session *asp,
|
144 |
|
|
struct variable_list *vbp);
|
145 |
|
|
|
146 |
|
|
struct nlist;
|
147 |
|
|
|
148 |
|
|
extern long long_return;
|
149 |
|
|
extern u_char return_buf[];
|
150 |
|
|
|
151 |
|
|
extern oid nullOid[];
|
152 |
|
|
extern int nullOidLen;
|
153 |
|
|
|
154 |
|
|
#define INST 0xFFFFFFFF /* used to fill out the instance field of the variables table */
|
155 |
|
|
|
156 |
|
|
struct variable {
|
157 |
|
|
u_char magic; /* passed to function as a hint */
|
158 |
|
|
char type; /* type of variable */
|
159 |
|
|
/* See important comment in snmp_vars.c relating to acl */
|
160 |
|
|
u_short acl; /* access control list for variable */
|
161 |
|
|
FindVarMethod *findVar; /* function that finds variable */
|
162 |
|
|
u_char namelen; /* length of above */
|
163 |
|
|
oid name[MAX_OID_LEN]; /* object identifier of variable */
|
164 |
|
|
};
|
165 |
|
|
|
166 |
|
|
void init_agent(const char *);
|
167 |
|
|
int subtree_old_size (void);
|
168 |
|
|
void sort_tree (void);
|
169 |
|
|
|
170 |
|
|
#ifndef _AGENT_REGISTRY_H
|
171 |
|
|
#include "agent_registry.h"
|
172 |
|
|
#endif
|
173 |
|
|
|
174 |
|
|
/* fail overloads non-negative integer value. it must be -1 ! */
|
175 |
|
|
#define MATCH_FAILED (-1)
|
176 |
|
|
#define MATCH_SUCCEEDED 0
|
177 |
|
|
|
178 |
|
|
#endif /* _SNMP_VARS_H_ */
|