00001 #ifndef NETSNMP_TEXT_UTILS_H
00002 #define NETSNMP_TEXT_UTILS_H
00003
00004 #ifdef _cplusplus
00005 extern "C" {
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014 netsnmp_container *
00015 netsnmp_file_text_parse(netsnmp_file *f, netsnmp_container *cin,
00016 int parse_mode, u_int flags, void *context);
00017
00018 #define PM_SAVE_EVERYTHING 1
00019 #define PM_INDEX_STRING_STRING 2
00020 #define PM_USER_FUNCTION 3
00021
00022 #define PM_FLAG_NO_CONTAINER 0x00000001
00023 #define PM_FLAG_SKIP_WHITESPACE 0x00000002
00024
00025
00026
00027
00028
00029 struct netsnmp_line_process_info_s;
00030
00031 typedef struct netsnmp_line_info_s {
00032
00033 size_t index;
00034
00035 char *line;
00036 size_t line_len;
00037 size_t line_max;
00038
00039 char *start;
00040 size_t start_len;
00041
00042 } netsnmp_line_info;
00043
00044 typedef int (Netsnmp_Process_Text_Line)
00045 (netsnmp_line_info *line_info, void *mem,
00046 struct netsnmp_line_process_info_s* lpi);
00047
00048 typedef struct netsnmp_line_process_info_s {
00049
00050 size_t line_max;
00051 size_t mem_size;
00052
00053 u_int flags;
00054
00055 Netsnmp_Process_Text_Line *process;
00056
00057 void *user_context;
00058
00059 } netsnmp_line_process_info;
00060
00061
00062
00063
00064 #define PMLP_RC_STOP_PROCESSING -1
00065 #define PMLP_RC_MEMORY_USED 0
00066 #define PMLP_RC_MEMORY_UNUSED 1
00067
00068
00070 #define PMLP_FLAG_ALLOC_LINE 0x00000001
00071
00072 #define PMLP_FLAG_STRDUP_LINE 0x00000002
00073
00074 #define PMLP_FLAG_LEAVE_NEWLINE 0x00000004
00075
00076 #define PMLP_FLAG_PROCESS_WHITESPACE 0x00000008
00077
00078 #define PMLP_FLAG_NO_CONTAINER 0x00000010
00079
00080
00081
00082
00083
00084
00085 typedef struct netsnmp_token_value_index_s {
00086
00087 char *token;
00088 netsnmp_cvalue value;
00089 size_t index;
00090
00091 } netsnmp_token_value_index;
00092
00093 netsnmp_container *netsnmp_text_token_container_from_file(const char *file,
00094 u_int flags,
00095 netsnmp_container *c,
00096 void *context);
00097
00098
00099
00100 #define NSTTC_FLAG_TYPE_CONTEXT_DIRECT 0x00000001
00101
00102
00103 #define PMLP_TYPE_UNSIGNED 1
00104 #define PMLP_TYPE_INTEGER 2
00105 #define PMLP_TYPE_STRING 3
00106 #define PMLP_TYPE_BOOLEAN 4
00107
00108
00109 #ifdef _cplusplus
00110 }
00111 #endif
00112
00113 #endif