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

int avahi_record_is_valid ( AvahiRecord r  ) 

Check whether the specified record is valid

Definition at line 668 of file rr.c.

References AvahiRecord::data, AvahiRecord::key, AvahiStringList::next, AvahiStringList::size, and AvahiKey::type.

                                          {
    assert(r);

    if (!avahi_key_is_valid(r->key))
        return 0;

    switch (r->key->type) {

        case AVAHI_DNS_TYPE_PTR:
        case AVAHI_DNS_TYPE_CNAME:
        case AVAHI_DNS_TYPE_NS:
            return avahi_is_valid_domain_name(r->data.ptr.name);

        case AVAHI_DNS_TYPE_SRV:
            return avahi_is_valid_domain_name(r->data.srv.name);

        case AVAHI_DNS_TYPE_HINFO:
            return
                strlen(r->data.hinfo.os) <= 255 &&
                strlen(r->data.hinfo.cpu) <= 255;
            
        case AVAHI_DNS_TYPE_TXT: {

            AvahiStringList *strlst;

            for (strlst = r->data.txt.string_list; strlst; strlst = strlst->next)
                if (strlst->size > 255 || strlst->size <= 0)
                    return 0;

            return 1;
        }
    }
            

    return 1;
}


Generated by  Doxygen 1.6.0   Back to index