fastapi functions


Functions

fast_codec_tfast_create_codec (void)
 Create and initialize the codec.
int fast_destroy_codec (fast_codec_t *codec)
 Destroy the codec and release associated memory.
void fast_reset_state (fast_codec_t *codec, fast_tag_t tag)
 Reset the codec state for a specific tag.
int fast_set_codec_input (fast_codec_t *codec, FILE *fptr)
 Set the input FILE stream for a codec.
int fast_set_codec_output (fast_codec_t *codec, FILE *fptr)
 Set the output FILE stream for a codec.
fast_tag_t fast_make_tag (fast_op_t, fast_type_t, u32 tid, u32 slot)
 Make a FAST tag.
int fast_decode_new_msg (fast_codec_t *codec, fast_tag_t tag)
 Decode the first tag of a new message.
int fast_decode_end_msg (fast_codec_t *codec, fast_tag_t tag)
 Complete the decoding of a message.
int fast_decode_i32 (fast_codec_t *codec, fast_tag_t tag, i32 *data)
 Decode a 32-bit signed integer.
int fast_decode_u32 (fast_codec_t *codec, fast_tag_t tag, u32 *data)
 Decode a 32-bit unsigned integer.
int fast_decode_str (fast_codec_t *codec, fast_tag_t tag, u8 *data, int size)
 Decode an ASCII String.
int fast_encode_new_msg (fast_codec_t *codec, fast_tag_t tag)
 Encode the first tag of a new message.
int fast_encode_end_msg (fast_codec_t *codec, fast_tag_t tag)
 Complete the encoding of a message.
int fast_encode_i32 (fast_codec_t *codec, fast_tag_t tag, i32 data)
 Encode a 32-bit signed integer.
int fast_encode_u32 (fast_codec_t *codec, fast_tag_t tag, u32 data)
 Encode a 32-bit unsigned integer.
int fast_encode_str (fast_codec_t *codec, fast_tag_t tag, u8 *data, int size)
 Encode an ASCII String.
int fast_print_error (fast_codec_t *codec, FILE *fptr)
 Format and print the last reported codec error to a human readable string to a FILE stream.
const char * fast_error_string (fast_codec_t *codec)
 Convert the last reported codec error to a human readable string.
u32 fast_ascii_to_u32 (u8 *data, int size)
 Convert a u8 byte arrray of characters to a u32.

Function Documentation

u32 fast_ascii_to_u32 u8 *  data,
int  size
 

Convert a u8 byte arrray of characters to a u32.

Parameters:
data Pointer to a u8 containing ASCII number
size Lenght of data
Returns:
The converted u32 number
Remarks:
This function will convert an ASCII string of numbers to a binary value All characters must be in range of '0' - '9'

Definition at line 1357 of file fastapi.c.

fast_codec_t* fast_create_codec void   ) 
 

Create and initialize the codec.

Returns:
A pointer to opaque type fast_codec_t
Remarks:
This function will allocate a segment of memory on your behalf to manage the codec state information. The pointer returned should be treated as an opaque handle, it is a required parameter to most other fastapi functions.

Definition at line 1317 of file fastapi.c.

References FAST_CODEC_MAGIC, and init_buffer().

int fast_decode_end_msg fast_codec_t codec,
fast_tag_t  tag
 

Complete the decoding of a message.

Parameters:
codec Pointer to a fast_codec_t
tag The fast_codec_tag we are decoding
Remarks:
This function must be called after the last tag of a message has been decoded

Definition at line 730 of file fastapi.c.

References check_codec().

int fast_decode_i32 fast_codec_t codec,
fast_tag_t  tag,
i32 *  data
 

Decode a 32-bit signed integer.

Parameters:
codec Pointer to a fast_codec_t
tag The fast_codec_tag we are decoding
data Pointer to a i32 that will contain the result

Definition at line 843 of file fastapi.c.

References bad_op_error(), check_codec(), check_type(), cv_get_i32(), cv_is_valid(), cv_set_i32(), FAST_OP_COPY, FAST_OP_DELTA, FAST_OP_INCR, FAST_OP_NONE, FAST_TYPE_I32, get_tag_op(), parse_i32(), and value_error().

int fast_decode_new_msg fast_codec_t codec,
fast_tag_t  tag
 

Decode the first tag of a new message.

Parameters:
codec Pointer to a fast_codec_t
tag The fast_codec_tag we are decoding
Remarks:
This function must be called to decode the first tag of a new message. The fast_codec_tag should be the template ID

Definition at line 720 of file fastapi.c.

References check_codec(), and parse_pmap().

int fast_decode_str fast_codec_t codec,
fast_tag_t  tag,
u8 *  data,
int  size
 

Decode an ASCII String.

Parameters:
codec Pointer to a fast_codec_t
tag The fast_codec_tag we are decoding
data Pointer to a char * that will contain the result
size The maximum number of chars data can hold
Remarks:
The resulting sting will NOT be NULL terminated, this function will only fill the string with char's decoded from the input.

Definition at line 742 of file fastapi.c.

References bad_op_error(), check_codec(), check_type(), cv_get_str(), cv_is_valid(), cv_set_str(), FAST_ERR_SIZE, FAST_OP_COPY, FAST_OP_DELTA, FAST_OP_INCR, FAST_OP_NONE, FAST_TYPE_STR, get_tag_op(), parse_str(), set_err(), and value_error().

int fast_decode_u32 fast_codec_t codec,
fast_tag_t  tag,
u32 *  data
 

Decode a 32-bit unsigned integer.

Parameters:
codec Pointer to a fast_codec_t
tag The fast_codec_tag we are decoding
data Pointer to a u32 that will contain the result

Definition at line 950 of file fastapi.c.

References bad_op_error(), check_codec(), check_type(), cv_get_u32(), cv_is_valid(), cv_set_u32(), FAST_OP_COPY, FAST_OP_DELTA, FAST_OP_INCR, FAST_OP_NONE, FAST_TYPE_U32, get_tag_op(), parse_i32(), parse_u32(), and value_error().

int fast_destroy_codec fast_codec_t codec  ) 
 

Destroy the codec and release associated memory.

Parameters:
codec Pointer to a fast_codec_t
Remarks:
This function will free the segment of memory on your behalf originally allocated by the fast_create_codec() function. The codec is invalid upon return.

Definition at line 1338 of file fastapi.c.

References FAST_CODEC_MAGIC, and fast_codec_t::magic.

int fast_encode_end_msg fast_codec_t codec,
fast_tag_t  tag
 

Complete the encoding of a message.

Parameters:
codec Pointer to a fast_codec_t
tag The fast_codec_tag we are encoding
Remarks:
This function must be called after the last tag of a message has been encoded

Definition at line 1142 of file fastapi.c.

References check_codec(), FAST_ERR_CALL_SEQ, flush_msg(), fast_codec_t::in_message, and set_err().

int fast_encode_i32 fast_codec_t codec,
fast_tag_t  tag,
i32  data
 

Encode a 32-bit signed integer.

Parameters:
codec Pointer to a fast_codec_t
tag The fast_codec_tag we are decoding
data i32 integer containing the value to encode

Definition at line 1158 of file fastapi.c.

References bad_op_error(), check_codec(), check_type(), cv_eq_i32(), cv_set_i32(), emit_i32(), FAST_OP_COPY, FAST_OP_DELTA, FAST_OP_INCR, FAST_OP_NONE, FAST_TYPE_I32, and get_tag_op().

int fast_encode_new_msg fast_codec_t codec,
fast_tag_t  tag
 

Encode the first tag of a new message.

Parameters:
codec Pointer to a fast_codec_t
tag The fast_codec_tag we are decoding
Remarks:
This function must be called to encode the first tag of a new message. The fast_codec_tag should be the template ID

Definition at line 1127 of file fastapi.c.

References check_codec(), fast_codec_t::curr_tag, FAST_ERR_CALL_SEQ, fast_codec_t::in_message, and set_err().

int fast_encode_str fast_codec_t codec,
fast_tag_t  tag,
u8 *  data,
int  size
 

Encode an ASCII String.

Parameters:
codec Pointer to a fast_codec_t
tag The fast_codec_tag we are decoding
data char * containing the value to encode
size The number of characters to encode
Remarks:
This function will encode exactly size number of char's, it will not not assume a NULL terminated string.

Definition at line 1205 of file fastapi.c.

References bad_op_error(), check_codec(), check_type(), cv_eq_str(), cv_get_str(), cv_set_str(), emit_str(), FAST_OP_COPY, FAST_OP_DELTA, FAST_OP_INCR, FAST_OP_NONE, FAST_TYPE_STR, find_char_delta_offset(), and get_tag_op().

int fast_encode_u32 fast_codec_t codec,
fast_tag_t  tag,
u32  data
 

Encode a 32-bit unsigned integer.

Parameters:
codec Pointer to a fast_codec_t
tag The fast_codec_tag we are decoding
data u32 integer containing the value to encode

Definition at line 1259 of file fastapi.c.

References bad_op_error(), check_codec(), check_type(), cv_eq_u32(), cv_get_u32(), cv_is_valid(), cv_set_u32(), emit_i32(), emit_u32(), FAST_OP_COPY, FAST_OP_DELTA, FAST_OP_INCR, FAST_OP_NONE, FAST_TYPE_U32, and get_tag_op().

const char* fast_error_string fast_codec_t codec  ) 
 

Convert the last reported codec error to a human readable string.

Parameters:
codec Pointer to a fast_codec_t
Returns:
The error string

Definition at line 351 of file fastapi.c.

References fast_codec_error_t::code, fast_codec_t::error, fast_codec_error_t::fn, format_error_code(), format_tag_op(), format_tag_type(), get_tag_op(), get_tag_slot(), get_tag_tid(), get_tag_type(), fast_codec_error_t::tag, and fast_codec_error_t::text.

Referenced by fast_print_error(), and set_err().

fast_tag_t fast_make_tag fast_op_t  ,
fast_type_t  ,
u32  tid,
u32  slot
 

Make a FAST tag.

int fast_print_error fast_codec_t codec,
FILE *  fptr
 

Format and print the last reported codec error to a human readable string to a FILE stream.

Parameters:
codec Pointer to a fast_codec_t
fptr FILE stream
Returns:
The error string

Definition at line 369 of file fastapi.c.

References fast_error_string().

void fast_reset_state fast_codec_t codec,
fast_tag_t  tag
 

Reset the codec state for a specific tag.

Parameters:
codec Pointer to a fast_codec_t
tag The fast_codec_tag we are reseting
Remarks:
This function will reset the state of the codec for the specific tag.

int fast_set_codec_input fast_codec_t codec,
FILE *  fptr
 

Set the input FILE stream for a codec.

Parameters:
codec Pointer to a fast_codec_t
fptr FILE Pointer to a FILE stream
Remarks:
The default input stream in stdin

int fast_set_codec_output fast_codec_t codec,
FILE *  fptr
 

Set the output FILE stream for a codec.

Parameters:
codec Pointer to a fast_codec_t
fptr FILE Pointer to a FILE stream
Remarks:
The default output stream in stdout


Generated on Thu Feb 9 13:11:35 2006 for fastapi by doxygen 1.4.6-NO    FAST ProtocolSM