Main Page | Modules | File List | Globals | Related Pages

In Memory Serialization/Deserialization Functions


Detailed Description

These functions take host endian values and serialize them into explicit endianess buffers and vice versa.

The 64-bit versions of these functions can be found under 64-bit Support

Here's an example usage that serializes a struct into a big-endian buffer:

struct mystruct { posh_u16_t u16; posh_i32_t i32; }; void WriteStruct( void *buffer, const struct mystruct *s ) { void *p = buffer; //The POSH_Write??? functions return a pointer to the next write address p = POSH_WriteU16ToBig( p, &s->u16 ); p = POSH_WriteI32ToBig( p, &s->i32 ); }


Functions

posh_u16_tPOSH_WriteU16ToLittle (void *dst, posh_u16_t value)
 Writes an unsigned 16-bit value to a little endian buffer.

posh_i16_tPOSH_WriteI16ToLittle (void *dst, posh_i16_t value)
 Writes a signed 16-bit value to a little endian buffer.

posh_u32_tPOSH_WriteU32ToLittle (void *dst, posh_u32_t value)
 Writes an unsigned 32-bit value to a little endian buffer.

posh_i32_tPOSH_WriteI32ToLittle (void *dst, posh_i32_t value)
 Writes a signed 32-bit value to a little endian buffer.

posh_u16_tPOSH_WriteU16ToBig (void *dst, posh_u16_t value)
 Writes an unsigned 16-bit value to a big endian buffer.

posh_i16_tPOSH_WriteI16ToBig (void *dst, posh_i16_t value)
 Writes a signed 16-bit value to a big endian buffer.

posh_u32_tPOSH_WriteU32ToBig (void *dst, posh_u32_t value)
 Writes an unsigned 32-bit value to a big endian buffer.

posh_i32_tPOSH_WriteI32ToBig (void *dst, posh_i32_t value)
 Writes a signed 32-bit value to a big endian buffer.

posh_u16_t POSH_ReadU16FromLittle (const void *src)
 Reads an unsigned 16-bit value from a little-endian buffer.

posh_i16_t POSH_ReadI16FromLittle (const void *src)
 Reads a signed 16-bit value from a little-endian buffer.

posh_u32_t POSH_ReadU32FromLittle (const void *src)
 Reads an unsigned 32-bit value from a little-endian buffer.

posh_i32_t POSH_ReadI32FromLittle (const void *src)
 Reads a signed 32-bit value from a little-endian buffer.

posh_u16_t POSH_ReadU16FromBig (const void *src)
 Reads an unsigned 16-bit value from a big-endian buffer.

posh_i16_t POSH_ReadI16FromBig (const void *src)
 Reads a signed 16-bit value from a big-endian buffer.

posh_u32_t POSH_ReadU32FromBig (const void *src)
 Reads an unsigned 32-bit value from a big-endian buffer.

posh_i32_t POSH_ReadI32FromBig (const void *src)
 Reads a signed 32-bit value from a big-endian buffer.


Function Documentation

posh_i16_t POSH_ReadI16FromBig const void *  src  ) 
 

Reads a signed 16-bit value from a big-endian buffer.

Parameters:
src [in] source buffer
Returns:
host-endian signed 16-bit value

Definition at line 722 of file posh.c.

References posh_i16_t, and POSH_ReadU16FromBig().

posh_i16_t POSH_ReadI16FromLittle const void *  src  ) 
 

Reads a signed 16-bit value from a little-endian buffer.

Parameters:
src [in] source buffer
Returns:
host-endian signed 16-bit value

Definition at line 659 of file posh.c.

References posh_i16_t, and POSH_ReadU16FromLittle().

posh_i32_t POSH_ReadI32FromBig const void *  src  ) 
 

Reads a signed 32-bit value from a big-endian buffer.

Parameters:
src [in] source buffer
Returns:
host-endian signed 32-bit value

Definition at line 754 of file posh.c.

References POSH_BigI32, and posh_i32_t.

posh_i32_t POSH_ReadI32FromLittle const void *  src  ) 
 

Reads a signed 32-bit value from a little-endian buffer.

Parameters:
src [in] source buffer
Returns:
host-endian signed 32-bit value

Definition at line 691 of file posh.c.

References posh_i32_t, and POSH_ReadU32FromLittle().

posh_u16_t POSH_ReadU16FromBig const void *  src  ) 
 

Reads an unsigned 16-bit value from a big-endian buffer.

Parameters:
src [in] source buffer
Returns:
host-endian unsigned 16-bit value

Definition at line 704 of file posh.c.

References posh_byte_t, and posh_u16_t.

Referenced by POSH_ReadI16FromBig().

posh_u16_t POSH_ReadU16FromLittle const void *  src  ) 
 

Reads an unsigned 16-bit value from a little-endian buffer.

Parameters:
src [in] source buffer
Returns:
host-endian unsigned 16-bit value

Definition at line 641 of file posh.c.

References posh_byte_t, and posh_u16_t.

Referenced by POSH_ReadI16FromLittle().

posh_u32_t POSH_ReadU32FromBig const void *  src  ) 
 

Reads an unsigned 32-bit value from a big-endian buffer.

Parameters:
src [in] source buffer
Returns:
host-endian unsigned 32-bit value

Definition at line 734 of file posh.c.

References posh_byte_t, and posh_u32_t.

posh_u32_t POSH_ReadU32FromLittle const void *  src  ) 
 

Reads an unsigned 32-bit value from a little-endian buffer.

Parameters:
src [in] source buffer
Returns:
host-endian unsigned 32-bit value

Definition at line 671 of file posh.c.

References posh_byte_t, and posh_u32_t.

Referenced by POSH_ReadI32FromLittle().

posh_i16_t* POSH_WriteI16ToBig void *  dst,
posh_i16_t  value
 

Writes a signed 16-bit value to a big endian buffer.

Parameters:
dst [out] pointer to the destination buffer, may not be NULL
value [in] host-endian signed 16-bit value
Returns:
a pointer to the location two bytes after dst
Remarks:
does no validation of the inputs. This simply calls POSH_WriteU16ToLittle() with appropriate casting.

Definition at line 505 of file posh.c.

References posh_i16_t, posh_u16_t, and POSH_WriteU16ToBig().

posh_i16_t* POSH_WriteI16ToLittle void *  dst,
posh_i16_t  value
 

Writes a signed 16-bit value to a little endian buffer.

Parameters:
dst [out] pointer to the destination buffer, may not be NULL
value [in] host-endian signed 16-bit value
Returns:
a pointer to the location two bytes after dst
Remarks:
does no validation of the inputs. This simply calls POSH_WriteU16ToLittle() with appropriate casting.

Definition at line 429 of file posh.c.

References posh_i16_t, posh_u16_t, and POSH_WriteU16ToLittle().

posh_i32_t* POSH_WriteI32ToBig void *  dst,
posh_i32_t  value
 

Writes a signed 32-bit value to a big endian buffer.

Parameters:
dst [out] pointer to the destination buffer, may not be NULL
value [in] host-endian signed 32-bit value
Returns:
a pointer to the location four bytes after dst
Remarks:
does no validation of the inputs. This simply calls POSH_WriteU32ToBig() with appropriate casting.

Definition at line 544 of file posh.c.

References posh_i32_t, posh_u32_t, and POSH_WriteU32ToBig().

posh_i32_t* POSH_WriteI32ToLittle void *  dst,
posh_i32_t  value
 

Writes a signed 32-bit value to a little endian buffer.

Parameters:
dst [out] pointer to the destination buffer, may not be NULL
value [in] host-endian signed 32-bit value
Returns:
a pointer to the location four bytes after dst
Remarks:
does no validation of the inputs. This simply calls POSH_WriteU32ToLittle() with appropriate casting.

Definition at line 468 of file posh.c.

References posh_i32_t, posh_u32_t, and POSH_WriteU32ToLittle().

posh_u16_t* POSH_WriteU16ToBig void *  dst,
posh_u16_t  value
 

Writes an unsigned 16-bit value to a big endian buffer.

Parameters:
dst [out] pointer to the destination buffer, may not be NULL
value [in] host-endian unsigned 16-bit value
Returns:
a pointer to the location two bytes after dst
Remarks:
does no validation of the inputs

Definition at line 483 of file posh.c.

References posh_byte_t, and posh_u16_t.

Referenced by POSH_WriteI16ToBig().

posh_u16_t* POSH_WriteU16ToLittle void *  dst,
posh_u16_t  value
 

Writes an unsigned 16-bit value to a little endian buffer.

Parameters:
dst [out] pointer to the destination buffer, may not be NULL. Alignment doesn't matter.
value [in] host-endian unsigned 16-bit value
Returns:
a pointer to the location two bytes after dst
Remarks:
does no validation of the inputs

Definition at line 407 of file posh.c.

References posh_byte_t, and posh_u16_t.

Referenced by POSH_WriteI16ToLittle().

posh_u32_t* POSH_WriteU32ToBig void *  dst,
posh_u32_t  value
 

Writes an unsigned 32-bit value to a big endian buffer.

Parameters:
dst [out] pointer to the destination buffer, may not be NULL
value [in] host-endian unsigned 32-bit value
Returns:
a pointer to the location four bytes after dst
Remarks:
does no validation of the inputs.

Definition at line 520 of file posh.c.

References posh_byte_t, and posh_u32_t.

Referenced by POSH_WriteI32ToBig().

posh_u32_t* POSH_WriteU32ToLittle void *  dst,
posh_u32_t  value
 

Writes an unsigned 32-bit value to a little endian buffer.

Parameters:
dst [out] pointer to the destination buffer, may not be NULL
value [in] host-endian signed 32-bit value
Returns:
a pointer to the location four bytes after dst
Remarks:
does no validation of the inputs.

Definition at line 444 of file posh.c.

References posh_byte_t, and posh_u32_t.

Referenced by POSH_WriteI32ToLittle().


Generated on Tue Jan 31 18:27:36 2006 for POSH by doxygen 1.3.7