#include "common.h"
#include "fastapi.h"
Include dependency graph for fastapi.c:
Go to the source code of this file.
Defines | |
#define | SIGN_MASK_I32 0x40 |
#define | SIGN_MASK_U32 0x00 |
Functions | |
static void | reset_buffer (fast_buffer_t *buffer) |
static void | init_buffer (fast_buffer_t *buffer, int fd) |
static int | buffer_empty_p (fast_buffer_t *buffer) |
static int | get_buffer_left (fast_buffer_t *buffer) |
static int | get_buffer_size (fast_buffer_t *buffer) |
static int | get_buffer_used (fast_buffer_t *buffer) |
static u32 | get_tag_op (u32 tag) |
static u32 | get_tag_slot (u32 tag) |
static u32 | get_tag_tid (u32 tag) |
static u32 | get_tag_type (u32 tag) |
static fast_cv_t * | cv_get_tag_state (fast_codec_t *codec, u32 tag) |
static i32 * | cv_get_i32_values (fast_codec_t *codec, u32 tag) |
static u32 * | cv_get_u32_values (fast_codec_t *codec, u32 tag) |
static u8 ** | cv_get_str_values (fast_codec_t *codec, u32 tag) |
static u32 * | cv_get_valid_values (fast_codec_t *codec, u32 tag) |
static i32 | cv_get_i32 (fast_codec_t *codec, u32 tag) |
static u32 | cv_get_u32 (fast_codec_t *codec, u32 tag) |
static u8 * | cv_get_str (fast_codec_t *codec, u32 tag) |
static void | cv_set_valid (fast_codec_t *codec, u32 tag) |
static int | cv_is_valid (fast_codec_t *codec, u32 tag) |
static int | cv_eq_i32 (fast_codec_t *codec, u32 tag, i32 data) |
static int | cv_eq_u32 (fast_codec_t *codec, u32 tag, u32 data) |
static int | cv_eq_str (fast_codec_t *codec, u32 tag, u8 *data, int size) |
static void | cv_set_i32 (fast_codec_t *codec, u32 tag, i32 data) |
Set the current signed integer value for the specified tag. | |
static void | cv_set_u32 (fast_codec_t *codec, u32 tag, u32 data) |
Set the current unsigned integer value for the specified tag. | |
static void | cv_set_str (fast_codec_t *codec, u32 tag, u8 *data, int size) |
Set the current string value for the specified tag. | |
static int | u32_to_size (u32 data) |
static int | i32_to_size (i32 data) |
static const char * | format_error_code (fast_error_t code) |
static const char * | format_tag_op (fast_op_t op) |
static const char * | format_tag_type (fast_type_t type) |
static int | set_err (const char *fn, fast_codec_t *codec, fast_tag_t tag, fast_error_t code, const char *format,...) |
static int | check_codec (const char *fn, fast_codec_t *codec) |
static int | check_type (const char *fn, fast_codec_t *codec, fast_tag_t tag, u32 type) |
static int | bad_op_error (const char *fn, fast_codec_t *codec, fast_tag_t tag) |
static int | value_error (const char *fn, fast_codec_t *codec, fast_tag_t tag) |
const char * | fast_error_string (fast_codec_t *codec) |
Convert the last reported codec error to a human readable string. | |
int | fast_print_error (fast_codec_t *codec, FILE *fp) |
Format and print the last reported codec error to a human readable string to a FILE stream. | |
static int | get_pmap (fast_codec_t *codec, fast_tag_t tag) |
Get a presence bit from the current presence map. | |
static void | reset_pmap (fast_codec_t *codec) |
Reset the current presence map. | |
static int | set_pmap (fast_codec_t *codec, fast_tag_t tag) |
Set a presence bit in the current presence map. | |
static int | emit_pmap (fast_codec_t *codec, u8 *data) |
Serialize the current presence map. | |
static void | emit_byte (fast_codec_t *codec, u8 data) |
Append a byte to the message buffer. | |
static int | check_msg_avail (const char *fn, fast_codec_t *codec, fast_tag_t tag, int size) |
Verify that there is enough room in the output buffer to store size bytes of data into the buffer. | |
static int | emit_i32 (fast_codec_t *codec, fast_tag_t tag, i32 data) |
Serialize a 32-bit signed integer field. | |
static int | emit_u32 (fast_codec_t *codec, fast_tag_t tag, u32 data) |
Serielize a 32-bit unsigned integer field. | |
static int | emit_str (fast_codec_t *codec, fast_tag_t tag, u8 *data, int size) |
Serialize an ASCII string field. | |
static int | parse_bytes (fast_codec_t *codec, u8 *data, int size) |
Deserialize an SBIT coded field. | |
static int | parse_pmap (fast_codec_t *codec) |
static int | parse_32 (fast_codec_t *codec, fast_tag_t tag, u32 *data, int sign_mask) |
static int | parse_u32 (fast_codec_t *codec, fast_tag_t tag, u32 *data) |
Deserialize a 32-bit unsigned integer. | |
static int | parse_i32 (fast_codec_t *codec, fast_tag_t tag, i32 *data) |
Deserialize a 32-bit signed integer. | |
static int | parse_str (fast_codec_t *codec, fast_tag_t tag, u8 *data, int size) |
Deserialize an ASCII string. | |
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_str (fast_codec_t *codec, fast_tag_t tag, u8 *data, int size) |
Decode an ASCII String. | |
int | fast_decode_i32 (fast_codec_t *codec, fast_tag_t tag, i32 *value) |
Decode a 32-bit signed integer. | |
int | fast_decode_u32 (fast_codec_t *codec, fast_tag_t tag, u32 *value) |
Decode a 32-bit unsigned integer. | |
static int | flush_group (fast_codec_t *codec) |
static int | flush_msg (fast_codec_t *codec) |
Flush a message Flush the last group of the message and write serialized data. | |
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 value) |
Encode a 32-bit signed integer. | |
static int | find_char_delta_offset (u8 *a, u8 *b, int size) |
int | fast_encode_str (fast_codec_t *codec, fast_tag_t tag, u8 *data, int size) |
Encode an ASCII String. | |
int | fast_encode_u32 (fast_codec_t *codec, fast_tag_t tag, u32 value) |
Encode a 32-bit unsigned integer. | |
fast_codec_t * | fast_create_codec (void) |
Create and initialize the codec. | |
int | fast_destroy_codec (fast_codec_t *codec) |
Destroy the codec and release associated memory. | |
u32 | fast_ascii_to_u32 (u8 *data, int size) |
Convert a u8 byte arrray of characters to a u32. | |
Variables | |
static u32 | bit_mask [8] = { 64, 32, 16, 8, 4, 2, 1, 0 } |
|
Definition at line 663 of file fastapi.c. Referenced by parse_i32(). |
|
Definition at line 664 of file fastapi.c. Referenced by parse_u32(). |
|
Definition at line 339 of file fastapi.c. References FAST_ERR_TAG_OP, and set_err(). Referenced by fast_decode_i32(), fast_decode_str(), fast_decode_u32(), fast_encode_i32(), fast_encode_str(), and fast_encode_u32(). |
|
Definition at line 39 of file fastapi.c. References fast_buffer_t::head, and fast_buffer_t::tail. Referenced by parse_bytes(). |
|
Definition at line 313 of file fastapi.c. References FAST_CODEC_MAGIC, FAST_ERR_CODEC, fast_codec_t::magic, and set_err(). Referenced by fast_decode_end_msg(), fast_decode_i32(), fast_decode_new_msg(), fast_decode_str(), fast_decode_u32(), fast_encode_end_msg(), fast_encode_i32(), fast_encode_new_msg(), fast_encode_str(), and fast_encode_u32(). |
|
Verify that there is enough room in the output buffer to store size bytes of data into the buffer.
Definition at line 472 of file fastapi.c. References FAST_ERR_SIZE, get_buffer_left(), fast_codec_t::msg, and set_err(). Referenced by emit_i32(), emit_str(), and emit_u32(). |
|
Definition at line 327 of file fastapi.c. References FAST_ERR_TAG_TYPE, format_tag_type(), get_tag_type(), and set_err(). Referenced by fast_decode_i32(), fast_decode_str(), fast_decode_u32(), fast_encode_i32(), fast_encode_str(), and fast_encode_u32(). |
|
Definition at line 149 of file fastapi.c. References cv_get_i32(), and cv_is_valid(). Referenced by fast_encode_i32(). |
|
Definition at line 159 of file fastapi.c. References cv_get_str(), and cv_is_valid(). Referenced by fast_encode_str(). |
|
Definition at line 154 of file fastapi.c. References cv_get_u32(), and cv_is_valid(). Referenced by fast_encode_u32(). |
|
Definition at line 110 of file fastapi.c. References cv_get_i32_values(), and get_tag_slot(). Referenced by cv_eq_i32(), and fast_decode_i32(). |
|
Definition at line 88 of file fastapi.c. References cv_get_tag_state(), and fast_cv_t::i32_values. Referenced by cv_get_i32(), and cv_set_i32(). |
|
Definition at line 120 of file fastapi.c. References cv_get_str_values(), and get_tag_slot(). Referenced by cv_eq_str(), cv_set_str(), fast_decode_str(), and fast_encode_str(). |
|
Definition at line 98 of file fastapi.c. References cv_get_tag_state(), and fast_cv_t::str_values. Referenced by cv_get_str(). |
|
Definition at line 81 of file fastapi.c. References fast_codec_t::cv, and get_tag_tid(). Referenced by cv_get_i32_values(), cv_get_str_values(), cv_get_u32_values(), and cv_get_valid_values(). |
|
Definition at line 115 of file fastapi.c. References cv_get_u32_values(), and get_tag_slot(). Referenced by cv_eq_u32(), fast_decode_u32(), and fast_encode_u32(). |
|
Definition at line 93 of file fastapi.c. References cv_get_tag_state(), and fast_cv_t::u32_values. Referenced by cv_get_u32(), and cv_set_u32(). |
|
Definition at line 103 of file fastapi.c. References cv_get_tag_state(), and fast_cv_t::valid. Referenced by cv_is_valid(), and cv_set_valid(). |
|
Definition at line 142 of file fastapi.c. References cv_get_valid_values(), and get_tag_slot(). Referenced by cv_eq_i32(), cv_eq_str(), cv_eq_u32(), fast_decode_i32(), fast_decode_str(), fast_decode_u32(), and fast_encode_u32(). |
|
Set the current signed integer value for the specified tag.
Definition at line 175 of file fastapi.c. References cv_get_i32_values(), cv_set_valid(), and get_tag_slot(). Referenced by fast_decode_i32(), and fast_encode_i32(). |
|
Set the current string value for the specified tag.
Definition at line 191 of file fastapi.c. References cv_get_str(), and cv_set_valid(). Referenced by fast_decode_str(), and fast_encode_str(). |
|
Set the current unsigned integer value for the specified tag.
Definition at line 183 of file fastapi.c. References cv_get_u32_values(), cv_set_valid(), and get_tag_slot(). Referenced by fast_decode_u32(), and fast_encode_u32(). |
|
Definition at line 137 of file fastapi.c. References cv_get_valid_values(), and get_tag_slot(). Referenced by cv_set_i32(), cv_set_str(), and cv_set_u32(). |
|
Append a byte to the message buffer.
Definition at line 462 of file fastapi.c. References fast_codec_t::msg, and fast_buffer_t::tail. Referenced by emit_i32(), emit_str(), and emit_u32(). |
|
Serialize a 32-bit signed integer field.
Definition at line 486 of file fastapi.c. References check_msg_avail(), emit_byte(), FAST_ERR_SIZE, i32_to_size(), set_err(), and set_pmap(). Referenced by fast_encode_i32(), and fast_encode_u32(). Here is the call graph for this function: ![]() |
|
Serialize the current presence map.
Definition at line 430 of file fastapi.c. References bit_mask, fast_pmap_t::bits, fast_pmap_t::max_pos, and fast_codec_t::pmap. Referenced by flush_group(). |
|
Serialize an ASCII string field.
Definition at line 551 of file fastapi.c. References check_msg_avail(), emit_byte(), FAST_ERR_SIZE, set_err(), and set_pmap(). Referenced by fast_encode_str(). |
|
Serielize a 32-bit unsigned integer field.
Definition at line 519 of file fastapi.c. References check_msg_avail(), emit_byte(), FAST_ERR_SIZE, set_err(), set_pmap(), and u32_to_size(). Referenced by fast_encode_u32(). |
|
Definition at line 1192 of file fastapi.c. Referenced by fast_encode_str(). |
|
Copy the message body into the output buffer Reset the presence map Definition at line 1064 of file fastapi.c. References emit_pmap(), FAST_ERR_SIZE, get_buffer_left(), get_buffer_used(), fast_buffer_t::head, MAX_PMAP_BYTES, fast_codec_t::msg, fast_codec_t::output, reset_buffer(), reset_pmap(), and set_err(). Referenced by flush_msg(). |
|
Flush a message Flush the last group of the message and write serialized data.
Definition at line 1101 of file fastapi.c. References FAST_ERR_IO, fast_buffer_t::fd, flush_group(), get_buffer_used(), fast_buffer_t::head, fast_codec_t::output, reset_buffer(), set_err(), and fast_codec_t::skip_io. Referenced by fast_encode_end_msg(). |
|
Definition at line 234 of file fastapi.c. References FAST_ERR_CALL_SEQ, FAST_ERR_CODEC, FAST_ERR_IO, FAST_ERR_NONE, FAST_ERR_SIZE, FAST_ERR_TAG_OP, FAST_ERR_TAG_TYPE, and FAST_ERR_VALUE. Referenced by fast_error_string(). |
|
Definition at line 250 of file fastapi.c. References FAST_OP_COPY, FAST_OP_DELTA, FAST_OP_INCR, and FAST_OP_NONE. Referenced by fast_error_string(). |
|
Definition at line 267 of file fastapi.c. References FAST_TYPE_I32, FAST_TYPE_NULL, FAST_TYPE_STR, and FAST_TYPE_U32. Referenced by check_type(), and fast_error_string(). |
|
Definition at line 44 of file fastapi.c. References fast_buffer_t::end, and fast_buffer_t::tail. Referenced by check_msg_avail(), and flush_group(). |
|
Definition at line 49 of file fastapi.c. References fast_buffer_t::data, and fast_buffer_t::end. Referenced by parse_bytes(). |
|
Definition at line 54 of file fastapi.c. References fast_buffer_t::head, and fast_buffer_t::tail. Referenced by flush_group(), and flush_msg(). |
|
Get a presence bit from the current presence map.
Definition at line 381 of file fastapi.c. References fast_pmap_t::bits, get_tag_slot(), fast_codec_t::pmap, and fast_pmap_t::size. Referenced by parse_32(), and parse_str(). |
|
Definition at line 61 of file fastapi.c. References TAG_MAX_OP, and TAG_SHIFT_OP. Referenced by fast_decode_i32(), fast_decode_str(), fast_decode_u32(), fast_encode_i32(), fast_encode_str(), fast_encode_u32(), and fast_error_string(). |
|
Definition at line 66 of file fastapi.c. References TAG_MAX_SLOT, and TAG_SHIFT_SLOT. Referenced by cv_get_i32(), cv_get_str(), cv_get_u32(), cv_is_valid(), cv_set_i32(), cv_set_u32(), cv_set_valid(), fast_error_string(), get_pmap(), and set_pmap(). |
|
Definition at line 71 of file fastapi.c. References TAG_MAX_TID, and TAG_SHIFT_TID. Referenced by cv_get_tag_state(), and fast_error_string(). |
|
Definition at line 76 of file fastapi.c. References TAG_MAX_TYPE, and TAG_SHIFT_TYPE. Referenced by check_type(), and fast_error_string(). |
|
Definition at line 213 of file fastapi.c. Referenced by emit_i32(). |
|
Definition at line 32 of file fastapi.c. References fast_buffer_t::fd, and reset_buffer(). Referenced by fast_create_codec(). |
|
Definition at line 666 of file fastapi.c. References get_pmap(), and parse_bytes(). Referenced by parse_i32(), and parse_u32(). |
|
Deserialize an SBIT coded field.
Definition at line 584 of file fastapi.c. References buffer_empty_p(), get_buffer_size(), fast_codec_t::input, and fast_codec_t::skip_io. Referenced by parse_32(), parse_pmap(), and parse_str(). |
|
Deserialize a 32-bit signed integer.
Definition at line 702 of file fastapi.c. References parse_32(), and SIGN_MASK_I32. Referenced by fast_decode_i32(), and fast_decode_u32(). |
|
Definition at line 635 of file fastapi.c. References bit_mask, fast_pmap_t::bits, MAX_PMAP_BYTES, parse_bytes(), and fast_codec_t::pmap. Referenced by fast_decode_new_msg(). |
|
Deserialize an ASCII string.
Definition at line 709 of file fastapi.c. References get_pmap(), and parse_bytes(). Referenced by fast_decode_str(). |
|
Deserialize a 32-bit unsigned integer.
Definition at line 695 of file fastapi.c. References parse_32(), and SIGN_MASK_U32. Referenced by fast_decode_u32(). |
|
Definition at line 25 of file fastapi.c. References fast_buffer_t::data, fast_buffer_t::end, fast_buffer_t::head, and fast_buffer_t::tail. Referenced by flush_group(), flush_msg(), and init_buffer(). |
|
Reset the current presence map.
Definition at line 395 of file fastapi.c. References fast_pmap_t::bits, MAX_PMAP_BITS, fast_pmap_t::max_pos, and fast_codec_t::pmap. Referenced by flush_group(). |
|
Definition at line 286 of file fastapi.c. References fast_codec_error_t::code, fast_codec_t::error, fast_error_string(), fast_codec_error_t::fn, fast_codec_error_t::tag, fast_codec_error_t::text, and fast_codec_t::verbose. Referenced by bad_op_error(), check_codec(), check_msg_avail(), check_type(), emit_i32(), emit_str(), emit_u32(), fast_decode_str(), fast_encode_end_msg(), fast_encode_new_msg(), flush_group(), flush_msg(), set_pmap(), and value_error(). |
|
Set a presence bit in the current presence map.
Definition at line 404 of file fastapi.c. References fast_pmap_t::bits, FAST_ERR_SIZE, get_tag_slot(), MAX_PMAP_BITS, fast_pmap_t::max_pos, fast_codec_t::pmap, and set_err(). Referenced by emit_i32(), emit_str(), and emit_u32(). |
|
Definition at line 203 of file fastapi.c. Referenced by emit_u32(). |
|
Definition at line 344 of file fastapi.c. References FAST_ERR_VALUE, and set_err(). Referenced by fast_decode_i32(), fast_decode_str(), and fast_decode_u32(). |
|
Definition at line 423 of file fastapi.c. Referenced by emit_pmap(), and parse_pmap(). |