Public Member Functions |
|
domainname () | |
default constructor |
|
domainname (const char *text, domainname origin) | |
constructor from human-readable text |
|
domainname (const char *text, const _domain origin="") | |
constructor from human-readable text |
|
domainname (message_buff &buff, int ix) | |
constructor from data in a DNS message |
|
domainname (bool is_binary, const _domain dom) | |
constructor from binary domain name |
|
domainname (const domainname &nam) | |
copy constructor |
|
bool | operator== (const domainname &nam) |
equality test |
|
bool | operator!= (const domainname &nam) |
negatice equality test |
|
domainname & | operator= (const domainname &nam) |
assignment |
|
domainname & | operator= (const char *buff) |
assignment from human-readable text |
|
domainname & | operator+= (const domainname &dom) |
concatenation using += |
|
domainname & | operator+ (const domainname &dom) |
concatenation using + |
|
bool | operator>= (const domainname &dom) |
parent-child test |
|
bool | operator> (const domainname &dom) |
parent-child test |
|
~domainname () | |
destructor |
|
_domain | c_str () |
binary representation of domain |
|
int | len () |
length of binary representation |
|
stl_string | tostring () |
convert to human-readable string |
|
int | nlabels () |
number of labels of the domain name |
|
stl_string | label (int ix) |
label in domain name |
|
domainname | from (int ix) |
domain-name portion |
|
domainname | to (int labels) |
domain-name portion |
|
stl_string | torelstring (domainname &root) |
return relative representation |
|
int | ncommon (domainname &dom) |
check label match count |
This class represents a domain name. It offers functions to add domain names together, retrieving labels from the domainname, and converting it to human-readable strings and the binary format used in DNS messages.
Definition at line 64 of file domainfn.h.
|
default constructor This constructor sets the domain name to ".", the root domain. |
|
constructor from human-readable text This constructor takes a domain name in human-readable notation, e.g. "www.acdam.net", and an origin. If a relative domain name is given, it will be considered relative to the specified origin.
|
|
constructor from human-readable text This constructor takes a domain name in human-readable notation, e.g. "www.acdam.net", and optionally an origin. The origin is in the binary _domain format as found in DNS messages. In case of a relative domain name, it is considered relative to this origin (or to the root domain, if no origin is given).
|
|
constructor from data in a DNS message This constructor takes a DNS message, stored in a message_buff structor, and an offset in this message where the domain name is to begin. This function will decompress the domain name if nessecary.
|
|
constructor from binary domain name This constructor takes a domain name in binary form. Since a domain name in binary form is a char *, just like a human-readable domain name, this contructor takes a boolean value as well to prevent it from being ambiguous. The value of the boolean is silently ignored.
|
|
copy constructor This constructor just copies the given domainname structore.
|
|
destructor Frees resources associated with the domain name |
|
binary representation of domain Returns the binary representation of the domain name as it would appear in DNS messages (though in uncompressed form).
|
|
domain-name portion Returns the portion of the domain name from the label specified by ix.
|
|
label in domain name Returns a label in the domain name. This is just plain human-readable text. It does not contain dots.
|
|
length of binary representation Returns the length, in bytes, also counting the terminating character, of the binary representation of the domain name.
|
|
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
|
|
number of labels of the domain name Returns the number of labels in the domain name, also counting the root
|
|
negatice equality test Tests whether the two domain names are the same. Comparison is done in a case-insensitive way.
|
|
concatenation using + Appends two domain names, returning a third. The first domain name becomes a child domain of the second one.
|
|
concatenation using += Appends another domain name to the current domain name. The current domain name becomes a child domain of the appended domain name, for example, domainname("www") += domainname("acdam.net") would become
|
|
assignment from human-readable text Assigns another domain name, given in human-readable text. Relative domain names are considered relative to the root domain
|
|
assignment Assigns another domain name
|
|
equality test Tests whether the two domain names are the same. Comparison is done in a case-insensitive way.
|
|
parent-child test Tests whether we are the child domain of the given domain name. Returns false if the child and parent domain names given are the same.
|
|
parent-child test Tests whether we are the child domain of the given domain name. This function also returns true if the child and parent domains are the same.
|
|
domain-name portion Returns a domain name consisting of the first
|
|
return relative representation Returns a string representation of the domain name, relative to the given origin. If the domain is not a child of the given root, the complete, absolte domain name is returned. If we are the domain name queried itself, an "@" is returned.
|
|
convert to human-readable string Converts the domain name to a human-readable string. The string will always have a trailing dot.
|