1. dns_packet_getname

     #include <dns.h>

     newpos = dns_packet_getname(buf,len,pos,&dn);

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

dns_packet_getname reads a compressed domain name from position pos of a DNS packet stored at buf, copies the name into dn, and returns the position in the packet immediately after the name.

If the name is misformatted, or if reading the name would require reading past the first len bytes of the packet, or if there is not enough memory for dn, dns_packet_getname returns 0, setting errno appropriately, and leaves dn alone.


CategoryDns CategoryWatch CategoryTemplate

MoinQ: djbdns/dns_packetライブラリ (last edited 2022-09-10 06:49:38 by ToshinoriMaeno)