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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [snmp/] [lib/] [v2_0/] [include/] [read_config.h] - Blame information for rev 773

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      ./lib/current/include/read_config.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 Red Hat, 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 version.
15
//
16
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
17
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19
// for more details.
20
//
21
// You should have received a copy of the GNU General Public License along
22
// with eCos; if not, write to the Free Software Foundation, Inc.,
23
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
24
//
25
// As a special exception, if other files instantiate templates or use macros
26
// or inline functions from this file, or you compile this file and link it
27
// with other works to produce a work based on this file, this file does not
28
// by itself cause the resulting work to be covered by the GNU General Public
29
// License. However the source code for this file must still be made available
30
// in accordance with section (3) of the GNU General Public License.
31
//
32
// This exception does not invalidate any other reasons why a work based on
33
// this file might be covered by the GNU General Public License.
34
//
35
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
36
// at http://sources.redhat.com/ecos/ecos-license/
37
// -------------------------------------------
38
//####ECOSGPLCOPYRIGHTEND####
39
//####UCDSNMPCOPYRIGHTBEGIN####
40
//
41
// -------------------------------------------
42
//
43
// Portions of this software may have been derived from the UCD-SNMP
44
// project,  <http://ucd-snmp.ucdavis.edu/>  from the University of
45
// California at Davis, which was originally based on the Carnegie Mellon
46
// University SNMP implementation.  Portions of this software are therefore
47
// covered by the appropriate copyright disclaimers included herein.
48
//
49
// The release used was version 4.1.2 of May 2000.  "ucd-snmp-4.1.2"
50
// -------------------------------------------
51
//
52
//####UCDSNMPCOPYRIGHTEND####
53
//==========================================================================
54
//#####DESCRIPTIONBEGIN####
55
//
56
// Author(s):    hmt
57
// Contributors: hmt
58
// Date:         2000-05-30
59
// Purpose:      Port of UCD-SNMP distribution to eCos.
60
// Description:  
61
//              
62
//
63
//####DESCRIPTIONEND####
64
//
65
//==========================================================================
66
/********************************************************************
67
       Copyright 1989, 1991, 1992 by Carnegie Mellon University
68
 
69
                          Derivative Work -
70
Copyright 1996, 1998, 1999, 2000 The Regents of the University of California
71
 
72
                         All Rights Reserved
73
 
74
Permission to use, copy, modify and distribute this software and its
75
documentation for any purpose and without fee is hereby granted,
76
provided that the above copyright notice appears in all copies and
77
that both that copyright notice and this permission notice appear in
78
supporting documentation, and that the name of CMU and The Regents of
79
the University of California not be used in advertising or publicity
80
pertaining to distribution of the software without specific written
81
permission.
82
 
83
CMU AND THE REGENTS OF THE UNIVERSITY OF CALIFORNIA DISCLAIM ALL
84
WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
85
WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL CMU OR
86
THE REGENTS OF THE UNIVERSITY OF CALIFORNIA BE LIABLE FOR ANY SPECIAL,
87
INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
88
FROM THE LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
89
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
90
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
91
*********************************************************************/
92
/*
93
 *  read_config.h: reads configuration files for extensible sections.
94
 *
95
 */
96
#ifndef READ_CONFIG_H
97
#define READ_CONFIG_H
98
 
99
#ifdef __cplusplus
100
extern "C" {
101
#endif
102
 
103
#define STRINGMAX 1024
104
 
105
#define NORMAL_CONFIG 0
106
#define PREMIB_CONFIG 1
107
#define EITHER_CONFIG 2
108
 
109
 
110
 
111
/*
112
 * Defines a set of file types and the parse and free functions
113
 * which process the syntax following a given token in a given file.
114
 */
115
struct config_files {
116
   char                 *fileHeader;    /* Label for entire file. */
117
   struct config_line   *start;
118
   struct config_files  *next;
119
};
120
 
121
struct config_line {
122
   char                  *config_token; /* Label for each line parser
123
                                           in the given file. */
124
   void                 (*parse_line) (const char *, char *);
125
   void                 (*free_func) (void);
126
   struct config_line    *next;
127
   char                   config_time;  /* {NORMAL,PREMIB,EITHER}_CONFIG */
128
   char                  *help;
129
};
130
 
131
void read_config (const char *, struct config_line *, int);
132
void read_configs (void);
133
void read_premib_configs (void);
134
void read_config_files (int);
135
void free_config (void);
136
void config_perror (const char *);
137
void config_pwarn (const char *);
138
char *skip_white (char *);
139
char *skip_not_white (char *);
140
char *skip_token(char *);
141
char *copy_word (char *, char *);
142
void read_config_with_type (const char *, const char *);
143
struct config_line *register_config_handler (const char *, const char *,
144
                                             void (*parser)(const char *, char *),
145
                                             void (*releaser) (void),
146
                                             const char *);
147
struct config_line *register_app_config_handler (const char *,
148
                                             void (*parser)(const char *, char *),
149
                                             void (*releaser) (void),
150
                                             const char *);
151
struct config_line *register_premib_handler (const char *, const char *,
152
                                             void (*parser)(const char *, char *),
153
                                             void (*releaser) (void),
154
                                             const char *);
155
struct config_line *register_app_premib_handler (const char *,
156
                                             void (*parser)(const char *, char *),
157
                                             void (*releaser) (void),
158
                                             const char *);
159
void unregister_config_handler (const char *, const char *);
160
void unregister_app_config_handler (const char *);
161
void read_config_print_usage(const char *lead);
162
char *read_config_save_octet_string(char *saveto, u_char *str, size_t len);
163
char *read_config_read_octet_string(char *readfrom, u_char **str, size_t *len);
164
char *read_config_read_objid(char *readfrom, oid **objid, size_t *len);
165
char *read_config_save_objid(char *saveto, oid *objid, size_t len);
166
char *read_config_read_data(int type, char *readfrom, void *dataptr, size_t *len);
167
char *read_config_store_data(int type, char *storeto, void *dataptr, size_t *len);
168
void  read_config_store(const char *type, const char *line);
169
void  read_app_config_store(const char *line);
170
void  snmp_save_persistent(const char *type);
171
void  snmp_clean_persistent(const char *type);
172
 
173
#ifdef __cplusplus
174
}
175
#endif
176
 
177
#endif /* READ_CONFIG_H */

powered by: WebSVN 2.1.0

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