Commit graph

162 commits

Author SHA1 Message Date
Wim Taymans
a19bab4b16 avoid following NULL pointers 2020-05-20 15:24:25 +02:00
Wim Taymans
3324a15fe3 protocol: use bool for Bool pod 2020-04-30 17:12:20 +02:00
Wim Taymans
48036f7d13 improve debug 2020-04-21 15:51:55 +02:00
Wim Taymans
5074ca37ff protocol-native: Improve errors
A missing XDG_RUNTIME_DIR results in ENOENT, like on the server
side.
A too long name results in ENAMETOOLONG, like on the server side.
When we can't find the socket, return EHOSTDOWN to make it more
obvious what is going.
2020-02-21 15:05:43 +01:00
Wim Taymans
b33bd68bac improve error messages
Log an error when we send an error to the client so that we don't need
to log and error anymore.
Improve the error messages when we can
Move some warnings and errors to debug
2020-02-21 15:02:55 +01:00
Wim Taymans
d8bac82e72 improve logging
Remove some harmless warnings from the log
Remove some excessive info logging
2020-02-21 11:09:34 +01:00
Wim Taymans
495dc7c3af device: implement subscribe_params
Also add subscribe params for the device, like for Node and Port.
2020-02-12 16:07:10 +01:00
Wim Taymans
293932d4ec v0: improve compatibility
Implement RequestClockUpdate event and ClockUpdate message for
old clients.
2020-02-11 11:23:28 +01:00
Wim Taymans
7edd3fb054 typemap: fill out more audio formats 2020-02-10 20:46:18 +01:00
Wim Taymans
eab6dda513 protocol-native: improve v0 compatibility 2020-02-10 18:15:24 +01:00
Wim Taymans
56c15ca9e8 connection: improve version check
do the version check on the v2 update_types request or the v3
hello request.
2020-02-10 16:26:24 +01:00
Wim Taymans
a1bb1548e6 tests: msg is undefined when _get_next() return != 1 2020-02-07 15:40:28 +01:00
Wim Taymans
3aa8e301c5 protocol-native: implement v2 update_permissions
Convert the old permission update to new permission events.
2020-02-06 16:57:24 +01:00
Wim Taymans
7a395bccaf improve v2 compat mode
Always send the server types when we got the first client types and
don't rely on the message sequence number.
Add some more types in the typemap.
2020-02-06 16:56:19 +01:00
Wim Taymans
1cedfade3a protocol: improve old version check
Check if the pod size is > 4 because the unit test adds one fd
in the first message.
2020-01-15 12:24:11 +01:00
Wim Taymans
043e7f24fe add some more useful defines
Add define to match all ids for nodes and params.
Add define for invalid permissions
2020-01-15 11:15:51 +01:00
Wim Taymans
cf53ededd0 connection: improve old version check
Check the type of the pod in the message instead. Old versions
should not have 0 there, new versions keep the number of file
descriptors, which should be 0 for the first message.
2020-01-15 10:29:58 +01:00
Wim Taymans
bdc82bb94b typemap: add more video types 2020-01-03 09:33:59 +01:00
Wim Taymans
df519ee3b3 avoid including private.h
Expose some more methods to make it possible to build without
including the private.h header, especially in modules.
2020-01-02 13:48:50 +01:00
Wim Taymans
f391353c7f Make interface types a string
This is more in line with wayland and it allows us to create new
interfaces in modules without having to add anything to the type
enum. It also removes some lookups to map type_id to readable
name in debug.
2019-12-19 13:36:04 +01:00
Wim Taymans
e9b62c0ce6 v0: set media class
Set the media class on the client-node after we know the number of
ports.
Add more type mappings
Fix change_mask on core_info
2019-12-17 17:34:10 +01:00
Wim Taymans
c23006fcdb pw_port_proxy -> pw_port 2019-12-11 15:59:26 +01:00
Wim Taymans
beb3c69dfe pw_node_proxy -> pw_node 2019-12-11 15:26:11 +01:00
Wim Taymans
199fa47216 pw_module_proxy -> pw_module 2019-12-11 15:16:30 +01:00
Wim Taymans
e633e205c2 pw_link_proxy -> pw_link 2019-12-11 15:11:56 +01:00
Wim Taymans
114982f3f5 pw_factory_proxy -> pw_factory 2019-12-11 15:06:00 +01:00
Wim Taymans
f1eb5f6046 pw_device_proxy -> pw_device 2019-12-11 15:00:41 +01:00
Wim Taymans
a8f1d756c3 pw_client_proxy -> pw_client 2019-12-11 14:53:39 +01:00
Wim Taymans
aa378417c2 interfaces: move proxy API into their own header files 2019-12-11 14:44:59 +01:00
Wim Taymans
95688939bf pw_client -> pw_impl_client 2019-12-11 11:21:43 +01:00
Wim Taymans
d70a47b7fe move proxy implementations in their own file
Rearrange headers
2019-12-11 10:58:51 +01:00
Wim Taymans
49d736bbb7 pw_registry_proxy -> pw_registry 2019-12-11 09:44:48 +01:00
Wim Taymans
ecc6b27cd7 rename core_proxy -> core
Rename core_proxy to core and move the introspect and interface
contents to core.h

In an effort to promote the proxy API.
2019-12-11 07:46:59 +01:00
Wim Taymans
8ea78c2e3f pw_core -> pw_context
The proxy API is the one that we would like to expose for applications
and the other API is used internally when implementing modules or
factories.

The current pw_core object is really a context for all objects so
name it that way. It also makes it possible to rename pw_core_proxy
to pw_proxy later.
2019-12-10 18:19:56 +01:00
Wim Taymans
3d79970d88 remote: remove events and states 2019-12-06 12:03:45 +01:00
Wim Taymans
8a959ea7a1 core_proxy: prepare to rename pw_remote -> pw_core_proxy
The pw_remote object is really a wrapper around the pw_core_proxy.
The events it emits are also available in the core proxy and are
generally awkward to use.

With some clever new pw_core_proxy_* methods and a pw_core_connect
to create the core_proxy, we can convert all code away from pw_remote.

This is a first step in this conversion, using the pw_remote behind
the scenes. It leaks into some places because it really needs to become
its own struct in a next step.
2019-12-06 11:48:40 +01:00
Wim Taymans
0b2e4a18ff protocol-native: make the connection earlier
Make the connection as soon as we create the client. We create it
without file descriptor and then set it when we connect. This
makes it possible to use the connection to queue messages before
we connect.
2019-12-05 11:43:05 +01:00
Wim Taymans
f56e4dbc4d interfaces: add event to notify of global bound id
Make it possible to know when a proxy is bound to a global id before
the global shows up in the registry. This makes it possible to match
locally created objects to the one appearing in the registry and
possibly avoid a second bind.
2019-11-29 13:34:00 +01:00
Wim Taymans
e40fbf8cc4 Add printf checks for proxy_error and resource_error
Add an error variant without checks.
2019-11-21 16:09:05 +01:00
Wim Taymans
4ad7ce3aa2 session-manager: split policy and monitor
Separate the session manager in a monitor and policy part.

The monitor manages the devices and endpoints.

The policy watches the nodes/ports/clients and applies the policy
of linking them.

Because both now have a separate connection, we can remove some
hacks in the protocol. When a remote was both the implementer and
user of an object we could get in a deadlock when the user was
blocked waiting and the implementator was blocked sending a reply.
We used to un-busy a client when it was expecting a reply from a
ping or sync for this reason.

Add and use some more keys for the endpoints and streams.
2019-11-07 16:03:00 +01:00
Wim Taymans
6397db9d68 protocol: init spa_dict properly
Or else the flags might be wrong.
2019-11-04 17:30:33 +01:00
Wim Taymans
8ddf579cc0 protocol: add flags to protocol marshal
Allows us to to select marshallers for implementation and binding.
2019-11-03 10:21:57 +01:00
Wim Taymans
ebb5ed94a2 add some docs 2019-10-25 15:01:27 +02:00
Wim Taymans
9ffec214b8 fix includes 2019-10-25 15:01:02 +02:00
Wim Taymans
082463efd0 protocol: add v0 compatibility
For flatpaks we need to be able to support older v0 protocol clients.
To handle this we have:

- the connection detects an old client when it receives the first
  message. It can do this by checking the sequence number, on old
  versions it contains the message size and is never 0, on new
  clients the sequence number is 0.

- We add a new signal at the start of the connection with the detected
  version number. This installs the right version of the core proxy.
  We also move the binding of the client until the hello message is
  received. This way we can have a new client connect (portal),
  hand over the connection to an old client, which then removes the
  client binding again in the hello request with a v0 version.
  There are some changes to the passing of fds in v0 vs v3 which need
  to investigated some more.

- bump version of our interfaces to 3. This makes it possible to
  have v0 and v3 protocol marshal functions.

- Add version number in the proxy. This is mostly automatically done
  internally based on the version numbers the library is compiled
  with. Where the version number was in the API before, it is now
  actually used to look up the right protocol marshal functions. For
  Proxies there is usually just 1 version, the current one. It is the
  server that will support different versions.

- Add v0 compat marshal functions to convert from and to v0 format.
  This has some complications. v0 has a type map it keeps in sync
  with the server. For this we have a static type map with mappings
  to our own v3 types. Pods are mostly the same except for objects
  that used to have arbitrary pods in v0 vs spa_pod_prop in v3. Also
  convert between v0 spa_pod_prop and v3 spa_pod_choice.
  Formats and commands are also slightly different so handle those
  mappings as well.
  We only have marshal functions for the server side (resource)
  v0 functions.

- Add v0 compatible client-node again. It's a bit tricky to map, v0
  client-node basically lets the server to the mixing and teeing
  and just does the processing of the internal node.
2019-10-08 23:20:18 +02:00
Wim Taymans
cc8e992cd1 protocol: improve flushing
Use the IO_OUT flag to schedule flushing instead of a flush_event.

Handle EGAIN and wait for IO_OUT to try again.

Fixes #111
2019-10-01 12:53:56 +02:00
Wim Taymans
3d48ba8394 connection: move remaining data and fds
If we can't send all of the data, move the remaining data to the
start of the buffer so that we can send it again later.

See #111
2019-10-01 10:45:20 +02:00
Wim Taymans
d00c641559 protocol: we need to read Fd into int64_t 2019-08-20 10:51:58 +02:00
Wim Taymans
d9050fcb72 connection: use right size 2019-08-16 22:57:24 +02:00
Wim Taymans
8db4a797aa core: remove parent_id from the global event
Remove the parent_id from the global event. Remove the parent
and owner from the global object.

Use properties instead to mark parents and owners of objects.

Properties are easier to control for client exported objects and
usually a simple parent/child is not enough. For example, a client
exported node has the client as a parent but also the factory that
created the node.
2019-08-16 22:11:42 +02:00