diff options
Diffstat (limited to 'plugins/uriparser/UriBase.h')
-rw-r--r-- | plugins/uriparser/UriBase.h | 197 |
1 files changed, 0 insertions, 197 deletions
diff --git a/plugins/uriparser/UriBase.h b/plugins/uriparser/UriBase.h deleted file mode 100644 index 45ba5abd..00000000 --- a/plugins/uriparser/UriBase.h +++ /dev/null | |||
@@ -1,197 +0,0 @@ | |||
1 | /* | ||
2 | * uriparser - RFC 3986 URI parsing library | ||
3 | * | ||
4 | * Copyright (C) 2007, Weijia Song <songweijia@gmail.com> | ||
5 | * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org> | ||
6 | * All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions | ||
10 | * are met: | ||
11 | * | ||
12 | * * Redistributions of source code must retain the above | ||
13 | * copyright notice, this list of conditions and the following | ||
14 | * disclaimer. | ||
15 | * | ||
16 | * * Redistributions in binary form must reproduce the above | ||
17 | * copyright notice, this list of conditions and the following | ||
18 | * disclaimer in the documentation and/or other materials | ||
19 | * provided with the distribution. | ||
20 | * | ||
21 | * * Neither the name of the <ORGANIZATION> nor the names of its | ||
22 | * contributors may be used to endorse or promote products | ||
23 | * derived from this software without specific prior written | ||
24 | * permission. | ||
25 | * | ||
26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
27 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
28 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
29 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
30 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
31 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
32 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
33 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
34 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
35 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
36 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
37 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
38 | */ | ||
39 | |||
40 | /** | ||
41 | * @file UriBase.h | ||
42 | * Holds definitions independent of the encoding pass. | ||
43 | */ | ||
44 | |||
45 | #ifndef URI_BASE_H | ||
46 | #define URI_BASE_H 1 | ||
47 | |||
48 | |||
49 | |||
50 | /* Version helper macro */ | ||
51 | #define URI_ANSI_TO_UNICODE(x) L##x | ||
52 | |||
53 | |||
54 | |||
55 | /* Version */ | ||
56 | #define URI_VER_MAJOR 0 | ||
57 | #define URI_VER_MINOR 8 | ||
58 | #define URI_VER_RELEASE 5 | ||
59 | #define URI_VER_SUFFIX_ANSI "" | ||
60 | #define URI_VER_SUFFIX_UNICODE URI_ANSI_TO_UNICODE(URI_VER_SUFFIX_ANSI) | ||
61 | |||
62 | |||
63 | |||
64 | /* More version helper macros */ | ||
65 | #define URI_INT_TO_ANSI_HELPER(x) #x | ||
66 | #define URI_INT_TO_ANSI(x) URI_INT_TO_ANSI_HELPER(x) | ||
67 | |||
68 | #define URI_INT_TO_UNICODE_HELPER(x) URI_ANSI_TO_UNICODE(#x) | ||
69 | #define URI_INT_TO_UNICODE(x) URI_INT_TO_UNICODE_HELPER(x) | ||
70 | |||
71 | #define URI_VER_ANSI_HELPER(ma, mi, r, s) \ | ||
72 | URI_INT_TO_ANSI(ma) "." \ | ||
73 | URI_INT_TO_ANSI(mi) "." \ | ||
74 | URI_INT_TO_ANSI(r) \ | ||
75 | s | ||
76 | |||
77 | #define URI_VER_UNICODE_HELPER(ma, mi, r, s) \ | ||
78 | URI_INT_TO_UNICODE(ma) L"." \ | ||
79 | URI_INT_TO_UNICODE(mi) L"." \ | ||
80 | URI_INT_TO_UNICODE(r) \ | ||
81 | s | ||
82 | |||
83 | |||
84 | |||
85 | /* Full version strings */ | ||
86 | #define URI_VER_ANSI URI_VER_ANSI_HELPER(URI_VER_MAJOR, URI_VER_MINOR, URI_VER_RELEASE, URI_VER_SUFFIX_ANSI) | ||
87 | #define URI_VER_UNICODE URI_VER_UNICODE_HELPER(URI_VER_MAJOR, URI_VER_MINOR, URI_VER_RELEASE, URI_VER_SUFFIX_UNICODE) | ||
88 | |||
89 | |||
90 | |||
91 | /* Unused parameter macro */ | ||
92 | #ifdef __GNUC__ | ||
93 | # define URI_UNUSED(x) unused_##x __attribute__((unused)) | ||
94 | #else | ||
95 | # define URI_UNUSED(x) x | ||
96 | #endif | ||
97 | |||
98 | |||
99 | |||
100 | typedef int UriBool; /**< Boolean type */ | ||
101 | |||
102 | #define URI_TRUE 1 | ||
103 | #define URI_FALSE 0 | ||
104 | |||
105 | |||
106 | |||
107 | /* Shared errors */ | ||
108 | #define URI_SUCCESS 0 | ||
109 | #define URI_ERROR_SYNTAX 1 /* Parsed text violates expected format */ | ||
110 | #define URI_ERROR_NULL 2 /* One of the params passed was NULL | ||
111 | although it mustn't be */ | ||
112 | #define URI_ERROR_MALLOC 3 /* Requested memory could not be allocated */ | ||
113 | #define URI_ERROR_OUTPUT_TOO_LARGE 4 /* Some output is to large for the receiving buffer */ | ||
114 | #define URI_ERROR_NOT_IMPLEMENTED 8 /* The called function is not implemented yet */ | ||
115 | #define URI_ERROR_RANGE_INVALID 9 /* The parameters passed contained invalid ranges */ | ||
116 | |||
117 | |||
118 | /* Errors specific to ToString */ | ||
119 | #define URI_ERROR_TOSTRING_TOO_LONG URI_ERROR_OUTPUT_TOO_LARGE /* Deprecated, test for URI_ERROR_OUTPUT_TOO_LARGE instead */ | ||
120 | |||
121 | /* Errors specific to AddBaseUri */ | ||
122 | #define URI_ERROR_ADDBASE_REL_BASE 5 /* Given base is not absolute */ | ||
123 | |||
124 | /* Errors specific to RemoveBaseUri */ | ||
125 | #define URI_ERROR_REMOVEBASE_REL_BASE 6 /* Given base is not absolute */ | ||
126 | #define URI_ERROR_REMOVEBASE_REL_SOURCE 7 /* Given base is not absolute */ | ||
127 | |||
128 | |||
129 | |||
130 | #ifndef URI_DOXYGEN | ||
131 | # include <stdio.h> /* For NULL, snprintf */ | ||
132 | # include <ctype.h> /* For wchar_t */ | ||
133 | # include <string.h> /* For strlen, memset, memcpy */ | ||
134 | # include <stdlib.h> /* For malloc */ | ||
135 | #endif /* URI_DOXYGEN */ | ||
136 | |||
137 | |||
138 | |||
139 | /** | ||
140 | * Holds an IPv4 address. | ||
141 | */ | ||
142 | typedef struct UriIp4Struct { | ||
143 | unsigned char data[4]; /**< Each octet in one byte */ | ||
144 | } UriIp4; /**< @copydoc UriIp4Struct */ | ||
145 | |||
146 | |||
147 | |||
148 | /** | ||
149 | * Holds an IPv6 address. | ||
150 | */ | ||
151 | typedef struct UriIp6Struct { | ||
152 | unsigned char data[16]; /**< Each quad in two bytes */ | ||
153 | } UriIp6; /**< @copydoc UriIp6Struct */ | ||
154 | |||
155 | |||
156 | |||
157 | /** | ||
158 | * Specifies a line break conversion mode. | ||
159 | */ | ||
160 | typedef enum UriBreakConversionEnum { | ||
161 | URI_BR_TO_LF, /**< Convert to Unix line breaks ("\\x0a") */ | ||
162 | URI_BR_TO_CRLF, /**< Convert to Windows line breaks ("\\x0d\\x0a") */ | ||
163 | URI_BR_TO_CR, /**< Convert to Macintosh line breaks ("\\x0d") */ | ||
164 | URI_BR_TO_UNIX = URI_BR_TO_LF, /**< @copydoc UriBreakConversionEnum::URI_BR_TO_LF */ | ||
165 | URI_BR_TO_WINDOWS = URI_BR_TO_CRLF, /**< @copydoc UriBreakConversionEnum::URI_BR_TO_CRLF */ | ||
166 | URI_BR_TO_MAC = URI_BR_TO_CR, /**< @copydoc UriBreakConversionEnum::URI_BR_TO_CR */ | ||
167 | URI_BR_DONT_TOUCH /**< Copy line breaks unmodified */ | ||
168 | } UriBreakConversion; /**< @copydoc UriBreakConversionEnum */ | ||
169 | |||
170 | |||
171 | |||
172 | /** | ||
173 | * Specifies which component of a %URI has to be normalized. | ||
174 | */ | ||
175 | typedef enum UriNormalizationMaskEnum { | ||
176 | URI_NORMALIZED = 0, /**< Do not normalize anything */ | ||
177 | URI_NORMALIZE_SCHEME = 1 << 0, /**< Normalize scheme (fix uppercase letters) */ | ||
178 | URI_NORMALIZE_USER_INFO = 1 << 1, /**< Normalize user info (fix uppercase percent-encodings) */ | ||
179 | URI_NORMALIZE_HOST = 1 << 2, /**< Normalize host (fix uppercase letters) */ | ||
180 | URI_NORMALIZE_PATH = 1 << 3, /**< Normalize path (fix uppercase percent-encodings and redundant dot segments) */ | ||
181 | URI_NORMALIZE_QUERY = 1 << 4, /**< Normalize query (fix uppercase percent-encodings) */ | ||
182 | URI_NORMALIZE_FRAGMENT = 1 << 5 /**< Normalize fragment (fix uppercase percent-encodings) */ | ||
183 | } UriNormalizationMask; /**< @copydoc UriNormalizationMaskEnum */ | ||
184 | |||
185 | |||
186 | |||
187 | /** | ||
188 | * Specifies how to resolve %URI references. | ||
189 | */ | ||
190 | typedef enum UriResolutionOptionsEnum { | ||
191 | URI_RESOLVE_STRICTLY = 0, /**< Full RFC conformance */ | ||
192 | URI_RESOLVE_IDENTICAL_SCHEME_COMPAT = 1 << 0 /**< Treat %URI to resolve with identical scheme as having no scheme */ | ||
193 | } UriResolutionOptions; /**< @copydoc UriResolutionOptionsEnum */ | ||
194 | |||
195 | |||
196 | |||
197 | #endif /* URI_BASE_H */ | ||