test-agent: One source file for both test-agent and cockpit-agent

Our test code uses a test bus. Make it look like this test bus
is the system bus.

Our multi dbus service logic will allow using multiple services
but not (at least not in the near future) multiple buses. So stick
to the system bus everywhere.

Pass environment variables to the agent to tell it where to connect
to. This is temporary code. Once we get the frontend telling the
agent which service to connect to, this code will be gone.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
agent: Make g_debug work in cockpit-agent and test-agent

Currently using g_debug or g_info and G_MESSAGES_LOG in cockpit-agent
breaks things. That's because the debug output is intermingled with
the dbus-json output to stdout.

Reroute fd 1 inside of the agent process so that it sends stuff to
stderr. Use another fd to talk to stdout.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
dbus-server: Make dbus_server_serve_dbus not block

Run the mainloop outside of dbus_server_serve_dbus() and handle
closing of the transport from there as well.

This is a step in the direction of having the agent handle channel
commands, and eventually multiple channels.

Some of the code duplication will be removed when we use cockpit-agent
instead of test-agent.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
test-webservice: Parse and validate control messages better

Better functions for building a control message, and expecting/verifying
validity of a received one.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
ws: Send control channel commands to the agent

The agent now processes control channel commands (see protocol.md)
and opens and closes channels as needed.

CockpitWebSocket forwards control channel commands to the relevant
agent. Still only one channel per agent. That's a future work item.

The test-webservice tests use the mock-echo agent, which relays
everything back verbatim. This causes the WebSocket client to get
some unexpected 'open' commands ... but we just ignore them.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
agent: Pass the dbus service and path from dbus.js

Allow connecting to arbitrary DBus services. These services must
implement o.f.DBus.ObjectManager. Future work will relax that
limitation.

The DBus service and path are passed through the control 'open'
command options as the "service" and "object-manager" options
respectively.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>FIXUP: Typo.
dbus-test.html: Add test for accessing multiple DBus services

This includes modifications to test-server to export multiple
object managers and own multiple DBus service names.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>