| Uri.h | | Uri.h | |
| | | | |
| skipping to change at line 105 | | skipping to change at line 105 | |
| typedef struct URI_TYPE(PathSegmentStruct) { | | typedef struct URI_TYPE(PathSegmentStruct) { | |
| URI_TYPE(TextRange) text; /**< Path segment name */ | | URI_TYPE(TextRange) text; /**< Path segment name */ | |
| struct URI_TYPE(PathSegmentStruct) * next; /**< Pointer to the next
path segment in the list, can be NULL if last already */ | | struct URI_TYPE(PathSegmentStruct) * next; /**< Pointer to the next
path segment in the list, can be NULL if last already */ | |
| | | | |
| void * reserved; /**< Reserved to the parser */ | | void * reserved; /**< Reserved to the parser */ | |
| } URI_TYPE(PathSegment); | | } URI_TYPE(PathSegment); | |
| | | | |
| /** | | /** | |
| * Holds structured host information. | | * Holds structured host information. | |
| * This is either a IPv4, IPv6, plain | | * This is either a IPv4, IPv6, plain | |
|
| * text for IPvFutere or all zero for | | * text for IPvFuture or all zero for | |
| * a registered name. | | * a registered name. | |
| */ | | */ | |
| typedef struct URI_TYPE(HostDataStruct) { | | typedef struct URI_TYPE(HostDataStruct) { | |
| UriIp4 * ip4; /**< IPv4 address */ | | UriIp4 * ip4; /**< IPv4 address */ | |
| UriIp6 * ip6; /**< IPv6 address */ | | UriIp6 * ip6; /**< IPv6 address */ | |
| URI_TYPE(TextRange) ipFuture; /**< IPvFuture address */ | | URI_TYPE(TextRange) ipFuture; /**< IPvFuture address */ | |
| } URI_TYPE(HostData); | | } URI_TYPE(HostData); | |
| | | | |
| /** | | /** | |
| * Represents an RFC 3986 %URI. | | * Represents an RFC 3986 %URI. | |
| | | | |
| skipping to change at line 129 | | skipping to change at line 129 | |
| URI_TYPE(TextRange) scheme; /**< Scheme (e.g. "http") */ | | URI_TYPE(TextRange) scheme; /**< Scheme (e.g. "http") */ | |
| URI_TYPE(TextRange) userInfo; /**< User info (e.g. "user:pass") */ | | URI_TYPE(TextRange) userInfo; /**< User info (e.g. "user:pass") */ | |
| URI_TYPE(TextRange) hostText; /**< Host text (set for all hosts, exc
luding square brackets) */ | | URI_TYPE(TextRange) hostText; /**< Host text (set for all hosts, exc
luding square brackets) */ | |
| URI_TYPE(HostData) hostData; /**< Structured host type specific data
*/ | | URI_TYPE(HostData) hostData; /**< Structured host type specific data
*/ | |
| URI_TYPE(TextRange) portText; /**< Port (e.g. "80") */ | | URI_TYPE(TextRange) portText; /**< Port (e.g. "80") */ | |
| URI_TYPE(PathSegment) * pathHead; /**< Head of a linked list of path
segments */ | | URI_TYPE(PathSegment) * pathHead; /**< Head of a linked list of path
segments */ | |
| URI_TYPE(PathSegment) * pathTail; /**< Tail of the list behind pathH
ead */ | | URI_TYPE(PathSegment) * pathTail; /**< Tail of the list behind pathH
ead */ | |
| URI_TYPE(TextRange) query; /**< Query without leading "?" */ | | URI_TYPE(TextRange) query; /**< Query without leading "?" */ | |
| URI_TYPE(TextRange) fragment; /**< Query without leading "#" */ | | URI_TYPE(TextRange) fragment; /**< Query without leading "#" */ | |
| UriBool absolutePath; /**< Absolute path flag, meaningless if %URI i
s absolute */ | | UriBool absolutePath; /**< Absolute path flag, meaningless if %URI i
s absolute */ | |
|
| | | | |
| | | /* TODO reserved deep copy flag? */ | |
| } URI_TYPE(Uri); | | } URI_TYPE(Uri); | |
| | | | |
| /** | | /** | |
| * Represents a state of the %URI parser. | | * Represents a state of the %URI parser. | |
| * Missing components can be NULL to reflect | | * Missing components can be NULL to reflect | |
| * a components absence. | | * a components absence. | |
| */ | | */ | |
| typedef struct URI_TYPE(ParserStateStruct) { | | typedef struct URI_TYPE(ParserStateStruct) { | |
|
| URI_TYPE(Uri) * uri; /**< %URI structure filled while parsing */ | | URI_TYPE(Uri) * uri; /**< Plug in the %URI structure to be filled wh
ile parsing here */ | |
| int errorCode; /**< Code identifying the occured error */ | | int errorCode; /**< Code identifying the occured error */ | |
| const URI_CHAR * errorPos; /**< Pointer to position in case of a syn
tax error */ | | const URI_CHAR * errorPos; /**< Pointer to position in case of a syn
tax error */ | |
| | | | |
| void * reserved; /**< Reserved to the parser */ | | void * reserved; /**< Reserved to the parser */ | |
| } URI_TYPE(ParserState); | | } URI_TYPE(ParserState); | |
| | | | |
| /** | | /** | |
| * Parses a RFC 3986 URI. | | * Parses a RFC 3986 URI. | |
| * | | * | |
| * @param state Parser state with set output %URI, must not
be NULL | | * @param state Parser state with set output %URI, must not
be NULL | |
| | | | |
| skipping to change at line 187 | | skipping to change at line 189 | |
| * The return value will be point to the new position | | * The return value will be point to the new position | |
| * of the terminating zero. Use this value to get the new | | * of the terminating zero. Use this value to get the new | |
| * length of the string. NULL is only returned if <code>inout</code> | | * length of the string. NULL is only returned if <code>inout</code> | |
| * is NULL. | | * is NULL. | |
| * | | * | |
| * @param inout Text to unescape | | * @param inout Text to unescape | |
| * @return Pointer to new position of the terminating zero | | * @return Pointer to new position of the terminating zero | |
| */ | | */ | |
| const URI_CHAR * URI_FUNC(UnescapeInPlace)(URI_CHAR * inout); | | const URI_CHAR * URI_FUNC(UnescapeInPlace)(URI_CHAR * inout); | |
| | | | |
|
| | | /** | |
| | | * Performs reference resolution as described in | |
| | | * <a href="http://tools.ietf.org/html/rfc3986#section-5.2.2">section 5.2.2 | |
| | | of RFC 3986</a>. | |
| | | * | |
| | | * @param absoluteDest Result %URI | |
| | | * @param relativeSource Reference to resolve | |
| | | * @param absoluteBase Base %URI to apply | |
| | | * @return Error code or 0 on success | |
| | | */ | |
| | | int URI_FUNC(AddBaseUri)(URI_TYPE(Uri) * absoluteDest, | |
| | | const URI_TYPE(Uri) * relativeSource, | |
| | | const URI_TYPE(Uri) * absoluteBase); | |
| | | | |
| | | /** | |
| | | * Checks two URIs for equivalence. Comparison is done | |
| | | * the naive way, without prior normalization. | |
| | | * NOTE: Two <code>NULL</code> URIs are equal as well. | |
| | | * | |
| | | * @param a First %URI | |
| | | * @param b Second %URI | |
| | | * @return <code>URI_TRUE</code> when equal, <code>URI_FAlSE</c | |
| | | ode> else | |
| | | */ | |
| | | UriBool URI_FUNC(EqualsUri)(const URI_TYPE(Uri) * a, const URI_TYPE(Uri) * | |
| | | b); | |
| | | | |
| | | /** | |
| | | * Converts a %URI structure back to text as described in | |
| | | * <a href="http://tools.ietf.org/html/rfc3986#section-5.3">section 5.3 of | |
| | | RFC 3986</a>. | |
| | | * | |
| | | * @param dest Output destination | |
| | | * @param uri %URI to convert | |
| | | * @param maxChars Maximum number of characters to copy includi | |
| | | ng terminator | |
| | | * @param charsWritten Number of characters written, can be lower than maxC | |
| | | hars even if the %URI is too long! | |
| | | * @return Error code or 0 on success | |
| | | */ | |
| | | int URI_FUNC(ToString)(URI_CHAR * dest, const URI_TYPE(Uri) * uri, int maxC | |
| | | hars, int * charsWritten); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
End of changes. 4 change blocks. |
| 2 lines changed or deleted | | 47 lines changed or added | |
|
| UriBase.h | | UriBase.h | |
| | | | |
| skipping to change at line 45 | | skipping to change at line 45 | |
| * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | |
| * OF THE POSSIBILITY OF SUCH DAMAGE. | | * OF THE POSSIBILITY OF SUCH DAMAGE. | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @file UriBase.h | | * @file UriBase.h | |
| * Holds definitions independent of the encoding pass. | | * Holds definitions independent of the encoding pass. | |
| */ | | */ | |
| | | | |
|
| #ifndef URI_INDEPENDENT_H | | #ifndef URI_BASE_H | |
| #define URI_INDEPENDENT_H 1 | | #define URI_BASE_H 1 | |
| | | | |
| /* Version helper macro */ | | /* Version helper macro */ | |
| #define URI_ANSI_TO_UNICODE(x) L##x | | #define URI_ANSI_TO_UNICODE(x) L##x | |
| | | | |
| /* Version */ | | /* Version */ | |
| #define URI_VER_MAJOR 0 | | #define URI_VER_MAJOR 0 | |
|
| #define URI_VER_MINOR 3 | | #define URI_VER_MINOR 4 | |
| #define URI_VER_RELEASE 3 | | #define URI_VER_RELEASE 0 | |
| #define URI_VER_SUFFIX_ANSI "" | | #define URI_VER_SUFFIX_ANSI "" | |
| #define URI_VER_SUFFIX_UNICODE URI_ANSI_TO_UNICODE(URI_VER_SUFFIX_ANSI) | | #define URI_VER_SUFFIX_UNICODE URI_ANSI_TO_UNICODE(URI_VER_SUFFIX_ANSI) | |
| | | | |
| /* More version helper macros */ | | /* More version helper macros */ | |
| #define URI_INT_TO_ANSI_HELPER(x) #x | | #define URI_INT_TO_ANSI_HELPER(x) #x | |
| #define URI_INT_TO_ANSI(x) URI_INT_TO_ANSI_HELPER(x) | | #define URI_INT_TO_ANSI(x) URI_INT_TO_ANSI_HELPER(x) | |
| | | | |
| #define URI_INT_TO_UNICODE_HELPER(x) URI_ANSI_TO_UNICODE(#x) | | #define URI_INT_TO_UNICODE_HELPER(x) URI_ANSI_TO_UNICODE(#x) | |
| #define URI_INT_TO_UNICODE(x) URI_INT_TO_UNICODE_HELPER(x) | | #define URI_INT_TO_UNICODE(x) URI_INT_TO_UNICODE_HELPER(x) | |
| | | | |
| | | | |
| skipping to change at line 99 | | skipping to change at line 99 | |
| | | | |
| #define URI_TRUE 1 | | #define URI_TRUE 1 | |
| #define URI_FALSE 0 | | #define URI_FALSE 0 | |
| | | | |
| /* Error codes */ | | /* Error codes */ | |
| #define URI_SUCCESS 0 | | #define URI_SUCCESS 0 | |
| #define URI_ERROR_SYNTAX 1 | | #define URI_ERROR_SYNTAX 1 | |
| #define URI_ERROR_NULL 2 /* One of the params passed was NULL although
it mustn't be */ | | #define URI_ERROR_NULL 2 /* One of the params passed was NULL although
it mustn't be */ | |
| #define URI_ERROR_MALLOC 3 /* Not used yet, TODO */ | | #define URI_ERROR_MALLOC 3 /* Not used yet, TODO */ | |
| | | | |
|
| | | #define URI_ERROR_TOSTRING_TOO_LONG 4 /* URI too long for target buffer | |
| | | */ | |
| | | | |
| #ifndef URI_DOXYGEN | | #ifndef URI_DOXYGEN | |
|
| # include <stdio.h> /* For NULL */ | | # include <stdio.h> /* For NULL, fprintf */ | |
| # include <ctype.h> /* For wchar_t */ | | # include <ctype.h> /* For wchar_t */ | |
| # include <string.h> /* For strlen, memset, memcpy */ | | # include <string.h> /* For strlen, memset, memcpy */ | |
| # include <stdlib.h> /* For malloc */ | | # include <stdlib.h> /* For malloc */ | |
| #endif /* URI_DOXYGEN */ | | #endif /* URI_DOXYGEN */ | |
| | | | |
| /** | | /** | |
| * Holds an IPv4 address. | | * Holds an IPv4 address. | |
| */ | | */ | |
| typedef struct UriIp4Struct { | | typedef struct UriIp4Struct { | |
| unsigned char data[4]; /**< Each octet in one byte */ | | unsigned char data[4]; /**< Each octet in one byte */ | |
| | | | |
| skipping to change at line 124 | | skipping to change at line 126 | |
| * Holds an IPv6 address. | | * Holds an IPv6 address. | |
| */ | | */ | |
| typedef struct UriIp6Struct { | | typedef struct UriIp6Struct { | |
| unsigned char data[16]; /**< Each quad in two bytes */ | | unsigned char data[16]; /**< Each quad in two bytes */ | |
| } UriIp6; | | } UriIp6; | |
| | | | |
| void uriWriteQuadToDoubleByte(const unsigned char * hexDigits, int digitCou
nt, | | void uriWriteQuadToDoubleByte(const unsigned char * hexDigits, int digitCou
nt, | |
| unsigned char * output); | | unsigned char * output); | |
| unsigned char uriGetOctetValue(const unsigned char * digits, int digitCount
); | | unsigned char uriGetOctetValue(const unsigned char * digits, int digitCount
); | |
| | | | |
|
| #endif /* URI_INDEPENDENT_H */ | | #endif /* URI_BASE_H */ | |
| | | | |
End of changes. 5 change blocks. |
| 5 lines changed or deleted | | 8 lines changed or added | |
|