[avahi] Error code -49 when registering service

Versteeg Marcel (ST-CO/ENG1.4) Marcel.Versteeg at nl.bosch.com
Mon Sep 26 06:25:22 PDT 2011


Hi all,

I have an issue when registering a service via the Avahi API. Below is a small code file that produces the issue. In the code file I put a comment where the error code -49 ("Not supported") is returned by the library. What am I doing wrong??

I have Avahi 0.6.25 running on Fedora 13. Due to other restrictions I cannot upgrade to a higher version of Fedora and thus am "confined" to using Fedora 0.6.25 which is the highest version available in a binary version for this OS.
The configuration of Avahi (avahi-daemon.conf) is default and was not changed. The Avahi-daemon is running.

In the code file I removed all other error detection and handling to prevent a large code file which might be harder to understand. The service is registered on another domain that .local which is where it goes wrong. If I change the code below and replace AVAHI_PUBLISH_USE_WIDE_AREA with 0 (a zero) and "mydomain.com" with NULL, the service myservice._mytype._tcp.local can be found and resolved on another computer running Apple's Bonjour service.

--------------- CODE START -------------------

#include <avahi-client/publish.h>
#include <avahi-common/error.h>
#include <avahi-common/thread-watch.h>

static AvahiThreadedPoll* g_poll = NULL;
static AvahiClient* g_client = NULL;
static AvahiEntryGroup* g_group = NULL;

void OnAvahiClientState(AvahiClient* client, AvahiClientState state, void* userdata)
{
    switch (state)
    {
        case AVAHI_CLIENT_S_RUNNING:
            if (NULL == group)
            {
                g_group = avahi_entry_group_new(client, OnAvahiEntryGroupState, userdata);
            }
            if ((NULL != group) && avahi_entry_group_is_empty(g_group))
            {
                int avahiError = avahi_entry_group_add_service(g_group,
                                                               AVAHI_IF_UNSPEC,
                                                               AVAHI_PUBLISH_USE_WIDE_AREA,
                                                               "myservice",
                                                               "_mytype._tcp",
                                                               "mydomain.com",
                                                               NULL,
                                                               9999,
                                                               "txt=value",
                                                               NULL);
                /* THIS IS WHERE avahiError IS -49 (AVAHI_ERR_NOT_SUPPORTED) */
            }
    }
}

void OnAvahiEntryGroupState(AvahiEntryGroup* group, AvahiEntryGroupState state, void* userdata)
{
    /* NOT RELEVANT FOR THIS EXAMPLE, JUST NEEDED FOR COMPILATION ;) */
}

void main()
{
    int avahiError = AVAHI_OK;

    g_poll = avahi_threaded_poll_new();
    g_client = avahi_client_new(avahi_threaded_poll_get(g_poll,
                                                        AVAHI_CLIENT_NO_FAIL,
                                                        OnAvahiClientState,
                                                        NULL,
                                                        &avahiError);
    avahiError = avahi_threaded_poll_start(g_poll);
}

--------------- CODE END -------------------

Marcel Versteeg
Bosch Security System BV
LOB Communication Systems, Software Competence Team (ST-CO/ENG1.4)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/avahi/attachments/20110926/f5884bc6/attachment.html>


More information about the avahi mailing list