summaryrefslogtreecommitdiff
path: root/doc/texi/tld.c.texi
blob: de3891f6ce76e73ccf3d93960023356da5e7a70c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
@subheading tld_get_table
@anchor{tld_get_table}
@deftypefun {const Tld_table *} {tld_get_table} (const char * @var{tld}, const Tld_table ** @var{tables})
@var{tld}: TLD name (e.g. "com") as zero terminated ASCII byte string.

@var{tables}: Zero terminated array of @code{Tld_table} info-structures for
TLDs.

Get the TLD table for a named TLD by searching through the given
TLD table array.

@strong{Return value:} Return structure corresponding to TLD @code{tld} by going
thru @code{tables}, or return @code{NULL} if no such structure is found.
@end deftypefun

@subheading tld_default_table
@anchor{tld_default_table}
@deftypefun {const Tld_table *} {tld_default_table} (const char * @var{tld}, const Tld_table ** @var{overrides})
@var{tld}: TLD name (e.g. "com") as zero terminated ASCII byte string.

@var{overrides}: Additional zero terminated array of @code{Tld_table}
info-structures for TLDs, or @code{NULL} to only use library deault
tables.

Get the TLD table for a named TLD, using the internal defaults,
possibly overrided by the (optional) supplied tables.

@strong{Return value:} Return structure corresponding to TLD @code{tld_str}, first
looking through @code{overrides} then thru built-in list, or @code{NULL} if
no such structure found.
@end deftypefun

@subheading tld_get_4
@anchor{tld_get_4}
@deftypefun {int} {tld_get_4} (const uint32_t * @var{in}, size_t @var{inlen}, char ** @var{out})
@var{in}: Array of unicode code points to process. Does not need to be
zero terminated.

@var{inlen}: Number of unicode code points.

@var{out}: Zero terminated ascii result string pointer.

Isolate the top-level domain of @code{in} and return it as an ASCII
string in @code{out}.

@strong{Return value:} Return @code{TLD_SUCCESS} on success, or the corresponding
@code{Tld_rc} error code otherwise.
@end deftypefun

@subheading tld_get_4z
@anchor{tld_get_4z}
@deftypefun {int} {tld_get_4z} (const uint32_t * @var{in}, char ** @var{out})
@var{in}: Zero terminated array of unicode code points to process.

@var{out}: Zero terminated ascii result string pointer.

Isolate the top-level domain of @code{in} and return it as an ASCII
string in @code{out}.

@strong{Return value:} Return @code{TLD_SUCCESS} on success, or the corresponding
@code{Tld_rc} error code otherwise.
@end deftypefun

@subheading tld_get_z
@anchor{tld_get_z}
@deftypefun {int} {tld_get_z} (const char * @var{in}, char ** @var{out})
@var{in}: Zero terminated character array to process.

@var{out}: Zero terminated ascii result string pointer.

Isolate the top-level domain of @code{in} and return it as an ASCII
string in @code{out}.  The input string @code{in} may be UTF-8, ISO-8859-1 or
any ASCII compatible character encoding.

@strong{Return value:} Return @code{TLD_SUCCESS} on success, or the corresponding
@code{Tld_rc} error code otherwise.
@end deftypefun

@subheading tld_check_4t
@anchor{tld_check_4t}
@deftypefun {int} {tld_check_4t} (const uint32_t * @var{in}, size_t @var{inlen}, size_t * @var{errpos}, const Tld_table * @var{tld})
@var{in}: Array of unicode code points to process. Does not need to be
zero terminated.

@var{inlen}: Number of unicode code points.

@var{errpos}: Position of offending character is returned here.

@var{tld}: A @code{Tld_table} data structure representing the restrictions for
which the input should be tested.

Test each of the code points in @code{in} for whether or not
they are allowed by the data structure in @code{tld}, return
the position of the first character for which this is not
the case in @code{errpos}.

@strong{Return value:} Returns the @code{Tld_rc} value @code{TLD_SUCCESS} if all code
points are valid or when @code{tld} is null, @code{TLD_INVALID} if a
character is not allowed, or additional error codes on general
failure conditions.
@end deftypefun

@subheading tld_check_4tz
@anchor{tld_check_4tz}
@deftypefun {int} {tld_check_4tz} (const uint32_t * @var{in}, size_t * @var{errpos}, const Tld_table * @var{tld})
@var{in}: Zero terminated array of unicode code points to process.

@var{errpos}: Position of offending character is returned here.

@var{tld}: A @code{Tld_table} data structure representing the restrictions for
which the input should be tested.

Test each of the code points in @code{in} for whether or not
they are allowed by the data structure in @code{tld}, return
the position of the first character for which this is not
the case in @code{errpos}.

@strong{Return value:} Returns the @code{Tld_rc} value @code{TLD_SUCCESS} if all code
points are valid or when @code{tld} is null, @code{TLD_INVALID} if a
character is not allowed, or additional error codes on general
failure conditions.
@end deftypefun

@subheading tld_check_4
@anchor{tld_check_4}
@deftypefun {int} {tld_check_4} (const uint32_t * @var{in}, size_t @var{inlen}, size_t * @var{errpos}, const Tld_table ** @var{overrides})
@var{in}: Array of unicode code points to process. Does not need to be
zero terminated.

@var{inlen}: Number of unicode code points.

@var{errpos}: Position of offending character is returned here.

@var{overrides}: A @code{Tld_table} array of additional domain restriction
structures that complement and supersede the built-in information.

Test each of the code points in @code{in} for whether or not they are
allowed by the information in @code{overrides} or by the built-in TLD
restriction data. When data for the same TLD is available both
internally and in @code{overrides}, the information in @code{overrides} takes
precedence. If several entries for a specific TLD are found, the
first one is used.  If @code{overrides} is @code{NULL}, only the built-in
information is used.  The position of the first offending character
is returned in @code{errpos}.

@strong{Return value:} Returns the @code{Tld_rc} value @code{TLD_SUCCESS} if all code
points are valid or when @code{tld} is null, @code{TLD_INVALID} if a
character is not allowed, or additional error codes on general
failure conditions.
@end deftypefun

@subheading tld_check_4z
@anchor{tld_check_4z}
@deftypefun {int} {tld_check_4z} (const uint32_t * @var{in}, size_t * @var{errpos}, const Tld_table ** @var{overrides})
@var{in}: Zero-terminated array of unicode code points to process.

@var{errpos}: Position of offending character is returned here.

@var{overrides}: A @code{Tld_table} array of additional domain restriction
structures that complement and supersede the built-in information.

Test each of the code points in @code{in} for whether or not they are
allowed by the information in @code{overrides} or by the built-in TLD
restriction data. When data for the same TLD is available both
internally and in @code{overrides}, the information in @code{overrides} takes
precedence. If several entries for a specific TLD are found, the
first one is used.  If @code{overrides} is @code{NULL}, only the built-in
information is used.  The position of the first offending character
is returned in @code{errpos}.

@strong{Return value:} Returns the @code{Tld_rc} value @code{TLD_SUCCESS} if all code
points are valid or when @code{tld} is null, @code{TLD_INVALID} if a
character is not allowed, or additional error codes on general
failure conditions.
@end deftypefun

@subheading tld_check_8z
@anchor{tld_check_8z}
@deftypefun {int} {tld_check_8z} (const char * @var{in}, size_t * @var{errpos}, const Tld_table ** @var{overrides})
@var{in}: Zero-terminated UTF8 string to process.

@var{errpos}: Position of offending character is returned here.

@var{overrides}: A @code{Tld_table} array of additional domain restriction
structures that complement and supersede the built-in information.

Test each of the characters in @code{in} for whether or not they are
allowed by the information in @code{overrides} or by the built-in TLD
restriction data. When data for the same TLD is available both
internally and in @code{overrides}, the information in @code{overrides} takes
precedence. If several entries for a specific TLD are found, the
first one is used.  If @code{overrides} is @code{NULL}, only the built-in
information is used.  The position of the first offending character
is returned in @code{errpos}.  Note that the error position refers to the
decoded character offset rather than the byte position in the
string.

@strong{Return value:} Returns the @code{Tld_rc} value @code{TLD_SUCCESS} if all
characters are valid or when @code{tld} is null, @code{TLD_INVALID} if a
character is not allowed, or additional error codes on general
failure conditions.
@end deftypefun

@subheading tld_check_lz
@anchor{tld_check_lz}
@deftypefun {int} {tld_check_lz} (const char * @var{in}, size_t * @var{errpos}, const Tld_table ** @var{overrides})
@var{in}: Zero-terminated string in the current locales encoding to process.

@var{errpos}: Position of offending character is returned here.

@var{overrides}: A @code{Tld_table} array of additional domain restriction
structures that complement and supersede the built-in information.

Test each of the characters in @code{in} for whether or not they are
allowed by the information in @code{overrides} or by the built-in TLD
restriction data. When data for the same TLD is available both
internally and in @code{overrides}, the information in @code{overrides} takes
precedence. If several entries for a specific TLD are found, the
first one is used.  If @code{overrides} is @code{NULL}, only the built-in
information is used.  The position of the first offending character
is returned in @code{errpos}.  Note that the error position refers to the
decoded character offset rather than the byte position in the
string.

@strong{Return value:} Returns the @code{Tld_rc} value @code{TLD_SUCCESS} if all
characters are valid or when @code{tld} is null, @code{TLD_INVALID} if a
character is not allowed, or additional error codes on general
failure conditions.
@end deftypefun