2 * Copyright 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.
18 #include <notification.h>
23 #ifndef SERVICE_COMMON_H_
24 #define SERVICE_COMMON_H_
26 #define NORMAL_UID_BASE 5000
33 NOTIFICATION_SERVICE = 0,
38 enum service_common_error {
39 SERVICE_COMMON_ERROR_NONE = 0,
40 SERVICE_COMMON_ERROR_INVALID_PARAMETER = -1,
41 SERVICE_COMMON_ERROR_ALREADY_STARTED = -2,
42 SERVICE_COMMON_ERROR_FAULT = -3,
43 SERVICE_COMMON_ERROR_PERMISSION_DENIED = -4,
44 SERVICE_COMMON_ERROR_IO_ERROR = -5,
45 SERVICE_COMMON_ERROR_OUT_OF_MEMORY = -6,
46 SERVICE_COMMON_ERROR_NOT_EXIST = -7,
47 SERVICE_COMMON_ERROR_ALREADY_EXIST = -8,
50 typedef struct monitoring_info {
56 int send_notify(GVariant *body, char *cmd, GHashTable **monitoring_hash, char *interface_name, uid_t uid);
57 bool is_existed_busname(const char *sender_name);
58 int send_event_notify_by_busname(GVariant *body, char *cmd, char *busname, char *interface_name);
59 int service_register(GVariant *parameters, GVariant **reply_body, const gchar *sender,
60 GBusNameAppearedCallback name_appeared_handler,
61 GBusNameVanishedCallback name_vanished_handler,
62 GHashTable **monitoring_hash,
64 int service_unregister(GVariant *parameters, GVariant **reply_body, const gchar *sender, GHashTable **monitoring_hash, uid_t uid);
65 int delete_monitoring_list(GHashTable **monitoring_hash, const char *sender, uid_t uid);
66 GDBusConnection *service_common_get_connection();
67 int service_common_register_dbus_interface(char *introspection_xml, GDBusInterfaceVTable interface_vtable);
68 uid_t get_sender_uid(const char *sender_name);
69 pid_t get_sender_pid(const char *sender_name);
70 void free_monitoring_list(gpointer data);
71 void service_common_init(void);
72 void service_common_set_connection(GDBusConnection *conn);
78 #endif //SERVICE_COMMON_H_