EpcServiceInfo: Easy Publish and Consume Reference Manual

## EpcServiceInfo EpcServiceInfo — DNS-SD service descriptions |

## Stability Level

Unstable, unless otherwise indicated

## Functions

EpcServiceInfo * | epc_service_info_new ()
EpcServiceInfo * | epc_service_info_new_full ()
EpcServiceInfo * | epc_service_info_ref ()
void | epc_service_info_unref ()
const AvahiAddress * | epc_service_info_get_address ()
EpcAddressFamily | epc_service_info_get_address_family ()
const gchar * | epc_service_info_get_detail ()
const gchar * | epc_service_info_get_host ()
const gchar * | epc_service_info_get_interface ()
guint | epc_service_info_get_port ()
const gchar * | epc_service_info_get_service_type ()

## Types and Values

| EpcServiceInfo

## Object Hierarchy

        GBoxed
        ╰── EpcServiceInfo

## Includes

    #include <libepc/service-info.h>

## Description

The EpcServiceInfo object describes DNS-SD services.

## Functions

### epc_service_info_new ()

    EpcServiceInfo *
    epc_service_info_new (const gchar *type,
                          const gchar *host,
                          guint port,
                          const AvahiStringList *details);

Creates a new service description using the information provided. The `details` list usually is retrieved from the TXT record the dynamic naming system (DNS) provides for the service. When using Avahi's service chooser `aui_service_dialog_get_txt_data()` can be used for getting a `details` list. To create an ad-hoc list use `avahi_string_list_new()` and related functions.

#### Parameters

type | the DNS-SD service type |
host | the DNS hostname |
port | the TCP/IP port |
details | list of key-value pairs, or `NULL` |

#### Returns

The newly created service description, or `NULL` on error.

### epc_service_info_new_full ()

    EpcServiceInfo *
    epc_service_info_new_full (const gchar *type,
                               const gchar *host,
                               guint port,
                               const AvahiStringList *details,
                               const AvahiAddress *address,
                               const gchar *ifname);

Creates a new service description using the information provided. The `details` list usually is retrieved from the TXT record the dynamic naming system (DNS) provides for the service. When using Avahi's service chooser `aui_service_dialog_get_txt_data()` can be used for getting a `details` list. To create an ad-hoc list use `avahi_string_list_new()` and related functions.

#### Parameters

type | the DNS-SD service type |
host | the DNS hostname |
port | the TCP/IP port |
details | list of key-value pairs, or `NULL` |
address | IP address of the service, or `NULL` |
ifname | network interface for contacting the service, or `NULL` |

#### Returns

The newly created service description, or `NULL` on error.

### epc_service_info_ref ()

    EpcServiceInfo *
    epc_service_info_ref (EpcServiceInfo *info);

Increases the reference count of `info` by one. See also: `epc_service_info_unref()`

#### Parameters

info | a EpcServiceInfo |

#### Returns

The same `info` object.

### epc_service_info_unref ()

    void
    epc_service_info_unref (EpcServiceInfo *info);

Decreases the reference count of `info` by one. When its reference count drops to 0, the object is finalized (i.e. its memory is freed).

See also: `epc_service_info_ref()`

#### Parameters

info | a EpcServiceInfo |

### epc_service_info_get_address ()

    const AvahiAddress *
    epc_service_info_get_address (const EpcServiceInfo *info);

Retrieves the IP address for contacting the service, or `NULL` when that information is not available.

#### Parameters

info | a EpcServiceInfo |

#### Returns

A IP address, or `NULL`.

### epc_service_info_get_address_family ()

    EpcAddressFamily
    epc_service_info_get_address_family (const EpcServiceInfo *info);

Retrieves the address family for contacting the service, or EPC_ADDRESS_UNSPEC when that information is not available.

#### Parameters

info | a EpcServiceInfo |

#### Returns

A EpcAddressFamily.

### epc_service_info_get_detail ()

    const gchar *
    epc_service_info_get_detail (const EpcServiceInfo *info,
                                 const gchar *name);

Retrieves a detail stored in the service's TXT record. Returns `NULL` when the requested information is not available.

#### Parameters

info | a EpcServiceInfo |
name | the detail's name |

#### Returns

The requested service detail, or `NULL`.

### epc_service_info_get_host ()

    const gchar *
    epc_service_info_get_host (const EpcServiceInfo *info);

Retrieves the DNS host name associated with `info` .

#### Parameters

info | a EpcServiceInfo |

#### Returns

A DNS host name.

### epc_service_info_get_interface ()

    const gchar *
    epc_service_info_get_interface (const EpcServiceInfo *info);

Retrieves the name of the network interface which must be used for contacting the service, or `NULL` when that information is not available.

#### Parameters

info | a EpcServiceInfo |

#### Returns

A network interface name, or `NULL`.

### epc_service_info_get_port ()

    guint
    epc_service_info_get_port (const EpcServiceInfo *info);

Retrieves the TCP/IP port associated with `info` .

#### Parameters

info | a EpcServiceInfo |

#### Returns

A TCP/IP port.

### epc_service_info_get_service_type ()

    const gchar *
    epc_service_info_get_service_type (const EpcServiceInfo *info);

Retrieves the DNS-SD service type associated with `info` .

#### Parameters

info | a EpcServiceInfo |

#### Returns

A DNS-SD service type.

## Types and Values

### EpcServiceInfo

    typedef struct _EpcServiceInfo EpcServiceInfo;

Description of a network service. See also: `epc_service_monitor_new()`.