## GSSDPClient

GSSDPClient — SSDP "bus" wrapper.

## Functions

GSSDPClient * | gssdp_client_new ()
GSSDPClient * | gssdp_client_new_with_port ()
GMainContext * | gssdp_client_get_main_context ()
void | gssdp_client_set_server_id ()
const char * | gssdp_client_get_server_id ()
const char * | gssdp_client_get_interface ()
const char * | gssdp_client_get_host_ip ()
void | gssdp_client_set_network ()
const char * | gssdp_client_get_network ()
gboolean | gssdp_client_get_active ()
void | gssdp_client_append_header ()
void | gssdp_client_clear_headers ()
void | gssdp_client_remove_header ()
void | gssdp_client_add_cache_entry ()
const char * | gssdp_client_guess_user_agent ()

## Properties

gboolean | active | Read / Write
gchar * | host-ip | Read / Write / Construct
gchar * | interface | Read / Write / Construct Only
gpointer | main-context | Read / Write / Construct Only
guint | msearch-port | Read / Write / Construct Only
gchar * | network | Read / Write / Construct
gchar * | server-id | Read / Write
guint | socket-ttl | Read / Write / Construct Only

## Signals

void | message-received | Run Last

## Types and Values

struct | GSSDPClient

## Object Hierarchy

        GObject
        ╰── GSSDPClient

## Implemented Interfaces

GSSDPClient implements GInitable.

## Description

GSSDPClient wraps the SSDP "bus" as used by both GSSDPResourceBrowser and GSSDPResourceGroup.

## Functions

### gssdp_client_new ()

    GSSDPClient *
    gssdp_client_new (GMainContext *main_context,
                      const char *iface,
                      GError **error);

#### Parameters

main_context | Deprecated: 0.11.2: Always set to NULL. If you want to specify a context use `g_main_context_push_thread_default()`. | [allow-none]
iface | The name of the network interface, or `NULL` for auto-detection. | [allow-none]
error | Location to store error, or NULL |

#### Returns

A new GSSDPClient object.

### gssdp_client_new_with_port ()

    GSSDPClient *
    gssdp_client_new_with_port (const char *iface,
                                guint16 msearch_port,
                                GError **error);

#### Parameters

iface | The name of the network interface, or `NULL` for auto-detection. | [allow-none]
msearch_port | The network port to use for M-SEARCH requests or 0 for random. |
error | Location to store error, or `NULL`. | [allow-none]

#### Returns

A new GSSDPClient object.

### gssdp_client_get_main_context ()

    GMainContext *
    gssdp_client_get_main_context (GSSDPClient *client);

### gssdp_client_set_server_id ()

    void
    gssdp_client_set_server_id (GSSDPClient *client,
                                const char *server_id);

Sets the server ID of `client` to `server_id` .

#### Parameters

client | A GSSDPClient |
server_id | The server ID |

### gssdp_client_get_server_id ()

    const char *
    gssdp_client_get_server_id (GSSDPClient *client);

#### Parameters

client | A GSSDPClient |

#### Returns

The server ID.

### gssdp_client_get_interface ()

    const char *
    gssdp_client_get_interface (GSSDPClient *client);

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

#### Parameters

client | A GSSDPClient |

#### Returns

The network interface name. This string should not be freed.

### gssdp_client_get_host_ip ()

    const char *
    gssdp_client_get_host_ip (GSSDPClient *client);

Get the IP address we advertise ourselves as using.

#### Parameters

client | A GSSDPClient |

#### Returns

The IP address. This string should not be freed.

### gssdp_client_set_network ()

    void
    gssdp_client_set_network (GSSDPClient *client,
                              const char *network);

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

#### Parameters

client | A GSSDPClient |
network | The string identifying the network |

### gssdp_client_get_network ()

    const char *
    gssdp_client_get_network (GSSDPClient *client);

Get the network this client is associated with.

#### Parameters

client | A GSSDPClient |

#### Returns

The network identification. This string should not be freed.

### gssdp_client_get_active ()

    gboolean
    gssdp_client_get_active (GSSDPClient *client);

#### Parameters

client | A GSSDPClient |

#### Returns

`TRUE` if `client` is active, `FALSE` otherwise.

### gssdp_client_append_header ()

    void
    gssdp_client_append_header (GSSDPClient *client,
                                const char *name,
                                const char *value);

Adds a header field to the message sent by this `client` . It is intended to be used by clients requiring vendor specific header fields. (If there is an existing header with name name , then this creates a second one).

#### Parameters

client | A GSSDPClient |
name | Header name |
value | Header value |

### gssdp_client_clear_headers ()

    void
    gssdp_client_clear_headers (GSSDPClient *client);

Removes all the headers for this `client` .

#### Parameters

client | A GSSDPClient |

### gssdp_client_remove_header ()

    void
    gssdp_client_remove_header (GSSDPClient *client,
                                const char *name);

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

#### Parameters

client | A GSSDPClient |
name | Header name |

### gssdp_client_add_cache_entry ()

    void
    gssdp_client_add_cache_entry (GSSDPClient *client,
                                  const char *ip_address,
                                  const char *user_agent);

#### Parameters

client | A GSSDPClient |
ip_address | The host to add to the cache |
user_agent | User agent ot the host to add |

### gssdp_client_guess_user_agent ()

    const char *
    gssdp_client_guess_user_agent (GSSDPClient *client,
                                   const char *ip_address);

#### Parameters

client | A GSSDPClient |
ip_address | IP address to guess the user-agent for |

#### Returns

The user-agent cached for this IP, `NULL` if none is cached.

[transfer none]

## Types and Values

### struct GSSDPClient

    struct GSSDPClient;

## Property Details

### The `“active”` property

      “active”                   gboolean

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.

Flags: Read / Write

Default value: TRUE

### The `“host-ip”` property

      “host-ip”                  gchar *

The IP address of the assoicated network interface.

Flags: Read / Write / Construct

Default value: NULL

### The `“interface”` property

      “interface”                gchar *

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

Flags: Read / Write / Construct Only

Default value: NULL

### The `“main-context”` property

      “main-context”             gpointer

The GMainContext to use. Set to NULL to use the default.

[skip]

`GSSDPClient:main-context` has been deprecated since version 0.11.2 and should not be used in newly-written code.

Use `g_main_context_push_thread_default()`.

Flags: Read / Write / Construct Only

### The `“msearch-port”` property

      “msearch-port”             guint

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.

Flags: Read / Write / Construct Only

Allowed values: <= 65535

Default value: 0

### The `“network”` property

      “network”                  gchar *

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.

Flags: Read / Write / Construct

Default value: NULL

### The `“server-id”` property

      “server-id”                gchar *

The SSDP server's identifier.

Flags: Read / Write

Default value: NULL

### The `“socket-ttl”` property

      “socket-ttl”               guint

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.

Flags: Read / Write / Construct Only

Allowed values: <= 255

Default value: 0

## Signal Details

### The `“message-received”` signal

    void
    user_function (GSSDPClient *client,
                   gchar       *from_ip,
                   guint        from_port,
                   gint         type,
                   gpointer     headers,
                   gpointer     user_data)

Internal signal.

[skip]

#### Parameters

client | The GSSDPClient that received the message. |
from_ip | The IP address of the source. |
from_port | The UDP port used by the sender. |
type | The _GSSDPMessageType. |
headers | Parsed SoupMessageHeaders from the message. | [type SoupMessageHeaders]
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Stability Level: Private