mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	interfaces: remove core permissions
Use the client update_permissions call instead
This commit is contained in:
		
							parent
							
								
									505eb7a423
								
							
						
					
					
						commit
						1a27d7da1d
					
				
					 4 changed files with 15 additions and 89 deletions
				
			
		| 
						 | 
				
			
			@ -531,8 +531,9 @@ static void on_state_changed(void *_data, enum pw_remote_state old, enum pw_remo
 | 
			
		|||
		permissions[1].id = SPA_ID_INVALID;
 | 
			
		||||
		permissions[1].permissions = PW_PERM_R;
 | 
			
		||||
 | 
			
		||||
		pw_core_proxy_permissions(pw_remote_get_core_proxy(data->remote),
 | 
			
		||||
					  2, permissions);
 | 
			
		||||
		pw_client_proxy_update_permissions(
 | 
			
		||||
				pw_remote_get_client_proxy(data->remote),
 | 
			
		||||
				2, permissions);
 | 
			
		||||
 | 
			
		||||
		make_node(data);
 | 
			
		||||
		break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,29 +69,6 @@ static void core_marshal_client_update(void *object, const struct spa_dict *prop
 | 
			
		|||
	pw_protocol_native_end_proxy(proxy, b);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void core_marshal_permissions(void *object, uint32_t n_permissions,
 | 
			
		||||
		const struct pw_permission *permissions)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_proxy *proxy = object;
 | 
			
		||||
	struct spa_pod_builder *b;
 | 
			
		||||
	uint32_t i;
 | 
			
		||||
 | 
			
		||||
	b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_PERMISSIONS);
 | 
			
		||||
 | 
			
		||||
	spa_pod_builder_add(b, "[",
 | 
			
		||||
				"i", n_permissions,
 | 
			
		||||
				NULL);
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < n_permissions; i++) {
 | 
			
		||||
		spa_pod_builder_add(b,
 | 
			
		||||
				    "i", permissions[i].id,
 | 
			
		||||
				    "i", permissions[i].permissions, NULL);
 | 
			
		||||
	}
 | 
			
		||||
	spa_pod_builder_add(b, "]", NULL);
 | 
			
		||||
 | 
			
		||||
	pw_protocol_native_end_proxy(proxy, b);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void core_marshal_sync(void *object, uint32_t seq)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_proxy *proxy = object;
 | 
			
		||||
| 
						 | 
				
			
			@ -343,31 +320,6 @@ static int core_demarshal_client_update(void *object, void *data, size_t size)
 | 
			
		|||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int core_demarshal_permissions(void *object, void *data, size_t size)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_resource *resource = object;
 | 
			
		||||
	struct spa_pod_parser prs;
 | 
			
		||||
	struct pw_permission *permissions;
 | 
			
		||||
	uint32_t i, n_permissions;
 | 
			
		||||
 | 
			
		||||
	spa_pod_parser_init(&prs, data, size, 0);
 | 
			
		||||
	if (spa_pod_parser_get(&prs, "[",
 | 
			
		||||
				"i", &n_permissions, NULL) < 0)
 | 
			
		||||
		return -EINVAL;
 | 
			
		||||
 | 
			
		||||
	permissions = alloca(n_permissions * sizeof(struct pw_permission));
 | 
			
		||||
	for (i = 0; i < n_permissions; i++) {
 | 
			
		||||
		if (spa_pod_parser_get(&prs,
 | 
			
		||||
				"i", &permissions[i].id,
 | 
			
		||||
				"i", &permissions[i].permissions,
 | 
			
		||||
				NULL) < 0)
 | 
			
		||||
			return -EINVAL;
 | 
			
		||||
	}
 | 
			
		||||
	pw_resource_do(resource, struct pw_core_proxy_methods, permissions, 0,
 | 
			
		||||
			n_permissions, permissions);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int core_demarshal_hello(void *object, void *data, size_t size)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_resource *resource = object;
 | 
			
		||||
| 
						 | 
				
			
			@ -1482,7 +1434,6 @@ static const struct pw_core_proxy_methods pw_protocol_native_core_method_marshal
 | 
			
		|||
	&core_marshal_sync,
 | 
			
		||||
	&core_marshal_get_registry,
 | 
			
		||||
	&core_marshal_client_update,
 | 
			
		||||
	&core_marshal_permissions,
 | 
			
		||||
	&core_marshal_create_object,
 | 
			
		||||
	&core_marshal_destroy,
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -1492,7 +1443,6 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_core_method_
 | 
			
		|||
	{ &core_demarshal_sync, 0, },
 | 
			
		||||
	{ &core_demarshal_get_registry, 0, },
 | 
			
		||||
	{ &core_demarshal_client_update, 0, },
 | 
			
		||||
	{ &core_demarshal_permissions, 0, },
 | 
			
		||||
	{ &core_demarshal_create_object, 0, },
 | 
			
		||||
	{ &core_demarshal_destroy, 0, }
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -161,13 +161,6 @@ static void core_client_update(void *object, const struct spa_dict *props)
 | 
			
		|||
	pw_client_update_properties(resource->client, props);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void core_permissions(void *object, uint32_t n_permissions,
 | 
			
		||||
		const struct pw_permission *permissions)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_resource *resource = object;
 | 
			
		||||
	pw_client_update_permissions(resource->client, n_permissions, permissions);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void core_sync(void *object, uint32_t seq)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_resource *resource = object;
 | 
			
		||||
| 
						 | 
				
			
			@ -322,7 +315,6 @@ static const struct pw_core_proxy_methods core_methods = {
 | 
			
		|||
	.sync = core_sync,
 | 
			
		||||
	.get_registry = core_get_registry,
 | 
			
		||||
	.client_update = core_client_update,
 | 
			
		||||
	.permissions = core_permissions,
 | 
			
		||||
	.create_object = core_create_object,
 | 
			
		||||
	.destroy = core_destroy,
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -70,10 +70,9 @@ struct pw_link_proxy;
 | 
			
		|||
#define PW_CORE_PROXY_METHOD_SYNC		1
 | 
			
		||||
#define PW_CORE_PROXY_METHOD_GET_REGISTRY	2
 | 
			
		||||
#define PW_CORE_PROXY_METHOD_CLIENT_UPDATE	3
 | 
			
		||||
#define PW_CORE_PROXY_METHOD_PERMISSIONS	4
 | 
			
		||||
#define PW_CORE_PROXY_METHOD_CREATE_OBJECT	5
 | 
			
		||||
#define PW_CORE_PROXY_METHOD_DESTROY		6
 | 
			
		||||
#define PW_CORE_PROXY_METHOD_NUM		7
 | 
			
		||||
#define PW_CORE_PROXY_METHOD_CREATE_OBJECT	4
 | 
			
		||||
#define PW_CORE_PROXY_METHOD_DESTROY		5
 | 
			
		||||
#define PW_CORE_PROXY_METHOD_NUM		6
 | 
			
		||||
 | 
			
		||||
#define PW_LINK_OUTPUT_NODE_ID	"link.output_node.id"
 | 
			
		||||
#define PW_LINK_OUTPUT_PORT_ID	"link.output_port.id"
 | 
			
		||||
| 
						 | 
				
			
			@ -120,22 +119,6 @@ struct pw_core_proxy_methods {
 | 
			
		|||
	 * \param props the new client properties
 | 
			
		||||
	 */
 | 
			
		||||
	void (*client_update) (void *object, const struct spa_dict *props);
 | 
			
		||||
	/**
 | 
			
		||||
	 * Manage the permissions of the global objects for this
 | 
			
		||||
	 * client
 | 
			
		||||
	 *
 | 
			
		||||
	 * Update the permissions of the global objects using the
 | 
			
		||||
	 * provided array with permissions
 | 
			
		||||
	 *
 | 
			
		||||
	 * Globals can use the default permissions or can have specific
 | 
			
		||||
	 * permissions assigned to them.
 | 
			
		||||
	 *
 | 
			
		||||
	 * \param n_permissions number of permissions
 | 
			
		||||
	 * \param permissions array of permissions
 | 
			
		||||
	 */
 | 
			
		||||
	void (*permissions) (void *object,
 | 
			
		||||
			     uint32_t n_permissions,
 | 
			
		||||
			     const struct pw_permission *permissions);
 | 
			
		||||
	/**
 | 
			
		||||
	 * Create a new object on the PipeWire server from a factory.
 | 
			
		||||
	 * Use a \a factory_name of "client-node" to create a
 | 
			
		||||
| 
						 | 
				
			
			@ -189,12 +172,6 @@ pw_core_proxy_client_update(struct pw_core_proxy *core, const struct spa_dict *p
 | 
			
		|||
	pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, client_update, props);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void
 | 
			
		||||
pw_core_proxy_permissions(struct pw_core_proxy *core, uint32_t n_permissions, struct pw_permission *permissions)
 | 
			
		||||
{
 | 
			
		||||
	pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, permissions, n_permissions, permissions);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void *
 | 
			
		||||
pw_core_proxy_create_object(struct pw_core_proxy *core,
 | 
			
		||||
			    const char *factory_name,
 | 
			
		||||
| 
						 | 
				
			
			@ -794,12 +771,18 @@ struct pw_client_proxy_methods {
 | 
			
		|||
	 * \param num the maximum number of items to get
 | 
			
		||||
	 */
 | 
			
		||||
	void (*get_permissions) (void *object, uint32_t index, uint32_t num);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Update client permissions
 | 
			
		||||
	 * Manage the permissions of the global objects for this
 | 
			
		||||
	 * client
 | 
			
		||||
	 *
 | 
			
		||||
	 * Update the permissions of the global objects using the
 | 
			
		||||
	 * provided array with permissions
 | 
			
		||||
	 *
 | 
			
		||||
	 * Globals can use the default permissions or can have specific
 | 
			
		||||
	 * permissions assigned to them.
 | 
			
		||||
	 *
 | 
			
		||||
	 * \param n_permissions number of permissions
 | 
			
		||||
	 * \param permissions array of new permissions
 | 
			
		||||
	 * \param permissions array of permissions
 | 
			
		||||
	 */
 | 
			
		||||
	void (*update_permissions) (void *object, uint32_t n_permissions,
 | 
			
		||||
			const struct pw_permission *permissions);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue