• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _XTABLES_INTERNAL_H
2 #define _XTABLES_INTERNAL_H 1
3 
4 #ifndef XT_LIB_DIR
5 #	define XT_LIB_DIR "/lib/xtables"
6 #endif
7 
8 /* protocol family dependent informations */
9 struct afinfo {
10 	/* protocol family */
11 	int family;
12 
13 	/* prefix of library name (ex "libipt_" */
14 	char *libprefix;
15 
16 	/* used by setsockopt (ex IPPROTO_IP */
17 	int ipproto;
18 
19 	/* kernel module (ex "ip_tables" */
20 	char *kmod;
21 
22 	/* optname to check revision support of match */
23 	int so_rev_match;
24 
25 	/* optname to check revision support of match */
26 	int so_rev_target;
27 };
28 
29 enum xt_tryload {
30 	DONT_LOAD,
31 	DURING_LOAD,
32 	TRY_LOAD,
33 	LOAD_MUST_SUCCEED
34 };
35 
36 struct xtables_rule_match {
37 	struct xtables_rule_match *next;
38 	struct xtables_match *match;
39 	/* Multiple matches of the same type: the ones before
40 	   the current one are completed from parsing point of view */
41 	unsigned int completed;
42 };
43 
44 extern char *lib_dir;
45 
46 extern void *fw_calloc(size_t count, size_t size);
47 extern void *fw_malloc(size_t size);
48 
49 extern const char *modprobe_program;
50 extern int xtables_insmod(const char *modname, const char *modprobe, int quiet);
51 extern int load_xtables_ko(const char *modprobe, int quiet);
52 
53 /* This is decleared in ip[6]tables.c */
54 extern struct afinfo afinfo;
55 
56 /* Keeping track of external matches and targets: linked lists.  */
57 extern struct xtables_match *xtables_matches;
58 extern struct xtables_target *xtables_targets;
59 
60 extern struct xtables_match *find_match(const char *name, enum xt_tryload,
61 					struct xtables_rule_match **match);
62 extern struct xtables_target *find_target(const char *name, enum xt_tryload);
63 
64 extern void _init(void);
65 
66 #endif /* _XTABLES_INTERNAL_H */
67