2 *****************************************************************************
4 * File: fw_util_iptables.h
6 * Author: Damien Stuart (dstuart@dstuart.org)
8 * Purpose: Header file for fw_util_iptables.c.
10 * Copyright 2010 Damien Stuart (dstuart@dstuart.org)
12 * License (GNU Public License):
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
29 *****************************************************************************
31 #ifndef FW_UTIL_IPTABLES_H
32 #define FW_UTIL_IPTABLES_H
34 #define SNAT_TARGET_BUFSIZE 64
36 /* iptables command args
38 #define IPT_ADD_RULE_ARGS "-t %s -A %s -p %i -s %s --dport %i -m comment --comment " EXPIRE_COMMENT_PREFIX "%u -j %s 2>&1"
39 #define IPT_ADD_OUT_RULE_ARGS "-t %s -A %s -p %i -d %s --sport %i -m comment --comment " EXPIRE_COMMENT_PREFIX "%u -j %s 2>&1"
40 #define IPT_ADD_FWD_RULE_ARGS "-t %s -A %s -p %i -s %s -d %s --dport %i -m comment --comment " EXPIRE_COMMENT_PREFIX "%u -j %s 2>&1"
41 #define IPT_ADD_DNAT_RULE_ARGS "-t %s -A %s -p %i -s %s --dport %i -m comment --comment " EXPIRE_COMMENT_PREFIX "%u -j %s --to-destination %s:%i 2>&1"
42 #define IPT_ADD_SNAT_RULE_ARGS "-t %s -A %s -p %i -d %s --dport %i -m comment --comment " EXPIRE_COMMENT_PREFIX "%u -j %s %s 2>&1"
43 #define IPT_TMP_COMMENT_ARGS "-t %s -I %s %i -s 127.0.0.2 -m comment --comment " TMP_COMMENT " -j %s 2>&1"
44 #define IPT_DEL_RULE_ARGS "-t %s -D %s %i 2>&1"
45 #define IPT_NEW_CHAIN_ARGS "-t %s -N %s 2>&1"
46 #define IPT_FLUSH_CHAIN_ARGS "-t %s -F %s 2>&1"
47 #define IPT_DEL_CHAIN_ARGS "-t %s -X %s 2>&1"
48 #define IPT_ADD_JUMP_RULE_ARGS "-t %s -I %s %i -j %s 2>&1"
49 #define IPT_LIST_RULES_ARGS "-t %s -L %s --line-numbers -n 2>&1"
50 #define IPT_LIST_ALL_RULES_ARGS "-t %s -v -n -L --line-numbers 2>&1"
52 #endif /* FW_UTIL_IPTABLES_H */