}
/**
+ * Gets pointer to the memory pool, wher received messages are
+ * placed and some ioctls return their info
+ * @param transport transport
+ * @returns pointer to the pool
+ */
+void* dbus_transport_get_pool_pointer(DBusTransport* transport)
+{
+ return ((DBusTransportKdbus*)transport)->kdbus_mmap_ptr;
+}
+
+/**
* Puts locally generated message into received messages queue
* @param message message that will be added
* @param connection connection to which message will be added
msg_size = sizeof(struct kdbus_msg);
if(use_memfd == TRUE) // bulk data - memfd
- msg_size += KDBUS_ITEM_SIZE(sizeof(struct kdbus_memfd));
+ msg_size += KDBUS_PART_SIZE(sizeof(struct kdbus_memfd));
else
{
- msg_size += KDBUS_ITEM_SIZE(sizeof(struct kdbus_vec)); //header is a must
+ msg_size += KDBUS_PART_SIZE(sizeof(struct kdbus_vec)); //header is a must
while(body_size > KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE)
{
- msg_size += KDBUS_ITEM_SIZE(sizeof(struct kdbus_vec));
+ msg_size += KDBUS_PART_SIZE(sizeof(struct kdbus_vec));
body_size -= KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE;
}
if(body_size)
- msg_size += KDBUS_ITEM_SIZE(sizeof(struct kdbus_vec));
+ msg_size += KDBUS_PART_SIZE(sizeof(struct kdbus_vec));
}
if(fds_count)
- msg_size += KDBUS_ITEM_SIZE(sizeof(int)*fds_count);
+ msg_size += KDBUS_PART_SIZE(sizeof(int)*fds_count);
if (name)
- msg_size += KDBUS_ITEM_SIZE(strlen(name) + 1);
+ msg_size += KDBUS_PART_SIZE(strlen(name) + 1);
else if (dst_id == KDBUS_DST_ID_BROADCAST)
msg_size += KDBUS_PART_HEADER_SIZE + transport->bloom_size;
memset(msg, 0, msg_size);
msg->size = msg_size;
- msg->payload_type = KDBUS_PAYLOAD_DBUS1;
+ msg->payload_type = KDBUS_PAYLOAD_DBUS;
msg->dst_id = name ? 0 : dst_id;
msg->src_id = strtoull(dbus_bus_get_unique_name(transport->base.connection), NULL , 10);
static dbus_bool_t bus_register_kdbus(char* name, DBusTransportKdbus* transportS)
{
struct kdbus_cmd_hello __attribute__ ((__aligned__(8))) hello;
+ memset(&hello, 0, sizeof(hello));
hello.conn_flags = KDBUS_HELLO_ACCEPT_FD/* |
KDBUS_HELLO_ATTACH_COMM |
strcpy(name, ":1.");
if(!bus_register_kdbus(&name[3], (DBusTransportKdbus*)transport))
goto out;
+#ifdef POLICY_TO_KDBUS
if(!register_kdbus_policy(&name[3], transport, geteuid()))
goto out;
-
+#endif
((DBusTransportKdbus*)transport)->sender = name;
if(!reply_1_data(message, DBUS_TYPE_STRING, &name, transport->connection))
const char *enum_PAYLOAD(long long id);
TABLE(PAYLOAD) = {
ENUM(KDBUS_PAYLOAD_KERNEL),
- ENUM(KDBUS_PAYLOAD_DBUS1),
- ENUM(KDBUS_PAYLOAD_GVARIANT),
+ ENUM(KDBUS_PAYLOAD_DBUS),
};
LOOKUP(PAYLOAD);
break;
case KDBUS_ITEM_NAME_ADD:
- _dbus_verbose(" +%s (%llu bytes) '%s', old id=%lld, new id=%lld, flags=0x%llx\n",
+ _dbus_verbose(" +%s (%llu bytes) '%s', old id=%lld, new id=%lld, old flags=0x%llx, new flags=0x%llx\n",
enum_MSG(item->type), (unsigned long long) item->size,
item->name_change.name, item->name_change.old_id,
- item->name_change.new_id, item->name_change.flags);
+ item->name_change.new_id, item->name_change.old_flags,
+ item->name_change.new_flags);
message = dbus_message_new_signal(DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, "NameOwnerChanged");
if(message == NULL)
break;
case KDBUS_ITEM_NAME_REMOVE:
- _dbus_verbose(" +%s (%llu bytes) '%s', old id=%lld, new id=%lld, flags=0x%llx\n",
+ _dbus_verbose(" +%s (%llu bytes) '%s', old id=%lld, new id=%lld, old flags=0x%llx, new flags=0x%llx\n",
enum_MSG(item->type), (unsigned long long) item->size,
item->name_change.name, item->name_change.old_id,
- item->name_change.new_id, item->name_change.flags);
+ item->name_change.new_id, item->name_change.old_flags,
+ item->name_change.new_flags);
message = dbus_message_new_signal(DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, "NameOwnerChanged"); // name of the signal
if(message == NULL)
break;
case KDBUS_ITEM_NAME_CHANGE:
- _dbus_verbose(" +%s (%llu bytes) '%s', old id=%lld, new id=%lld, flags=0x%llx\n",
+ _dbus_verbose(" +%s (%llu bytes) '%s', old id=%lld, new id=%lld, old flags=0x%llx, new flags=0x%llx\n",
enum_MSG(item->type), (unsigned long long) item->size,
item->name_change.name, item->name_change.old_id,
- item->name_change.new_id, item->name_change.flags);
+ item->name_change.new_id, item->name_change.old_flags,
+ item->name_change.new_flags);
message = dbus_message_new_signal(DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, "NameOwnerChanged");
if(message == NULL)