Go to the source code of this file.
Classes |
|
class | domainname |
class representing a domain name More... |
|
struct | dom_compr_info |
internal domain name compression structure More... |
|
Defines |
|
#define | DOM_LEN 255 |
Maximum length of binary domain name. |
|
#define | DOMLABEL_LEN 63 |
Maximum length of domain name label. |
|
#define | tocstr() tostring().c_str() |
convert to human-readable character array |
|
Typedefs |
|
typedef char | _sdomain [DOM_LEN] |
static binary domain name |
|
Functions |
|
void * | memdup (const void *src, int len) |
dump memory |
|
int | dom_comprlen (message_buff &buff, int ix) |
compressed length |
|
_domain | dom_uncompress (message_buff &buff, int ix) |
uncompress domain name |
|
void | dom_write (stl_string &ret, _domain dom, stl_slist(dom_compr_info)&compr) |
compress domain name |
|
_domain | domfrom (_domain dom, int ix) |
domain name portion pointer |
|
bool | domisparent (_domain parent, _domain child) |
test for parent<->child relationship |
|
int | domlen (const _domain dom) |
length of binary domain name |
|
_domain | domdup (const _domain dom) |
dynamic copy of binary domain name |
|
bool | domlcmp (const _domain dom1, const _domain dom2) |
compare binary domain labels |
|
bool | domcmp (const _domain dom1, const _domain dom2) |
compare binary domain names |
|
void | domcat (_domain target, const _domain src) |
domain name concatenation |
|
void | domcpy (_domain res, const _domain src) |
static copy of binary domain name |
|
void | domfromlabel (_domain dom, const char *label, int len=-1) |
create domain name from label |
|
stl_string | dom_tostring (const _domain dom) |
to-string conversion |
|
int | dom_nlabels (const _domain dom) |
number of labels |
|
stl_string | dom_label (const _domain dom, int label) |
label of domain name |
|
const _domain | dom_plabel (const _domain dom, int label) |
label of domain name |
|
int | domncommon (const _domain dom1, const _domain dom2) |
check label match count |
|
int | domccmp (const _domain _dom1, const _domain _dom2) |
compare domain names |
|
void | domto (_domain ret, const _domain src, int labels) |
return domain name portion |
This source file offers various functions for domain-name manipulation. Firstly, it offers the domainname class, which is a C++ class representing a domain name. Secondly, it offers various functions for reading and writing domain names from and to DNS messages, and thirdly, it offers functions which can be used to manipulate domain names as they would appear in DNS messages. These functions use the _domain typedef to represent such a domain name. Usually you will not need to call these yourself.
Definition in file domainfn.h.
|
Maximum length of binary domain name. This is the maximum length of a decompressed binary domain name. Definition at line 47 of file domainfn.h. |
|
Maximum length of domain name label. This is the maximum length of a domain name label, not including the length byte (in binary data), or the trailing Definition at line 55 of file domainfn.h. |
|
convert to human-readable character array Converts the domain name to a human-readable character array. It will also have a trailing dot. This is static data, so if you want a copy, use a strdup().
Definition at line 256 of file domainfn.h. |
|
static binary domain name Use this typedef if you want to declare a static _domain variable. Definition at line 334 of file domainfn.h. |
|
compressed length This function returns the compressed length - that is, the length the domain takes up in the DNS message - of a domain name.
|
|
label of domain name Returns a label of the domain name in human-readable form.
|
|
number of labels Returns the number of labels, also counting the empty
|
|
label of domain name Returns a label of the domain name as a pointer to the position in the domain.
|
|
to-string conversion Converts the domain name to a human-readable string. Contains the trailing dot.
|
|
uncompress domain name This function decompresses a domain name in a DNS message. It returns the binary, decompressed data describing the domain name.
|
|
compress domain name This function writes a domain name to the end of a DNS message, compressing it if possible.
|
|
domain name concatenation Appends
|
|
compare domain names This function offers a way to compare domain names the way the
|
|
compare binary domain names Checks whether both binary domain names are equal.
|
|
static copy of binary domain name Makes a static copy of a domain name. Make sure that
|
|
dynamic copy of binary domain name Makes a dynamically allocated copy of a domain name.
|
|
domain name portion pointer Returns a pointer to the portion of the domain name from the ix'th label.
|
|
create domain name from label Creates a domain name containing just one label: the string argument given. If a length is given, only the first few characters of the string are used. Make sure that
|
|
test for parent<->child relationship Tests whether the first domain name is a parent of the second domain name.
|
|
compare binary domain labels Checks whether both binary domain name start with the same label.
|
|
length of binary domain name Returns the length, in bytes, including the trailing
|
|
check label match count Returns the number of labels the two domain names have in common at their ends; for example this returns 2 for
|
|
return domain name portion Returns a domain name consisting of the first
|
|
dump memory This is an alternative to the c strdup() function, but instead it can dump any type of memory, as long as you give the right length.
|