Uri.h | Uri.h | |||
---|---|---|---|---|
skipping to change at line 88 | skipping to change at line 88 | |||
/** | /** | |||
* Specifies a range of characters within a string. | * Specifies a range of characters within a string. | |||
* The range includes all characters from <code>first</code> | * The range includes all characters from <code>first</code> | |||
* to one before <code>afterLast</code>. So if both are | * to one before <code>afterLast</code>. So if both are | |||
* non-NULL the difference is the length of the text range. | * non-NULL the difference is the length of the text range. | |||
*/ | */ | |||
typedef struct URI_TYPE(TextRangeStruct) { | typedef struct URI_TYPE(TextRangeStruct) { | |||
const URI_CHAR * first; /**< Pointer to first character */ | const URI_CHAR * first; /**< Pointer to first character */ | |||
const URI_CHAR * afterLast; /**< Pointer to character after the last one still in */ | const URI_CHAR * afterLast; /**< Pointer to character after the last one still in */ | |||
} URI_TYPE(TextRange); | } URI_TYPE(TextRange); /**< @copydoc UriTextRangeStructA */ | |||
/** | /** | |||
* Represents a segment within a %URI path. | * Represents a segment within a %URI path. | |||
* More precisely it is a node in a linked | * More precisely it is a node in a linked | |||
* list of path segments. | * list of path segments. | |||
*/ | */ | |||
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); /**< @copydoc UriPathSegmentStructA */ | |||
/** | /** | |||
* Holds structured host information. | * Holds structured host information. | |||
* This is either a IPv4, IPv6, plain | * This is either a IPv4, IPv6, plain | |||
* text for IPvFuture 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); /**< @copydoc UriHostDataStructA */ | |||
/** | /** | |||
* Represents an RFC 3986 %URI. | * Represents an RFC 3986 %URI. | |||
* Missing components can be {NULL, NULL} ranges. | * Missing components can be {NULL, NULL} ranges. | |||
*/ | */ | |||
typedef struct URI_TYPE(UriStruct) { | typedef struct URI_TYPE(UriStruct) { | |||
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 */ | |||
UriBool owner; /**< Memory owner flag */ | UriBool owner; /**< Memory owner flag */ | |||
void * reserved; /**< Reserved to the parser */ | void * reserved; /**< Reserved to the parser */ | |||
} URI_TYPE(Uri); | } URI_TYPE(Uri); /**< @copydoc UriUriStructA */ | |||
/** | /** | |||
* 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; /**< Plug in the %URI structure to be filled wh ile parsing here */ | 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); /**< @copydoc UriParserStateStructA */ | |||
/** | /** | |||
* 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 | |||
* @param first Pointer to the first character to parse, must not be NULL | * @param first Pointer to the first character to parse, must not be NULL | |||
* @param afterLast Pointer to the character after the last to parse, mus t not be NULL | * @param afterLast Pointer to the character after the last to parse, mus t not be NULL | |||
* @return 0 on success, error code otherwise | * @return 0 on success, error code otherwise | |||
*/ | */ | |||
int URI_FUNC(ParseUriEx)(URI_TYPE(ParserState) * state, | int URI_FUNC(ParseUriEx)(URI_TYPE(ParserState) * state, | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
UriBase.h | UriBase.h | |||
---|---|---|---|---|
skipping to change at line 54 | skipping to change at line 54 | |||
#ifndef URI_BASE_H | #ifndef URI_BASE_H | |||
#define URI_BASE_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 6 | #define URI_VER_MINOR 6 | |||
#define URI_VER_RELEASE 2 | #define URI_VER_RELEASE 3 | |||
#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 122 | skipping to change at line 122 | |||
# 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 */ | |||
} UriIp4; | } UriIp4; /**< @copydoc UriIp4Struct */ | |||
/** | /** | |||
* 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; /**< @copydoc UriIp6Struct */ | |||
/** | /** | |||
* Specifies a line break conversion mode | * Specifies a line break conversion mode | |||
*/ | */ | |||
typedef enum UriBreakConversionEnum { | typedef enum UriBreakConversionEnum { | |||
URI_BR_TO_LF, | URI_BR_TO_LF, /**< Convert to Unix line breaks ("\\x0a") */ | |||
URI_BR_TO_CRLF, | URI_BR_TO_CRLF, /**< Convert to Windows line breaks ("\\x0d\\x0a") * | |||
URI_BR_TO_CR, | / | |||
URI_BR_TO_UNIX = URI_BR_TO_LF, | URI_BR_TO_CR, /**< Convert to Macintosh line breaks ("\\x0d") */ | |||
URI_BR_TO_WINDOWS = URI_BR_TO_CRLF, | URI_BR_TO_UNIX = URI_BR_TO_LF, /**< @copydoc UriBreakConversionEnum: | |||
URI_BR_TO_MAC = URI_BR_TO_CR, | :URI_BR_TO_LF */ | |||
URI_BR_DONT_TOUCH | URI_BR_TO_WINDOWS = URI_BR_TO_CRLF, /**< @copydoc UriBreakConversion | |||
} UriBreakConversion; | Enum::URI_BR_TO_CRLF */ | |||
URI_BR_TO_MAC = URI_BR_TO_CR, /**< @copydoc UriBreakConversionEnum:: | ||||
URI_BR_TO_CR */ | ||||
URI_BR_DONT_TOUCH /**< Copy line breaks unmodified */ | ||||
} UriBreakConversion; /**< @copydoc UriBreakConversionEnum */ | ||||
/** | /** | |||
* Specifies which component of a %URI has to be normalized. | * Specifies which component of a %URI has to be normalized. | |||
*/ | */ | |||
typedef enum UriNormalizationMaskEnum { | typedef enum UriNormalizationMaskEnum { | |||
URI_NORMALIZED = 0, | URI_NORMALIZED = 0, /**< Do not normalize anything */ | |||
URI_NORMALIZE_SCHEME = 1 << 0, /* Because of uppercase letters */ | URI_NORMALIZE_SCHEME = 1 << 0, /**< Normalize scheme (fix uppercase | |||
URI_NORMALIZE_USER_INFO = 1 << 1, /* .. uppercase percent-encodings | letters) */ | |||
*/ | URI_NORMALIZE_USER_INFO = 1 << 1, /**< Normalize user info (fix uppe | |||
URI_NORMALIZE_HOST = 1 << 2, /* .. uppercase letters */ | rcase percent-encodings) */ | |||
URI_NORMALIZE_PATH = 1 << 3, /* .. uppercase percent-encodings or do | URI_NORMALIZE_HOST = 1 << 2, /**< Normalize host (fix uppercase lett | |||
t segments */ | ers) */ | |||
URI_NORMALIZE_QUERY = 1 << 4, /* .. uppercase percent-encodings */ | URI_NORMALIZE_PATH = 1 << 3, /**< Normalize path (fix uppercase perc | |||
URI_NORMALIZE_FRAGMENT = 1 << 5 /* .. uppercase percent-encodings */ | ent-encodings and redundant dot segments) */ | |||
} UriNormalizationMask; | URI_NORMALIZE_QUERY = 1 << 4, /**< Normalize query (fix uppercase pe | |||
rcent-encodings) */ | ||||
URI_NORMALIZE_FRAGMENT = 1 << 5 /**< Normalize fragment (fix upperca | ||||
se percent-encodings) */ | ||||
} UriNormalizationMask; /**< @copydoc UriNormalizationMaskEnum */ | ||||
#endif /* URI_BASE_H */ | #endif /* URI_BASE_H */ | |||
End of changes. 5 change blocks. | ||||
21 lines changed or deleted | 29 lines changed or added | |||