man dns_domain (Fonctions bibliothèques) - The dns_domain library interface

NAME

dns_domain_* - The dns_domain library interface

SYNOPSIS

#include <dns.h>

len = dns_domain_length(dn);

char *dn; unsigned int len;

dns_domain_equal(dn, dn2);

char *dn; char *dn2;

dns_domain_copy(&dn, in);

char *dn = 0; char *in;

dns_domain_fromdot(&dn, buf, len);

char *dn = 0; char *buf; unsigned int len;

DESCRIPTION

A DNS domain name is a sequence of components. Each component is a string of bytes, of length between 1 and 63 inclusive. The total length of all the components, plus the number of components, is between 0 and 254 inclusive.

A component is packet-encoded as a self-delimiting sequence of bytes, the first byte being the length of the component, the remaining bytes being the bytes in the component. A DNS domain name is packet-encoded as a sequence of bytes obtained by concatenating the encodings of the components and a terminating \0. Beware that \0 can appear inside components. The total length of a packet-encoded DNS domain name is between 1 and 255 inclusive.

dns_domain_length returns the number of bytes in the packet-encoded DNS name that dn points to.

dns_domain_equal compares the packet-encoded DNS names that dn and dn2 point to. It returns 1 if the names are the same, 0 if not. Lowercase ASCII and uppercase ASCII are considered the same.

dns_domain_copy reads the packet-encoded DNS name that in points to, copies the name into dynamically allocated space, points dn to that space, and returns 1. If not enough memory is available, dns_domain_copy returns 0, setting errno appropriately, and leaves dn alone.

You can call dns_domain_copy repeatedly. If dn is nonzero, dns_domain_copy frees it before replacing it with the new pointer. Initially dn must be 0.

dns_domain_fromdot reads a dot-encoded DNS name of length len from buf, copies the name in packet-encoded format into dynamically allocated space, points dn to that space, and returns 1.

If buf violates DNS name length restrictions, or if not enough memory is available, dns_domain_fromdot leaves dn alone and returns 0, setting errno appropriately.

Like dns_domain_copy, dns_domain_fromdot frees dn before changing it, if dn is nonzero.

SEE ALSO

dns_ip4(3), dns_ip4_qualify(3), dns_mx(3), dns_name4(3), dns_packet(3), dns_random(3), dns_transmit(3), dns_txt(3)

http://cr.yp.to/djbdns/blurb/library.html

CETTE PAGE DOCUMENTE AUSSI :