1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /* kdbus-common.h kdbus related utils for daemon and libdbus
4 * Copyright (C) 2013 Samsung Electronics
6 * Licensed under the Academic Free License version 2.1
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version and under the terms of the GNU
12 * Lesser General Public License as published by the
13 * Free Software Foundation; either version 2.1 of the License, or (at
14 * your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 #ifndef KDBUS_COMMON_H_
28 #define KDBUS_COMMON_H_
30 #include <dbus/dbus-types.h>
31 #include <dbus/dbus-transport.h>
32 #include <dbus/kdbus.h>
34 #define KDBUS_ALIGN8(l) (((l) + 7) & ~7)
35 #define KDBUS_PART_NEXT(part) \
36 (typeof(part))(((uint8_t *)part) + KDBUS_ALIGN8((part)->size))
37 #define KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE 0x00800000 /* maximum size of message header and items */
38 #define KDBUS_PART_HEADER_SIZE offsetof(struct kdbus_item, data)
39 #define KDBUS_PART_SIZE(s) KDBUS_ALIGN8((s) + KDBUS_PART_HEADER_SIZE)
41 //todo restore if DBus policy will be applied in kdbus somehow
42 #define POLICY_TO_KDBUS
44 dbus_bool_t register_kdbus_policy(const char* name, DBusTransport *transport, unsigned long int uid);
45 int request_kdbus_name(int fd, const char *name, const __u64 flags, __u64 id);
46 int release_kdbus_name(int fd, const char *name, __u64 id);
48 #endif /* KDBUS_COMMON_H_ */