version 1.3, 2013/03/07 23:04:48
|
version 1.4, 2013/05/30 09:07:34
|
Line 46 SUCH DAMAGE.
|
Line 46 SUCH DAMAGE.
|
#include "global.h" |
#include "global.h" |
|
|
|
|
static int | static inline int |
vars2buffer(u_char * __restrict buf, int buflen, int be, array_t * __restrict vars) |
vars2buffer(u_char * __restrict buf, int buflen, int be, array_t * __restrict vars) |
{ |
{ |
int Limit = 0; |
int Limit = 0; |
Line 145 vars2buffer(u_char * __restrict buf, int buflen, int b
|
Line 145 vars2buffer(u_char * __restrict buf, int buflen, int b
|
return Limit; |
return Limit; |
} |
} |
|
|
static array_t * | static inline array_t * |
buffer2vars(u_char * __restrict buf, int buflen, int vnum, int zcpy) |
buffer2vars(u_char * __restrict buf, int buflen, int vnum, int zcpy) |
{ |
{ |
array_t *vars; |
array_t *vars; |
Line 258 buffer2vars(u_char * __restrict buf, int buflen, int v
|
Line 258 buffer2vars(u_char * __restrict buf, int buflen, int v
|
* @vars = Variable array |
* @vars = Variable array |
* return: -1 error, 0 nothing done or >0 size of marshaled data |
* return: -1 error, 0 nothing done or >0 size of marshaled data |
*/ |
*/ |
inline int | int |
ait_vars2buffer(u_char * __restrict buf, int buflen, array_t * __restrict vars) |
ait_vars2buffer(u_char * __restrict buf, int buflen, array_t * __restrict vars) |
{ |
{ |
return vars2buffer(buf, buflen, 42, vars); |
return vars2buffer(buf, buflen, 42, vars); |
Line 274 ait_vars2buffer(u_char * __restrict buf, int buflen, a
|
Line 274 ait_vars2buffer(u_char * __restrict buf, int buflen, a
|
*DON'T MODIFY OR DESTROY BUFFER*. =0 call array_Free() before array_Destroy() |
*DON'T MODIFY OR DESTROY BUFFER*. =0 call array_Free() before array_Destroy() |
* return: =NULL error, !=NULL allocated variable array, after use must free with array_Destroy() |
* return: =NULL error, !=NULL allocated variable array, after use must free with array_Destroy() |
*/ |
*/ |
inline array_t * | array_t * |
ait_buffer2vars(u_char * __restrict buf, int buflen, int vnum, int zcpy) |
ait_buffer2vars(u_char * __restrict buf, int buflen, int vnum, int zcpy) |
{ |
{ |
return buffer2vars(buf, buflen, vnum, zcpy); |
return buffer2vars(buf, buflen, vnum, zcpy); |
Line 290 ait_buffer2vars(u_char * __restrict buf, int buflen, i
|
Line 290 ait_buffer2vars(u_char * __restrict buf, int buflen, i
|
* @vars = Variable array |
* @vars = Variable array |
* return: -1 error, 0 nothing done or >0 size of marshaled data |
* return: -1 error, 0 nothing done or >0 size of marshaled data |
*/ |
*/ |
inline int | int |
ait_vars2map(u_char *buf, int buflen, array_t *vars) |
ait_vars2map(u_char *buf, int buflen, array_t *vars) |
{ |
{ |
return vars2buffer(buf, buflen, 0, vars); |
return vars2buffer(buf, buflen, 0, vars); |
Line 306 ait_vars2map(u_char *buf, int buflen, array_t *vars)
|
Line 306 ait_vars2map(u_char *buf, int buflen, array_t *vars)
|
*DON'T MODIFY OR DESTROY BUFFER*. =0 call array_Free() before array_Destroy() |
*DON'T MODIFY OR DESTROY BUFFER*. =0 call array_Free() before array_Destroy() |
* return: =NULL error, !=NULL allocated variable array, after use must free with array_Destroy() |
* return: =NULL error, !=NULL allocated variable array, after use must free with array_Destroy() |
*/ |
*/ |
inline array_t * | array_t * |
ait_map2vars(u_char *buf, int buflen, int vnum, int zcpy) |
ait_map2vars(u_char *buf, int buflen, int vnum, int zcpy) |
{ |
{ |
return buffer2vars(buf, buflen, vnum, zcpy); |
return buffer2vars(buf, buflen, vnum, zcpy); |
Line 321 ait_map2vars(u_char *buf, int buflen, int vnum, int zc
|
Line 321 ait_map2vars(u_char *buf, int buflen, int vnum, int zc
|
* @varnum = Number of variables |
* @varnum = Number of variables |
* return: =NULL error or !=NULL allocated array |
* return: =NULL error or !=NULL allocated array |
*/ |
*/ |
inline array_t * | array_t * |
ait_allocVars(int varnum) |
ait_allocVars(int varnum) |
{ |
{ |
array_t *arr; |
array_t *arr; |
Line 349 ait_allocVars(int varnum)
|
Line 349 ait_allocVars(int varnum)
|
* @n = index of variable into array |
* @n = index of variable into array |
* return: NULL error or !=NULL ait_val_t element |
* return: NULL error or !=NULL ait_val_t element |
*/ |
*/ |
inline ait_val_t * | ait_val_t * |
ait_getVars(array_t ** __restrict vars, int n) |
ait_getVars(array_t ** __restrict vars, int n) |
{ |
{ |
register int i; |
register int i; |
Line 382 ait_getVars(array_t ** __restrict vars, int n)
|
Line 382 ait_getVars(array_t ** __restrict vars, int n)
|
* @vars = Variable array |
* @vars = Variable array |
* return: -1 error or size of array |
* return: -1 error or size of array |
*/ |
*/ |
inline int | int |
ait_clrVars(array_t * __restrict vars) |
ait_clrVars(array_t * __restrict vars) |
{ |
{ |
register int i; |
register int i; |
Line 404 ait_clrVars(array_t * __restrict vars)
|
Line 404 ait_clrVars(array_t * __restrict vars)
|
* @vars = Variable array |
* @vars = Variable array |
* return: none |
* return: none |
*/ |
*/ |
inline void | void |
ait_freeVars(array_t ** __restrict vars) |
ait_freeVars(array_t ** __restrict vars) |
{ |
{ |
if (!vars || !*vars) |
if (!vars || !*vars) |
Line 421 ait_freeVars(array_t ** __restrict vars)
|
Line 421 ait_freeVars(array_t ** __restrict vars)
|
* |
* |
* return: NULL error or new variable, after use free variable with ait_freeVar() |
* return: NULL error or new variable, after use free variable with ait_freeVar() |
*/ |
*/ |
inline ait_val_t * | ait_val_t * |
ait_allocVar(void) |
ait_allocVar(void) |
{ |
{ |
ait_val_t *v = NULL; |
ait_val_t *v = NULL; |
Line 442 ait_allocVar(void)
|
Line 442 ait_allocVar(void)
|
* @val = Variable |
* @val = Variable |
* return: none |
* return: none |
*/ |
*/ |
inline void | void |
ait_freeVar(ait_val_t ** __restrict val) |
ait_freeVar(ait_val_t ** __restrict val) |
{ |
{ |
if (val && *val) { |
if (val && *val) { |
Line 570 _cmp_arr_val_desc(const void *a, const void *b)
|
Line 570 _cmp_arr_val_desc(const void *a, const void *b)
|
* @cmp = Custom compare function for sorting. If =NULL compare by value |
* @cmp = Custom compare function for sorting. If =NULL compare by value |
* return: none |
* return: none |
*/ |
*/ |
inline void | void |
ait_sortVarsByVal(array_t * __restrict vars, int order, int (*cmp)(const void*, const void*)) |
ait_sortVarsByVal(array_t * __restrict vars, int order, int (*cmp)(const void*, const void*)) |
{ |
{ |
if (!vars) |
if (!vars) |
Line 591 ait_sortVarsByVal(array_t * __restrict vars, int order
|
Line 591 ait_sortVarsByVal(array_t * __restrict vars, int order
|
* @order = Sort order. If =0 ascend or !=0 descend |
* @order = Sort order. If =0 ascend or !=0 descend |
* return: none |
* return: none |
*/ |
*/ |
inline void | void |
ait_sortVarsByKey(array_t * __restrict vars, int order) |
ait_sortVarsByKey(array_t * __restrict vars, int order) |
{ |
{ |
if (!vars) |
if (!vars) |
Line 702 ait_hashVar(ait_val_t * __restrict v, const char * __r
|
Line 702 ait_hashVar(ait_val_t * __restrict v, const char * __r
|
* @vars = Variables |
* @vars = Variables |
* return -1 error or 0 ok |
* return -1 error or 0 ok |
*/ |
*/ |
inline int | int |
ait_hashKeyVars(array_t * __restrict vars) |
ait_hashKeyVars(array_t * __restrict vars) |
{ |
{ |
register int i; |
register int i; |
Line 723 ait_hashKeyVars(array_t * __restrict vars)
|
Line 723 ait_hashKeyVars(array_t * __restrict vars)
|
* @key = Search string |
* @key = Search string |
* return: NULL error or not found, !=NULL valid element |
* return: NULL error or not found, !=NULL valid element |
*/ |
*/ |
inline ait_val_t * | ait_val_t * |
ait_findKeyHash(array_t * __restrict vars, const char * __restrict key) |
ait_findKeyHash(array_t * __restrict vars, const char * __restrict key) |
{ |
{ |
u_short k = 0; |
u_short k = 0; |
Line 777 ait_sprintfVar(ait_val_t * __restrict v, const char *f
|
Line 777 ait_sprintfVar(ait_val_t * __restrict v, const char *f
|
* @... = data |
* @... = data |
* return: -1 error or 0 ok |
* return: -1 error or 0 ok |
*/ |
*/ |
inline int | int |
ait_setlikeVar(ait_val_t * __restrict v, ait_type_t t, u_int l, ...) |
ait_setlikeVar(ait_val_t * __restrict v, ait_type_t t, u_int l, ...) |
{ |
{ |
va_list lst; |
va_list lst; |
Line 812 ait_setlikeVar(ait_val_t * __restrict v, ait_type_t t,
|
Line 812 ait_setlikeVar(ait_val_t * __restrict v, ait_type_t t,
|
* @v = variable |
* @v = variable |
* return: return raw data |
* return: return raw data |
*/ |
*/ |
inline uint64_t | uint64_t |
ait_getlikeVar(ait_val_t * __restrict v) |
ait_getlikeVar(ait_val_t * __restrict v) |
{ |
{ |
if (!v) |
if (!v) |
Line 828 ait_getlikeVar(ait_val_t * __restrict v)
|
Line 828 ait_getlikeVar(ait_val_t * __restrict v)
|
* @b = 2nd variable |
* @b = 2nd variable |
* return: 0 is equal or !=0 is different |
* return: 0 is equal or !=0 is different |
*/ |
*/ |
inline int | int |
ait_cmpVar(ait_val_t * __restrict a, ait_val_t * __restrict b) |
ait_cmpVar(ait_val_t * __restrict a, ait_val_t * __restrict b) |
{ |
{ |
intptr_t ret; |
intptr_t ret; |