blob: b8ea67daf9880afd03687628adbc3918b153c527 [file] [log] [blame]
Jamal Hadi Salim63c7d262009-02-07 08:19:20 -05001#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 */
9struct 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
29enum xt_tryload {
30 DONT_LOAD,
31 DURING_LOAD,
32 TRY_LOAD,
33 LOAD_MUST_SUCCEED
34};
35
36struct 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
44extern char *lib_dir;
45
46extern void *fw_calloc(size_t count, size_t size);
47extern void *fw_malloc(size_t size);
48
49extern const char *modprobe_program;
50extern int xtables_insmod(const char *modname, const char *modprobe, int quiet);
51extern int load_xtables_ko(const char *modprobe, int quiet);
52
53/* This is decleared in ip[6]tables.c */
54extern struct afinfo afinfo;
55
56/* Keeping track of external matches and targets: linked lists. */
57extern struct xtables_match *xtables_matches;
58extern struct xtables_target *xtables_targets;
59
60extern struct xtables_match *find_match(const char *name, enum xt_tryload,
61 struct xtables_rule_match **match);
62extern struct xtables_target *find_target(const char *name, enum xt_tryload);
63
64extern void _init(void);
65
66#endif /* _XTABLES_INTERNAL_H */