-
Notifications
You must be signed in to change notification settings - Fork 0
/
sendip_module.h
56 lines (47 loc) · 1.47 KB
/
sendip_module.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/** sendip_module.h */
#ifndef _SENDIP_MODULE_H
#define _SENDIP_MODULE_H
#include <stdbool.h>
#ifndef LINE_MAX
#define LINE_MAX 2048 /* single option value is usually not longer [bytes] */
#endif
/* Options */
typedef struct {
const char *optname; /* sub option character */
const bool arg; /* expects an argument */
const char *description; /* short description of the option */
const char *def; /* default value to show in the description */
} sendip_option;
/* Data */
typedef struct {
void *data;
int alloc_len;
unsigned int modified;
void *private; /* Untouched by sendip main */
} sendip_data;
/* The loaded module - see load_sendip_module() */
typedef struct {
char *name;
char optchar;
int num_opts;
sendip_option *opts;
sendip_data * (*initialize)(void);
bool (*do_opt)(const char *optstring, const char *optarg, sendip_data *pack);
bool (*set_addr)(char *hostname, sendip_data *pack);
bool (*finalize)(char *hdrs, sendip_data *headers[], int index,
sendip_data *data, sendip_data *pack);
} sendip_module;
/* Prototypes */
#ifndef _SENDIP_MAIN
sendip_data *initialize(void);
bool do_opt(const char *optstring, const char *optarg, sendip_data *pack);
bool set_addr(char *hostname, sendip_data *pack);
bool finalize(char *hdrs, sendip_data *headers[], int index, sendip_data *data,
sendip_data *pack);
int num_opts(void);
sendip_option *get_opts(void);
char get_optchar(void);
#endif /* _SENDIP_MAIN */
#endif /* _SENDIP_MODULE_H */
/* vim: ts=4 sw=4 filetype=c
*/