### Class

# GUPnP Context

#### Description [src]

    class GUPnP.Context : GSSDP.Client
      implements Gio.Initable {
      /* No available fields */
    }

Context object wrapping shared networking bits.

`GUPnPContext` wraps the networking bits that are used by the various GUPnP classes. It automatically starts a web server on demand.

For debugging, it is possible to see the messages being sent and received by setting the environment variable `GUPNP_DEBUG`.

#### Ancestors

- GSSDPClient
- GObject

#### Implements

- GInitable

#### Constructors

###### gupnp_context_new

Create a new `GUPnPContext` with the specified `iface` and `port`.

deprecated: 1.6.

###### gupnp_context_new_for_address

Creates a GUPnP context with address `addr`. If none is specified, GUPnP will chose the address it deems most suitable.

since: 1.6.0

###### gupnp_context_new_full

Creates a GUPnP context with address `addr` on network interface `iface`. If neither is specified, GUPnP will chose the address it deems most suitable.

since: 1.6.0

#### Instance methods

###### gupnp_context_add_server_handler

Add a `SoupServerCallback` to the `GUPnPContext`‘s `SoupServer`.

since: 0.20.11

###### gupnp_context_get_acl

Access the `GUPnPAcl` associated with this client. If there isn’t any, retturns `NULL`. The returned ACL must not be freed.

since: 0.20.11

###### gupnp_context_get_default_language

Get the default Content-Language header for this context.

since: 0.18.0

###### gupnp_context_get_port

Get the port that the SOAP server is running on.

###### gupnp_context_get_server

Get the `SoupServer` HTTP server that GUPnP is using.

###### gupnp_context_get_session

Get the `SoupSession` object that GUPnP is using.

since: 0.12.3

###### gupnp_context_get_subscription_timeout

Get the event subscription timeout (in seconds), or 0 meaning there is no timeout.

###### gupnp_context_host_path

Start hosting `local_path` at `server_path`. Files with the path `local_path`.LOCALE (if they exist) will be served up when LOCALE is specified in the request’s Accept-Language header.

###### gupnp_context_host_path_for_agent

Use this method to serve different local path to specific user-agent(s). The path `server_path` must already be hosted by `context`.

since: 0.14.0

###### gupnp_context_remove_server_handler

Remove a `SoupServerCallback` from the `GUPnPContext`‘s `SoupServer`.

since: 0.20.11

###### gupnp_context_rewrite_uri

Utility function to re-write an uri to the IPv6 link-local form which has the zone index appended to the IP address.

since: 1.2.0

###### gupnp_context_set_acl

Attach or remove the assoicated access control list to this context. If `acl` is `NULL`, the current access control list will be removed.

since: 0.20.11

###### gupnp_context_set_default_language

Set the default language for the Content-Language header to `language`.

since: 0.18.0

###### gupnp_context_set_subscription_timeout

Sets the event subscription timeout to `timeout`. Use 0 if you don’t want subscriptions to time out. Note that any client side subscriptions will automatically be renewed.

###### gupnp_context_unhost_path

Stop hosting the file or folder at `server_path`.

##### Methods inherited from GSSDPClient (22)

###### gssdp_client_add_cache_entry

Add `user_agent` for `ip_address`.

###### gssdp_client_append_header

Adds a header field to the messages sent by this `client`. It is intended to be used by clients requiring vendor specific header fields.

###### gssdp_client_can_reach

Check if the peer at `address` is reachable using this `client`.

###### gssdp_client_clear_headers

Removes all the headers for this `client`.

###### gssdp_client_get_active

Get the current state of the client. See `GSSDPClient:active` for details.

###### gssdp_client_get_address

The IP address this client works on.

###### gssdp_client_get_address_mask

No description available.

###### gssdp_client_get_family

No description available.

###### gssdp_client_get_host_ip

Get the IP address we advertise ourselves as using.

###### gssdp_client_get_index

No description available.

###### gssdp_client_get_interface

Get the name of the network interface associated to `client`.

###### gssdp_client_get_network

Get the network identifier of the client. See `GSSDPClient:network` for details.

###### gssdp_client_get_port

No description available.

###### gssdp_client_get_server_id

No description available.

###### gssdp_client_get_tcp_socket

Get the associated TCP socket.

###### gssdp_client_get_uda_version

No description available.

###### gssdp_client_guess_user_agent

Try to get a User-Agent for `ip_address`.

###### gssdp_client_remove_header

Removes `name` from the list of headers. If there are multiple values for `name`, they are all removed.

###### gssdp_client_set_boot_id

Will set the new boot-id for this SSDP client. Does nothing if the UDA version used by the client is UDA 1.0.

###### gssdp_client_set_config_id

The config-id is used to allow caching of the device or service description. It should be changed if that changes.

###### gssdp_client_set_network

Sets the network identification of `client` to `network`.

###### gssdp_client_set_server_id

Sets the server ID of `client` to `server_id`. This string is used as the “Server:” identification header for SSDP discovery and response packets and “User-Agent” header for searches.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

##### Methods inherited from GInitable (1)

###### g_initable_init

Initializes the object implementing the interface.

#### Properties

###### GUPnP.Context:acl

An access control list.

since: 0.20.11

###### GUPnP.Context:default-language

The content of the Content-Language header id the client sends Accept-Language and no language-specific pages to serve exist. The property defaults to ‘en’.

since: 0.18.0

###### GUPnP.Context:server

The `SoupServer` HTTP server used by GUPnP.

###### GUPnP.Context:session

The `SoupSession` object used by GUPnP.

###### GUPnP.Context:subscription-timeout

The preferred subscription timeout: the number of seconds after which subscriptions are renewed. Set to ‘0’ if subscriptions are never to time out.

##### Properties inherited from GSSDPClient (16)

###### GSSDP.Client:active

Whether this client is active or not (passive). When active (default), the client sends messages on the network, otherwise not. In most cases, you don’t want to touch this property.

###### GSSDP.Client:address

The network address this client is bound to.

###### GSSDP.Client:address-family

The IP protocol address family this client works on. When specified during construction without giving a concrete address, it will be used to determine the proper address.

###### GSSDP.Client:allocate-tcp-socket

The whether to allocate a TCP socket. Mainly used by GUPnPContext to signalize that it can handle a pre-allocated socket. Will become non-configurable default-on in a future release.

###### GSSDP.Client:boot-id

The value of the BOOTID.UPNP.ORG header.

###### GSSDP.Client:config-id

The value of the CONFIGID.UPNP.ORG header.

###### GSSDP.Client:host-ip

The IP address of the assoicated network interface.

###### GSSDP.Client:host-mask

The network mask of the assoicated network interface.

###### GSSDP.Client:interface

The name of the network interface this client is associated with. Set to NULL to autodetect.

###### GSSDP.Client:msearch-port

UDP port to use for sending multicast M-SEARCH requests on the network. If not set (or set to 0) a random port will be used. This property can be only set during object construction.

###### GSSDP.Client:network

The network this client is currently connected to. You could set this to anything you want to identify the network this client is associated with. If you are using `GUPnPContextManager` and associated interface is a WiFi interface, this property is set to the ESSID of the network. Otherwise, expect this to be the network IP address by default.

###### GSSDP.Client:port

UDP port to use for sending multicast M-SEARCH requests on the network. If not set (or set to 0) a random port will be used. This property can be only set during object construction.

###### GSSDP.Client:server-id

The SSDP server’s identifier.

###### GSSDP.Client:socket-ttl

Time-to-live value to use for all sockets created by this client. If not set (or set to 0) the value recommended by UPnP will be used. This property can only be set during object construction.

###### GSSDP.Client:tcp-socket

The allocated TCP socket bound to the same port as `GSSDPClient:port`.

###### GSSDP.Client:uda-version

The UPnP version the client adheres to.

#### Signals

##### Signals inherited from GSSDPClient (1)

###### GSSDPClient::message-received

Internal signal.

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct GUPnPContextClass {
      GSSDPClientClass parent_class;
      void (* _gupnp_reserved1) (
    void
      );
      void (* _gupnp_reserved2) (
    void
      );
      void (* _gupnp_reserved3) (
    void
      );
      void (* _gupnp_reserved4) (
    void
      );

    }

No description available.

###### Class members

`parent_class: GSSDPClientClass`

  No description available.

`_gupnp_reserved1: void (* _gupnp_reserved1) ( void )`

  No description available.

`_gupnp_reserved2: void (* _gupnp_reserved2) ( void )`

  No description available.

`_gupnp_reserved3: void (* _gupnp_reserved3) ( void )`

  No description available.

`_gupnp_reserved4: void (* _gupnp_reserved4) ( void )`

  No description available.