Loading...
Searching...
No Matches
security-context.h
Go to the documentation of this file.
/* PipeWire */
/* SPDX-FileCopyrightText: Copyright © 2019 Wim Taymans */
/* SPDX-License-Identifier: MIT */
#ifndef PIPEWIRE_EXT_SECURITY_CONTEXT_H
#define PIPEWIRE_EXT_SECURITY_CONTEXT_H
#include <spa/utils/defs.h>
#ifdef __cplusplus
extern "C" {
#endif
#define PW_TYPE_INTERFACE_SecurityContext PW_TYPE_INFO_INTERFACE_BASE "SecurityContext"
#define PW_SECURITY_CONTEXT_PERM_MASK PW_PERM_RWX
#define PW_VERSION_SECURITY_CONTEXT 3
struct pw_security_context;
#ifndef PW_API_SECURITY_CONTEXT
#define PW_API_SECURITY_CONTEXT static inline
#endif
#define PW_EXTENSION_MODULE_SECURITY_CONTEXT PIPEWIRE_MODULE_PREFIX "module-security-context"
#define PW_SECURITY_CONTEXT_EVENT_NUM 0
struct pw_security_context_events {
#define PW_VERSION_SECURITY_CONTEXT_EVENTS 0
uint32_t version;
};
#define PW_SECURITY_CONTEXT_METHOD_ADD_LISTENER 0
#define PW_SECURITY_CONTEXT_METHOD_CREATE 1
#define PW_SECURITY_CONTEXT_METHOD_NUM 2
struct pw_security_context_methods {
#define PW_VERSION_SECURITY_CONTEXT_METHODS 0
uint32_t version;
int (*add_listener) (void *object,
struct spa_hook *listener,
const struct pw_security_context_events *events,
void *data);
* listen_fd must be ready to accept new connections when this request is
* sent by the client. In other words, the client must call bind(2) and
* listen(2) before sending the FD.
*
* close_fd is a FD closed by the client when PipeWire should stop
* accepting new connections on listen_fd.
*
* PipeWire must continue to accept connections on listen_fd when
* the client which created the security context disconnects.
*
* After sending this request, closing listen_fd and close_fd remains the
* only valid operation on them.
*
* \param listen_fd the fd to listen on for new connections
* \param close_fd the fd used to stop listening
* \param props extra properties. These will be copied on the client
* that connects through this context.
*
* Some properties to set:
*
* - pipewire.sec.engine with the engine name.
* - pipewire.sec.app-id with the application id, this is an opaque,
* engine specific id for an application
* - pipewire.sec.instance-id with the instance id, this is an opaque,
* engine specific id for a running instance of an application.
*
* See https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/security-context/engines.md
* For a list of engine names and the properties to set.
*
* This requires X and W permissions on the security_context.
*/
int (*create) (void *object,
int listen_fd,
int close_fd,
const struct spa_dict *props);
};
PW_API_SECURITY_CONTEXT int pw_security_context_add_listener(struct pw_security_context *object,
struct spa_hook *listener,
const struct pw_security_context_events *events,
void *data)
{
return spa_api_method_r(int, -ENOTSUP,
pw_security_context, (struct spa_interface*)object, add_listener, 0,
listener, events, data);
}
PW_API_SECURITY_CONTEXT int pw_security_context_create(struct pw_security_context *object,
int listen_fd, int close_fd, const struct spa_dict *props)
{
return spa_api_method_r(int, -ENOTSUP,
pw_security_context, (struct spa_interface*)object, create, 0,
listen_fd, close_fd, props);
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* PIPEWIRE_EXT_SECURITY_CONTEXT_H */
defs.h
spa/utils/defs.h
pw_security_context_create
PW_API_SECURITY_CONTEXT int pw_security_context_create(struct pw_security_context *object, int listen_fd, int close_fd, const struct spa_dict *props)
Create a new security context.
Definition security-context.h:131
PW_API_SECURITY_CONTEXT
#define PW_API_SECURITY_CONTEXT
Definition security-context.h:39
pw_security_context_add_listener
PW_API_SECURITY_CONTEXT int pw_security_context_add_listener(struct pw_security_context *object, struct spa_hook *listener, const struct pw_security_context_events *events, void *data)
Definition security-context.h:119
spa_api_method_r
#define spa_api_method_r(rtype, def, type, o, method, version,...)
Definition hook.h:291
pw_security_context_events
Security Context events
Definition security-context.h:50
pw_security_context_events::version
uint32_t version
Definition security-context.h:53
pw_security_context_methods
Security Context methods
Definition security-context.h:64
pw_security_context_methods::add_listener
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_security_context_events *events, void *data)
Definition security-context.h:69
pw_security_context_methods::create
int(* create)(void *object, int listen_fd, int close_fd, const struct spa_dict *props)
Create a new security context.
Definition security-context.h:111
pw_security_context
spa_dict
Definition dict.h:51
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:427
spa_interface
Definition hook.h:148