You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
691 B
C

#include "byte.h"
#include "fmt.h"
#include "dns.h"
void dns_name4_domain(char name[DNS_NAME4_DOMAIN],const char ip[4])
{
unsigned int namelen;
unsigned int i;
namelen = 0;
i = fmt_ulong(name + namelen + 1,(unsigned long) (unsigned char) ip[3]);
name[namelen++] = i;
namelen += i;
i = fmt_ulong(name + namelen + 1,(unsigned long) (unsigned char) ip[2]);
name[namelen++] = i;
namelen += i;
i = fmt_ulong(name + namelen + 1,(unsigned long) (unsigned char) ip[1]);
name[namelen++] = i;
namelen += i;
i = fmt_ulong(name + namelen + 1,(unsigned long) (unsigned char) ip[0]);
name[namelen++] = i;
namelen += i;
byte_copy(name + namelen,14,"\7in-addr\4arpa\0");
}