Veil
|
Functions serialising and de-serialising session variables. The purpose of this is to allow the contents of session variables to be saved for later re-use. They may be saved in files, temporary tables or using some smart cache such as memcached (thru the pgmemcache add-in). More...
Go to the source code of this file.
Functions | |
static int | streamlen (int bytes) |
Return the length of a base64 encoded stream for a binary stream of ::bytes length. More... | |
static int | hdrlen (char *name) |
Return the length of the header part of a serialised data stream for the given named variable. More... | |
static void | serialise_int4 (char **p_stream, int32 value) |
Serialise an int4 value as a base64 stream (truncated to save a byte) into *p_stream. More... | |
static int32 | deserialise_int4 (char **p_stream) |
De-serialise an int4 value from a base64 character stream. More... | |
static void | serialise_stream (char **p_stream, int32 bytes, char *instream) |
Serialise a binary stream as a base64 stream into *p_stream. More... | |
static void | deserialise_stream (char **p_stream, int32 bytes, char *outstream) |
De-serialise a binary stream. More... | |
static void | serialise_bool (char **p_stream, bool value) |
Serialise a boolean value into *p_stream. More... | |
static bool | deserialise_bool (char **p_stream) |
De-serialise a boolean value. More... | |
static void | serialise_char (char **p_stream, char value) |
Serialise a character value into *p_stream. More... | |
static char | deserialise_char (char **p_stream) |
De-serialise a character value. More... | |
static void | serialise_name (char **p_stream, char *name) |
Serialise a string (containing a name) into *p_stream. More... | |
static char * | deserialise_name (char **p_stream) |
De-serialise a string returning a dynamically allocated string. More... | |
static char * | serialise_int4var (Int4Var *var, char *name) |
Serialise a veil integer variable into a dynamically allocated string. More... | |
static VarEntry * | deserialise_int4var (char **p_stream) |
De-serialise a veil integer variable. More... | |
static char * | serialise_int4array (Int4Array *array, char *name) |
Serialise a veil integer array variable into a dynamically allocated string. More... | |
static VarEntry * | deserialise_int4array (char **p_stream) |
De-serialise a veil integer array variable. More... | |
static char * | serialise_range (Range *range, char *name) |
Serialise a veil range variable into a dynamically allocated string. More... | |
static VarEntry * | deserialise_range (char **p_stream) |
De-serialise a veil range variable. More... | |
static void | serialise_one_bitmap (char **p_stream, Bitmap *bitmap) |
Serialise a single bitmap from a veil bitmap array or bitmap hash. More... | |
static char * | serialise_bitmap (Bitmap *bitmap, char *name) |
Serialise a veil bitmap variable into a dynamically allocated string. More... | |
static void | deserialise_one_bitmap (Bitmap **p_bitmap, char *name, bool shared, char **p_stream) |
De-serialise a single bitmap into a veil bitmap array or bitmap hash. More... | |
static VarEntry * | deserialise_bitmap (char **p_stream) |
De-serialise a veil bitmap variable. More... | |
static char * | serialise_bitmap_array (BitmapArray *bmarray, char *name) |
Serialise a veil bitmap array variable into a dynamically allocated string. More... | |
static VarEntry * | deserialise_bitmap_array (char **p_stream) |
De-serialise a veil bitmap array variable. More... | |
static int | sizeof_bitmaps_in_hash (BitmapHash *bmhash, int bitset_size) |
Calculate the size needed for a base64 stream to contain all of the bitmaps in a bitmap hash including their keys. More... | |
static char * | serialise_bitmap_hash (BitmapHash *bmhash, char *name) |
Serialise a veil bitmap hash variable into a dynamically allocated string. More... | |
static VarEntry * | deserialise_bitmap_hash (char **p_stream) |
De-serialise a veil bitmap hash variable. More... | |
char * | vl_serialise_var (char *name) |
Serialise a veil variable. More... | |
VarEntry * | vl_deserialise_next (char **p_stream) |
De-serialise the next veil variable from *p_stream. More... | |
int32 | vl_deserialise (char **p_stream) |
De-serialise a base64 string containing, possibly many, derialised veil variables. More... | |
Functions serialising and de-serialising session variables. The purpose of this is to allow the contents of session variables to be saved for later re-use. They may be saved in files, temporary tables or using some smart cache such as memcached (thru the pgmemcache add-in).
Definition in file veil_serialise.c.
|
static |
Return the length of a base64 encoded stream for a binary stream of ::bytes length.
bytes | The length of the input binary stream in bytes |
Definition at line 197 of file veil_serialise.c.
Referenced by deserialise_stream(), serialise_bitmap(), serialise_bitmap_array(), serialise_bitmap_hash(), and serialise_int4array().
|
static |
Return the length of the header part of a serialised data stream for the given named variable.
Note that the header contains the name and a base64 encode length indicator for the name.
name | The variable name to be recorded in the header |
Definition at line 212 of file veil_serialise.c.
Referenced by serialise_bitmap(), serialise_bitmap_array(), serialise_bitmap_hash(), serialise_int4array(), serialise_int4var(), serialise_range(), and sizeof_bitmaps_in_hash().
|
static |
Serialise an int4 value as a base64 stream (truncated to save a byte) into *p_stream.
p_stream | Pointer into stream currently being written. This must be large enought to take the contents to be written. This pointer is updated to point to the next free slot in the stream after writing the int4 value, and is null terminated at that position. |
value | The value to be written to the stream. |
Definition at line 229 of file veil_serialise.c.
Referenced by serialise_bitmap_array(), serialise_bitmap_hash(), serialise_int4array(), serialise_int4var(), serialise_name(), serialise_one_bitmap(), and serialise_range().
|
static |
De-serialise an int4 value from a base64 character stream.
p_stream | Pointer into the stream currently being read. must be large enought to take the contents to be written. This pointer is updated to point to the next free slot in the stream after reading the int4 value. |
Definition at line 247 of file veil_serialise.c.
Referenced by deserialise_bitmap_array(), deserialise_bitmap_hash(), deserialise_int4array(), deserialise_name(), and deserialise_one_bitmap().
|
static |
Serialise a binary stream as a base64 stream into *p_stream.
p_stream | Pointer into stream currently being written. This pointer is updated to point to the next free slot in the stream after writing the contents of instream and is null terminated at that position. |
bytes | The number of bytes to be written. |
instream | The binary stream to be written. |
Definition at line 309 of file veil_serialise.c.
Referenced by serialise_int4array(), and serialise_one_bitmap().
|
static |
De-serialise a binary stream.
p_stream | Pointer into the stream currently being read. pointer is updated to point to the next free slot in the stream after reading the stream. |
bytes | The number of bytes to be read |
outstream | Pointer into the pre-allocated memory are into which the binary from p_stream is to be written. |
Definition at line 327 of file veil_serialise.c.
References streamlen().
|
static |
Serialise a boolean value into *p_stream.
p_stream | Pointer into stream currently being written. This pointer is updated to point to the next free slot in the stream after writing the contents of value and is null terminated at that position. A true value is written as 'T', and false as 'F'. |
value | The boolean value to be written. |
Definition at line 345 of file veil_serialise.c.
Referenced by serialise_int4var().
|
static |
De-serialise a boolean value.
p_stream | Pointer into the stream currently being read. pointer is updated to point to the next free slot in the stream after reading the stream. |
Definition at line 361 of file veil_serialise.c.
|
static |
Serialise a character value into *p_stream.
p_stream | Pointer into stream currently being written. This pointer is updated to point to the next free slot in the stream after writing the contents of value and is null terminated at that position. The character is written as a single byte character. |
value | The character value to be written. |
Definition at line 379 of file veil_serialise.c.
Referenced by serialise_bitmap(), serialise_bitmap_array(), serialise_bitmap_hash(), serialise_int4array(), serialise_int4var(), and serialise_range().
|
static |
De-serialise a character value.
p_stream | Pointer into the stream currently being read. pointer is updated to point to the next free slot in the stream after reading the stream. |
Definition at line 395 of file veil_serialise.c.
Referenced by vl_deserialise_next().
|
static |
Serialise a string (containing a name) into *p_stream.
p_stream | Pointer into stream currently being written. This pointer is updated to point to the next free slot in the stream after writing the contents of value and is null terminated at that position. The character is written as a single byte character. |
name | The string to be written. |
Definition at line 413 of file veil_serialise.c.
References serialise_int4().
Referenced by serialise_bitmap(), serialise_bitmap_array(), serialise_bitmap_hash(), serialise_int4array(), serialise_int4var(), and serialise_range().
|
static |
De-serialise a string returning a dynamically allocated string.
p_stream | Pointer into the stream currently being read. pointer is updated to point to the next free slot in the stream after reading the stream. |
Definition at line 439 of file veil_serialise.c.
References deserialise_int4().
Referenced by deserialise_bitmap(), deserialise_bitmap_array(), deserialise_bitmap_hash(), deserialise_int4array(), deserialise_int4var(), and deserialise_range().
|
static |
Serialise a veil integer variable into a dynamically allocated string.
var | Pointer to the variable to be serialised |
name | The name of the variable |
Definition at line 458 of file veil_serialise.c.
References hdrlen(), Int4Var::isnull, serialise_bool(), serialise_char(), serialise_int4(), serialise_name(), and Int4Var::value.
|
static |
De-serialise a veil integer variable.
**p_stream | Pointer into the stream currently being read. pointer is updated to point to the next free slot in the stream after reading the stream |
Definition at line 480 of file veil_serialise.c.
References deserialise_name(), VarEntry::obj, Int4Var::type, and vl_lookup_variable().
Referenced by vl_deserialise_next().
|
static |
Serialise a veil integer array variable into a dynamically allocated string.
array | Pointer to the variable to be serialised |
name | The name of the variable |
Definition at line 510 of file veil_serialise.c.
References Int4Array::array, Int4Array::arraymax, Int4Array::arrayzero, hdrlen(), serialise_char(), serialise_int4(), serialise_name(), serialise_stream(), and streamlen().
|
static |
De-serialise a veil integer array variable.
**p_stream | Pointer into the stream currently being read. pointer is updated to point to the next free slot in the stream after reading the stream |
Definition at line 537 of file veil_serialise.c.
References deserialise_int4(), deserialise_name(), VarEntry::obj, Int4Array::type, and vl_lookup_variable().
Referenced by vl_deserialise_next().
|
static |
Serialise a veil range variable into a dynamically allocated string.
range | Pointer to the variable to be serialised |
name | The name of the variable |
Definition at line 573 of file veil_serialise.c.
References hdrlen(), Range::max, Range::min, serialise_char(), serialise_int4(), and serialise_name().
|
static |
De-serialise a veil range variable.
**p_stream | Pointer into the stream currently being read. pointer is updated to point to the next free slot in the stream after reading the stream |
Definition at line 595 of file veil_serialise.c.
References deserialise_name(), VarEntry::obj, Range::type, and vl_lookup_variable().
Referenced by vl_deserialise_next().
|
static |
Serialise a single bitmap from a veil bitmap array or bitmap hash.
p_stream | Pointer into the stream currently being read. pointer is updated to point to the next free slot in the stream after writing the stream. |
bitmap | The bitmap to be serialised. |
Definition at line 625 of file veil_serialise.c.
References ARRAYELEMS, Bitmap::bitmax, Bitmap::bitset, Bitmap::bitzero, serialise_int4(), and serialise_stream().
Referenced by serialise_bitmap(), serialise_bitmap_array(), and serialise_bitmap_hash().
|
static |
Serialise a veil bitmap variable into a dynamically allocated string.
bitmap | Pointer to the variable to be serialised |
name | The name of the variable |
Definition at line 644 of file veil_serialise.c.
References ARRAYELEMS, Bitmap::bitmax, Bitmap::bitzero, hdrlen(), serialise_char(), serialise_name(), serialise_one_bitmap(), and streamlen().
|
static |
De-serialise a single bitmap into a veil bitmap array or bitmap hash.
p_bitmap | Pointer to bitmap pointer. This may be updated to contain a dynamically allocated bitmap if none is already present. |
name | The name of the variable, for error reporting purposes. |
shared | Whether the bitmap is part of a shared rather than session variable. |
p_stream | Pointer into the stream currently being read. pointer is updated to point to the next free slot in the stream after reading the stream. |
Definition at line 671 of file veil_serialise.c.
References ARRAYELEMS, deserialise_int4(), and Bitmap::type.
Referenced by deserialise_bitmap().
|
static |
De-serialise a veil bitmap variable.
**p_stream | Pointer into the stream currently being read. pointer is updated to point to the next free slot in the stream after reading the stream |
Definition at line 706 of file veil_serialise.c.
References deserialise_name(), deserialise_one_bitmap(), VarEntry::obj, VarEntry::shared, and vl_lookup_variable().
Referenced by vl_deserialise_next().
|
static |
Serialise a veil bitmap array variable into a dynamically allocated string.
bmarray | Pointer to the variable to be serialised |
name | The name of the variable |
Definition at line 727 of file veil_serialise.c.
References ARRAYELEMS, BitmapArray::arraymax, BitmapArray::arrayzero, BitmapArray::bitmap, BitmapArray::bitmax, BitmapArray::bitzero, hdrlen(), serialise_char(), serialise_int4(), serialise_name(), serialise_one_bitmap(), and streamlen().
|
static |
De-serialise a veil bitmap array variable.
**p_stream | Pointer into the stream currently being read. pointer is updated to point to the next free slot in the stream after reading the stream |
Definition at line 760 of file veil_serialise.c.
References deserialise_int4(), deserialise_name(), VarEntry::obj, BitmapArray::type, and vl_lookup_variable().
Referenced by vl_deserialise_next().
|
static |
Calculate the size needed for a base64 stream to contain all of the bitmaps in a bitmap hash including their keys.
bmhash | Pointer to the variable to be serialised |
bitset_size | The size, in bytes, of each bitset in the bitmap hash. |
Definition at line 808 of file veil_serialise.c.
References BitmapHash::hash, hdrlen(), VarEntry::key, and vl_NextHashEntry().
Referenced by serialise_bitmap_hash().
|
static |
Serialise a veil bitmap hash variable into a dynamically allocated string.
bmhash | Pointer to the variable to be serialised |
name | The name of the variable |
Definition at line 831 of file veil_serialise.c.
References ARRAYELEMS, BitmapHash::bitmax, BitmapHash::bitzero, BitmapHash::hash, hdrlen(), VarEntry::key, VarEntry::obj, serialise_char(), serialise_int4(), serialise_name(), serialise_one_bitmap(), sizeof_bitmaps_in_hash(), streamlen(), and vl_NextHashEntry().
|
static |
De-serialise a veil bitmap hash variable.
**p_stream | Pointer into the stream currently being read. pointer is updated to point to the next free slot in the stream after reading the stream |
Definition at line 866 of file veil_serialise.c.
References deserialise_int4(), deserialise_name(), VarEntry::obj, BitmapHash::type, and vl_lookup_variable().
Referenced by vl_deserialise_next().
char* vl_serialise_var | ( | char * | name | ) |
Serialise a veil variable.
name | The name of the variable to be serialised. |
Definition at line 911 of file veil_serialise.c.
References VarEntry::obj, Object::type, and vl_lookup_variable().
Referenced by veil_serialise().
VarEntry* vl_deserialise_next | ( | char ** | p_stream | ) |
De-serialise the next veil variable from *p_stream.
**p_stream | Pointer into the stream currently being read. pointer is updated to point to the next free slot in the stream after reading the stream |
Definition at line 958 of file veil_serialise.c.
References deserialise_bitmap(), deserialise_bitmap_array(), deserialise_bitmap_hash(), deserialise_char(), deserialise_int4array(), deserialise_int4var(), and deserialise_range().
Referenced by vl_deserialise().
int32 vl_deserialise | ( | char ** | p_stream | ) |
De-serialise a base64 string containing, possibly many, derialised veil variables.
**p_stream | Pointer into the stream currently being read. |
Definition at line 996 of file veil_serialise.c.
References vl_deserialise_next().
Referenced by veil_deserialise().