Logo Search packages:      
Sourcecode: avahi version File versions  Download package

int avahi_is_valid_service_type_strict ( const char *  t )

Return 1 when the specified string contains a valid strict DNS-SD service type (i.e. consisting of only two words, the latter being either _udp or _tcp), 0 otherwise

Definition at line 274 of file domain.c.

References AVAHI_DOMAIN_NAME_MAX, and AVAHI_LABEL_MAX.

                                                      {
    char label[AVAHI_LABEL_MAX];
    assert(t);

    if (strlen(t) >= AVAHI_DOMAIN_NAME_MAX || !*t)
        return 0;

    /* Application name */

    if (!(avahi_unescape_label(&t, label, sizeof(label))))
        return 0;

    if (strlen(label) <= 2 || label[0] != '_')
        return 0;

    if (!*t)
        return 0;

    /* _tcp or _udp boilerplate */

    if (!(avahi_unescape_label(&t, label, sizeof(label))))
        return 0;

    if (strcasecmp(label, "_tcp") && strcasecmp(label, "_udp"))
        return 0;

    if (*t)
        return 0;

    return 1;
}

Generated by  Doxygen 1.6.0   Back to index