ISC DHCP 4.4.3-P1
A reference DHCPv4 and DHCPv6 implementation
 
Loading...
Searching...
No Matches
ns_name.c File Reference
#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.

Functions

int MRns_name_len (const u_char *eom, const u_char *src)
 
int MRns_name_ntop (const u_char *src, char *dst, size_t dstsiz)
 
int MRns_name_pton (const char *src, u_char *dst, size_t dstsiz)
 
int MRns_name_ntol (const u_char *src, u_char *dst, size_t dstsiz)
 
int MRns_name_unpack (const u_char *msg, const u_char *eom, const u_char *src, u_char *dst, size_t dstsiz)
 
int MRns_name_pack (const u_char *src, u_char *dst, unsigned dstsiz, const u_char **dnptrs, const u_char **lastdnptr)
 
int MRns_name_uncompress (const u_char *msg, const u_char *eom, const u_char *src, char *dst, size_t dstsiz)
 
int MRns_name_compress (const char *src, u_char *dst, size_t dstsiz, const u_char **dnptrs, const u_char **lastdnptr)
 
int MRns_name_skip (const u_char **ptrptr, const u_char *eom)
 
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.
 
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.
 

Function Documentation

◆ MRns_name_compress()

int MRns_name_compress ( const char * src,
u_char * dst,
size_t dstsiz,
const u_char ** dnptrs,
const u_char ** lastdnptr )

Definition at line 535 of file ns_name.c.

◆ MRns_name_compress_list()

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

Parameters
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
Returns
the length of the compressed data when successful, -1 on error.

Definition at line 780 of file ns_name.c.

◆ MRns_name_len()

int MRns_name_len ( const u_char * eom,
const u_char * src )

Definition at line 57 of file ns_name.c.

◆ MRns_name_ntol()

int MRns_name_ntol ( const u_char * src,
u_char * dst,
size_t dstsiz )

Definition at line 283 of file ns_name.c.

◆ MRns_name_ntop()

int MRns_name_ntop ( const u_char * src,
char * dst,
size_t dstsiz )

Definition at line 93 of file ns_name.c.

◆ MRns_name_pack()

int MRns_name_pack ( const u_char * src,
u_char * dst,
unsigned dstsiz,
const u_char ** dnptrs,
const u_char ** lastdnptr )

Definition at line 415 of file ns_name.c.

◆ MRns_name_pton()

int MRns_name_pton ( const char * src,
u_char * dst,
size_t dstsiz )

Definition at line 174 of file ns_name.c.

◆ MRns_name_skip()

int MRns_name_skip ( const u_char ** ptrptr,
const u_char * eom )

Definition at line 552 of file ns_name.c.

◆ MRns_name_uncompress()

int MRns_name_uncompress ( const u_char * msg,
const u_char * eom,
const u_char * src,
char * dst,
size_t dstsiz )

Definition at line 507 of file ns_name.c.

◆ MRns_name_uncompress_list()

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

Parameters
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
Returns
the length of the decompressed string when successful, -1 on error.

Definition at line 711 of file ns_name.c.

◆ MRns_name_unpack()

int MRns_name_unpack ( const u_char * msg,
const u_char * eom,
const u_char * src,
u_char * dst,
size_t dstsiz )

Definition at line 327 of file ns_name.c.