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