|  |  |  | Easy Publish and Consume Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | ||||
#include <libepc/service-type.h> #define EPC_SERVICE_TYPE_HTTP #define EPC_SERVICE_TYPE_HTTPS const gchar* epc_service_type_get_base (const gchar *type); EpcProtocol epc_service_type_get_protocol (const gchar *service_type); gchar** epc_service_type_list_supported (const gchar *application); gchar* epc_service_type_new (EpcProtocol protocol, const gchar *application);
DNS-SD uses well-known services types to discover service providers. The following macros describe the service types uses by this library.
Example 9. Find an Easy-Publish server
  dialog = aui_service_dialog_new ("Choose an Easy Publish Server", NULL,
                                   GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                   GTK_STOCK_CONNECT, GTK_RESPONSE_ACCEPT,
                                   NULL);
  aui_service_dialog_set_browse_service_types (AUI_SERVICE_DIALOG (dialog),
                                               EPC_SERVICE_TYPE_HTTPS,
                                               EPC_SERVICE_TYPE_HTTP,
                                               NULL);
  if (GTK_RESPONSE_ACCEPT == gtk_dialog_run (GTK_DIALOG (dialog)))
    {
      const gint port = aui_service_dialog_get_port (AUI_SERVICE_DIALOG (dialog));
      const gchar *host = aui_service_dialog_get_host_name (AUI_SERVICE_DIALOG (dialog));
      const gchar *type = aui_service_dialog_get_service_type (AUI_SERVICE_DIALOG (dialog));
      EpcProtocol protocol = epc_service_type_get_protocol (type);
      ...
    }
 
#define EPC_SERVICE_TYPE_HTTP "_easy-publish-http._tcp"
The well-known DNS-SD service type for EpcPublisher servers providing unencrypted HTTP access.
#define EPC_SERVICE_TYPE_HTTPS "_easy-publish-https._tcp"
The well-known DNS-SD service type for EpcPublisher servers providing encrypted HTTPS access.
const gchar* epc_service_type_get_base (const gchar *type);
Extracts the base service-type of a DNS-SD service-type.
DNS-SD service types may contain a sub service type, for instance the service-type "_anon._sub._ftp._tcp" contains the base-type "_ftp._tcp" and the sub-type "_anon". This function extracts extracts the base-type. The service type is returned unmodifed if it doesn't contain a sub-type.
| 
 | a DNS-SD service-type | 
| Returns : | The base-service-type. | 
EpcProtocol epc_service_type_get_protocol (const gchar *service_type);
Queries the EpcProtocol associated with a DNS-SD service type. See EPC_SERVICE_TYPE_HTTP, EPC_SERVICE_TYPE_HTTPS.
| 
 | a DNS-SD service type | 
| Returns : | Returns the EpcProtocol associated with service_type,
or EPC_PROTOCOL_UNKNOWN for unrecognized or unsupported service types. | 
gchar** epc_service_type_list_supported (const gchar *application);
Lists all service types supported by the library. When application is NULL
just the generic types, otherwise the service-subtypes for that application
are returned. The returned list is terminated by NULL and must be released
by the caller with g_strfreev().
See also: epc_service_type_new().
| 
 | an application name, or NULL | 
| Returns : | The NULLterminated list of all supported service types. | 
gchar* epc_service_type_new (EpcProtocol protocol, const gchar *application);
Builds the DNS-SD service type for the given transport protocol and
application. When application is NULL, the application name is retrieved by
calling g_get_prgname(). NULL is returned in that case if g_get_prgname() returns NULL.
The string returned should be released when no longer needed.
| 
 | a EpcProtocol | 
| 
 | the application name, or NULL | 
| Returns : | A newly allocated string holding the requested service-type,
or NULLwhenapplicationisNULLandg_get_prgname()fails. |