1
#ifndef NETSNMP_TEXT_UTILS_H
2
#define NETSNMP_TEXT_UTILS_H
9
/*------------------------------------------------------------------
11
* text file processing
15
netsnmp_file_text_parse(netsnmp_file *f, netsnmp_container *cin,
16
int parse_mode, u_int flags, void *context);
18
#define PM_SAVE_EVERYTHING 1
19
#define PM_INDEX_STRING_STRING 2
20
#define PM_USER_FUNCTION 3
22
#define PM_FLAG_NO_CONTAINER 0x00000001
23
#define PM_FLAG_SKIP_WHITESPACE 0x00000002
27
* line processing user function
29
struct netsnmp_line_process_info_s; /* fwd decl */
31
typedef struct netsnmp_line_info_s {
44
typedef int (Netsnmp_Process_Text_Line)
45
(netsnmp_line_info *line_info, void *mem,
46
struct netsnmp_line_process_info_s* lpi);
48
typedef struct netsnmp_line_process_info_s {
50
size_t line_max; /* defaults to STRINGMAX if 0 */
55
Netsnmp_Process_Text_Line *process;
59
} netsnmp_line_process_info;
62
* user function return codes
64
#define PMLP_RC_STOP_PROCESSING -1
65
#define PMLP_RC_MEMORY_USED 0
66
#define PMLP_RC_MEMORY_UNUSED 1
69
/** ALLOC_LINE: wasteful, but fast */
70
#define PMLP_FLAG_ALLOC_LINE 0x00000001
71
/** STRDUP_LINE: slower if you don't keep memory in most cases */
72
#define PMLP_FLAG_STRDUP_LINE 0x00000002
73
/** don't strip trailing newlines */
74
#define PMLP_FLAG_LEAVE_NEWLINE 0x00000004
75
/** don't skip blank or comment lines */
76
#define PMLP_FLAG_PROCESS_WHITESPACE 0x00000008
77
/** just process line, don't save it */
78
#define PMLP_FLAG_NO_CONTAINER 0x00000010
82
* a few useful pre-defined helpers
85
typedef struct netsnmp_token_value_index_s {
91
} netsnmp_token_value_index;
93
netsnmp_container *netsnmp_text_token_container_from_file(const char *file,
100
#define NSTTC_FLAG_TYPE_CONTEXT_DIRECT 0x00000001
103
#define PMLP_TYPE_UNSIGNED 1
104
#define PMLP_TYPE_INTEGER 2
105
#define PMLP_TYPE_STRING 3
106
#define PMLP_TYPE_BOOLEAN 4
113
#endif /* NETSNMP_TEXT_UTILS_H */