summaryrefslogtreecommitdiff
path: root/message.h
blob: 9d921b8494158c167ec7fbafe9e8469e7779f380 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * Copyright (C) 2013 Kay Sievers
 * Copyright (C) 2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 * Copyright (C) 2013 Daniel Mack <daniel@zonque.org>
 * Copyright (C) 2013 Linux Foundation
 *
 * kdbus is free software; you can redistribute it and/or modify it 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.
 */

#ifndef __KDBUS_MESSAGE_H
#define __KDBUS_MESSAGE_H

#include "internal.h"
#include "metadata.h"

/**
 * struct kdbus_kmsg - internal message handling data
 * @notification_type	Short-cut for faster lookup
 * @dst_name		Short-cut to msg for faster lookup
 * @bloom		Short-cut to msg for faster lookup
 * @bloom_size		Short-cut to msg for faster lookup
 * @fds			Array of file descriptors to pass
 * @fds_count		Number of file descriptors to pass
 * @meta		Appended SCM-like metadata of the sending process
 * @vecs_size		Size of PAYLOAD data
 * @vecs_count		Number of PAYLOAD vectors
 * @memfds_count	Number of memfds to pass
 * @msg			Message from or to userspace
 */
struct kdbus_kmsg {
	u64 notification_type;
	const char *dst_name;

	const u64 *bloom;
	unsigned int bloom_size;

	const int *fds;
	unsigned int fds_count;

	struct kdbus_meta meta;

	size_t vecs_size;
	unsigned int vecs_count;
	unsigned int memfds_count;

	struct kdbus_msg msg;
};

struct kdbus_ep;
struct kdbus_conn;

int kdbus_kmsg_new(size_t extra_size, struct kdbus_kmsg **m);
int kdbus_kmsg_new_from_user(struct kdbus_conn *conn, struct kdbus_msg __user *msg, struct kdbus_kmsg **m);
void kdbus_kmsg_free(struct kdbus_kmsg *kmsg);
#endif