PipeWire: permission.h Source File

PipeWire 0.3.69

Loading...
Searching...
No Matches
permission.h
Go to the documentation of this file.
1/* PipeWire */
2/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3/* SPDX-License-Identifier: MIT */
4
5#ifndef PIPEWIRE_PERMISSION_H
6#define PIPEWIRE_PERMISSION_H
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#include <spa/utils/defs.h>
13
27#define PW_PERM_R 0400
28#define PW_PERM_W 0200
29#define PW_PERM_X 0100
31#define PW_PERM_M 0010
33#define PW_PERM_RWX (PW_PERM_R|PW_PERM_W|PW_PERM_X)
34#define PW_PERM_RWXM (PW_PERM_RWX|PW_PERM_M)
35
36#define PW_PERM_IS_R(p) (((p)&PW_PERM_R) == PW_PERM_R)
37#define PW_PERM_IS_W(p) (((p)&PW_PERM_W) == PW_PERM_W)
38#define PW_PERM_IS_X(p) (((p)&PW_PERM_X) == PW_PERM_X)
39#define PW_PERM_IS_M(p) (((p)&PW_PERM_M) == PW_PERM_M)
40
41#define PW_PERM_ALL PW_PERM_RWXM
42#define PW_PERM_INVALID (uint32_t)(0xffffffff)
43
44 struct pw_permission {
45 uint32_t id;
46 uint32_t permissions;
47};
48
49#define PW_PERMISSION_INIT(id,p) ((struct pw_permission){ (id), (p) })
50
51#define PW_PERMISSION_FORMAT "%c%c%c%c"
52#define PW_PERMISSION_ARGS(permission) \
53 (permission) & PW_PERM_R ? 'r' : '-', \
54 (permission) & PW_PERM_W ? 'w' : '-', \
55 (permission) & PW_PERM_X ? 'x' : '-', \
56 (permission) & PW_PERM_M ? 'm' : '-'
57
62#ifdef __cplusplus
63}
64#endif
65
66#endif /* PIPEWIRE_PERMISSION_H */
defs.h
spa/utils/defs.h
pw_permission
Definition: permission.h:60
pw_permission::id
uint32_t id
id of object, PW_ID_ANY for default permission
Definition: permission.h:61
pw_permission::permissions
uint32_t permissions
bitmask of above permissions
Definition: permission.h:62