summaryrefslogtreecommitdiffstats
path: root/plugins/uriparser/Uri.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uriparser/Uri.h')
-rw-r--r--plugins/uriparser/Uri.h779
1 files changed, 0 insertions, 779 deletions
diff --git a/plugins/uriparser/Uri.h b/plugins/uriparser/Uri.h
deleted file mode 100644
index a3f7914..0000000
--- a/plugins/uriparser/Uri.h
+++ /dev/null
@@ -1,779 +0,0 @@
1/* f9ca23a99fc1c8ff610e2bdc0bff3c4bb4d883ccbff5851fe7a1398f9b6aca57 (0.8.5+)
2 *
3 * uriparser - RFC 3986 URI parsing library
4 *
5 * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
6 * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * * Redistributions of source code must retain the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer.
16 *
17 * * Redistributions in binary form must reproduce the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer in the documentation and/or other materials
20 * provided with the distribution.
21 *
22 * * Neither the name of the <ORGANIZATION> nor the names of its
23 * contributors may be used to endorse or promote products
24 * derived from this software without specific prior written
25 * permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
33 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
34 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
38 * OF THE POSSIBILITY OF SUCH DAMAGE.
39 */
40
41/**
42 * @file Uri.h
43 * Holds the RFC 3986 %URI parser interface.
44 * NOTE: This header includes itself twice.
45 */
46
47#if (defined(URI_PASS_ANSI) && !defined(URI_H_ANSI)) \
48 || (defined(URI_PASS_UNICODE) && !defined(URI_H_UNICODE)) \
49 || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
50/* What encodings are enabled? */
51#include "UriDefsConfig.h"
52#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
53/* Include SELF twice */
54# ifdef URI_ENABLE_ANSI
55# define URI_PASS_ANSI 1
56# include "Uri.h"
57# undef URI_PASS_ANSI
58# endif
59# ifdef URI_ENABLE_UNICODE
60# define URI_PASS_UNICODE 1
61# include "Uri.h"
62# undef URI_PASS_UNICODE
63# endif
64/* Only one pass for each encoding */
65#elif (defined(URI_PASS_ANSI) && !defined(URI_H_ANSI) \
66 && defined(URI_ENABLE_ANSI)) || (defined(URI_PASS_UNICODE) \
67 && !defined(URI_H_UNICODE) && defined(URI_ENABLE_UNICODE))
68# ifdef URI_PASS_ANSI
69# define URI_H_ANSI 1
70# include "UriDefsAnsi.h"
71# else
72# define URI_H_UNICODE 1
73# include "UriDefsUnicode.h"
74# endif
75
76
77
78#ifdef __cplusplus
79extern "C" {
80#endif
81
82
83
84#ifndef URI_DOXYGEN
85# include "UriBase.h"
86#endif
87
88
89
90/**
91 * Specifies a range of characters within a string.
92 * The range includes all characters from <c>first</c>
93 * to one before <c>afterLast</c>. So if both are
94 * non-NULL the difference is the length of the text range.
95 *
96 * @see UriUriA
97 * @see UriPathSegmentA
98 * @see UriHostDataA
99 * @since 0.3.0
100 */
101typedef struct URI_TYPE(TextRangeStruct) {
102 const URI_CHAR * first; /**< Pointer to first character */
103 const URI_CHAR * afterLast; /**< Pointer to character after the last one still in */
104} URI_TYPE(TextRange); /**< @copydoc UriTextRangeStructA */
105
106
107
108/**
109 * Represents a path segment within a %URI path.
110 * More precisely it is a node in a linked
111 * list of path segments.
112 *
113 * @see UriUriA
114 * @since 0.3.0
115 */
116typedef struct URI_TYPE(PathSegmentStruct) {
117 URI_TYPE(TextRange) text; /**< Path segment name */
118 struct URI_TYPE(PathSegmentStruct) * next; /**< Pointer to the next path segment in the list, can be NULL if last already */
119
120 void * reserved; /**< Reserved to the parser */
121} URI_TYPE(PathSegment); /**< @copydoc UriPathSegmentStructA */
122
123
124
125/**
126 * Holds structured host information.
127 * This is either a IPv4, IPv6, plain
128 * text for IPvFuture or all zero for
129 * a registered name.
130 *
131 * @see UriUriA
132 * @since 0.3.0
133 */
134typedef struct URI_TYPE(HostDataStruct) {
135 UriIp4 * ip4; /**< IPv4 address */
136 UriIp6 * ip6; /**< IPv6 address */
137 URI_TYPE(TextRange) ipFuture; /**< IPvFuture address */
138} URI_TYPE(HostData); /**< @copydoc UriHostDataStructA */
139
140
141
142/**
143 * Represents an RFC 3986 %URI.
144 * Missing components can be {NULL, NULL} ranges.
145 *
146 * @see uriParseUriA
147 * @see uriFreeUriMembersA
148 * @see UriParserStateA
149 * @since 0.3.0
150 */
151typedef struct URI_TYPE(UriStruct) {
152 URI_TYPE(TextRange) scheme; /**< Scheme (e.g. "http") */
153 URI_TYPE(TextRange) userInfo; /**< User info (e.g. "user:pass") */
154 URI_TYPE(TextRange) hostText; /**< Host text (set for all hosts, excluding square brackets) */
155 URI_TYPE(HostData) hostData; /**< Structured host type specific data */
156 URI_TYPE(TextRange) portText; /**< Port (e.g. "80") */
157 URI_TYPE(PathSegment) * pathHead; /**< Head of a linked list of path segments */
158 URI_TYPE(PathSegment) * pathTail; /**< Tail of the list behind pathHead */
159 URI_TYPE(TextRange) query; /**< Query without leading "?" */
160 URI_TYPE(TextRange) fragment; /**< Query without leading "#" */
161 UriBool absolutePath; /**< Absolute path flag, distincting "a" and "/a";
162 always <c>URI_FALSE</c> for URIs with host */
163 UriBool owner; /**< Memory owner flag */
164
165 void * reserved; /**< Reserved to the parser */
166} URI_TYPE(Uri); /**< @copydoc UriUriStructA */
167
168
169
170/**
171 * Represents a state of the %URI parser.
172 * Missing components can be NULL to reflect
173 * a components absence.
174 *
175 * @see uriFreeUriMembersA
176 * @since 0.3.0
177 */
178typedef struct URI_TYPE(ParserStateStruct) {
179 URI_TYPE(Uri) * uri; /**< Plug in the %URI structure to be filled while parsing here */
180 int errorCode; /**< Code identifying the occured error */
181 const URI_CHAR * errorPos; /**< Pointer to position in case of a syntax error */
182
183 void * reserved; /**< Reserved to the parser */
184} URI_TYPE(ParserState); /**< @copydoc UriParserStateStructA */
185
186
187
188/**
189 * Represents a query element.
190 * More precisely it is a node in a linked
191 * list of query elements.
192 *
193 * @since 0.7.0
194 */
195typedef struct URI_TYPE(QueryListStruct) {
196 const URI_CHAR * key; /**< Key of the query element */
197 const URI_CHAR * value; /**< Value of the query element, can be NULL */
198
199 struct URI_TYPE(QueryListStruct) * next; /**< Pointer to the next key/value pair in the list, can be NULL if last already */
200} URI_TYPE(QueryList); /**< @copydoc UriQueryListStructA */
201
202
203
204/**
205 * Parses a RFC 3986 URI.
206 *
207 * @param state <b>INOUT</b>: Parser state with set output %URI, must not be NULL
208 * @param first <b>IN</b>: Pointer to the first character to parse, must not be NULL
209 * @param afterLast <b>IN</b>: Pointer to the character after the last to parse, must not be NULL
210 * @return 0 on success, error code otherwise
211 *
212 * @see uriParseUriA
213 * @see uriToStringA
214 * @since 0.3.0
215 */
216int URI_FUNC(ParseUriEx)(URI_TYPE(ParserState) * state,
217 const URI_CHAR * first, const URI_CHAR * afterLast);
218
219
220
221/**
222 * Parses a RFC 3986 %URI.
223 *
224 * @param state <b>INOUT</b>: Parser state with set output %URI, must not be NULL
225 * @param text <b>IN</b>: Text to parse, must not be NULL
226 * @return 0 on success, error code otherwise
227 *
228 * @see uriParseUriExA
229 * @see uriToStringA
230 * @since 0.3.0
231 */
232int URI_FUNC(ParseUri)(URI_TYPE(ParserState) * state,
233 const URI_CHAR * text);
234
235
236
237/**
238 * Frees all memory associated with the members
239 * of the %URI structure. Note that the structure
240 * itself is not freed, only its members.
241 *
242 * @param uri <b>INOUT</b>: %URI structure whose members should be freed
243 *
244 * @since 0.3.0
245 */
246void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri);
247
248
249
250/**
251 * Percent-encodes all unreserved characters from the input string and
252 * writes the encoded version to the output string.
253 * Be sure to allocate <b>3 times</b> the space of the input buffer for
254 * the output buffer for <c>normalizeBreaks == URI_FALSE</c> and <b>6 times</b>
255 * the space for <c>normalizeBreaks == URI_TRUE</c>
256 * (since e.g. "\x0d" becomes "%0D%0A" in that case)
257 *
258 * @param inFirst <b>IN</b>: Pointer to first character of the input text
259 * @param inAfterLast <b>IN</b>: Pointer after the last character of the input text
260 * @param out <b>OUT</b>: Encoded text destination
261 * @param spaceToPlus <b>IN</b>: Wether to convert ' ' to '+' or not
262 * @param normalizeBreaks <b>IN</b>: Wether to convert CR and LF to CR-LF or not.
263 * @return Position of terminator in output string
264 *
265 * @see uriEscapeA
266 * @see uriUnescapeInPlaceExA
267 * @since 0.5.2
268 */
269URI_CHAR * URI_FUNC(EscapeEx)(const URI_CHAR * inFirst,
270 const URI_CHAR * inAfterLast, URI_CHAR * out,
271 UriBool spaceToPlus, UriBool normalizeBreaks);
272
273
274
275/**
276 * Percent-encodes all unreserved characters from the input string and
277 * writes the encoded version to the output string.
278 * Be sure to allocate <b>3 times</b> the space of the input buffer for
279 * the output buffer for <c>normalizeBreaks == URI_FALSE</c> and <b>6 times</b>
280 * the space for <c>normalizeBreaks == URI_TRUE</c>
281 * (since e.g. "\x0d" becomes "%0D%0A" in that case)
282 *
283 * @param in <b>IN</b>: Text source
284 * @param out <b>OUT</b>: Encoded text destination
285 * @param spaceToPlus <b>IN</b>: Wether to convert ' ' to '+' or not
286 * @param normalizeBreaks <b>IN</b>: Wether to convert CR and LF to CR-LF or not.
287 * @return Position of terminator in output string
288 *
289 * @see uriEscapeExA
290 * @see uriUnescapeInPlaceA
291 * @since 0.5.0
292 */
293URI_CHAR * URI_FUNC(Escape)(const URI_CHAR * in, URI_CHAR * out,
294 UriBool spaceToPlus, UriBool normalizeBreaks);
295
296
297
298/**
299 * Unescapes percent-encoded groups in a given string.
300 * E.g. "%20" will become " ". Unescaping is done in place.
301 * The return value will be point to the new position
302 * of the terminating zero. Use this value to get the new
303 * length of the string. NULL is only returned if <c>inout</c>
304 * is NULL.
305 *
306 * @param inout <b>INOUT</b>: Text to unescape/decode
307 * @param plusToSpace <b>IN</b>: Whether to convert '+' to ' ' or not
308 * @param breakConversion <b>IN</b>: Line break conversion mode
309 * @return Pointer to new position of the terminating zero
310 *
311 * @see uriUnescapeInPlaceA
312 * @see uriEscapeExA
313 * @since 0.5.0
314 */
315const URI_CHAR * URI_FUNC(UnescapeInPlaceEx)(URI_CHAR * inout,
316 UriBool plusToSpace, UriBreakConversion breakConversion);
317
318
319
320/**
321 * Unescapes percent-encoded groups in a given string.
322 * E.g. "%20" will become " ". Unescaping is done in place.
323 * The return value will be point to the new position
324 * of the terminating zero. Use this value to get the new
325 * length of the string. NULL is only returned if <c>inout</c>
326 * is NULL.
327 *
328 * NOTE: '+' is not decoded to ' ' and line breaks are not converted.
329 * Use the more advanced UnescapeInPlaceEx for that features instead.
330 *
331 * @param inout <b>INOUT</b>: Text to unescape/decode
332 * @return Pointer to new position of the terminating zero
333 *
334 * @see uriUnescapeInPlaceExA
335 * @see uriEscapeA
336 * @since 0.3.0
337 */
338const URI_CHAR * URI_FUNC(UnescapeInPlace)(URI_CHAR * inout);
339
340
341
342/**
343 * Performs reference resolution as described in
344 * <a href="http://tools.ietf.org/html/rfc3986#section-5.2.2">section 5.2.2 of RFC 3986</a>.
345 * NOTE: On success you have to call uriFreeUriMembersA on \p absoluteDest manually later.
346 *
347 * @param absoluteDest <b>OUT</b>: Result %URI
348 * @param relativeSource <b>IN</b>: Reference to resolve
349 * @param absoluteBase <b>IN</b>: Base %URI to apply
350 * @return Error code or 0 on success
351 *
352 * @see uriRemoveBaseUriA, uriAddBaseUriExA
353 * @since 0.4.0
354 */
355int URI_FUNC(AddBaseUri)(URI_TYPE(Uri) * absoluteDest,
356 const URI_TYPE(Uri) * relativeSource,
357 const URI_TYPE(Uri) * absoluteBase);
358
359
360
361/**
362 * Performs reference resolution as described in
363 * <a href="http://tools.ietf.org/html/rfc3986#section-5.2.2">section 5.2.2 of RFC 3986</a>.
364 * NOTE: On success you have to call uriFreeUriMembersA on \p absoluteDest manually later.
365 *
366 * @param absoluteDest <b>OUT</b>: Result %URI
367 * @param relativeSource <b>IN</b>: Reference to resolve
368 * @param absoluteBase <b>IN</b>: Base %URI to apply
369 * @param options <b>IN</b>: Configuration to apply
370 * @return Error code or 0 on success
371 *
372 * @see uriRemoveBaseUriA, uriAddBaseUriA
373 * @since 0.8.1
374 */
375int URI_FUNC(AddBaseUriEx)(URI_TYPE(Uri) * absoluteDest,
376 const URI_TYPE(Uri) * relativeSource,
377 const URI_TYPE(Uri) * absoluteBase,
378 UriResolutionOptions options);
379
380
381
382/**
383 * Tries to make a relative %URI (a reference) from an
384 * absolute %URI and a given base %URI. This can only work if
385 * the absolute %URI shares scheme and authority with
386 * the base %URI. If it does not the result will still be
387 * an absolute URI (with scheme part if necessary).
388 * NOTE: On success you have to call uriFreeUriMembersA on
389 * \p dest manually later.
390 *
391 * @param dest <b>OUT</b>: Result %URI
392 * @param absoluteSource <b>IN</b>: Absolute %URI to make relative
393 * @param absoluteBase <b>IN</b>: Base %URI
394 * @param domainRootMode <b>IN</b>: Create %URI with path relative to domain root
395 * @return Error code or 0 on success
396 *
397 * @see uriAddBaseUriA, uriAddBaseUriExA
398 * @since 0.5.2
399 */
400int URI_FUNC(RemoveBaseUri)(URI_TYPE(Uri) * dest,
401 const URI_TYPE(Uri) * absoluteSource,
402 const URI_TYPE(Uri) * absoluteBase,
403 UriBool domainRootMode);
404
405
406
407/**
408 * Checks two URIs for equivalence. Comparison is done
409 * the naive way, without prior normalization.
410 * NOTE: Two <c>NULL</c> URIs are equal as well.
411 *
412 * @param a <b>IN</b>: First %URI
413 * @param b <b>IN</b>: Second %URI
414 * @return <c>URI_TRUE</c> when equal, <c>URI_FAlSE</c> else
415 *
416 * @since 0.4.0
417 */
418UriBool URI_FUNC(EqualsUri)(const URI_TYPE(Uri) * a, const URI_TYPE(Uri) * b);
419
420
421
422/**
423 * Calculates the number of characters needed to store the
424 * string representation of the given %URI excluding the
425 * terminator.
426 *
427 * @param uri <b>IN</b>: %URI to measure
428 * @param charsRequired <b>OUT</b>: Length of the string representation in characters <b>excluding</b> terminator
429 * @return Error code or 0 on success
430 *
431 * @see uriToStringA
432 * @since 0.5.0
433 */
434int URI_FUNC(ToStringCharsRequired)(const URI_TYPE(Uri) * uri,
435 int * charsRequired);
436
437
438
439/**
440 * Converts a %URI structure back to text as described in
441 * <a href="http://tools.ietf.org/html/rfc3986#section-5.3">section 5.3 of RFC 3986</a>.
442 *
443 * @param dest <b>OUT</b>: Output destination
444 * @param uri <b>IN</b>: %URI to convert
445 * @param maxChars <b>IN</b>: Maximum number of characters to copy <b>including</b> terminator
446 * @param charsWritten <b>OUT</b>: Number of characters written, can be lower than maxChars even if the %URI is too long!
447 * @return Error code or 0 on success
448 *
449 * @see uriToStringCharsRequiredA
450 * @since 0.4.0
451 */
452int URI_FUNC(ToString)(URI_CHAR * dest, const URI_TYPE(Uri) * uri, int maxChars, int * charsWritten);
453
454
455
456/**
457 * Determines the components of a %URI that are not normalized.
458 *
459 * @param uri <b>IN</b>: %URI to check
460 * @return Normalization job mask
461 *
462 * @see uriNormalizeSyntaxA
463 * @since 0.5.0
464 */
465unsigned int URI_FUNC(NormalizeSyntaxMaskRequired)(const URI_TYPE(Uri) * uri);
466
467
468
469/**
470 * Normalizes a %URI using a normalization mask.
471 * The normalization mask decides what components are normalized.
472 *
473 * NOTE: If necessary the %URI becomes owner of all memory
474 * behind the text pointed to. Text is duplicated in that case.
475 *
476 * @param uri <b>INOUT</b>: %URI to normalize
477 * @param mask <b>IN</b>: Normalization mask
478 * @return Error code or 0 on success
479 *
480 * @see uriNormalizeSyntaxA
481 * @see uriNormalizeSyntaxMaskRequiredA
482 * @since 0.5.0
483 */
484int URI_FUNC(NormalizeSyntaxEx)(URI_TYPE(Uri) * uri, unsigned int mask);
485
486
487
488/**
489 * Normalizes all components of a %URI.
490 *
491 * NOTE: If necessary the %URI becomes owner of all memory
492 * behind the text pointed to. Text is duplicated in that case.
493 *
494 * @param uri <b>INOUT</b>: %URI to normalize
495 * @return Error code or 0 on success
496 *
497 * @see uriNormalizeSyntaxExA
498 * @see uriNormalizeSyntaxMaskRequiredA
499 * @since 0.5.0
500 */
501int URI_FUNC(NormalizeSyntax)(URI_TYPE(Uri) * uri);
502
503
504
505/**
506 * Converts a Unix filename to a %URI string.
507 * The destination buffer must be large enough to hold 7 + 3 * len(filename) + 1
508 * characters in case of an absolute filename or 3 * len(filename) + 1 in case
509 * of a relative filename.
510 *
511 * EXAMPLE
512 * Input: "/bin/bash"
513 * Output: "file:///bin/bash"
514 *
515 * @param filename <b>IN</b>: Unix filename to convert
516 * @param uriString <b>OUT</b>: Destination to write %URI string to
517 * @return Error code or 0 on success
518 *
519 * @see uriUriStringToUnixFilenameA
520 * @see uriWindowsFilenameToUriStringA
521 * @since 0.5.2
522 */
523int URI_FUNC(UnixFilenameToUriString)(const URI_CHAR * filename,
524 URI_CHAR * uriString);
525
526
527
528/**
529 * Converts a Windows filename to a %URI string.
530 * The destination buffer must be large enough to hold 8 + 3 * len(filename) + 1
531 * characters in case of an absolute filename or 3 * len(filename) + 1 in case
532 * of a relative filename.
533 *
534 * EXAMPLE
535 * Input: "E:\\Documents and Settings"
536 * Output: "file:///E:/Documents%20and%20Settings"
537 *
538 * @param filename <b>IN</b>: Windows filename to convert
539 * @param uriString <b>OUT</b>: Destination to write %URI string to
540 * @return Error code or 0 on success
541 *
542 * @see uriUriStringToWindowsFilenameA
543 * @see uriUnixFilenameToUriStringA
544 * @since 0.5.2
545 */
546int URI_FUNC(WindowsFilenameToUriString)(const URI_CHAR * filename,
547 URI_CHAR * uriString);
548
549
550
551/**
552 * Extracts a Unix filename from a %URI string.
553 * The destination buffer must be large enough to hold len(uriString) + 1 - 7
554 * characters in case of an absolute %URI or len(uriString) + 1 in case
555 * of a relative %URI.
556 *
557 * @param uriString <b>IN</b>: %URI string to convert
558 * @param filename <b>OUT</b>: Destination to write filename to
559 * @return Error code or 0 on success
560 *
561 * @see uriUnixFilenameToUriStringA
562 * @see uriUriStringToWindowsFilenameA
563 * @since 0.5.2
564 */
565int URI_FUNC(UriStringToUnixFilename)(const URI_CHAR * uriString,
566 URI_CHAR * filename);
567
568
569
570/**
571 * Extracts a Windows filename from a %URI string.
572 * The destination buffer must be large enough to hold len(uriString) + 1 - 5
573 * characters in case of an absolute %URI or len(uriString) + 1 in case
574 * of a relative %URI.
575 *
576 * @param uriString <b>IN</b>: %URI string to convert
577 * @param filename <b>OUT</b>: Destination to write filename to
578 * @return Error code or 0 on success
579 *
580 * @see uriWindowsFilenameToUriStringA
581 * @see uriUriStringToUnixFilenameA
582 * @since 0.5.2
583 */
584int URI_FUNC(UriStringToWindowsFilename)(const URI_CHAR * uriString,
585 URI_CHAR * filename);
586
587
588
589/**
590 * Calculates the number of characters needed to store the
591 * string representation of the given query list excluding the
592 * terminator. It is assumed that line breaks are will be
593 * normalized to "%0D%0A".
594 *
595 * @param queryList <b>IN</b>: Query list to measure
596 * @param charsRequired <b>OUT</b>: Length of the string representation in characters <b>excluding</b> terminator
597 * @return Error code or 0 on success
598 *
599 * @see uriComposeQueryCharsRequiredExA
600 * @see uriComposeQueryA
601 * @since 0.7.0
602 */
603int URI_FUNC(ComposeQueryCharsRequired)(const URI_TYPE(QueryList) * queryList,
604 int * charsRequired);
605
606
607
608/**
609 * Calculates the number of characters needed to store the
610 * string representation of the given query list excluding the
611 * terminator.
612 *
613 * @param queryList <b>IN</b>: Query list to measure
614 * @param charsRequired <b>OUT</b>: Length of the string representation in characters <b>excluding</b> terminator
615 * @param spaceToPlus <b>IN</b>: Wether to convert ' ' to '+' or not
616 * @param normalizeBreaks <b>IN</b>: Wether to convert CR and LF to CR-LF or not.
617 * @return Error code or 0 on success
618 *
619 * @see uriComposeQueryCharsRequiredA
620 * @see uriComposeQueryExA
621 * @since 0.7.0
622 */
623int URI_FUNC(ComposeQueryCharsRequiredEx)(const URI_TYPE(QueryList) * queryList,
624 int * charsRequired, UriBool spaceToPlus, UriBool normalizeBreaks);
625
626
627
628/**
629 * Converts a query list structure back to a query string.
630 * The composed string does not start with '?',
631 * on the way ' ' is converted to '+' and line breaks are
632 * normalized to "%0D%0A".
633 *
634 * @param dest <b>OUT</b>: Output destination
635 * @param queryList <b>IN</b>: Query list to convert
636 * @param maxChars <b>IN</b>: Maximum number of characters to copy <b>including</b> terminator
637 * @param charsWritten <b>OUT</b>: Number of characters written, can be lower than maxChars even if the query list is too long!
638 * @return Error code or 0 on success
639 *
640 * @see uriComposeQueryExA
641 * @see uriComposeQueryMallocA
642 * @see uriComposeQueryCharsRequiredA
643 * @see uriDissectQueryMallocA
644 * @since 0.7.0
645 */
646int URI_FUNC(ComposeQuery)(URI_CHAR * dest,
647 const URI_TYPE(QueryList) * queryList, int maxChars, int * charsWritten);
648
649
650
651/**
652 * Converts a query list structure back to a query string.
653 * The composed string does not start with '?'.
654 *
655 * @param dest <b>OUT</b>: Output destination
656 * @param queryList <b>IN</b>: Query list to convert
657 * @param maxChars <b>IN</b>: Maximum number of characters to copy <b>including</b> terminator
658 * @param charsWritten <b>OUT</b>: Number of characters written, can be lower than maxChars even if the query list is too long!
659 * @param spaceToPlus <b>IN</b>: Wether to convert ' ' to '+' or not
660 * @param normalizeBreaks <b>IN</b>: Wether to convert CR and LF to CR-LF or not.
661 * @return Error code or 0 on success
662 *
663 * @see uriComposeQueryA
664 * @see uriComposeQueryMallocExA
665 * @see uriComposeQueryCharsRequiredExA
666 * @see uriDissectQueryMallocExA
667 * @since 0.7.0
668 */
669int URI_FUNC(ComposeQueryEx)(URI_CHAR * dest,
670 const URI_TYPE(QueryList) * queryList, int maxChars, int * charsWritten,
671 UriBool spaceToPlus, UriBool normalizeBreaks);
672
673
674
675/**
676 * Converts a query list structure back to a query string.
677 * Memory for this string is allocated internally.
678 * The composed string does not start with '?',
679 * on the way ' ' is converted to '+' and line breaks are
680 * normalized to "%0D%0A".
681 *
682 * @param dest <b>OUT</b>: Output destination
683 * @param queryList <b>IN</b>: Query list to convert
684 * @return Error code or 0 on success
685 *
686 * @see uriComposeQueryMallocExA
687 * @see uriComposeQueryA
688 * @see uriDissectQueryMallocA
689 * @since 0.7.0
690 */
691int URI_FUNC(ComposeQueryMalloc)(URI_CHAR ** dest,
692 const URI_TYPE(QueryList) * queryList);
693
694
695
696/**
697 * Converts a query list structure back to a query string.
698 * Memory for this string is allocated internally.
699 * The composed string does not start with '?'.
700 *
701 * @param dest <b>OUT</b>: Output destination
702 * @param queryList <b>IN</b>: Query list to convert
703 * @param spaceToPlus <b>IN</b>: Wether to convert ' ' to '+' or not
704 * @param normalizeBreaks <b>IN</b>: Wether to convert CR and LF to CR-LF or not.
705 * @return Error code or 0 on success
706 *
707 * @see uriComposeQueryMallocA
708 * @see uriComposeQueryExA
709 * @see uriDissectQueryMallocExA
710 * @since 0.7.0
711 */
712int URI_FUNC(ComposeQueryMallocEx)(URI_CHAR ** dest,
713 const URI_TYPE(QueryList) * queryList,
714 UriBool spaceToPlus, UriBool normalizeBreaks);
715
716
717
718/**
719 * Constructs a query list from the raw query string of a given URI.
720 * On the way '+' is converted back to ' ', line breaks are not modified.
721 *
722 * @param dest <b>OUT</b>: Output destination
723 * @param itemCount <b>OUT</b>: Number of items found, can be NULL
724 * @param first <b>IN</b>: Pointer to first character <b>after</b> '?'
725 * @param afterLast <b>IN</b>: Pointer to character after the last one still in
726 * @return Error code or 0 on success
727 *
728 * @see uriDissectQueryMallocExA
729 * @see uriComposeQueryA
730 * @see uriFreeQueryListA
731 * @since 0.7.0
732 */
733int URI_FUNC(DissectQueryMalloc)(URI_TYPE(QueryList) ** dest, int * itemCount,
734 const URI_CHAR * first, const URI_CHAR * afterLast);
735
736
737
738/**
739 * Constructs a query list from the raw query string of a given URI.
740 *
741 * @param dest <b>OUT</b>: Output destination
742 * @param itemCount <b>OUT</b>: Number of items found, can be NULL
743 * @param first <b>IN</b>: Pointer to first character <b>after</b> '?'
744 * @param afterLast <b>IN</b>: Pointer to character after the last one still in
745 * @param plusToSpace <b>IN</b>: Whether to convert '+' to ' ' or not
746 * @param breakConversion <b>IN</b>: Line break conversion mode
747 * @return Error code or 0 on success
748 *
749 * @see uriDissectQueryMallocA
750 * @see uriComposeQueryExA
751 * @see uriFreeQueryListA
752 * @since 0.7.0
753 */
754int URI_FUNC(DissectQueryMallocEx)(URI_TYPE(QueryList) ** dest, int * itemCount,
755 const URI_CHAR * first, const URI_CHAR * afterLast,
756 UriBool plusToSpace, UriBreakConversion breakConversion);
757
758
759
760/**
761 * Frees all memory associated with the given query list.
762 * The structure itself is freed as well.
763 *
764 * @param queryList <b>INOUT</b>: Query list to free
765 *
766 * @since 0.7.0
767 */
768void URI_FUNC(FreeQueryList)(URI_TYPE(QueryList) * queryList);
769
770
771
772#ifdef __cplusplus
773}
774#endif
775
776
777
778#endif
779#endif