3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #ifndef __MOBILEAP_IPTABLES_H__
19 #define __MOBILEAP_IPTABLES_H__
21 #define IPTABLES "/usr/sbin/iptables"
22 #define TABLE_FILTER "filter"
23 #define TABLE_NAT "nat"
24 #define TABLE_MANGLE "mangle"
25 #define CHAIN_FW "FORWARD"
26 #define CHAIN_POST "POSTROUTING"
27 #define CHAIN_PRE "PREROUTING"
28 #define TETH_FILTER_FW "teth_filter_fw"
29 #define TETH_NAT_POST "teth_nat_post"
30 #define TETH_NAT_PRE "teth_nat_pre"
31 #define STATE_RELATED_ESTAB "RELATED,ESTABLISHED"
32 #define STATE_INVALID "INVALID"
33 #define ACTION_DROP "DROP"
34 #define ACTION_RETURN "RETURN"
38 FORWARD_RULE_WITH_ACTION,
39 FORWARD_RULE_WITH_ACTION_AND_STATE,
46 int _iptables_create_chain(const char *table_name, const char *chain_name);
47 int _iptables_flush_rules(const char *table_name, const char *chain_name);
48 int _iptables_delete_chain(const char *table_name, const char *chain_name);
49 int _iptables_add_rule(iptables_rule_e rule_type, const char *table,
50 const char *chain, ...);
51 int _iptables_delete_rule(iptables_rule_e rule_type, const char *table,
52 const char *chain, ...);
53 int _get_data_usage(const char *src, const char *dest, unsigned long long *tx,
54 unsigned long long *rx);