## InfDiscoveryAvahi InfDiscoveryAvahi — Service Discovery via Avahi |

## Synopsis

    #include <libinfinity/common/inf-discovery-avahi.h>

                        InfDiscoveryAvahi;
    struct              InfDiscoveryAvahiClass;
    InfDiscoveryAvahi * inf_discovery_avahi_new             (InfIo *io,
                                                             InfXmppManager *manager,
                                                             InfCertificateCredentials *creds,
                                                             InfSaslContext *sasl_context,
                                                             const gchar *sasl_mechanisms);
    void                inf_discovery_avahi_set_security_policy
                                                            (InfDiscoveryAvahi *discovery,
                                                             InfXmppConnectionSecurityPolicy plcy);
    InfXmppConnectionSecurityPolicy inf_discovery_avahi_get_security_policy
                                                            (InfDiscoveryAvahi *discovery);

## Object Hierarchy

      GObject
       +----InfDiscoveryAvahi

## Implemented Interfaces

InfDiscoveryAvahi implements InfDiscovery and InfLocalPublisher.

## Properties

      "credentials"              InfCertificateCredentials*  : Read / Write / Construct
      "io"                       InfIo*                : Read / Write / Construct Only
      "sasl-context"             InfSaslContext*       : Read / Write / Construct
      "sasl-mechanisms"          gchar*                : Read / Write / Construct
      "security-policy"          InfXmppConnectionSecurityPolicy  : Read / Write
      "xmpp-manager"             InfXmppManager*       : Read / Write / Construct Only

## Description

InfDiscoveryAvahi implements the InfDiscovery and InfLocalPublisher interfaces on top of avahi. It resolves services to client-side InfXmppConnections.

This class is only available if the macro `LIBINFINITY_HAVE_AVAHI` is defined.

## Details

### InfDiscoveryAvahi

    typedef struct _InfDiscoveryAvahi InfDiscoveryAvahi;

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

### struct InfDiscoveryAvahiClass

    struct InfDiscoveryAvahiClass {
    };

This structure does not contain any public fields.

### inf_discovery_avahi_new ()

    InfDiscoveryAvahi * inf_discovery_avahi_new             (InfIo *io,
                                                             InfXmppManager *manager,
                                                             InfCertificateCredentials *creds,
                                                             InfSaslContext *sasl_context,
                                                             const gchar *sasl_mechanisms);

Created a new InfDiscoveryAvahi object which can be used to publish and discovery Infinote services on the local network. When resolving a InfDiscoveryInfo (which means obtaining a InfXmlConnection for the discovered service) a new InfXmppConnection needs to be created if there is not already one for the destination host in `manager`. Such connections are created with the `creds` and `sasl_context` parameters. These may be `NULL` in which case InfXmppConnection uses builtin credentials or a builtin context, respectively.

If this InfDiscoveryAvahi is not used to discover services but only to publish any, then `creds`, `sasl_context` and `sasl_mechanisms` are ignored and can safely set to be `NULL`.

`sasl_mechanisms` specifies allowed mechanisms used for authentication with the server. It can be `NULL`, in which case all available mechanisms are accepted.

`io` : | A InfIo object used for watching sockets and timeouts.
`manager` : | A InfXmppManager.
`creds` : | The certificate credentials used for GnuTLS encryption.
`sasl_context` : | A SASL context used for authentication.
`sasl_mechanisms` : | A whitespace-separated list of accepted SASL mechanisms, or `NULL`.
Returns : | A new InfDiscoveryAvahi.

### inf_discovery_avahi_set_security_policy ()

    void                inf_discovery_avahi_set_security_policy
                                                            (InfDiscoveryAvahi *discovery,
                                                             InfXmppConnectionSecurityPolicy plcy);

Sets the InfXmppConnectionSecurityPolicy for newly created InfXmppConnections. It does not affect already existing connections.

`discovery` : | A InfDiscoveryAvahi.
`plcy` : | The new security policy.

### inf_discovery_avahi_get_security_policy ()

    InfXmppConnectionSecurityPolicy inf_discovery_avahi_get_security_policy
                                                            (InfDiscoveryAvahi *discovery);

Returns the current security policy used for new InfXmppConnections.

`discovery` : | A InfDiscoveryAvahi.
Returns : | The current security policy.

## Property Details

### The `"credentials"` property

      "credentials"              InfCertificateCredentials*  : Read / Write / Construct

The GnuTLS certificate credentials used for encrypting XMPP streams.

### The `"io"` property

      "io"                       InfIo*                : Read / Write / Construct Only

The IO object used for watching sockets and timeouts.

### The `"sasl-context"` property

      "sasl-context"             InfSaslContext*       : Read / Write / Construct

The SASL context used for authentication.

### The `"sasl-mechanisms"` property

      "sasl-mechanisms"          gchar*                : Read / Write / Construct

The accepted SASL mechanisms for authentication.

Default value: NULL

### The `"security-policy"` property

      "security-policy"          InfXmppConnectionSecurityPolicy  : Read / Write

How to decide whether to use TLS.

Default value: INF_XMPP_CONNECTION_SECURITY_BOTH_PREFER_TLS

### The `"xmpp-manager"` property

      "xmpp-manager"             InfXmppManager*       : Read / Write / Construct Only

The XMPP manager to register resolved XMPP connections.

## See Also

InfDiscovery, InfLocalPublisher