Go to the documentation of this file.
25 #ifndef PIPEWIRE_IMPL_CLIENT_H
26 #define PIPEWIRE_IMPL_CLIENT_H
32 #include <spa/utils/hook.h>
84 #define PW_VERSION_IMPL_CLIENT_EVENTS 0
116 size_t user_data_size );
140 uint32_t global_id, uint32_t permissions);
161 struct spa_hook *listener,
@ PW_MEMBLOCK_FLAG_READWRITE
Definition: mem.h:44
static uint32_t int int res
Definition: core.h:326
#define PW_CLIENT_CHANGE_MASK_ALL
Definition: client.h:50
#define PW_VERSION_CLIENT
Definition: client.h:40
static uint32_t id
Definition: core.h:325
#define NAME
Definition: impl-client.c:31
static void * pw_map_lookup(struct pw_map *map, uint32_t id)
Find an item in the map.
Definition: map.h:169
SPA_EXPORT void pw_impl_client_set_busy(struct pw_impl_client *client, bool busy)
Mark the client busy.
Definition: impl-client.c:695
uint32_t id
unique id
Definition: mem.h:70
SPA_EXPORT struct pw_resource * pw_impl_client_get_core_resource(struct pw_impl_client *client)
Get the client core resource.
Definition: impl-client.c:513
#define pw_log_error(...)
const char * error
Definition: impl-client.c:113
SPA_EXPORT int pw_impl_client_update_properties(struct pw_impl_client *client, const struct spa_dict *dict)
Update client properties.
Definition: impl-client.c:619
#define PW_PERM_INVALID
Definition: permission.h:59
SPA_EXPORT struct pw_global * pw_impl_client_get_global(struct pw_impl_client *client)
Get the global associated with this client.
Definition: impl-client.c:525
uint32_t id
Definition: impl-client.c:111
SPA_EXPORT void pw_global_destroy(struct pw_global *global)
Destroy a global.
Definition: global.c:377
SPA_EXPORT struct pw_resource * pw_impl_client_find_resource(struct pw_impl_client *client, uint32_t id)
Get a resource with the given id.
Definition: impl-client.c:519
void pw_mempool_destroy(struct pw_mempool *pool)
Clear and destroy a pool.
Definition: mem.c:170
static void pw_map_init(struct pw_map *map, size_t size, size_t extend)
Initialize a map.
Definition: map.h:76
Definition: impl-core.c:37
#define PW_KEY_OBJECT_ID
a global object id
Definition: keys.h:60
SPA_EXPORT const struct pw_properties * pw_impl_client_get_properties(struct pw_impl_client *client)
Get the client properties.
Definition: impl-client.c:531
Manages protocols and their implementation.
struct pw_resource * pw_impl_client_find_resource(struct pw_impl_client *client, uint32_t id)
Get a resource with the given id.
Definition: impl-client.c:519
void(* resource_added)(void *data, struct pw_resource *resource)
emitted when a new resource is added for client
Definition: impl-client.h:100
struct spa_hook resource_listener
Definition: impl-core.c:39
uint32_t flags
flags for the memory block on of enum pw_memblock_flags
Definition: mem.h:72
SPA_EXPORT struct pw_protocol * pw_impl_client_get_protocol(struct pw_impl_client *client)
Get the protocol used to create this client.
Definition: impl-client.c:507
Global events, use pw_global_add_listener.
Definition: global.h:65
PipeWire client object class.
#define PW_KEY_SEC_PID
Various keys related to the identity of a client process and its security.
Definition: keys.h:50
int pw_impl_client_check_permissions(struct pw_impl_client *client, uint32_t global_id, uint32_t permissions)
check if a client has permissions for global_id, Since 0.3.9
Definition: impl-client.c:704
void pw_mempool_add_listener(struct pw_mempool *pool, struct spa_hook *listener, const struct pw_mempool_events *events, void *data)
Listen for events.
Definition: mem.c:191
SPA_EXPORT void * pw_impl_client_get_user_data(struct pw_impl_client *client)
Get the client user data.
Definition: impl-client.c:537
uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_impl_client *client)
Get the permissions of the global for a given client.
Definition: global.c:45
#define PW_KEY_MODULE_ID
module properties
Definition: keys.h:207
void pw_global_add_listener(struct pw_global *global, struct spa_hook *listener, const struct pw_global_events *events, void *data)
Add an event listener on the global.
Definition: global.c:262
static uint32_t int int const char int r
Definition: core.h:338
The events that a client can emit.
Definition: impl-client.h:83
A global object visible to remote clients.
a PipeWire permission
Definition: permission.h:61
struct spa_dict dict
dictionary of key/values
Definition: properties.h:46
struct pw_global * pw_impl_client_get_global(struct pw_impl_client *client)
Get the global associated with this client.
Definition: impl-client.c:525
#define PW_PERMISSION_INIT(id, p)
Definition: permission.h:66
static int pw_map_for_each(struct pw_map *map, int(*func)(void *item_data, void *data), void *data)
Iterate all map items.
Definition: map.h:188
An array object.
Definition: array.h:43
void * pw_impl_client_get_user_data(struct pw_impl_client *client)
Get the client user data.
Definition: impl-client.c:537
void pw_resource_error(struct pw_resource *resource, int res, const char *error)
Generate an error for a resource.
Definition: resource.c:255
struct pw_context * pw_impl_client_get_context(struct pw_impl_client *client)
Get the context used to create this client.
Definition: impl-client.c:501
SPA_EXPORT int pw_properties_setf(struct pw_properties *properties, const char *key, const char *format,...)
Set a property value by format.
Definition: properties.c:433
context events emitted by the context object added with pw_context_add_listener
Definition: context.h:96
#define PW_KEY_SEC_UID
Client uid, set by protocol.
Definition: keys.h:51
SPA_EXPORT void pw_impl_client_destroy(struct pw_impl_client *client)
Destroy a client object.
Definition: impl-client.c:557
int fd
fd
Definition: mem.h:74
struct spa_hook object_listener
Definition: impl-core.c:40
void(* busy_changed)(void *data, bool busy)
emitted when the client becomes busy processing an asynchronous message.
Definition: impl-client.h:108
#define PW_KEY_SEC_GID
client gid, set by protocol
Definition: keys.h:52
struct pw_global * pw_context_find_global(struct pw_context *context, uint32_t id)
Find a context global by id.
int pw_global_update_keys(struct pw_global *global, const struct spa_dict *dict, const char *keys[])
Update the global properties, must be done when unregistered.
Definition: global.c:215
#define pw_log_debug(...)
uint32_t permissions
bitmask of above permissions
Definition: permission.h:63
#define PW_VERSION_RESOURCE_EVENTS
Definition: resource.h:65
#define PW_CLIENT_CHANGE_MASK_PROPS
Definition: client.h:49
int pw_impl_client_update_permissions(struct pw_impl_client *client, uint32_t n_permissions, const struct pw_permission *permissions)
Update the client permissions.
Definition: impl-client.c:627
The client information.
Definition: client.h:47
#define PW_KEY_SEC_LABEL
client security label, set by protocol
Definition: keys.h:53
#define PW_VERSION_MEMPOOL_EVENTS
Definition: mem.h:90
void * pw_resource_get_user_data(struct pw_resource *resource)
Get the user data for the resource, the size was given in pw_resource_new.
Definition: resource.c:159
const struct pw_properties * pw_impl_client_get_properties(struct pw_impl_client *client)
Get the client properties.
Definition: impl-client.c:531
Definition: impl-client.c:110
SPA_EXPORT int pw_impl_client_register(struct pw_impl_client *client, struct pw_properties *properties)
Finish configuration and register a client.
Definition: impl-client.c:452
static void pw_map_clear(struct pw_map *map)
Clear a map.
Definition: map.h:87
void pw_impl_client_add_listener(struct pw_impl_client *client, struct spa_hook *listener, const struct pw_impl_client_events *events, void *data)
listen to events from this client
Definition: impl-client.c:593
int pw_global_add_resource(struct pw_global *global, struct pw_resource *resource)
Add a resource to a global.
Definition: global.c:237
void(* free)(void *data)
emitted right before the client is freed
Definition: impl-client.h:91
const SPA_EXPORT char * pw_properties_get(const struct pw_properties *properties, const char *key)
Get a property.
Definition: properties.c:456
struct pw_protocol * pw_impl_client_get_protocol(struct pw_impl_client *client)
Get the protocol used to create this client.
Definition: impl-client.c:507
const struct pw_client_info * pw_impl_client_get_info(struct pw_impl_client *client)
Get the client information.
Definition: impl-client.c:602
static void * pw_array_add(struct pw_array *arr, size_t size)
Add ref size bytes to arr.
Definition: array.h:127
#define pw_array_get_len(a, t)
Get the number of items of type t in array.
Definition: array.h:57
void(* initialized)(void *data)
the client is initialized
Definition: impl-client.h:94
int pw_global_update_permissions(struct pw_global *global, struct pw_impl_client *client, uint32_t old_permissions, uint32_t new_permissions)
Definition: global.c:321
SPA_EXPORT int pw_properties_set(struct pw_properties *properties, const char *key, const char *value)
Set a property value.
Definition: properties.c:400
int pw_impl_client_register(struct pw_impl_client *client, struct pw_properties *properties)
Finish configuration and register a client.
Definition: impl-client.c:452
void pw_resource_add_object_listener(struct pw_resource *resource, struct spa_hook *listener, const void *funcs, void *data)
Set the resource implementation.
Definition: resource.c:174
void pw_resource_destroy(struct pw_resource *resource)
Destroy a resource.
Definition: resource.c:264
#define PW_VERSION_GLOBAL_EVENTS
Definition: global.h:66
struct result_device_params_data data
Definition: impl-device.c:64
#define PW_KEY_ACCESS
how the client access is controlled
Definition: keys.h:43
#define PW_PERM_R
object can be seen and events can be received
Definition: permission.h:44
void pw_context_add_listener(struct pw_context *context, struct spa_hook *listener, const struct pw_context_events *events, void *data)
Add a new event listener to a context.
Client methods.
Definition: client.h:103
SPA_EXPORT struct pw_impl_client * pw_context_create_client(struct pw_impl_core *core, struct pw_protocol *protocol, struct pw_properties *properties, size_t user_data_size)
Make a new client object.
Definition: impl-client.c:364
#define pw_array_get_unchecked(a, idx, t)
Get the item with index idx and type t from array.
Definition: array.h:59
void(* info_changed)(void *data, const struct pw_client_info *info)
emitted when the client info changed
Definition: impl-client.h:97
#define PW_VERSION_CLIENT_METHODS
Definition: client.h:104
#define PW_TYPE_INTERFACE_Client
Definition: client.h:38
struct pw_resource * pw_resource_new(struct pw_impl_client *client, uint32_t id, uint32_t permissions, const char *type, uint32_t version, size_t user_data_size)
Make a new resource for client.
Definition: resource.c:43
struct pw_mempool * pw_mempool_new(struct pw_properties *props)
Create a new memory pool.
Definition: mem.c:133
SPA_EXPORT struct pw_global * pw_global_new(struct pw_context *context, const char *type, uint32_t version, struct pw_properties *properties, pw_global_bind_func_t func, void *object)
Create a new global.
Definition: global.c:67
struct pw_control this
Definition: control.c:34
#define PW_KEY_APP_NAME
application keys
Definition: keys.h:94
void(* resource_removed)(void *data, struct pw_resource *resource)
emitted when a resource is removed
Definition: impl-client.h:103
uint32_t version
Definition: impl-client.h:85
SPA_EXPORT struct pw_properties * pw_properties_new(const char *key,...)
Make a new properties object.
Definition: properties.c:98
#define pw_array_check_index(a, idx, t)
Check if an item with index idx and type t exist in array.
Definition: array.h:61
#define PW_VERSION_CONTEXT_EVENTS
Definition: context.h:97
struct pw_resource * resource
Definition: impl-core.c:38
#define PW_ID_CORE
Definition: core.h:49
#define PW_ID_ANY
Definition: core.h:52
#define PW_KEY_CLIENT_ACCESS
how the client wants to be access controlled
Definition: keys.h:44
SPA_EXPORT const struct pw_client_info * pw_impl_client_get_info(struct pw_impl_client *client)
Get the client information.
Definition: impl-client.c:602
SPA_EXPORT int pw_global_register(struct pw_global *global)
register a global to the context registry
Definition: global.c:128
int res
Definition: impl-client.c:112
SPA_EXPORT struct pw_context * pw_impl_client_get_context(struct pw_impl_client *client)
Get the context used to create this client.
Definition: impl-client.c:501
SPA_EXPORT int pw_impl_client_update_permissions(struct pw_impl_client *client, uint32_t n_permissions, const struct pw_permission *permissions)
Update the client permissions.
Definition: impl-client.c:627
void(* destroy)(void *data)
emitted when the client is destroyed
Definition: impl-client.h:88
uint32_t type
type of the fd, one of enum spa_data_type
Definition: mem.h:73
Resource events.
Definition: resource.h:64
void pw_resource_add_listener(struct pw_resource *resource, struct spa_hook *listener, const struct pw_resource_events *events, void *data)
Add an event listener.
Definition: resource.c:165
uint32_t version
Definition: resource.h:66
void pw_impl_client_set_busy(struct pw_impl_client *client, bool busy)
Mark the client busy.
Definition: impl-client.c:695
SPA_EXPORT int pw_impl_client_check_permissions(struct pw_impl_client *client, uint32_t global_id, uint32_t permissions)
check if a client has permissions for global_id, Since 0.3.9
Definition: impl-client.c:704
SPA_EXPORT void pw_impl_client_add_listener(struct pw_impl_client *client, struct spa_hook *listener, const struct pw_impl_client_events *events, void *data)
listen to events from this client
Definition: impl-client.c:593
struct pw_resource * pw_impl_client_get_core_resource(struct pw_impl_client *client)
Get the client core resource.
Definition: impl-client.c:513
A collection of key/value pairs.
Definition: properties.h:45
SPA_EXPORT void pw_properties_free(struct pw_properties *properties)
Free a properties object.
Definition: properties.c:335
uint32_t id
id of object, PW_ID_ANY for default permission
Definition: permission.h:62
#define PW_KEY_PROTOCOL
A collection of keys that are used to add extra information on objects.
Definition: keys.h:42
static void pw_array_init(struct pw_array *arr, size_t extend)
Initialize the array with given extend.
Definition: array.h:85