[Fix] Use localtime_r() instead of localtime()
[platform/core/connectivity/stc-manager.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_MGR_GDBUS_H__
17 #define __STC_MGR_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_MGR_SERVICE                 "net.stc"
28 #define STC_MGR_STATISTICS_INTERFACE    STC_MGR_SERVICE ".statistics"
29 #define STC_MGR_RESTRICTION_INTERFACE   STC_MGR_SERVICE ".restriction"
30 #define STC_MGR_MANAGER_INTERFACE       STC_MGR_SERVICE ".manager"
31
32 #define STC_MGR_STATISTICS_PATH         "/net/stc/statistics"
33 #define STC_MGR_RESTRICTION_PATH        "/net/stc/restriction"
34 #define STC_MGR_MANAGER_PATH            "/net/stc/manager"
35
36 #define STC_MGR_METHOD_STATISTICS_INIT              "Init"
37 #define STC_MGR_METHOD_STATISTICS_GET_PER_APP_ID    "Get"
38 #define STC_MGR_METHOD_STATISTICS_GET_ALL           "GetAll"
39 #define STC_MGR_METHOD_STATISTICS_GET_TOTAL         "Get"
40 #define STC_MGR_METHOD_STATISTICS_RESET             "Reset"
41
42 #define STC_MGR_METHOD_RESTRICTION_SET              "Set"
43 #define STC_MGR_METHOD_RESTRICTION_GET_STATUS       "GetState"
44 #define STC_MGR_METHOD_RESTRICTION_GET_PER_APP_ID   "Get"
45 #define STC_MGR_METHOD_RESTRICTION_GET_ALL          "GetAll"
46 #define STC_MGR_METHOD_RESTRICTION_UNSET            "Unset"
47 #define STC_MGR_METHOD_RESTRICTION_EXCLUDE          "Exclude"
48
49 #define STC_MGR_METHOD_MANAGER_STOP                 "Stop"
50
51 class GDbus {
52 private:
53         GDBusConnection *m_pConnection;
54         GCancellable *m_pCancellable;
55 public:
56         GDbus();
57         ~GDbus();
58         error_e Create(void);
59         error_e Destroy(void);
60         GDBusConnection *GetConnection(void);
61         GCancellable *GetCancellable(void);
62         error_e ConvertErrorStringToEnum(const char *error);
63         GVariant *InvokeMethod(const char *dest, const char *path,
64                 const char *iface_name, const char *method, GVariant *params, error_e *dbus_error);
65         error_e InvokeMethodNonblock(const char *dest, const char *path,
66                 const char *iface_name, const char *method, GVariant *params, int timeout,
67                 GAsyncReadyCallback notify_func, void *user_data);
68 };
69
70 #endif /* __STC_MGR_GDBUS_H__ */