PipeWire 1.2.8
Loading...
Searching...
No Matches
security-context.h
Go to the documentation of this file.
1/* PipeWire */
2/* SPDX-FileCopyrightText: Copyright © 2019 Wim Taymans */
3/* SPDX-License-Identifier: MIT */
4
5#ifndef PIPEWIRE_EXT_SECURITY_CONTEXT_H
6#define PIPEWIRE_EXT_SECURITY_CONTEXT_H
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#include <spa/utils/defs.h>
13
17
22#define PW_TYPE_INTERFACE_SecurityContext PW_TYPE_INFO_INTERFACE_BASE "SecurityContext"
23
24#define PW_SECURITY_CONTEXT_PERM_MASK PW_PERM_RWX
25
26#define PW_VERSION_SECURITY_CONTEXT 3
28
29#define PW_EXTENSION_MODULE_SECURITY_CONTEXT PIPEWIRE_MODULE_PREFIX "module-security-context"
31#define PW_SECURITY_CONTEXT_EVENT_NUM 0
32
36#define PW_VERSION_SECURITY_CONTEXT_EVENTS 0
37 uint32_t version;
38};
39
40#define PW_SECURITY_CONTEXT_METHOD_ADD_LISTENER 0
41#define PW_SECURITY_CONTEXT_METHOD_CREATE 1
42#define PW_SECURITY_CONTEXT_METHOD_NUM 2
43
46#define PW_VERSION_SECURITY_CONTEXT_METHODS 0
47 uint32_t version;
49 int (*add_listener) (void *object,
50 struct spa_hook *listener,
51 const struct pw_security_context_events *events,
52 void *data);
53
59 *
60 * listen_fd must be ready to accept new connections when this request is
61 * sent by the client. In other words, the client must call bind(2) and
62 * listen(2) before sending the FD.
63 *
64 * close_fd is a FD closed by the client when PipeWire should stop
65 * accepting new connections on listen_fd.
66 *
67 * PipeWire must continue to accept connections on listen_fd when
68 * the client which created the security context disconnects.
69 *
70 * After sending this request, closing listen_fd and close_fd remains the
71 * only valid operation on them.
72 *
73 * \param listen_fd the fd to listen on for new connections
74 * \param close_fd the fd used to stop listening
75 * \param props extra properties. These will be copied on the client
76 * that connects through this context.
77 *
78 * Some properties to set:
79 *
80 * - pipewire.sec.engine with the engine name.
81 * - pipewire.sec.app-id with the application id, this is an opaque,
82 * engine specific id for an application
83 * - pipewire.sec.instance-id with the instance id, this is an opaque,
84 * engine specific id for a running instance of an application.
85 *
86 * See https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/security-context/engines.md
87 * For a list of engine names and the properties to set.
88 *
89 * This requires X and W permissions on the security_context.
90 */
91 int (*create) (void *object,
92 int listen_fd,
93 int close_fd,
94 const struct spa_dict *props);
95};
96
97
98#define pw_security_context_method(o,method,version,...) \
99({ \
100 int _res = -ENOTSUP; \
101 spa_interface_call_res((struct spa_interface*)o, \
102 struct pw_security_context_methods, _res, \
103 method, version, ##__VA_ARGS__); \
104 _res; \
105})
107#define pw_security_context_add_listener(c,...) pw_security_context_method(c,add_listener,0,__VA_ARGS__)
108#define pw_security_context_create(c,...) pw_security_context_method(c,create,0,__VA_ARGS__)
109
111
114#ifdef __cplusplus
115} /* extern "C" */
116#endif
117
118#endif /* PIPEWIRE_EXT_SECURITY_CONTEXT_H */
spa/utils/defs.h
Security Context events
Definition security-context.h:45
uint32_t version
Definition security-context.h:48
Security Context methods
Definition security-context.h:59
uint32_t version
Definition security-context.h:62
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_security_context_events *events, void *data)
Definition security-context.h:64
int(* create)(void *object, int listen_fd, int close_fd, const struct spa_dict *props)
Create a new security context.
Definition security-context.h:106
Definition dict.h:39
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:350