libtld 1.2.0
|
00001 /* TLD library -- TLD, domain name, and sub-domain extraction 00002 * Copyright (C) 2011 Made to Order Software Corp. 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00017 */ 00018 #ifndef LIB_TLD_H 00019 #define LIB_TLD_H 00020 00021 #ifdef __cplusplus 00022 extern "C" { 00023 #endif 00024 00025 #define LIBTLD_VERSION_MAJOR @LIBTLD_VERSION_MAJOR@ 00026 #define LIBTLD_VERSION_MINOR @LIBTLD_VERSION_MINOR@ 00027 #define LIBTLD_VERSION_PATCH @LIBTLD_VERSION_PATCH@ 00028 #define LIBTLD_VERSION "@LIBTLD_VERSION_MAJOR@.@LIBTLD_VERSION_MINOR@.@LIBTLD_VERSION_PATCH@" 00029 00030 enum tld_category 00031 { 00032 TLD_CATEGORY_INTERNATIONAL, 00033 TLD_CATEGORY_PROFESSIONALS, 00034 TLD_CATEGORY_LANGUAGE, 00035 TLD_CATEGORY_GROUPS, 00036 TLD_CATEGORY_REGION, 00037 TLD_CATEGORY_TECHNICAL, 00038 TLD_CATEGORY_COUNTRY, 00039 TLD_CATEGORY_ENTREPRENEURIAL, 00040 TLD_CATEGORY_UNDEFINED 00041 }; 00042 00043 enum tld_status 00044 { 00045 TLD_STATUS_VALID, 00046 TLD_STATUS_PROPOSED, 00047 TLD_STATUS_DEPRECATED, 00048 TLD_STATUS_UNUSED, 00049 TLD_STATUS_RESERVED, 00050 TLD_STATUS_INFRASTRUCTURE, 00051 TLD_STATUS_UNDEFINED, 00052 00053 /* The following status is never returned. It is used internally to handle 00054 * exceptions (i.e. usually 2nd level domain names that should not be.) 00055 */ 00056 TLD_STATUS_EXCEPTION = 100 00057 }; 00058 00059 enum tld_result 00060 { 00061 TLD_RESULT_SUCCESS, 00062 TLD_RESULT_INVALID, /* TLD not acceptable (reserved, deprecated, etc.) */ 00063 TLD_RESULT_NULL, /* URI is a NULL pointer */ 00064 TLD_RESULT_NO_TLD, /* no '.' in the URI */ 00065 TLD_RESULT_BAD_URI, /* URI includes two '.' one after another */ 00066 TLD_RESULT_NOT_FOUND 00067 }; 00068 00069 struct tld_info 00070 { 00071 enum tld_category f_category; 00072 enum tld_status f_status; 00073 const char * f_country; 00074 const char * f_tld; /* pointer within your URI string */ 00075 int f_offset; 00076 }; 00077 00078 extern enum tld_result tld(const char *uri, struct tld_info *info); 00079 00080 extern const char *tld_version(); 00081 00082 #ifdef __cplusplus 00083 } 00084 #endif 00085 00086 #endif 00087 /*#ifndef LIB_TLD_H*/ 00088 /* vim: ts=4 sw=4 00089 */
This document is part of the libtld Project.
Copyright by Made to Order Software Corp.