2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
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.
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.
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
18 #ifndef __STC_IPTABLES_UTIL_H__
19 #define __STC_IPTABLES_UTIL_H__
25 #include "stc-iptables-gdbus.h"
26 #include "helper-log.h"
28 #define MALLOC0(t, n) ((t*) g_try_malloc0((n) * sizeof(t)))
29 #define FREE(p) do { \
36 #define STC_DEBUG_GDBUS_VARIANT(str, parameters) do { \
37 gchar *params_str = NULL; \
39 params_str = g_variant_print(parameters, \
42 STC_LOGD("%s[%s]", str, \
43 params_str ? params_str : "NULL"); \
47 #define STC_DEBUG_GDBUS_KEY_VALUE(key, value) do { \
49 STC_LOGD("Key : [%s]", key); \
52 STC_DEBUG_GDBUS_VARIANT("Value: ", value); \
56 gboolean handle_iptables_stop(StcManager *object,
57 GDBusMethodInvocation *invocation);
60 gboolean handle_iptables_add_rule(StcRule *object,
61 GDBusMethodInvocation *invocation,
65 gboolean handle_iptables_insert_rule(StcRule *object,
66 GDBusMethodInvocation *invocation,
70 gboolean handle_iptables_remove_rule(StcRule *object,
71 GDBusMethodInvocation *invocation,
75 gboolean handle_iptables_add_chain(StcChain *object,
76 GDBusMethodInvocation *invocation,
80 gboolean handle_iptables_remove_chain(StcChain *object,
81 GDBusMethodInvocation *invocation,
85 gboolean handle_iptables_flush_chain(StcChain *object,
86 GDBusMethodInvocation *invocation,
91 gboolean handle_ip6tables_add_rule(StcRule *object,
92 GDBusMethodInvocation *invocation,
96 gboolean handle_ip6tables_insert_rule(StcRule *object,
97 GDBusMethodInvocation *invocation,
101 gboolean handle_ip6tables_remove_rule(StcRule *object,
102 GDBusMethodInvocation *invocation,
106 gboolean handle_ip6tables_add_chain(StcChain *object,
107 GDBusMethodInvocation *invocation,
111 gboolean handle_ip6tables_remove_chain(StcChain *object,
112 GDBusMethodInvocation *invocation,
116 gboolean handle_ip6tables_flush_chain(StcChain *object,
117 GDBusMethodInvocation *invocation,
121 #endif /* __STC_IPTABLES_UTIL_H__ */