1 #ifndef _SENDIP_MODULE_H
2 #define _SENDIP_MODULE_H
3 
4 #include <stdio.h>   // for fprintf
5 
6 #include "types.h"
7 
8 /* Options
9  */
10 typedef struct {
11 	const char *optname;
12 	const bool arg;
13 	const char *description;
14 	const char *def;
15 } sendip_option;
16 
17 /* Data
18  */
19 typedef struct {
20 	void *data;
21 	int alloc_len;
22 	unsigned int modified;
23 } sendip_data;
24 
25 /* Prototypes */
26 #ifndef _SENDIP_MAIN
27 sendip_data *initialize(void);
28 bool do_opt(char *optstring, char *optarg, sendip_data *pack);
29 bool set_addr(char *hostname, sendip_data *pack);
30 bool finalize(char *hdrs, sendip_data *headers[], sendip_data *data,
31 				  sendip_data *pack);
32 int num_opts(void);
33 sendip_option *get_opts(void);
34 char get_optchar(void);
35 
36 #endif  /* _SENDIP_MAIN */
37 
38 #define usage_error(x) fprintf(stderr,x)
39 
40 extern u_int16_t csum(u_int16_t *packet, int packlen);
41 extern int compact_string(char *data_out);
42 
43 #endif  /* _SENDIP_MODULE_H */
44