## InfLocalPublisher InfLocalPublisher — Publish services on the local network |

## Synopsis

    #include <libinfinity/common/inf-local-publisher.h>

                        InfLocalPublisher;
    struct              InfLocalPublisherIface;
                        InfLocalPublisherItem;
    InfLocalPublisherItem * inf_local_publisher_publish     (InfLocalPublisher *publisher,
                                                             const gchar *type,
                                                             const gchar *name,
                                                             guint port);
    void                inf_local_publisher_unpublish       (InfLocalPublisher *publisher,
                                                             InfLocalPublisherItem *item);

## Object Hierarchy

      GInterface
       +----InfLocalPublisher

## Prerequisites

InfLocalPublisher requires GObject.

## Known Implementations

InfLocalPublisher is implemented by InfDiscoveryAvahi.

## Description

InfLocalPublisher provides a common interface to publish services on the local network.

## Details

### InfLocalPublisher

    typedef struct _InfLocalPublisher InfLocalPublisher;

InfLocalPublisher is an opaque data type. You should only access it via the public API functions.

### struct InfLocalPublisherIface

    struct InfLocalPublisherIface {
      InfLocalPublisherItem* (*publish)(InfLocalPublisher* publisher,
                                        const gchar* type,
                                        const gchar* name,
                                        guint port);

      void (*unpublish)(InfLocalPublisher* publisher,
                        InfLocalPublisherItem* item);
    };

Virtual functions for InfLocalPublisher.

`publish` () | Virtual function to announce a service of the given type with the given name on the given port. The returned InfLocalPublisherItem is valid as long as the service is published and the InfLocalPublisher is alive. It can be used to unpublish the service again using the `unpublish` function.
`unpublish` () | Virtual function to unpublish a previously published service.

### InfLocalPublisherItem

    typedef struct _InfLocalPublisherItem InfLocalPublisherItem;

InfLocalPublisherItem is an opaque data type. You should only access it via the public API functions.

### inf_local_publisher_publish ()

    InfLocalPublisherItem * inf_local_publisher_publish     (InfLocalPublisher *publisher,
                                                             const gchar *type,
                                                             const gchar *name,
                                                             guint port);

Publishes a service through `publisher` so that it can be discovered with an appropriate InfDiscovery.

`publisher` : | A InfLocalPublisher.
`type` : | The service type to publish, such as _http._tcp.
`name` : | The name of the service.
`port` : | The port the service is listening on.
Returns : | A InfLocalPublisherItem that can be used to unpublish the service again.

### inf_local_publisher_unpublish ()

    void                inf_local_publisher_unpublish       (InfLocalPublisher *publisher,
                                                             InfLocalPublisherItem *item);

Unpublishes `item` so that it can no longer be found in the network.

`publisher` : | A InfLocalPublisher.
`item` : | A published item obtained from `inf_local_publisher_publish()`.

## See Also

InfDiscoveryAvahi