added files
[bcm963xx.git] / userapps / opensource / net-snmp / include / net-snmp / library / read_config.h
1 /*
2  *  read_config.h: reads configuration files for extensible sections.
3  *
4  */
5 #ifndef READ_CONFIG_H
6 #define READ_CONFIG_H
7
8 #ifdef __cplusplus
9 extern          "C" {
10 #endif
11
12 #define STRINGMAX 1024
13
14 #define NORMAL_CONFIG 0
15 #define PREMIB_CONFIG 1
16 #define EITHER_CONFIG 2
17
18
19
20     /*
21      * Defines a set of file types and the parse and free functions
22      * which process the syntax following a given token in a given file.
23      */
24     struct config_files {
25         char           *fileHeader;     /* Label for entire file. */
26         struct config_line *start;
27         struct config_files *next;
28     };
29
30     struct config_line {
31         char           *config_token;   /* Label for each line parser
32                                          * in the given file. */
33         void            (*parse_line) (const char *, char *);
34         void            (*free_func) (void);
35         struct config_line *next;
36         char            config_time;    /* {NORMAL,PREMIB,EITHER}_CONFIG */
37         char           *help;
38     };
39
40     struct read_config_memory {
41         char           *line;
42         struct read_config_memory *next;
43     };
44
45
46     int             netsnmp_config(char *);     /* parse a simple line: token=values */
47     void            netsnmp_config_remember(char *);    /* process later, during snmp_init() */
48     void            netsnmp_config_process_memories(void);      /* run all memories through parser */
49 /*
50 Renamed to read_config_snmp to resolve linket error:
51  read_config is redefined in /CommEngine/user96345/src/udhcp-0.9.6/udhcp.a
52  See also "/net-snmp-5.0.3/snmplib/read_config.c"  
53  --YD
54 */
55     void            read_config_snmp(const char *, struct config_line *, int);
56     void            read_configs(void);
57     void            read_premib_configs(void);
58     void            read_config_files(int);
59     void            free_config(void);
60     void            config_perror(const char *);
61     void            config_pwarn(const char *);
62     char           *skip_white(char *);
63     char           *skip_not_white(char *);
64     char           *skip_token(char *);
65     char           *copy_nword(char *, char *, int);
66     char           *copy_word(char *, char *);  /* do not use */
67     void            read_config_with_type(const char *, const char *);
68     struct config_line *register_config_handler(const char *, const char *,
69                                                 void (*parser) (const char
70                                                                 *, char *),
71                                                 void (*releaser) (void),
72                                                 const char *);
73     struct config_line *register_app_config_handler(const char *,
74                                                     void (*parser) (const
75                                                                     char *,
76                                                                     char
77                                                                     *),
78                                                     void (*releaser)
79                                                     (void), const char *);
80     struct config_line *register_prenetsnmp_mib_handler(const char *,
81                                                         const char *,
82                                                         void (*parser)
83                                                         (const char *,
84                                                          char *),
85                                                         void (*releaser)
86                                                         (void),
87                                                         const char *);
88     struct config_line *register_app_prenetsnmp_mib_handler(const char *,
89                                                             void (*parser)
90                                                             (const char *,
91                                                              char *),
92                                                             void
93                                                             (*releaser)
94                                                             (void),
95                                                             const char *);
96     void            unregister_config_handler(const char *, const char *);
97     void            unregister_app_config_handler(const char *);
98     void            unregister_all_config_handlers(void);
99     void            read_config_print_usage(const char *lead);
100     char           *read_config_save_octet_string(char *saveto,
101                                                   u_char * str,
102                                                   size_t len);
103     char           *read_config_read_octet_string(char *readfrom,
104                                                   u_char ** str,
105                                                   size_t * len);
106     char           *read_config_read_objid(char *readfrom, oid ** objid,
107                                            size_t * len);
108     char           *read_config_save_objid(char *saveto, oid * objid,
109                                            size_t len);
110     char           *read_config_read_data(int type, char *readfrom,
111                                           void *dataptr, size_t * len);
112     char           *read_config_read_memory(int type, char *readfrom,
113                                             char *dataptr, size_t * len);
114     char           *read_config_store_data(int type, char *storeto,
115                                            void *dataptr, size_t * len);
116     char           *read_config_store_data_prefix(char prefix, int type,
117                                                   char *storeto,
118                                                   void *dataptr, size_t len);
119     void            read_config_store(const char *type, const char *line);
120     void            read_app_config_store(const char *line);
121     void            snmp_save_persistent(const char *type);
122     void            snmp_clean_persistent(const char *type);
123     struct config_line *read_config_get_handlers(const char *type);
124
125     /*
126      * external memory list handlers 
127      */
128     void            snmp_config_remember_in_list(char *line,
129                                                  struct read_config_memory
130                                                  **mem);
131     void            snmp_config_process_memory_list(struct
132                                                     read_config_memory
133                                                     **mem, int, int);
134     void            snmp_config_remember_free_list(struct
135                                                    read_config_memory
136                                                    **mem);
137
138     void            set_configuration_directory(const char *dir);
139     const char     *get_configuration_directory(void);
140     void            set_persistent_directory(const char *dir);
141     const char     *get_persistent_directory(void);
142     void            handle_long_opt(const char *myoptarg);
143
144 #ifdef __cplusplus
145 }
146 #endif
147 #endif                          /* READ_CONFIG_H */