Previous: , Up: Network Discovery: mDNS and Service Location   [Contents]


B.6.2 STMDNS: The Discovery Engine

Macro: ST_MDNS_OPTION_NO_DISCOVERY

Option bit for st_mdns_new_with_options: publish-only mode (do not browse for peers).

Function: STMDNS * st_mdns_new (void)

Creates a discovery/publish engine with browsing enabled.

Returns: New STMDNS.

Function: STMDNS * st_mdns_new_with_options (int options)

Creates an engine with option bits (e.g. ST_MDNS_OPTION_NO_DISCOVERY).

options

Bitwise options; 0 matches st_mdns_new.

Returns: New STMDNS.

Function: void st_mdns_set_notify_context (STMDNS *self, GMainContext *ctx)

Sets affinity for service-added / service-removed signals.

self

Discovery engine.

ctx

Affinity context, or NULL for default.

Returns: Nothing.

Function: gboolean st_mdns_publish_service (STMDNS *self, const gchar *name, const gchar *type, guint16 port)

Publishes one service (add + commit) so peers can discover it.

self

Discovery engine.

name

Service instance name.

type

mDNS type (e.g. "_dbus._tcp").

port

Port already bound by STServer.

Returns: TRUE on success, FALSE on Avahi/publish failure.

Function: gboolean st_mdns_add_service (STMDNS *self, const gchar *name, const gchar *type, guint16 port)

Queues a service into the current entry group without committing (batch publish).

self

Discovery engine.

name

Service instance name.

type

mDNS type.

port

Service port.

Returns: TRUE if queued, FALSE on failure.

Function: gboolean st_mdns_commit (STMDNS *self)

Commits pending services added with st_mdns_add_service.

self

Discovery engine.

Returns: TRUE on success.

Function: const GList * st_mdns_get_all_services (STMDNS *self)

Lists currently discovered services.

self

Discovery engine.

Returns: Borrowed GList of STMDNSService * (owned by self).


Previous: STMDNSService: Service Representation, Up: Network Discovery: mDNS and Service Location   [Contents]