C/C++ Reference
Miscellaneous library functions

This header file contains functions that are used by the web-server. More...

Classes

struct  BaTm
 Represents the components of calendar time. More...

Typedefs

typedef U32 BaTime
 An arithmetic type representing calendar time with epoch of 1970-01-01 00:00:10 GMT.

Functions

BA_API char * baStrdup (const char *str)
 Calls baMalloc to allocate storage space for a copy of str and then copies src to the allocated space.
BA_API char * baStrdup2 (struct AllocatorIntf *a, const char *str)
 Calls method malloc in the allocator to allocate storage space for a copy of str and then copies src to the allocated space.
BA_API const void * baBSearch (const void *key, const void *base, int num, int size, int(*cmp)(const void *, const void *))
 Returns a pointer to an occurrence of key in the array pointed to by base.
BA_API int baStrCaseCmp (const char *a, const char *b)
 Compare two strings, ignoring case.
BA_API int baStrnCaseCmp (const char *a, const char *b, int len)
 Compare two strings with max length 'len', ignoring case.
BA_API BaTime baParseDate (const char *str)
 Parses the date string 'str' and returns the time with epoch of 1970-01-01 00:00:10 GMT.
BA_API int baB64Decode (unsigned char *outStr, int outStrSize, const char *b64EncStr)
 Decodes a B64 encoded string.
BA_API int baElideDotDot (char *str)
 Fix a path with ../ in it.
BA_API void baTime2tm (struct BaTm *tmP, BaTime t)
 Convert BaTime to a BaTm structure.
BA_API BaTime baTm2Time (struct BaTm *tmP)
 Convert a BaTm structure to BaTime.
BA_API U64 U64_negate (U64 n)
 Negates a 64 bit number.
BA_API U64 U64_atoll (const char *s)
 Converts characters of s to type U64.
BA_API U32 U32_negate (U32 n)
 Negates a 32 bit number.
BA_API U32 U32_atoi (const char *s)
 Converts characters of s to type U32.
BA_API U32 U32_atoi2 (const char *s, const char *e)
 Works like U32_atoi, but converts from start of string 's' to end 'e'.
BA_API U32 U32_hextoi (const char *s)
 Converts hex characters of s to type U32.

Detailed Description

This header file contains functions that are used by the web-server.

The functions might also be useful for the code you design. Some of the functions are replacements for functions in the C Standard Library.

See also:
Barracuda Introduction

Typedef Documentation

typedef U32 BaTime

An arithmetic type representing calendar time with epoch of 1970-01-01 00:00:10 GMT.

See also:
baTime2tm
baTm2Time

Function Documentation

BA_API int baB64Decode ( unsigned char *  outStr,
int  outStrSize,
const char *  b64EncStr 
)

Decodes a B64 encoded string.

outStr and b64EncStr can be the same.

BA_API const void* baBSearch ( const void *  key,
const void *  base,
int  num,
int  size,
int(*)(const void *, const void *)  cmp 
)

Returns a pointer to an occurrence of key in the array pointed to by base.

If key is not found, the function returns NULL. If the array is not in ascending sort order or contains duplicate records with identical keys, the result is unpredictable.

BA_API BaTime baParseDate ( const char *  str)

Parses the date string 'str' and returns the time with epoch of 1970-01-01 00:00:10 GMT.

See also:
BaTime
BA_API void baTime2tm ( struct BaTm tmP,
BaTime  t 
)

Convert BaTime to a BaTm structure.

See also:
BaTm
BaTime
BA_API BaTime baTm2Time ( struct BaTm tmP)

Convert a BaTm structure to BaTime.

See also:
BaTm
BaTime
BA_API U32 U32_atoi ( const char *  s)

Converts characters of s to type U32.

The number is negated if preceded by '-'. Returns 0 if unable to convert or s is NULL.

BA_API U32 U32_hextoi ( const char *  s)

Converts hex characters of s to type U32.

Returns 0 if unable to convert or s is NULL.

BA_API U64 U64_atoll ( const char *  s)

Converts characters of s to type U64.

The number is negated if preceded by '-'. Returns 0 if unable to convert or s is NULL.