libtld: tld_info Struct Reference

libtld  1.5.13
A library to determine the Top-Level Domain name of any URL.
tld_info Struct Reference

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

Public Attributes

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

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 91 of file tld.h.

Member Data Documentation

enum tld_category tld_info::f_category

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 93 of file tld.h.

Referenced by cat_ext(), tld_object::category(), check_uri(), PHP_FUNCTION(), tld(), and tld_clear_info().

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 95 of file tld.h.

Referenced by cat_ext(), check_uri(), tld_object::country(), PHP_FUNCTION(), tld(), and tld_clear_info().

int tld_info::f_offset

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 97 of file tld.h.

Referenced by cat_ext(), check_uri(), PHP_FUNCTION(), tld(), tld_check_uri(), and tld_clear_info().

enum tld_status tld_info::f_status

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 94 of file tld.h.

Referenced by cat_ext(), check_uri(), tld_object::is_valid(), PHP_FUNCTION(), tld_object::status(), tld(), and tld_clear_info().

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 96 of file tld.h.

Referenced by cat_ext(), check_uri(), tld_object::domain_only(), tld_object::full_domain(), PHP_FUNCTION(), tld_object::sub_domains(), tld(), tld_check_uri(), tld_clear_info(), tld_encode(), and tld_object::tld_only().


The documentation for this struct was generated from the following files:
  • /home/snapwebsites/BUILD/contrib/libtld/include/libtld/tld.h
  • /home/snapwebsites/snapcpp/contrib/libtld/src/tld.c

This document is part of the Snap! Websites Project.

Copyright by Made to Order Software Corp.

Syndicate content

Snap! Websites
An Open Source CMS System in C++

Contact Us Directly