Teonet library  0.4.7
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
teodb_com.h
Go to the documentation of this file.
1 
8 #ifndef TEODB_COM_H
9 #define TEODB_COM_H
10 
11 #include <stddef.h>
12 #include <stdint.h>
13 
17 enum CMD_D {
18 
21  CMD_D_SET = 129,
26 
29 
32 
34 
35  // Reserved
37 };
38 
39 #pragma pack(push)
40 #pragma pack(1)
41 
45 typedef struct {
46 
47  uint8_t key_length;
48  uint32_t data_length;
49  uint32_t id;
50  char key_data[];
51 
52 } teo_db_data;
53 
57 typedef struct teo_db_data_range {
58 
59  uint32_t from;
60  uint32_t to;
61 
63 
64 #pragma pack(pop)
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
70 teo_db_data *prepare_request_data(const void *key, size_t key_len,
71  const void *data, size_t data_len, uint32_t id, size_t *tdd_len);
72 
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif /* TEODB_COM_H */
79 
uint32_t from
From index (begin from zero)
Definition: teodb_com.h:59
#130 Get data request: TYPE_OF_REQUEST: { namespace, key, ID } }
Definition: teodb_com.h:22
Teo DB binary network structure.
Definition: teodb_com.h:45
#133 List response: [ key, key, ... ]
Definition: teodb_com.h:25
uint8_t key_length
Key length.
Definition: teodb_com.h:47
CMD_D
Teonet database API commands.
Definition: teodb_com.h:17
#138 Bad request answer
Definition: teodb_com.h:33
const char data[]
Make it with: gcc -o post-callback post-callback.c -lcurl.
Definition: post-callback.c:23
The TYPE_OF_REQUEST field: "JSON:" or empty The ID field: id of reques, it resend to user in answer...
Definition: teodb_com.h:21
#132 Get data response: { namespace, key, data, data_len, ID } }
Definition: teodb_com.h:24
struct teo_db_data_range teo_db_data_range
CMD_D_GET_LIST_RANGE extended Data structure.
#137 List range response: { listLength, key, ID }
Definition: teodb_com.h:31
CMD_D_GET_LIST_RANGE extended Data structure.
Definition: teodb_com.h:57
uint32_t to
To index (not include))
Definition: teodb_com.h:60
#136 List range request: TYPE_OF_REQUEST: { ID, namespace } }
Definition: teodb_com.h:30
uint32_t id
Request ID.
Definition: teodb_com.h:49
Reserved.
Definition: teodb_com.h:36
#134 List length request: TYPE_OF_REQUEST: { ID, namespace } }
Definition: teodb_com.h:27
#131 List request: TYPE_OF_REQUEST: { key, ID, namespace } }
Definition: teodb_com.h:23
#135 List length response: { listLength, key, ID }
Definition: teodb_com.h:28
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.
Definition: teodb_com.c:25
uint32_t data_length
Data length.
Definition: teodb_com.h:48