Modify init value for logging mode
[platform/core/connectivity/stc-iptables.git] / unittest / gdbus.h
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 #ifndef __STC_IPT_GDBUS_H__
17 #define __STC_IPT_GDBUS_H__
18
19 #include <glib.h>
20 #include <gio/gio.h>
21
22 #include "stcmgr.h"
23
24 #define GMAINTIMEOUT 10000
25 #define DBUS_REPLY_TIMEOUT (120 * 1000)
26
27 #define STC_IPT_DBUS_SERVICE               "net.stc.iptables"
28 #define STC_IPT_DBUS_MANAGER_INTERFACE     STC_IPT_DBUS_SERVICE ".manager"
29 #define STC_IPT_DBUS_RULE_INTERFACE        STC_IPT_DBUS_SERVICE ".rule"
30 #define STC_IPT_DBUS_CHAIN_INTERFACE       STC_IPT_DBUS_SERVICE ".chain"
31 #define STC_IPT_DBUS_SERVICE_MANAGER_PATH  "/net/stc/iptables/manager"
32 #define STC_IPT_DBUS_SERVICE_RULE_PATH     "/net/stc/iptables/rule"
33 #define STC_IPT_DBUS_SERVICE_CHAIN_PATH    "/net/stc/iptables/chain"
34
35 class GDbus {
36 private:
37         GDBusConnection *m_pConnection;
38         GCancellable *m_pCancellable;
39 public:
40         GDbus();
41         ~GDbus();
42         error_e Create(void);
43         error_e Destroy(void);
44         GDBusConnection *GetConnection(void);
45         GCancellable *GetCancellable(void);
46         error_e ConvertErrorStringToEnum(const char *error);
47         GVariant *InvokeMethod(const char *dest, const char *path,
48                 const char *iface_name, const char *method, GVariant *params, error_e *dbus_error);
49         error_e InvokeMethodNonblock(const char *dest, const char *path,
50                 const char *iface_name, const char *method, GVariant *params, int timeout,
51                 GAsyncReadyCallback notify_func, void *user_data);
52 };
53
54 #endif /* __STC_IPT_GDBUS_H__ */