InfDiscoveryAvahi: libinfinity-0.7 Reference Manual

## InfDiscoveryAvahi InfDiscoveryAvahi — Service Discovery via Avahi |

## Functions

InfDiscoveryAvahi * | inf_discovery_avahi_new ()
void | inf_discovery_avahi_set_security_policy ()
InfXmppConnectionSecurityPolicy | inf_discovery_avahi_get_security_policy ()
void | inf_discovery_avahi_set_keepalive ()
const InfKeepalive * | inf_discovery_avahi_get_keepalive ()

## Properties

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

## Types and Values

struct | InfDiscoveryAvahi
struct | InfDiscoveryAvahiClass

## Object Hierarchy

        GObject
        ╰── InfDiscoveryAvahi

## Implemented Interfaces

InfDiscoveryAvahi implements InfDiscovery and InfLocalPublisher.

## Includes

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

## 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.

## Functions

### 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.

[constructor]

#### Parameters

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.

[transfer full]

### 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.

#### Parameters

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.

#### Parameters

discovery | A InfDiscoveryAvahi. |

#### Returns

The current security policy.

### inf_discovery_avahi_set_keepalive ()

    void
    inf_discovery_avahi_set_keepalive (InfDiscoveryAvahi *discovery,
                                       const InfKeepalive *keepalive);

Sets the keepalive settings for newly created connections. It does not affect already existing connections.

#### Parameters

discovery | A InfDiscoveryAvahi. |
keepalive | The new keepalive configuration. |

### inf_discovery_avahi_get_keepalive ()

    const InfKeepalive *
    inf_discovery_avahi_get_keepalive (InfDiscoveryAvahi *discovery);

Returns the keepalive settings that will be used for new connections.

#### Parameters

discovery | A InfDiscoveryAvahi. |

#### Returns

A InfKeepalive set for new connections, owned by `discovery` .

## Types and Values

### struct InfDiscoveryAvahi

    struct 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.

## Property Details

### The `“credentials”` property

      “credentials”              InfCertificateCredentials *

The GnuTLS certificate credentials used for encrypting XMPP streams.

Owner: InfDiscoveryAvahi

Flags: Read / Write

### The `“io”` property

      “io”                       InfIo *

The IO object used for watching sockets and timeouts.

Owner: InfDiscoveryAvahi

Flags: Read / Write / Construct Only

### The `“keepalive”` property

      “keepalive”                InfKeepalive *

The keepalive settings for new connections.

Owner: InfDiscoveryAvahi

Flags: Read / Write

### The `“sasl-context”` property

      “sasl-context”             InfSaslContext *

The SASL context used for authentication.

Owner: InfDiscoveryAvahi

Flags: Read / Write

### The `“sasl-mechanisms”` property

      “sasl-mechanisms”          gchar *

The accepted SASL mechanisms for authentication.

Owner: InfDiscoveryAvahi

Flags: Read / Write

Default value: NULL

### The `“security-policy”` property

      “security-policy”          InfXmppConnectionSecurityPolicy

How to decide whether to use TLS.

Owner: InfDiscoveryAvahi

Flags: Read / Write

Default value: INF_XMPP_CONNECTION_SECURITY_BOTH_PREFER_TLS

### The `“xmpp-manager”` property

      “xmpp-manager”             InfXmppManager *

The XMPP manager to register resolved XMPP connections.

Owner: InfDiscoveryAvahi

Flags: Read / Write / Construct Only

## See Also

InfDiscovery, InfLocalPublisher