OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [net/] [snmp/] [agent/] [current/] [include/] [agent_registry.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      ./agent/current/include/agent_registry.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
#ifndef AGENT_REGISTRY_H
92
#define AGENT_REGISTRY_H
93
 
94
/* the structure of parameters passed to registered ACM modules */
95
struct view_parameters {
96
   struct snmp_pdu *pdu;
97
   oid             *name;
98
   size_t           namelen;
99
   int              errorcode; /* do not change unless you're
100
                                  specifying an error,
101
                                  as it starts in a success state. */
102
};
103
 
104
struct register_parameters {
105
   oid    *name;
106
   size_t  namelen;
107
   int     priority;
108
   int     range_subid;
109
   oid     range_ubound;
110
};
111
 
112
#define MIB_REGISTERED_OK                0
113
#define MIB_DUPLICATE_REGISTRATION      -1
114
#define MIB_REGISTRATION_FAILED         -2
115
 
116
#define MIB_UNREGISTERED_OK              0
117
#define MIB_NO_SUCH_REGISTRATION        -1
118
#define MIB_UNREGISTRATION_FAILED       -2
119
 
120
#define DEFAULT_MIB_PRIORITY            127
121
 
122
#define ALLOCATE_THIS_INDEX             0x0
123
#define ALLOCATE_ANY_INDEX              0x1
124
#define ALLOCATE_NEW_INDEX              0x3
125
        /* N.B: it's deliberate that NEW_INDEX & ANY_INDEX == ANY_INDEX */
126
 
127
#define ANY_INTEGER_INDEX               -1
128
#define ANY_STRING_INDEX                NULL
129
#define ANY_OID_INDEX                   NULL
130
 
131
#define INDEX_ERR_GENERR                -1
132
#define INDEX_ERR_WRONG_TYPE            -2
133
#define INDEX_ERR_NOT_ALLOCATED         -3
134
#define INDEX_ERR_WRONG_SESSION         -4
135
 
136
char*                 register_string_index( oid *, size_t, char *);
137
int                   register_int_index( oid *, size_t, int);
138
struct variable_list* register_oid_index( oid *, size_t, oid *, size_t);
139
struct variable_list* register_index( struct variable_list *, int, struct snmp_session*);
140
 
141
int  release_index( struct variable_list *);
142
int  remove_index( struct variable_list *, struct snmp_session*);
143
void unregister_index_by_session(struct snmp_session *);
144
int  unregister_index(struct variable_list *, int, struct snmp_session *);
145
 
146
void setup_tree (void);
147
struct subtree *find_subtree (oid *, size_t, struct subtree *);
148
struct subtree *find_subtree_next (oid *, size_t, struct subtree *);
149
struct subtree *find_subtree_previous (oid *, size_t, struct subtree *);
150
struct snmp_session *get_session_for_oid( oid *, size_t);
151
 
152
int register_mib(const char *, struct variable *, size_t, size_t, oid *, size_t);
153
int register_mib_priority(const char *, struct variable *, size_t, size_t, oid *, size_t, int);
154
int register_mib_range(const char *, struct variable *, size_t , size_t , oid *, size_t, int, int, oid, struct snmp_session *);
155
 
156
int unregister_mib (oid *, size_t);
157
int unregister_mib_priority (oid *, size_t, int);
158
int unregister_mib_range (oid *, size_t, int, int, oid);
159
void unregister_mibs_by_session (struct snmp_session *);
160
 
161
struct subtree *free_subtree (struct subtree *);
162
int compare_tree (const oid *, size_t, const oid *, size_t);
163
int in_a_view(oid *, size_t *, struct snmp_pdu *, int);
164
int check_access(struct snmp_pdu *pdu);
165
 
166
/* REGISTER_MIB(): This macro simply loads register_mib with less pain:
167
 
168
   descr:   A short description of the mib group being loaded.
169
   var:     The variable structure to load.
170
   vartype: The variable structure used to define it (variable2, variable4, ...)
171
   theoid:  A *initialized* *exact length* oid pointer.
172
            (sizeof(theoid) *must* return the number of elements!)
173
*/
174
#define REGISTER_MIB(descr, var, vartype, theoid)                      \
175
  if (register_mib(descr, (struct variable *) var, sizeof(struct vartype), \
176
               sizeof(var)/sizeof(struct vartype),                     \
177
               theoid, sizeof(theoid)/sizeof(oid)) != MIB_REGISTERED_OK ) \
178
        DEBUGMSGTL(("register_mib", "%s registration failed\n", descr));
179
 
180
#endif /* AGENT_REGISTRY_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.