test: split up code, resolve enums, add stand-alone test daemon

-- opening /dev/kdbus/control
-- creating bus '2702-testbus'
-- opening bus connection /dev/kdbus/2702-testbus/bus
-- Our peer ID for /dev/kdbus/2702-testbus/bus: 1
-- opening bus connection /dev/kdbus/2702-testbus/bus
-- Our peer ID for /dev/kdbus/2702-testbus/bus: 2
name_acquire(): flags after call: 0x0
name_acquire(): flags after call: 0x202
REGISTRY:
  'foo.bar.baz' is acquired by id 1

-- entering poll loop ...
MESSAGE: KDBUS_PAYLOAD_NONE (168 bytes) flags=0x0, KERNEL → BROADCAST, cookie=0, timeout=0
  +KDBUS_MSG_ID_ADD (168 bytes) 2
  +KDBUS_MSG_TIMESTAMP (24 bytes) 51119981535 ns

MESSAGE: KDBUS_PAYLOAD_NONE (192 bytes) flags=0x0, KERNEL → BROADCAST, cookie=0, timeout=0
  +KDBUS_MSG_NAME_ADD (192 bytes) 'foo.bar.baz', old id=0, new id=1, flags=0x0
  +KDBUS_MSG_TIMESTAMP (24 bytes) 51120038634 ns

REGISTRY:
  'foo.bar.baz' is acquired by id 1

MESSAGE: KDBUS_PAYLOAD_NONE (192 bytes) flags=0x0, KERNEL → BROADCAST, cookie=0, timeout=0
  +KDBUS_MSG_NAME_ADD (192 bytes) 'foo.bar.baz', old id=0, new id=1, flags=0x0
  +KDBUS_MSG_TIMESTAMP (24 bytes) 51120038634 ns

MESSAGE: KDBUS_PAYLOAD_NONE (192 bytes) flags=0x0, KERNEL → BROADCAST, cookie=0, timeout=0
  +KDBUS_MSG_NAME_ADD (192 bytes) 'foo.bar.baz', old id=0, new id=1, flags=0x0
  +KDBUS_MSG_TIMESTAMP (24 bytes) 51120046816 ns

REGISTRY:
  'foo.bar.baz' is acquired by id 1

MESSAGE: KDBUS_PAYLOAD_NONE (192 bytes) flags=0x0, KERNEL → BROADCAST, cookie=0, timeout=0
  +KDBUS_MSG_NAME_ADD (192 bytes) 'foo.bar.baz', old id=0, new id=1, flags=0x0
  +KDBUS_MSG_TIMESTAMP (24 bytes) 51120046816 ns

MESSAGE: KDBUS_PAYLOAD_DBUS1 (136 bytes) flags=0x0, 1 → 1, cookie=3221225472, timeout=0
  +KDBUS_MSG_TIMESTAMP (24 bytes) 51120236314 ns

REGISTRY:
  'foo.bar.baz' is acquired by id 1

conn 1 giving up name 'foo.bar.baz'
MESSAGE: KDBUS_PAYLOAD_DBUS1 (204 bytes) flags=0x0, 2 → KERNEL, cookie=3221225472, timeout=0
  +KDBUS_MSG_DST_NAME (68 bytes) 'foo.bar.baz'
  +KDBUS_MSG_TIMESTAMP (24 bytes) 51120187336 ns

MESSAGE: KDBUS_PAYLOAD_DBUS1 (136 bytes) flags=0x0, 1 → 1, cookie=3221225474, timeout=0
  +KDBUS_MSG_TIMESTAMP (24 bytes) 51120308563 ns

REGISTRY:
  'foo.bar.baz' is acquired by id 2

conn 1 giving up name 'foo.bar.baz'
MESSAGE: KDBUS_PAYLOAD_DBUS1 (136 bytes) flags=0x0, 2 → 2, cookie=3221225473, timeout=0
  +KDBUS_MSG_TIMESTAMP (24 bytes) 51120264902 ns

MESSAGE: KDBUS_PAYLOAD_DBUS1 (136 bytes) flags=0x0, 1 → 1, cookie=3221225476, timeout=0
  +KDBUS_MSG_TIMESTAMP (24 bytes) 51120373183 ns
test: print the right data size for some types
test: always dump all data types
message.c: fix wrong message data size calculation

data->size always contains the size of the *entire* data segment, so no
extra fiddling with payload sizes is necessary. The code crashed the
kernel with memory corruptions.
policy: restructure db entries

Let struct kdbus_policy_db_entry maintain a list of struct
kdbus_policy_db_entry_access so we can just look up the name and then
walk the list of access rights later.
connection: store credentials on connect
policy: refactor code and define public interface

Restructure the code all over and add two functions,
kdbus_policy_db_check_send_access() and
kdbus_policy_db_check_own_access() which return either 0 for granted
access or < 0 for denied access.
message: fix copy_from_user size
connection: do not resursively lock the message mutex

export a function that simply schedules the scan work instead of doing
it directly from message.c, which would lead to a race agains the mutex.
bus: do not unref the bus while we hold its lock
connection: return -EINVAL if endpoint doesn't have a policy db

This will be important once we make the policy db optional to endpoints.
message: set _kmsg earlier

... so it will be passed back to the caller in case of error exits.
policy: refactor code for KDBUS_POLICY_OWN

kdbus_policy_db_check_own_access() needs a name as argument, as the
connection it is being called for does not yet have a the name assigned
to it.
names: check policy before assigning a name
test: add some rough test functions for policy commands
policy: fix comments
message: take conn_src as argument

this is needed for policy checks
kdbus_internal.h: fix kdbus_policy_db_check_send_access() parameter names
test-kdbus: fix copy length and malloc sizes
policy: add kdbus_policy_db_parse()

... and do in there what kdbus_policy_db_add_one() used to do, so we can
parse the policy blocks and keep track of the last NAME entry.

Let kdbus_policy_db_check_own_access() return -EPERM by default.