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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [snmp/] [agent/] [v2_0/] [src/] [agent_read_config.c] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      ./agent/current/src/agent_read_config.c
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
 * agent_read_config.c
94
 */
95
 
96
#include <config.h>
97
 
98
#include <sys/types.h>
99
#if HAVE_STDLIB_H
100
#include <stdlib.h>
101
#endif
102
#if HAVE_STRING_H
103
#include <string.h>
104
#else
105
#include <strings.h>
106
#endif
107
#include <stdio.h>
108
#include <ctype.h>
109
#include <errno.h>
110
 
111
#if TIME_WITH_SYS_TIME
112
# ifdef WIN32
113
#  include <sys/timeb.h>
114
# else
115
#  include <sys/time.h>
116
# endif
117
# include <time.h>
118
#else
119
# if HAVE_SYS_TIME_H
120
#  include <sys/time.h>
121
# else
122
#  include <time.h>
123
# endif
124
#endif
125
#if HAVE_NETINET_IN_H
126
#include <netinet/in.h>
127
#endif
128
#if HAVE_NETINET_IN_SYSTM_H
129
#include <netinet/in_systm.h>
130
#endif
131
#if HAVE_NETINET_IP_H
132
#include <netinet/ip.h>
133
#endif
134
#ifdef INET6
135
#if HAVE_NETINET_IP6_H
136
#include <netinet/ip6.h>
137
#endif
138
#endif
139
#if HAVE_SYS_QUEUE_H
140
#include <sys/queue.h>
141
#endif
142
#if HAVE_SYS_SOCKET_H
143
#include <sys/socket.h>
144
#elif HAVE_WINSOCK_H
145
#include <winsock.h>
146
#endif 
147
#if HAVE_SYS_STREAM_H
148
#include <sys/stream.h>
149
#endif
150
#if HAVE_NET_ROUTE_H
151
#include <net/route.h>
152
#endif
153
#if HAVE_NETINET_IP_VAR_H
154
#include <netinet/ip_var.h>
155
#endif
156
#ifdef INET6
157
#if HAVE_NETINET6_IP6_VAR_H
158
#include <netinet6/ip6_var.h>
159
#endif
160
#endif
161
#if HAVE_NETINET_IN_PCB_H
162
#include <netinet/in_pcb.h>
163
#endif
164
#if HAVE_INET_MIB2_H
165
#include <inet/mib2.h>
166
#endif
167
 
168
#if HAVE_DMALLOC_H
169
#include <dmalloc.h>
170
#endif
171
 
172
#include "mibincl.h"
173
#include "snmpusm.h"
174
 
175
#include "mibgroup/struct.h"
176
#include "read_config.h"
177
#include "agent_read_config.h"
178
#include "callback.h"
179
#include "snmp_agent.h"
180
#include "agent_trap.h"
181
#include "snmpd.h"
182
#include "system.h"
183
#include "snmp_debug.h"
184
#include "snmp_alarm.h"
185
#include "default_store.h"
186
#include "ds_agent.h"
187
#include "mib_module_includes.h"
188
 
189
char dontReadConfigFiles;
190
char *optconfigfile;
191
 
192
void init_agent_read_config (const char *app)
193
{
194
  if ( app != NULL )
195
      ds_set_string(DS_LIBRARY_ID, DS_LIB_APPTYPE, app);
196
 
197
  register_app_config_handler("authtrapenable",
198
                          snmpd_parse_config_authtrap, NULL,
199
                          "1 | 2\t\t(1 = enable, 2 = disable)");
200
 
201
  if ( ds_get_boolean(DS_APPLICATION_ID, DS_AGENT_ROLE) == MASTER_AGENT ) {
202
      register_app_config_handler("trapsink",
203
                          snmpd_parse_config_trapsink, snmpd_free_trapsinks,
204
                          "host [community]");
205
      register_app_config_handler("trap2sink",
206
                          snmpd_parse_config_trap2sink, NULL,
207
                          "host [community]");
208
      register_app_config_handler("informsink",
209
                          snmpd_parse_config_informsink, NULL,
210
                          "host [community]");
211
  }
212
  register_app_config_handler("trapcommunity",
213
                          snmpd_parse_config_trapcommunity,
214
                          snmpd_free_trapcommunity,
215
                          "community-string");
216
#include "mib_module_dot_conf.h"
217
#ifdef TESTING
218
  print_config_handlers();
219
#endif
220
}
221
 
222
void update_config(void)
223
{
224
  free_config();
225
  read_configs();
226
}
227
 
228
 
229
void
230
snmpd_register_config_handler(const char *token,
231
                              void (*parser) (const char *, char *),
232
                              void (*releaser) (void),
233
                              const char *help)
234
{
235
  DEBUGMSGTL(("snmpd_register_app_config_handler",
236
              "registering .conf token for \"%s\"\n", token));
237
  register_app_config_handler(token, parser, releaser, help);
238
}
239
 
240
void
241
snmpd_unregister_config_handler(const char *token)
242
{
243
  unregister_app_config_handler(token);
244
}
245
 
246
/* this function is intended for use by mib-modules to store permenant
247
   configuration information generated by sets or persistent counters */
248
void
249
snmpd_store_config(const char *line)
250
{
251
  read_app_config_store(line);
252
}

powered by: WebSVN 2.1.0

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