#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <errno.h>
#include <string.h>
#include <ctype.h>
#include "ns_name.h"
#include "arpa/nameser.h"
Go to the source code of this file.
int MRns_name_compress_list | ( | const char * | buf, |
int | buflen, | ||
unsigned char * | compbuf, | ||
size_t | compbuf_size | ||
) |
Creates a compressed list from a string of comma-separated domain-names.
Produces a buffer containing a compressed data version of a list of domain-names extracted from a comma-separated string. Given a string containing:
one.two.com,three.four.com
It will compress this into:
03 6f 6e 65 03 74 77 6f 03 63 6f 6d 00 05 74 68 72 65 65 04 66 6f 75 72 c0 08
buf | - buffer containing the uncompressed string of domain-names |
buflen | - length of uncompressed string of domain-names |
compbuf | - buffer to receive the compressed list |
compbuf_size | - size of the compression buffer |
int MRns_name_uncompress_list | ( | const unsigned char * | buf, |
int | buflen, | ||
char * | dst_buf, | ||
size_t | dst_size | ||
) |
Creates a string of comma-separated domain-names from a compressed list.
Produces a null-terminated string of comma-separated domain-names from a buffer containing a compressed list of domain-names. The names will be dotted and without enclosing quotes. For example: If a compressed list contains the follwoing two domain names:
a. one.two.com b. three.four.com
The compressed data will look like this:
03 6f 6e 65 03 74 77 6f 03 63 6f 6d 00 05 74 68 72 65 65 04 66 6f 75 72 c0 08
and will decompress into:
one.two.com,three.four.com
buf | - buffer containing the compressed list of domain-names |
buflen | - length of compressed list of domain-names |
dst_buf | - buffer to receive the decompressed list |
dst_size | - size of the destination buffer |