00001 /* 00002 * read_config.h: reads configuration files for extensible sections. 00003 * 00004 */ 00005 #ifndef READ_CONFIG_H 00006 #define READ_CONFIG_H 00007 00008 #ifdef __cplusplus 00009 extern "C" { 00010 #endif 00011 00012 #define STRINGMAX 1024 00013 00014 #define NORMAL_CONFIG 0 00015 #define PREMIB_CONFIG 1 00016 #define EITHER_CONFIG 2 00017 00018 #include <net-snmp/config_api.h> 00019 00020 /* 00021 * Defines a set of file types and the parse and free functions 00022 * which process the syntax following a given token in a given file. 00023 */ 00024 struct config_files { 00025 char *fileHeader; /* Label for entire file. */ 00026 struct config_line *start; 00027 struct config_files *next; 00028 }; 00029 00030 struct config_line { 00031 char *config_token; /* Label for each line parser 00032 * in the given file. */ 00033 void (*parse_line) (const char *, char *); 00034 void (*free_func) (void); 00035 struct config_line *next; 00036 char config_time; /* {NORMAL,PREMIB,EITHER}_CONFIG */ 00037 char *help; 00038 }; 00039 00040 struct read_config_memory { 00041 char *line; 00042 struct read_config_memory *next; 00043 }; 00044 00045 00046 int netsnmp_config(char *); /* parse a simple line: token=values */ 00047 void netsnmp_config_remember(char *); /* process later, during snmp_init() */ 00048 void netsnmp_config_process_memories(void); /* run all memories through parser */ 00049 void read_config(const char *, struct config_line *, int); 00050 void read_config_files(int); 00051 void free_config(void); 00052 #if !defined(__GNUC__) || __GNUC__ < 2 || (__GNUC__ == 2&& __GNUC_MINOR__ < 8) 00053 void netsnmp_config_error(const char *, ...); 00054 void netsnmp_config_warn(const char *, ...); 00055 #else 00056 void netsnmp_config_error(const char *, ...) 00057 __attribute__((__format__(__printf__, 1, 2))); 00058 void netsnmp_config_warn(const char *, ...) 00059 __attribute__((__format__(__printf__, 1, 2))); 00060 #endif 00061 00062 char *skip_white(char *); 00063 char *skip_not_white(char *); 00064 char *skip_token(char *); 00065 char *copy_nword(char *, char *, int); 00066 char *copy_word(char *, char *); /* do not use */ 00067 void read_config_with_type(const char *, const char *); 00068 char *read_config_save_octet_string(char *saveto, 00069 u_char * str, 00070 size_t len); 00071 char *read_config_read_octet_string(char *readfrom, 00072 u_char ** str, 00073 size_t * len); 00074 char *read_config_read_objid(char *readfrom, oid ** objid, 00075 size_t * len); 00076 char *read_config_save_objid(char *saveto, oid * objid, 00077 size_t len); 00078 char *read_config_read_data(int type, char *readfrom, 00079 void *dataptr, size_t * len); 00080 char *read_config_read_memory(int type, char *readfrom, 00081 char *dataptr, size_t * len); 00082 char *read_config_store_data(int type, char *storeto, 00083 void *dataptr, size_t * len); 00084 char *read_config_store_data_prefix(char prefix, int type, 00085 char *storeto, 00086 void *dataptr, size_t len); 00087 void read_config_store(const char *type, const char *line); 00088 void read_app_config_store(const char *line); 00089 void snmp_save_persistent(const char *type); 00090 void snmp_clean_persistent(const char *type); 00091 struct config_line *read_config_get_handlers(const char *type); 00092 00093 /* 00094 * external memory list handlers 00095 */ 00096 void snmp_config_remember_in_list(char *line, 00097 struct read_config_memory 00098 **mem); 00099 void snmp_config_process_memory_list(struct 00100 read_config_memory 00101 **mem, int, int); 00102 void snmp_config_remember_free_list(struct 00103 read_config_memory 00104 **mem); 00105 00106 void set_configuration_directory(const char *dir); 00107 const char *get_configuration_directory(void); 00108 void set_persistent_directory(const char *dir); 00109 const char *get_persistent_directory(void); 00110 void set_temp_file_pattern(const char *pattern); 00111 const char *get_temp_file_pattern(void); 00112 void handle_long_opt(const char *myoptarg); 00113 00114 #ifdef __cplusplus 00115 } 00116 #endif 00117 #endif /* READ_CONFIG_H */
1.5.7.1
Last modified: Tuesday, 23-Dec-2025 17:22:04 UTC
For questions regarding web content and site functionality, please write to the net-snmp-users mail list.