2 * Copyright (C) 2013-2015 Kay Sievers
3 * Copyright (C) 2013-2015 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 * Copyright (C) 2013-2015 Daniel Mack <daniel@zonque.org>
5 * Copyright (C) 2013-2015 David Herrmann <dh.herrmann@gmail.com>
6 * Copyright (C) 2013-2015 Linux Foundation
7 * Copyright (C) 2014-2015 Djalal Harouni <tixxdz@opendz.org>
9 * kdbus is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU Lesser General Public License as published by the
11 * Free Software Foundation; either version 2.1 of the License, or (at
12 * your option) any later version.
15 #ifndef __KDBUS_ENDPOINT_H
16 #define __KDBUS_ENDPOINT_H
18 #include <linux/list.h>
19 #include <linux/mutex.h>
20 #include <linux/uidgid.h>
28 * struct kdbus_ep - endpoint to access a bus
29 * @node: The kdbus node
30 * @lock: Endpoint data lock
31 * @bus: Bus behind this endpoint
32 * @user: Custom enpoints account against an anonymous user
33 * @policy_db: Uploaded policy
34 * @conn_list: Connections of this endpoint
36 * An endpoint offers access to a bus; the default endpoint node name is "bus".
37 * Additional custom endpoints to the same bus can be created and they can
38 * carry their own policies/filters.
41 struct kdbus_node node;
45 struct kdbus_bus *bus;
46 struct kdbus_user *user;
48 /* protected by own locks */
49 struct kdbus_policy_db policy_db;
51 /* protected by ep->lock */
52 struct list_head conn_list;
55 #define kdbus_ep_from_node(_node) \
56 container_of((_node), struct kdbus_ep, node)
58 struct kdbus_ep *kdbus_ep_new(struct kdbus_bus *bus, const char *name,
59 unsigned int access, kuid_t uid, kgid_t gid,
61 struct kdbus_ep *kdbus_ep_ref(struct kdbus_ep *ep);
62 struct kdbus_ep *kdbus_ep_unref(struct kdbus_ep *ep);
64 bool kdbus_ep_is_privileged(struct kdbus_ep *ep, struct file *file);
65 bool kdbus_ep_is_owner(struct kdbus_ep *ep, struct file *file);
67 struct kdbus_ep *kdbus_cmd_ep_make(struct kdbus_bus *bus, void __user *argp);
68 int kdbus_cmd_ep_update(struct kdbus_ep *ep, void __user *argp);