Teonet library  0.4.7
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
teodb_com.h File Reference
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  teo_db_data
 Teo DB binary network structure. More...
 
struct  teo_db_data_range
 CMD_D_GET_LIST_RANGE extended Data structure. More...
 

Typedefs

typedef struct teo_db_data_range teo_db_data_range
 CMD_D_GET_LIST_RANGE extended Data structure. More...
 

Enumerations

enum  CMD_D {
  CMD_D_SET = 129, CMD_D_GET, CMD_D_LIST, CMD_D_GET_ANSWER,
  CMD_D_LIST_ANSWER, CMD_D_LIST_LENGTH, CMD_D_LIST_LENGTH_ANSWER, CMD_D_LIST_RANGE,
  CMD_D_LIST_RANGE_ANSWER, CMD_D_ERROR_ANSWER, CMD_R_NONE
}
 Teonet database API commands. More...
 

Functions

teo_db_dataprepare_request_data (const void *key, size_t key_len, const void *data, size_t data_len, uint32_t id, size_t *tdd_len)
 Prepare teonet db data. More...
 

Detailed Description

Author
kirill

Created on February 15, 2016, 3:43 PM

Author
kirill

Created on February 15, 2016, 2:44 AM

Typedef Documentation

CMD_D_GET_LIST_RANGE extended Data structure.

Enumeration Type Documentation

enum CMD_D

Teonet database API commands.

Enumerator
CMD_D_SET 

The TYPE_OF_REQUEST field: "JSON:" or empty The ID field: id of reques, it resend to user in answer.

#129 Set data request: TYPE_OF_REQUEST: { namespace, key, data, data_len } }

CMD_D_GET 

#130 Get data request: TYPE_OF_REQUEST: { namespace, key, ID } }

CMD_D_LIST 

#131 List request: TYPE_OF_REQUEST: { key, ID, namespace } }

CMD_D_GET_ANSWER 

#132 Get data response: { namespace, key, data, data_len, ID } }

CMD_D_LIST_ANSWER 

#133 List response: [ key, key, ... ]

CMD_D_LIST_LENGTH 

#134 List length request: TYPE_OF_REQUEST: { ID, namespace } }

CMD_D_LIST_LENGTH_ANSWER 

#135 List length response: { listLength, key, ID }

CMD_D_LIST_RANGE 

#136 List range request: TYPE_OF_REQUEST: { ID, namespace } }

CMD_D_LIST_RANGE_ANSWER 

#137 List range response: { listLength, key, ID }

CMD_D_ERROR_ANSWER 

#138 Bad request answer

CMD_R_NONE 

Reserved.

Function Documentation

teo_db_data* prepare_request_data ( const void *  key,
size_t  key_len,
const void *  data,
size_t  data_len,
uint32_t  id,
size_t *  tdd_len 
)

Prepare teonet db data.

Parameters
keyKey
key_lenKey length
dataPointer to value
data_lenValue length
idRequest ID
tdd_lenPointer to variable to hold result packet length
Returns
Result packet, should be free after use

References teo_db_data::data_length, teo_db_data::id, teo_db_data::key_data, teo_db_data::key_length, and malloc().

Referenced by event_cb(), get_cb(), and teo::Teonet::TeoDB::prepareRequest().