2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
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.
17 #ifndef __STC_HELPER_FIREWALL_H__
18 #define __STC_HELPER_FIREWALL_H__
20 #include <arpa/inet.h>
22 #include "stc-manager.h"
23 #include "stc-error.h"
25 #define FIREWALL_CHAIN_TARGET_IN "INPUT"
26 #define FIREWALL_CHAIN_TARGET_OUT "OUTPUT"
28 #define FIREWALL_RULE_TARGET_ACCEPT "ACCEPT"
29 #define FIREWALL_RULE_TARGET_DROP "DROP"
30 #define FIREWALL_RULE_TARGET_LOG "LOG"
31 #define FIREWALL_RULE_TARGET_NFLOG "NFLOG"
33 #define RULE_CHAIN "chain"
34 #define RULE_DIRECTION "direction"
35 #define RULE_IFNAME "ifname"
36 #define RULE_PROTOCOL "protocol"
37 #define RULE_TARGET "target"
38 #define RULE_TARGETTYPE "target_type"
40 #define RULE_FAMILY "family"
41 #define RULE_SIPTYPE "s_ip_type"
42 #define RULE_SIP1 "s_ip1"
43 #define RULE_SIP2 "s_ip2"
44 #define RULE_DIPTYPE "d_ip_type"
45 #define RULE_DIP1 "d_ip1"
46 #define RULE_DIP2 "d_ip2"
47 #define RULE_SPORTTYPE "s_port_type"
48 #define RULE_SPORT1 "s_port1"
49 #define RULE_SPORT2 "s_port2"
50 #define RULE_DPORTTYPE "d_port_type"
51 #define RULE_DPORT1 "d_port1"
52 #define RULE_DPORT2 "d_port2"
54 #define RULE_LOG_LEVEL "log_level"
55 #define RULE_LOG_PREFIX "log_prefix"
56 #define RULE_NFLOG_GROUP "nflog_group"
57 #define RULE_NFLOG_PREFIX "nflog_prefix"
58 #define RULE_NFLOG_RANGE "nflog_range"
59 #define RULE_NFLOG_THRESHOLD "nflog_threshold"
74 stc_fw_chain_target_e target;
81 stc_fw_direction_e direction;
82 stc_fw_ip_type_e s_ip_type;
83 stc_fw_ip_type_e d_ip_type;
84 stc_fw_port_type_e s_port_type;
85 stc_fw_port_type_e d_port_type;
86 stc_fw_protocol_type_e protocol;
87 stc_fw_family_type_e family;
97 stc_fw_rule_target_e target;
104 guint nflog_threshold;
108 stc_error_e firewall_chain_add(firewall_chain_s *chain);
109 stc_error_e firewall_chain_remove(firewall_chain_s *chain);
110 stc_error_e firewall_chain_flush(firewall_chain_s *chain);
111 stc_error_e firewall_chain_set(firewall_chain_s *chain);
112 stc_error_e firewall_chain_unset(firewall_chain_s *chain);
114 stc_error_e firewall_rule_append(firewall_rule_s *rule);
115 stc_error_e firewall_rule_insert(firewall_rule_s *rule);
116 stc_error_e firewall_rule_remove(firewall_rule_s *rule);
118 #endif /*__STC_HELPER_FIREWALL_H__*/