#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdbool.h>
#include <xtables.h>
#include <libiptc/xtcshared.h>
#include "linux_list.h"
Data Structures | |
struct | counter_map |
struct | rule_head |
struct | chain_head |
struct | xtc_handle |
struct | iptcb_chain_start |
struct | iptcb_chain_foot |
struct | iptcb_chain_error |
Macros | |
#define | DEBUGP(x, args...) |
#define | DEBUGP_C(x, args...) |
#define | debug(x, args...) |
#define | CHECK(h) |
#define | CHAIN_INDEX_BUCKET_LEN 40 |
#define | CHAIN_INDEX_INSERT_MAX 355 |
#define | IPTCB_CHAIN_START_SIZE |
#define | IPTCB_CHAIN_FOOT_SIZE |
#define | IPTCB_CHAIN_ERROR_SIZE |
Enumerations | |
enum | iptcc_rule_type { IPTCC_R_STANDARD, IPTCC_R_MODULE, IPTCC_R_FALLTHROUGH, IPTCC_R_JUMP } |
enum | bsearch_type { BSEARCH_NAME, BSEARCH_OFFSET } |
Variables | |
const struct xtc_ops | TC_OPS |
#define CHAIN_INDEX_BUCKET_LEN 40 |
Referenced by TC_CREATE_CHAIN().
#define CHAIN_INDEX_INSERT_MAX 355 |
Referenced by TC_CREATE_CHAIN().
#define CHECK | ( | h | ) |
Referenced by TC_COMMIT(), TC_DUMP_ENTRIES(), TC_INIT(), TC_READ_COUNTER(), TC_SET_COUNTER(), and TC_ZERO_COUNTER().
#define debug | ( | x, | |
args... | |||
) |
Referenced by TC_CREATE_CHAIN().
#define DEBUGP | ( | x, | |
args... | |||
) |
#define DEBUGP_C | ( | x, | |
args... | |||
) |
Referenced by TC_FIRST_RULE(), and TC_NEXT_RULE().
#define IPTCB_CHAIN_ERROR_SIZE |
#define IPTCB_CHAIN_FOOT_SIZE |
#define IPTCB_CHAIN_START_SIZE |
enum bsearch_type |
enum iptcc_rule_type |
int TC_APPEND_ENTRY | ( | const IPT_CHAINLABEL | chain, |
const STRUCT_ENTRY * | e, | ||
struct xtc_handle * | handle | ||
) |
int TC_BUILTIN | ( | const char * | chain, |
struct xtc_handle *const | handle | ||
) |
int TC_CHECK_ENTRY | ( | const IPT_CHAINLABEL | chain, |
const STRUCT_ENTRY * | origfw, | ||
unsigned char * | matchmask, | ||
struct xtc_handle * | handle | ||
) |
int TC_COMMIT | ( | struct xtc_handle * | handle | ) |
References xtc_handle::chains, xtc_handle::changed, CHECK, rule_head::counter_map, chain_head::counter_map, chain_head::counters, DEBUGP, rule_head::entry, chain_head::foot_index, rule_head::index, xtc_handle::info, rule_head::list, chain_head::list, list_for_each_entry, counter_map::mappos, counter_map::maptype, new_number, chain_head::rules, SO_SET_ADD_COUNTERS, SO_SET_REPLACE, xtc_handle::sockfd, STRUCT_COUNTERS, STRUCT_COUNTERS_INFO, STRUCT_REPLACE, TC_DUMP_ENTRIES(), and TC_IPPROTO.
int TC_CREATE_CHAIN | ( | const IPT_CHAINLABEL | chain, |
struct xtc_handle * | handle | ||
) |
References CHAIN_INDEX_BUCKET_LEN, CHAIN_INDEX_INSERT_MAX, xtc_handle::chain_index_sz, debug, DEBUGP, IPT_CHAINLABEL, LABEL_ACCEPT, LABEL_DROP, LABEL_QUEUE, LABEL_RETURN, and xtc_handle::num_chains.
Referenced by TC_STRERROR().
int TC_DELETE_CHAIN | ( | const IPT_CHAINLABEL | chain, |
struct xtc_handle * | handle | ||
) |
References xtc_handle::chain_iterator_cur, DEBUGP, xtc_handle::num_chains, chain_head::num_rules, chain_head::references, TC_BUILTIN(), and TC_GET_REFERENCES().
Referenced by TC_STRERROR().
int TC_DELETE_ENTRY | ( | const IPT_CHAINLABEL | chain, |
const STRUCT_ENTRY * | origfw, | ||
unsigned char * | matchmask, | ||
struct xtc_handle * | handle | ||
) |
int TC_DELETE_NUM_ENTRY | ( | const IPT_CHAINLABEL | chain, |
unsigned int | rulenum, | ||
struct xtc_handle * | handle | ||
) |
References rule_head::list, list_entry, chain_head::num_rules, list_head::prev, and xtc_handle::rule_iterator_cur.
Referenced by TC_STRERROR().
void TC_DUMP_ENTRIES | ( | struct xtc_handle *const | handle | ) |
References CHECK, dump_entry(), xtc_handle::entries, ENTRY_ITERATE, HOOK_FORWARD, HOOK_LOCAL_IN, HOOK_LOCAL_OUT, HOOK_POST_ROUTING, HOOK_PRE_ROUTING, and xtc_handle::info.
Referenced by TC_COMMIT().
const char* TC_FIRST_CHAIN | ( | struct xtc_handle * | handle | ) |
References xtc_handle::chain_iterator_cur, xtc_handle::chains, DEBUGP, chain_head::list, list_entry, chain_head::name, list_head::next, and NULL.
const STRUCT_ENTRY* TC_FIRST_RULE | ( | const char * | chain, |
struct xtc_handle * | handle | ||
) |
References DEBUGP, DEBUGP_C, rule_head::entry, rule_head::list, list_entry, list_head::next, NULL, xtc_handle::rule_iterator_cur, and chain_head::rules.
int TC_FLUSH_ENTRIES | ( | const IPT_CHAINLABEL | chain, |
struct xtc_handle * | handle | ||
) |
References rule_head::list, list_for_each_entry_safe, chain_head::num_rules, and chain_head::rules.
void TC_FREE | ( | struct xtc_handle * | h | ) |
References xtc_handle::chains, xtc_handle::entries, rule_head::list, chain_head::list, list_for_each_entry_safe, chain_head::rules, and xtc_handle::sockfd.
Referenced by TC_INIT().
const char* TC_GET_POLICY | ( | const char * | chain, |
STRUCT_COUNTERS * | counters, | ||
struct xtc_handle * | handle | ||
) |
References chain_head::counters, DEBUGP, NULL, and chain_head::verdict.
int TC_GET_REFERENCES | ( | unsigned int * | ref, |
const IPT_CHAINLABEL | chain, | ||
struct xtc_handle * | handle | ||
) |
References chain_head::references.
Referenced by TC_DELETE_CHAIN().
const char* TC_GET_TARGET | ( | const STRUCT_ENTRY * | ce, |
struct xtc_handle * | handle | ||
) |
References container_of, data, DEBUGP, rule_head::entry, GET_TARGET(), IPTCC_R_FALLTHROUGH, IPTCC_R_JUMP, IPTCC_R_MODULE, IPTCC_R_STANDARD, rule_head::jump, chain_head::name, NULL, STRUCT_ENTRY, and rule_head::type.
struct xtc_handle* TC_INIT | ( | const char * | tablename | ) |
References CHECK, DEBUGP, xtc_handle::entries, error, info, xtc_handle::info, NULL, s, SO_GET_ENTRIES, SO_GET_INFO, sockfd, xtc_handle::sockfd, STRUCT_GET_ENTRIES, STRUCT_GETINFO, TABLE_MAXNAMELEN, TC_AF, TC_FREE(), and TC_IPPROTO.
Referenced by TC_STRERROR().
int TC_INSERT_ENTRY | ( | const IPT_CHAINLABEL | chain, |
const STRUCT_ENTRY * | e, | ||
unsigned int | rulenum, | ||
struct xtc_handle * | handle | ||
) |
References rule_head::counter_map, rule_head::entry, rule_head::list, counter_map::maptype, chain_head::num_rules, list_head::prev, and chain_head::rules.
Referenced by TC_STRERROR().
int TC_IS_CHAIN | ( | const char * | chain, |
struct xtc_handle *const | handle | ||
) |
References NULL.
const char* TC_NEXT_CHAIN | ( | struct xtc_handle * | handle | ) |
References xtc_handle::chain_iterator_cur, DEBUGP, chain_head::name, and NULL.
const STRUCT_ENTRY* TC_NEXT_RULE | ( | const STRUCT_ENTRY * | prev, |
struct xtc_handle * | handle | ||
) |
References rule_head::chain, DEBUGP, DEBUGP_C, rule_head::entry, rule_head::list, list_entry, list_head::next, NULL, xtc_handle::rule_iterator_cur, and chain_head::rules.
STRUCT_COUNTERS* TC_READ_COUNTER | ( | const IPT_CHAINLABEL | chain, |
unsigned int | rulenum, | ||
struct xtc_handle * | handle | ||
) |
References CHECK, rule_head::entry, and NULL.
Referenced by TC_STRERROR().
int TC_RENAME_CHAIN | ( | const IPT_CHAINLABEL | oldname, |
const IPT_CHAINLABEL | newname, | ||
struct xtc_handle * | handle | ||
) |
References IPT_CHAINLABEL, LABEL_ACCEPT, LABEL_DROP, LABEL_QUEUE, LABEL_RETURN, chain_head::name, and TC_BUILTIN().
int TC_REPLACE_ENTRY | ( | const IPT_CHAINLABEL | chain, |
const STRUCT_ENTRY * | e, | ||
unsigned int | rulenum, | ||
struct xtc_handle * | handle | ||
) |
References rule_head::counter_map, rule_head::entry, rule_head::list, counter_map::maptype, and chain_head::num_rules.
Referenced by TC_STRERROR().
int TC_SET_COUNTER | ( | const IPT_CHAINLABEL | chain, |
unsigned int | rulenum, | ||
STRUCT_COUNTERS * | counters, | ||
struct xtc_handle * | handle | ||
) |
References CHECK, rule_head::counter_map, rule_head::entry, counter_map::maptype, STRUCT_COUNTERS, and STRUCT_ENTRY.
int TC_SET_POLICY | ( | const IPT_CHAINLABEL | chain, |
const IPT_CHAINLABEL | policy, | ||
STRUCT_COUNTERS * | counters, | ||
struct xtc_handle * | handle | ||
) |
References chain_head::counter_map, chain_head::counters, DEBUGP, LABEL_ACCEPT, LABEL_DROP, counter_map::maptype, NF_ACCEPT, NF_DROP, STRUCT_COUNTERS, and chain_head::verdict.
Referenced by TC_STRERROR().
const char* TC_STRERROR | ( | int | err | ) |
References NULL, TC_CREATE_CHAIN(), TC_DELETE_CHAIN(), TC_DELETE_ENTRY(), TC_DELETE_NUM_ENTRY(), TC_INIT(), TC_INSERT_ENTRY(), TC_READ_COUNTER(), TC_REPLACE_ENTRY(), TC_SET_POLICY(), and TC_ZERO_COUNTER().
int TC_ZERO_COUNTER | ( | const IPT_CHAINLABEL | chain, |
unsigned int | rulenum, | ||
struct xtc_handle * | handle | ||
) |
References CHECK, rule_head::counter_map, and counter_map::maptype.
Referenced by TC_STRERROR().
int TC_ZERO_ENTRIES | ( | const IPT_CHAINLABEL | chain, |
struct xtc_handle * | handle | ||
) |