|
uriparser 1.0.0
|
Data Structures | |
| struct | UriIp4Struct |
| struct | UriIp6Struct |
| struct | UriMemoryManagerStruct |
Typedefs | |
| typedef int | UriBool |
| typedef struct UriIp4Struct | UriIp4 |
| typedef struct UriIp6Struct | UriIp6 |
| typedef void *(* | UriFuncMalloc) (struct UriMemoryManagerStruct *, size_t) |
| typedef void *(* | UriFuncCalloc) (struct UriMemoryManagerStruct *, size_t, size_t) |
| typedef void *(* | UriFuncRealloc) (struct UriMemoryManagerStruct *, void *, size_t) |
| typedef void *(* | UriFuncReallocarray) (struct UriMemoryManagerStruct *, void *, size_t, size_t) |
| typedef void(* | UriFuncFree) (struct UriMemoryManagerStruct *, void *) |
| typedef struct UriMemoryManagerStruct | UriMemoryManager |
| typedef enum UriBreakConversionEnum | UriBreakConversion |
| typedef enum UriNormalizationMaskEnum | UriNormalizationMask |
| typedef enum UriResolutionOptionsEnum | UriResolutionOptions |
Enumerations | |
| enum | UriBreakConversionEnum { URI_BR_TO_LF , URI_BR_TO_CRLF , URI_BR_TO_CR , URI_BR_TO_UNIX = URI_BR_TO_LF , URI_BR_TO_WINDOWS , URI_BR_TO_MAC = URI_BR_TO_CR , URI_BR_DONT_TOUCH } |
| enum | UriNormalizationMaskEnum { URI_NORMALIZED = 0 , URI_NORMALIZE_SCHEME = 1 << 0 , URI_NORMALIZE_USER_INFO , URI_NORMALIZE_HOST = 1 << 2 , URI_NORMALIZE_PATH = 1 << 3 , URI_NORMALIZE_QUERY , URI_NORMALIZE_FRAGMENT , URI_NORMALIZE_PORT = 1 << 6 } |
| enum | UriResolutionOptionsEnum { URI_RESOLVE_STRICTLY = 0 , URI_RESOLVE_IDENTICAL_SCHEME_COMPAT } |
Functions | |
| int | uriCompleteMemoryManager (UriMemoryManager *memory, UriMemoryManager *backend) |
| void * | uriEmulateCalloc (UriMemoryManager *memory, size_t nmemb, size_t size) |
| void * | uriEmulateReallocarray (UriMemoryManager *memory, void *ptr, size_t nmemb, size_t size) |
| int | uriTestMemoryManager (UriMemoryManager *memory) |
| int | uriTestMemoryManagerEx (UriMemoryManager *memory, UriBool challengeAlignment) |
Holds definitions independent of the encoding pass.
| typedef int UriBool |
Boolean type
| typedef enum UriBreakConversionEnum UriBreakConversion |
Specifies a line break conversion mode.
Specifies a line break conversion mode.
| typedef void *(* UriFuncCalloc) (struct UriMemoryManagerStruct *, size_t, size_t) |
Function signature that custom calloc(3) functions must conform to
| typedef void(* UriFuncFree) (struct UriMemoryManagerStruct *, void *) |
Function signature that custom free(3) functions must conform to
| typedef void *(* UriFuncMalloc) (struct UriMemoryManagerStruct *, size_t) |
Function signature that custom malloc(3) functions must conform to
| typedef void *(* UriFuncRealloc) (struct UriMemoryManagerStruct *, void *, size_t) |
Function signature that custom realloc(3) functions must conform to
| typedef void *(* UriFuncReallocarray) (struct UriMemoryManagerStruct *, void *, size_t, size_t) |
Function signature that custom reallocarray(3) functions must conform to
| typedef struct UriIp4Struct UriIp4 |
Holds an IPv4 address.
Holds an IPv4 address.
| typedef struct UriIp6Struct UriIp6 |
Holds an IPv6 address.
Holds an IPv6 address.
| typedef struct UriMemoryManagerStruct UriMemoryManager |
Class-like interface of custom memory managers
Class-like interface of custom memory managers
| typedef enum UriNormalizationMaskEnum UriNormalizationMask |
Specifies which component of a URI has to be normalized.
Specifies which component of a URI has to be normalized.
| typedef enum UriResolutionOptionsEnum UriResolutionOptions |
Specifies how to resolve URI references.
Specifies how to resolve URI references.
Specifies a line break conversion mode.
Specifies which component of a URI has to be normalized.
| int uriCompleteMemoryManager | ( | UriMemoryManager * | memory, |
| UriMemoryManager * | backend ) |
Wraps a memory manager backend that only provides malloc(3) and free(3) to make a complete memory manager ready to be used.
The core feature of this wrapper is that you don't need to implement realloc(3) if you don't want to. The wrapped memory manager uses backend->malloc, memcpy(3), and backend->free and (at least) sizeof(size_t) extra bytes per allocation to emulate fallback realloc(3) for you.
memory->calloc is uriEmulateCalloc. memory->free uses backend->free, and handles the size header. memory->malloc uses backend->malloc, and adds a size header. memory->realloc uses memory->malloc, memcpy(3) and memory->free, and reads the size header. memory->reallocarray is uriEmulateReallocarray. The internal workings behind memory->free, memory->malloc, and memory->realloc may change, and the functions exposed by these function pointers should be considered internal and not public API.
| memory | OUT: Where to write the wrapped memory manager to |
| backend | IN: Memory manager to use as a backend |
| void * uriEmulateCalloc | ( | UriMemoryManager * | memory, |
| size_t | nmemb, | ||
| size_t | size ) |
Offers emulation of calloc(3) based on memory->malloc and memset. See "man 3 calloc" as well.
| memory | IN: Memory manager to use, should not be NULL |
| nmemb | IN: Number of elements to allocate |
| size | IN: Size in bytes per element |
| void * uriEmulateReallocarray | ( | UriMemoryManager * | memory, |
| void * | ptr, | ||
| size_t | nmemb, | ||
| size_t | size ) |
Offers emulation of reallocarray(3) based on memory->realloc. See "man 3 reallocarray" as well.
| memory | IN: Memory manager to use, should not be NULL |
| ptr | IN: Pointer allocated using memory->malloc/... or NULL |
| nmemb | IN: Number of elements to allocate |
| size | IN: Size in bytes per element |
| int uriTestMemoryManager | ( | UriMemoryManager * | memory | ) |
Run multiple tests against a given memory manager. For example, one test
It is recommended to compile with AddressSanitizer enabled to take full advantage of uriTestMemoryManager.
For backwards-compatibility, uriTestMemoryManager does not challenge pointer alignment; please see uriTestMemoryManagerEx for that feature.
| memory | IN: Memory manager to use, should not be NULL |
| int uriTestMemoryManagerEx | ( | UriMemoryManager * | memory, |
| UriBool | challengeAlignment ) |
Run multiple tests against a given memory manager. For example, one test
It is recommended to compile with both AddressSanitizer and UndefinedBehaviorSanitizer enabled to take full advantage of uriTestMemoryManagerEx. Note that environment variable UBSAN_OPTIONS may need adjustment to make UndefinedBehaviorSanitizer fatal (which by default it is not).
| memory | IN: Memory manager to use, should not be NULL |
| challengeAlignment | IN: Whether to challenge pointer alignment |