DeeServer

## DeeServer DeeServer — Creates a server object you can connect to. |

## Synopsis

    #include <dee.h>

                        DeeServer;
                        DeeServerClass;
    gchar *             dee_server_bus_address_for_name     (const gchar *name,
                                                             gboolean include_username);
    const gchar *       dee_server_get_client_address       (DeeServer *server);
    DeeServer *         dee_server_new                      (const gchar *swarm_name);
    DeeServer *         dee_server_new_for_address          (const gchar *swarm_name,
                                                             const gchar *bus_address);

## Object Hierarchy

      GObject
       +----DeePeer
             +----DeeServer

## Properties

      "bus-address"              gchar*                : Read / Write / Construct Only
      "same-user-only"           gboolean              : Read / Write / Construct Only

## Description

DeeServer allows you to create private connections (connections which are not routed via dbus-daemon). Note that, unlike DeePeer, DeeServer will always be swarm leader, and clients connected to it cannot overtake swarm leadership once the server connection is closed.

## Details

### DeeServer

    typedef struct _DeeServer DeeServer;

### DeeServerClass

    typedef struct {
    } DeeServerClass;

### dee_server_bus_address_for_name ()

    gchar *             dee_server_bus_address_for_name     (const gchar *name,
                                                             gboolean include_username);

Helper method which creates bus address string for the given name, which should have the same format as a DBus unique name.

`name` : | A name to create bus address for.
`include_username` : | Include current user name as part of the bus address.
Returns : | Newly allocated string with bus address. Use `g_free()` to free. [transfer full]

### dee_server_get_client_address ()

    const gchar *       dee_server_get_client_address       (DeeServer *server);

Gets a D-Bus address string that can be used by clients to connect to server.

`server` : | A DeeServer.
Returns : | A D-Bus address string. Do not free.

### dee_server_new ()

    DeeServer *         dee_server_new                      (const gchar *swarm_name);

Creates a new instance of DeeServer and tries to bind to "bus-address". The "swarm-leader" property will be set when the binding succeeds.

### Note

Note that this function will automatically determine the value of "bus-address" property and will generally cause your application to use new socket for every DeeServer with different swarm name. See `dee_server_new_for_address()` if you'd like to share one connection between multiple DeeServer instances.

`swarm_name` : | Name of swarm to join.
Returns : | A newly constructed DeeServer. [transfer full]

### dee_server_new_for_address ()

    DeeServer *         dee_server_new_for_address          (const gchar *swarm_name,
                                                             const gchar *bus_address);

Creates a new instance of DeeServer and tries to bind to `bus_address`. The "swarm-leader" property will be set when the binding succeeds.

If there is already a DeeServer instance bound to `bus_address`, the connection will be shared with the newly constructed instance.

### Note

This function is primarily meant for sharing of one connection (socket) between multiple DeeServers, so that you can create DeeServer instances with varying swarm names, but the same bus address, which will cause them to share the connection (the sharing is possible only within the same process though).

`swarm_name` : | Name of swarm to join.
`bus_address` : | D-Bus address to use for the connection.
Returns : | A newly constructed DeeServer. [transfer full]

## Property Details

### The `"bus-address"` property

      "bus-address"              gchar*                : Read / Write / Construct Only

Bus address to use for the connection.

Default value: NULL

### The `"same-user-only"` property

      "same-user-only"           gboolean              : Read / Write / Construct Only

Accept connections from current user only.

Default value: TRUE