Kdbus upstream merge in progress
[platform/upstream/dbus.git] / dbus / kdbus-common.h
index 93cd726..9958dd5 100644 (file)
@@ -1,10 +1,27 @@
-/*
- * kdbus_common.h
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* kdbus-common.h  kdbus related utils for daemon and libdbus
  *
- *  Created on: Sep 13, 2013
- *      Author: r.pajak
+ * Copyright (C) 2013  Samsung Electronics
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version and under the terms of the GNU
+ * Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
- *  Kdbus internal util functions used by daemon and libdbus
  */
 
 #ifndef KDBUS_COMMON_H_
 
 #include <dbus/dbus-types.h>
 #include <dbus/dbus-transport.h>
+#include <dbus/kdbus.h>
 
 #define KDBUS_ALIGN8(l) (((l) + 7) & ~7)
 #define KDBUS_PART_NEXT(part) \
        (typeof(part))(((uint8_t *)part) + KDBUS_ALIGN8((part)->size))
-#define KDBUS_ITEM_SIZE(s) KDBUS_ALIGN8((s) + KDBUS_PART_HEADER_SIZE)
+#define KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE  0x00800000              /* maximum size of message header and items */
+#define KDBUS_PART_HEADER_SIZE          offsetof(struct kdbus_item, data)
+#define KDBUS_PART_SIZE(s) KDBUS_ALIGN8((s) + KDBUS_PART_HEADER_SIZE)
+
+//todo restore if DBus policy will be applied in kdbus somehow
+#define POLICY_TO_KDBUS
 
-/*struct kdbus_policy *make_policy_name(const char *name);
-struct kdbus_policy *make_policy_access(__u64 type, __u64 bits, __u64 id);
-void append_policy(struct kdbus_cmd_policy *cmd_policy, struct kdbus_policy *policy, __u64 max_size);*/
-dbus_bool_t register_kdbus_policy(const char* name, int fd);
-dbus_bool_t list_kdbus_names(int fd, char ***listp, int *array_len);
+dbus_bool_t register_kdbus_policy(const char* name, DBusTransport *transport, unsigned long int uid);
 int request_kdbus_name(int fd, const char *name, const __u64 flags, __u64 id);
 int release_kdbus_name(int fd, const char *name, __u64 id);