Corrected comments in helper-ip6tables.h
[platform/core/connectivity/stc-iptables.git] / src / helper / helper-ip6tables.h
1 /*
2  *  Copyright (c) 2016 Samsung Electronics Co., Ltd.
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License version 2 as
6  *  published by the Free Software Foundation.
7  *
8  *  This program is distributed in the hope that it will be useful,
9  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  *  GNU General Public License for more details.
12  *
13  *  You should have received a copy of the GNU General Public License
14  *  along with this program; if not, write to the Free Software
15  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
16  */
17
18 /*
19  * Manage ip6tables rule using libip6tc
20  */
21 #ifndef __STC_HELPER_IP6TABLES_H__
22 #define __STC_HELPER_IP6TABLES_H__
23
24 #include <libiptc/libip6tc.h>
25
26 #define RULE_SIZE     64
27
28 typedef enum {
29         IP6TABLES_CHAIN_INPUT,
30         IP6TABLES_CHAIN_OUTPUT
31 } ip6tables_chain_e;
32
33 typedef enum {
34         IP6TABLES_RULE_IN,
35         IP6TABLES_RULE_OUT
36 } ip6tables_rule_type_e;
37
38 typedef enum {
39         IP6TABLES_ACTION_ACCEPT,
40         IP6TABLES_ACTION_DROP
41 } ip6tables_target_action_e;
42
43 typedef struct {
44         char *chain;
45         ip6tables_rule_type_e type;
46         char *ifname;
47         int classid;
48         char *nfacct_name;
49         char *target;
50 } ip6tables_rule_s;
51
52 /**
53  * @desc This function adds a new ip6tables rule.
54  * @return 0 on success and negative value if error.
55  */
56 int ip6tables_add_rule(ip6tables_rule_s *rule);
57
58 /**
59  * @desc This function removes already set ip6tables rule.
60  * @return 0 on success and negative value if error.
61  */
62 int ip6tables_remove_rule(ip6tables_rule_s *rule);
63
64 /**
65  * @desc This function adds a new ip6tables chain.
66  * @return 0 on success and negative value if error.
67  */
68 int ip6tables_add_chain(const char *chain);
69
70 /**
71  * @desc This function removes already set ip6tables chain.
72  * @return 0 on success and negative value if error.
73  */
74 int ip6tables_remove_chain(const char *chain);
75
76 /**
77  * @desc This function flushes all ip6tables rules in chain.
78  * @return 0 on success and negative value if error.
79  */
80 int ip6tables_flush_chain(const char *chain);
81
82 #endif /*__STC_HELPER_IP6TABLES_H__*/