hakurei/internal/pipewire/pipewire-helper.h
Ophestra 2a6c8ba51b
All checks were successful
Test / Create distribution (pull_request) Successful in 28s
Test / Sandbox (pull_request) Successful in 50s
Test / Hakurei (pull_request) Successful in 1m49s
Test / Hpkg (pull_request) Successful in 2m36s
Test / Sandbox (race detector) (pull_request) Successful in 2m48s
Test / Hakurei (race detector) (pull_request) Successful in 3m36s
Test / Flake checks (pull_request) Successful in 1m33s
Test / Create distribution (push) Successful in 26s
Test / Sandbox (push) Successful in 39s
Test / Sandbox (race detector) (push) Successful in 39s
Test / Hakurei (push) Successful in 43s
Test / Hakurei (race detector) (push) Successful in 43s
Test / Hpkg (push) Successful in 40s
Test / Flake checks (push) Successful in 1m28s
internal/pipewire: integrate pw_security_context
This is required for securely providing access to PipeWire.

This change has already been manually tested and confirmed to work correctly.

This unfortunately cannot be upstreamed in its current state as libpipewire-0.3 breaks static linking.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-18 22:43:23 +09:00

39 lines
1.1 KiB
C

#include <stdbool.h>
#include <sys/un.h>
typedef enum {
HAKUREI_PIPEWIRE_SUCCESS,
/* pw_main_loop_new failed, errno */
HAKUREI_PIPEWIRE_MAINLOOP,
/* pw_context_new failed, errno */
HAKUREI_PIPEWIRE_CTX,
/* pw_context_connect failed, errno */
HAKUREI_PIPEWIRE_CONNECT,
/* pw_core_get_registry failed */
HAKUREI_PIPEWIRE_REGISTRY,
/* no security context object found */
HAKUREI_PIPEWIRE_NOT_AVAIL,
/* socket failed, errno */
HAKUREI_PIPEWIRE_SOCKET,
/* bind failed, errno */
HAKUREI_PIPEWIRE_BIND,
/* listen failed, errno */
HAKUREI_PIPEWIRE_LISTEN,
/* pw_security_context_create failed, translated errno */
HAKUREI_PIPEWIRE_ATTACH,
/* ensure pathname failed, implemented in conn.go */
HAKUREI_PIPEWIRE_CREAT,
} hakurei_pipewire_res;
hakurei_pipewire_res hakurei_pw_security_context_bind(
char *socket_path,
char *remote_path,
int close_fd);
/* returns whether the specified size fits in the sun_path field of sockaddr_un */
static inline bool hakurei_pw_is_valid_size_sun_path(size_t sz) {
struct sockaddr_un sockaddr;
return sz <= sizeof(sockaddr.sun_path);
};