libtld 1.2.0
Public Attributes

tld_info Struct Reference

Set of information returned by the tld() function. More...

List of all members.

Public Attributes

enum tld_category f_category
 The category of the TLD.
const char * f_country
 The country where this TLD is used.
int f_offset
 The offset to the TLD in the URI string you supplied.
enum tld_status f_status
 The status of the TLD.
const char * f_tld
 Pointer to the TLD in the URI string you supplied.

Detailed Description

This structure is used by the tld() function to define the results to return to the caller.

Remember that this is a C structure. By default, the fields are undefined. The tld() function will first defined these fields, before returning any result.

It is acceptable to clear the structure before calling the tld() function but it is not required.

Definition at line 69 of file tld.h.in.


Member Data Documentation

This represents the category of the TLD. One of the tld_category enumeration values can be found in this field.

See also:
enum tld_category

Definition at line 71 of file tld.h.in.

Referenced by test_invalid(), and tld().

const char * tld_info::f_country

When the f_category is set to TLD_CATEGORY_COUNTRY then this field is a pointer to the name of the country in English (although some may include accents, the strings are in UTF-8.)

This field is set to NULL if the category is not Country or the TLD was not found.

See also:
tld_info::f_category
enum tld_category

Definition at line 73 of file tld.h.in.

Referenced by test_invalid(), and tld().

This offset, when added to the URI string pointer, gets you to the TLD of that URI. The offset can also be used to start searching for the beginning of the domain name by searching for the previous period from that offset minus one. In effect, this gives you a way to determine the list of sub-domain.

Definition at line 75 of file tld.h.in.

Referenced by main(), test_all(), test_invalid(), and tld().

This value defines the current status of the TLD. Most of the TLDs we define are valid, but some are either deprecated, unused, or proposed.

Only a TLD marked as TLD_STATUS_VALID should be considered valid, although otherwise may be accepted in some circumstances.

See also:
enum tld_status

Definition at line 72 of file tld.h.in.

Referenced by test_all(), test_invalid(), and tld().

const char * tld_info::f_tld

This is a pointer to the TLD section that the tld() function found in your URI. Note that it is valid only as long as your URI string pointer.

It is also possible to make use of the tld_info::f_offset value to extract the TLD, domain, or sub-domains.

If the TLD is not found, this field is NULL.

Definition at line 74 of file tld.h.in.

Referenced by main(), test_all(), test_invalid(), test_tlds(), and tld().


The documentation for this struct was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

This document is part of the libtld Project.

Copyright by Made to Order Software Corp.