Top |
Functions
EpcDispatcher * | epc_dispatcher_new () |
gboolean | epc_dispatcher_run () |
void | epc_dispatcher_reset () |
void | epc_dispatcher_add_service () |
void | epc_dispatcher_add_service_subtype () |
void | epc_dispatcher_set_collision_handling () |
void | epc_dispatcher_set_cookie () |
void | epc_dispatcher_set_name () |
void | epc_dispatcher_set_service_details () |
EpcCollisionHandling | epc_dispatcher_get_collision_handling () |
const gchar * | epc_dispatcher_get_cookie () |
const gchar * | epc_dispatcher_get_name () |
GEnumClass * | epc_address_family_get_class () |
const gchar * | epc_address_family_to_string () |
GEnumClass * | epc_collision_handling_get_class () |
const gchar * | epc_collision_handling_to_string () |
Properties
EpcCollisionHandling | collision-handling | Read / Write / Construct |
gchar * | cookie | Read / Write / Construct |
gchar * | name | Read / Write / Construct |
Types and Values
enum | EpcAddressFamily |
enum | EpcCollisionHandling |
EpcDispatcherPrivate | |
struct | EpcDispatcherClass |
struct | EpcDispatcher |
Description
The EpcDispatcher object provides an easy method for publishing DNS-SD services. Unlike established APIs like Avahi or HOWL the EpcDispatcher doesn't expose any state changes reported by the DNS-SD daemon, but instead tries to handle them automatically. Such state changes include, for instance, name collisions or a restart of the DNS-SD daemon.
Example 7. Publish a printing service
1 2 3 4 5 6 7 |
dispatcher = epc_dispatcher_new ("Dead Tree Desecrator"); epc_dispatcher_add_service (dispatcher, EPC_ADDRESS_IPV4, "_ipp._tcp", NULL, NULL, 651, "path=/printers", NULL); epc_dispatcher_add_service (dispatcher, EPC_ADDRESS_UNSPEC, "_duplex._sub._printer._tcp", NULL, NULL, 515, NULL); |
Functions
epc_dispatcher_new ()
EpcDispatcher *
epc_dispatcher_new (const gchar *name
);
Creates a new EpcDispatcher object for announcing a DNS-SD service. The service is announced on all network interfaces.
Call epc_dispatcher_add_service()
to actually announce a service.
epc_dispatcher_run ()
gboolean epc_dispatcher_run (EpcDispatcher *dispatcher
,GError **error
);
Starts the Avahi client of the EpcDispatcher. If the
client was not started, the function returns FALSE
and sets error
. The
error domain is EPC_AVAHI_ERROR. Possible error codes are those of the
epc_dispatcher_reset ()
void
epc_dispatcher_reset (EpcDispatcher *dispatcher
);
Revokes all service announcements of this EpcDispatcher.
epc_dispatcher_add_service ()
void epc_dispatcher_add_service (EpcDispatcher *dispatcher
,EpcAddressFamily protocol
,const gchar *type
,const gchar *domain
,const gchar *host
,guint16 port
,...
);
Announces a TCP/IP service via DNS-SD.
The service type
shall be a well-known DNS-SD service type as listed on
Pass NULL
for host
to use the official host name of the machine to announce
the service. On machines with multiple DNS entries you might want to explictly
choose a fully qualified DNS name to announce the service.
Parameters
dispatcher |
||
protocol |
the EpcAddressFamily this service supports |
|
type |
the machine friendly name of the service |
|
domain |
the DNS domain for the announcement, or |
|
host |
the fully qualified host name of the service, or |
|
port |
the TCP/IP port of the service |
|
... |
an optional list of TXT records, terminated by |
epc_dispatcher_add_service_subtype ()
void epc_dispatcher_add_service_subtype (EpcDispatcher *dispatcher
,const gchar *type
,const gchar *subtype
);
Announces an additional sub service for a registered DNS-SD service.
This function will fail silently, when the service specified by
type
hasn't been registered yet.
epc_dispatcher_set_collision_handling ()
void epc_dispatcher_set_collision_handling (EpcDispatcher *dispatcher
,EpcCollisionHandling method
);
Changes the collision handling strategy the dispatcher uses. See “collision-handling” for details.
Since: 0.3.1
epc_dispatcher_set_cookie ()
void epc_dispatcher_set_cookie (EpcDispatcher *dispatcher
,const gchar *cookie
);
Changes the unique identifier of the service. See “cookie” for details.
Since: 0.3.1
epc_dispatcher_set_name ()
void epc_dispatcher_set_name (EpcDispatcher *dispatcher
,const gchar *name
);
Changes the user friendly name used for announcing services. See “name”.
epc_dispatcher_set_service_details ()
void epc_dispatcher_set_service_details (EpcDispatcher *dispatcher
,const gchar *type
,...
);
Updates the list of TXT records for a registered DNS-SD service. The TXT records are specified by the service type and usually have the form of key-value pairs:
1 |
path=/dwarf-blog/ |
This function will fail silently, when the service specified by
type
hasn't been registered yet.
epc_dispatcher_get_collision_handling ()
EpcCollisionHandling
epc_dispatcher_get_collision_handling (EpcDispatcher *dispatcher
);
Queries the collision handling strategy the dispatcher uses. See “collision-handling” for details.
Since: 0.3.1
epc_dispatcher_get_cookie ()
const gchar *
epc_dispatcher_get_cookie (EpcDispatcher *dispatcher
);
Queries the unique identifier of the service. See “cookie” for details.
Since: 0.3.1
epc_dispatcher_get_name ()
const gchar *
epc_dispatcher_get_name (EpcDispatcher *dispatcher
);
Queries the user friendly name used for announcing services. See “name”.
epc_address_family_get_class ()
GEnumClass *
epc_address_family_get_class (void
);
Retrieves the GEnumClass describing the EpcAddressFamily enum.
epc_address_family_to_string ()
const gchar *
epc_address_family_to_string (EpcAddressFamily value
);
Retrieves the name of a EpcAddressFamily value
, or NULL
when value
is invalid.
epc_collision_handling_get_class ()
GEnumClass *
epc_collision_handling_get_class (void
);
Retrieves the GEnumClass describing the EpcCollisionHandling enum.
epc_collision_handling_to_string ()
const gchar *
epc_collision_handling_to_string (EpcCollisionHandling value
);
Retrieves the name of a EpcCollisionHandling value
, or NULL
when value
is invalid.
Types and Values
EpcDispatcherPrivate
typedef struct _EpcDispatcherPrivate EpcDispatcherPrivate;
Private fields of the EpcDispatcher class.
struct EpcDispatcherClass
struct EpcDispatcherClass { };
Virtual methods of the EpcDispatcher class.
Property Details
The “collision-handling”
property
“collision-handling” EpcCollisionHandling
The collision handling method to use.
Flags: Read / Write / Construct
Default value: EPC_COLLISIONS_CHANGE_NAME
The “cookie”
property
“cookie” gchar *
Unique identifier of the service.
Flags: Read / Write / Construct
Default value: NULL