2 * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 #ifndef __STC_MGR_FIREWALL_H__
17 #define __STC_MGR_FIREWALL_H__
25 #define FIREWALL_RULE_CHAIN "chain"
26 #define FIREWALL_RULE_DIRECTION "direction"
27 #define FIREWALL_RULE_IFNAME "ifname"
28 #define FIREWALL_RULE_PROTOCOL "protocol"
29 #define FIREWALL_RULE_TARGET "target"
30 #define FIREWALL_RULE_TARGETTYPE "target_type"
32 #define FIREWALL_RULE_FAMILY "family"
33 #define FIREWALL_RULE_SIPTYPE "s_ip_type"
34 #define FIREWALL_RULE_SIP1 "s_ip1"
35 #define FIREWALL_RULE_SIP2 "s_ip2"
36 #define FIREWALL_RULE_DIPTYPE "d_ip_type"
37 #define FIREWALL_RULE_DIP1 "d_ip1"
38 #define FIREWALL_RULE_DIP2 "d_ip2"
39 #define FIREWALL_RULE_SPORTTYPE "s_port_type"
40 #define FIREWALL_RULE_SPORT1 "s_port1"
41 #define FIREWALL_RULE_SPORT2 "s_port2"
42 #define FIREWALL_RULE_DPORTTYPE "d_port_type"
43 #define FIREWALL_RULE_DPORT1 "d_port1"
44 #define FIREWALL_RULE_DPORT2 "d_port2"
46 #define FIREWALL_RULE_LOG_LEVEL "log_level"
47 #define FIREWALL_RULE_LOG_PREFIX "log_prefix"
48 #define FIREWALL_RULE_NFLOG_GROUP "nflog_group"
49 #define FIREWALL_RULE_NFLOG_PREFIX "nflog_prefix"
50 #define FIREWALL_RULE_NFLOG_RANGE "nflog_range"
51 #define FIREWALL_RULE_NFLOG_THRESHOLD "nflog_threshold"
60 char chain[CHAIN_LEN];
76 char iface[IFACE_LEN];
83 class Firewall : public GDbus {
89 error_e SetRule(const char *app_id, const char *iface_name,
90 const char *subscriber_id, iface_type_e iface_type,
91 int64_t data_limit, int64_t data_warn_limit,
92 roaming_type_e roaming_type, const char *mac);
93 void MakeRuleParams(GVariant **params);
94 void MakeGetParams(GVariant **params);
95 void MakeStatusParams(GVariant **params);
98 error_e GetLock(int *state);
99 error_e AddChain(const char * chain);
100 error_e RemoveChain(const char * chain);
101 error_e FlushChain(const char * chain);
102 error_e GetAllChain();
103 error_e SetChain(const char *chain, unsigned int target);
104 error_e UnsetChain(const char *chain);
105 error_e SetRule(const char *chain, guint16 direction,
106 guint16 siptype, guint16 diptype, guint16 sporttype,
107 guint16 dporttype, guint16 protocol, guint16 family,
108 const char *sip1, const char *dip1, const char *sip2,
109 const char *dip2, guint32 dport1, guint32 dport2,
110 guint32 sport1, guint32 sport2, const char *iface,
113 error_e RemoveRule();
114 error_e UpdateRule();
115 error_e GetAllRule();
118 #endif /* __STC_MGR_FIREWALL_H__ */