GSSDP Reference Manual: GSSDPResourceBrowser

## GSSDPResourceBrowser GSSDPResourceBrowser — Class handling resource discovery. |

## Functions

GSSDPResourceBrowser * | gssdp_resource_browser_new ()
GSSDPClient * | gssdp_resource_browser_get_client ()
void | gssdp_resource_browser_set_target ()
const char * | gssdp_resource_browser_get_target ()
void | gssdp_resource_browser_set_mx ()
gushort | gssdp_resource_browser_get_mx ()
void | gssdp_resource_browser_set_active ()
gboolean | gssdp_resource_browser_get_active ()
gboolean | gssdp_resource_browser_rescan ()

## Properties

gboolean | active | Read / Write
GSSDPClient * | client | Read / Write / Construct Only
guint | mx | Read / Write
gchar * | target | Read / Write

## Signals

void | resource-available | Run Last
void | resource-unavailable | Run Last

## Types and Values

struct | GSSDPResourceBrowser
#define | GSSDP_ALL_RESOURCES

## Object Hierarchy

        GObject
        ╰── GSSDPResourceBrowser

## Description

GSSDPResourceBrowser handles resource discovery. After creating a browser and activating it, the ::resource-available and ::resource-unavailable signals will be emitted whenever the availability of a resource matching the specified discovery target changes. A discovery request is sent out automatically when activating the browser.

## Functions

### gssdp_resource_browser_new ()

    GSSDPResourceBrowser *
    gssdp_resource_browser_new (GSSDPClient *client,
                                const char *target);

`target` is a generic string the resource browser listens for on the SSDP bus. There are several possible targets such as

- "ssdp:all" for everything

- "upnp:rootdevice" for UPnP device entry points, not caring about the device type

- The UUID of a specific device

- Device types such as "urn:schemas-upnp-org:device:MediaServer:1"

- Service types such as "urn:schemas-upnp-org:service:ContentDirectory:1"

#### Parameters

client | The GSSDPClient to associate with |
target | A SSDP search target |

#### Returns

A new GSSDPResourceBrowser object.

### gssdp_resource_browser_get_client ()

    GSSDPClient *
    gssdp_resource_browser_get_client (GSSDPResourceBrowser *resource_browser);

#### Parameters

resource_browser | A GSSDPResourceBrowser |

#### Returns

The GSSDPClient `resource_browser` is associated with.

[transfer none]

### gssdp_resource_browser_set_target ()

    void
    gssdp_resource_browser_set_target (GSSDPResourceBrowser *resource_browser,
                                       const char *target);

Sets the browser target of `resource_browser` to `target` .

#### Parameters

resource_browser | A GSSDPResourceBrowser |
target | The browser target |

### gssdp_resource_browser_get_target ()

    const char *
    gssdp_resource_browser_get_target (GSSDPResourceBrowser *resource_browser);

#### Parameters

resource_browser | A GSSDPResourceBrowser |

#### Returns

The browser target.

### gssdp_resource_browser_set_mx ()

    void
    gssdp_resource_browser_set_mx (GSSDPResourceBrowser *resource_browser,
                                   gushort mx);

Sets the used MX value of `resource_browser` to `mx` .

#### Parameters

resource_browser | A GSSDPResourceBrowser |
mx | The to be used MX value |

### gssdp_resource_browser_get_mx ()

    gushort
    gssdp_resource_browser_get_mx (GSSDPResourceBrowser *resource_browser);

#### Parameters

resource_browser | A GSSDPResourceBrowser |

#### Returns

The used MX value.

### gssdp_resource_browser_set_active ()

    void
    gssdp_resource_browser_set_active (GSSDPResourceBrowser *resource_browser,
                                       gboolean active);

(De)activates `resource_browser` .

#### Parameters

resource_browser | A GSSDPResourceBrowser |
active | `TRUE` to activate `resource_browser` |

### gssdp_resource_browser_get_active ()

    gboolean
    gssdp_resource_browser_get_active (GSSDPResourceBrowser *resource_browser);

#### Parameters

resource_browser | A GSSDPResourceBrowser |

#### Returns

`TRUE` if `resource_browser` is active.

### gssdp_resource_browser_rescan ()

    gboolean
    gssdp_resource_browser_rescan (GSSDPResourceBrowser *resource_browser);

Begins discovery if `resource_browser` is active and no discovery is performed. Otherwise does nothing.

#### Parameters

resource_browser | A GSSDPResourceBrowser |

#### Returns

`TRUE` if rescaning has been started.

## Types and Values

### struct GSSDPResourceBrowser

    struct GSSDPResourceBrowser;

### GSSDP_ALL_RESOURCES

    #define GSSDP_ALL_RESOURCES "ssdp:all"

SSDP search target for finding all possible resources.

## Property Details

### The `“active”` property

      “active”                   gboolean

Whether this browser is active or not.

Flags: Read / Write

Default value: FALSE

### The `“client”` property

      “client”                   GSSDPClient *

The GSSDPClient to use.

Flags: Read / Write / Construct Only

### The `“mx”` property

      “mx”                       guint

The maximum number of seconds in which to request other parties to respond.

Flags: Read / Write

Allowed values: [1,65535]

Default value: 3

### The `“target”` property

      “target”                   gchar *

The discovery target.

Flags: Read / Write

Default value: NULL

## Signal Details

### The `“resource-available”` signal

    void
    user_function (GSSDPResourceBrowser *resource_browser,
                   gchar                *usn,
                   gpointer              locations,
                   gpointer              user_data)

The ::resource-available signal is emitted whenever a new resource has become available.

#### Parameters

resource_browser | The GSSDPResourceBrowser that received the signal |
usn | The USN of the discovered resource |
locations | A GList of strings describing the locations of the discovered resource. | [type GList*][transfer none][element-type utf8]
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“resource-unavailable”` signal

    void
    user_function (GSSDPResourceBrowser *resource_browser,
                   gchar                *usn,
                   gpointer              user_data)

The ::resource-unavailable signal is emitted whenever a resource is not available any more.

#### Parameters

resource_browser | The GSSDPResourceBrowser that received the signal |
usn | The USN of the resource |
user_data | user data set when the signal handler was connected. |

Flags: Run Last