42#ifndef __httpServerLib_h
43#define __httpServerLib_h
45#include <TargConfig.h>
61BA_API
BaBool httpParseDate(
const char* str,
BaTime* result);
77#ifdef INL_baConvBin2Hex
79extern const char baBin2HexTable[];
83#define baConvBin2Hex(hexOutData, binIn) \
84 hexOutData[0] = baBin2HexTable[((U8)binIn) >> 4], \
85 hexOutData[1] = baBin2HexTable[((U8)binIn) & 0x0f]
132BA_API
const void*
baBSearch(
const void* key,
const void* base,
int num,
133 int size,
int (*cmp)(
const void*,
const void*));
186 unsigned char* outStr,
int outStrSize,
const char* b64EncStr,
205#if defined(_WIN32) && !defined(NDEBUG)
208#define bIsspace(c) (c == ' ' || c == '\f' || c == '\n' || c == '\r' ||\
209 c == '\t' || c == '\v')
212#define httpEatWhiteSpace(ptr) while(bIsspace((U8)*ptr)) (ptr)++
213#define httpEatNonWhiteSpace(ptr) while(!bIsspace((U8)*ptr)) (ptr)++
214#define httpEatCharacters(ptr, delimiter) \
215 while(*ptr && *ptr != delimiter) (ptr)++
void * baRealloc(void *p, size_t size)
Resize storage using the target's configured allocator.
void * baMalloc(size_t size)
Allocate uninitialized storage using the target's configured allocator.
void baFree(void *p)
Release storage using the target's configured allocator.
BA_API U8 baConvHex2Bin(U8 c)
Decode one hexadecimal digit.
uint16_t U16
Unsigned 16-bit integer.
Definition: GenPrimT.h:91
BA_API void baConvU32ToHex(void *to, U32 from)
Encode four bytes as eight lowercase hexadecimal characters.
BA_API int baTm2TimeEx(struct BaTm *tm, BaBool local, BaTimeEx *tex)
Convert calendar fields and an optional timezone offset to a timestamp.
const char * baGetToken(const char **str, const char *set)
Locate a token separated by characters in set.
S32 SBaFileSize
Signed file-size value in bytes; 32 bits without BA_FILESIZE64.
Definition: GenPrimT.h:138
BA_API int baElideDotDot(char *str)
Normalize a slash-separated path in place.
S64 BaTime
An arithmetic type representing calendar time with epoch of 1970-01-01 00:00:00 UTC,...
Definition: GenPrimT.h:103
BA_API int baTime2tmEx(const BaTimeEx *tex, const BaBool local, struct BaTm *tm)
Convert a timestamp to UTC or offset-adjusted calendar fields.
BA_API void baConvBin2Hex(void *hexOutData, U8 binIn)
Encode one byte as two lowercase hexadecimal characters.
BA_API BaTime baParseDate(const char *str)
Parse an HTTP date string as UTC.
uint32_t U32
Unsigned 32-bit integer.
Definition: GenPrimT.h:93
BA_API char * baStrdup(const char *str)
Allocate a NUL-terminated copy of a string using baMalloc.
BA_API U32 baConvHexToU32(const void *from)
Decode eight hexadecimal characters into a U32.
BA_API int baISO8601ToTime(const char *str, size_t len, BaTimeEx *tex)
Parse an ISO 8601 calendar timestamp with an explicit timezone.
BA_API BaTime baTm2Time(struct BaTm *tmP)
Convert calendar fields to UTC epoch seconds.
uint8_t U8
Unsigned 8-bit integer.
Definition: GenPrimT.h:89
BA_API int baStrCaseCmp(const char *a, const char *b)
Compare two NUL-terminated strings using bTolower for case folding.
BA_API int baB64Decode(unsigned char *outStr, int outStrSize, const char *b64EncStr, BaBool *overflow)
Decode base64 or base64url into a caller buffer.
BA_API void baXmlUnescape(char *f)
Decode selected XML entity spellings in place.
BA_API const void * baBSearch(const void *key, const void *base, int num, int size, int(*cmp)(const void *, const void *))
Find a key in a sorted array without modifying it.
BA_API U8 baDaysInMonth(U16 y, U16 m)
Return the number of days in a Gregorian calendar month.
BA_API int baTime2ISO8601(const BaTimeEx *tex, char *str, size_t len)
Format a timestamp as ISO 8601 using its timezone offset.
BA_API int baStrnCaseCmp(const char *a, const char *b, size_t len)
Compare at most len bytes, using bTolower for case folding.
U8 BaBool
Boolean stored in an unsigned byte; FALSE is zero and TRUE is one.
Definition: GenPrimT.h:118
BA_API int baTime2tm(struct BaTm *tmP, BaTime t)
Convert UTC epoch seconds to calendar fields.
UTC timestamp with a fractional second and an explicit timezone offset.
Definition: GenPrimT.h:108
Represents the components of calendar time.
Definition: BaServerLib.h:223
int tm_yday
Days since January 1 [0,365]; output of the time-to-calendar functions.
Definition: BaServerLib.h:239
int tm_wday
days since Sunday [0,6]
Definition: BaServerLib.h:237
int tm_mon
months since January [0,11]
Definition: BaServerLib.h:233
int tm_sec
seconds after the minute [0,59]
Definition: BaServerLib.h:225
int tm_year
Years since 0000 (baTime2tmEx) or since 1900 (baTime2tm)
Definition: BaServerLib.h:235
int offset
Minutes east of UTC [-1439,1439]; negative means west.
Definition: BaServerLib.h:244
int tm_hour
hours since midnight [0,23]
Definition: BaServerLib.h:229
int tm_min
minutes after the hour [0,59]
Definition: BaServerLib.h:227
int tm_mday
day of the month [1,31], valid for the selected month
Definition: BaServerLib.h:231
int nsec
Fractional second in nanoseconds [0,999999999].
Definition: BaServerLib.h:242