]> rtime.felk.cvut.cz Git - frescor/frsh.git/blob - fres/contract/fres_container_internal.h
Modieief frsh_forb/frsh_api/Makefile.omk
[frescor/frsh.git] / fres / contract / fres_container_internal.h
1 /**
2  * @file   fres_container_internal.h
3  * @author Michal Sojka <sojkam1@fel.cvut.cz>
4  * 
5  * @brief  Internal interface to fres_container.
6  *
7  * This header should only be included by files in frsh/cm library.
8  * 
9  */
10 #ifndef FRES_CONTAINER_INTERNAL_H
11 #define FRES_CONTAINER_INTERNAL_H
12
13 #include <fres_contract_idl.h>
14
15 enum fres_block_state {
16         /** There is no such block in the container. */
17         FRES_BLOCK_EMPTY,
18         /** The container contains the block in the deserialized
19          * form. */
20         FRES_BLOCK_DATA,
21         /** The container contains the block in the serialized form
22          * (sequence of octets).*/
23         FRES_BLOCK_STREAM
24 };
25
26 struct fres_block {
27         enum fres_block_state state;
28         union {
29                 void *data; /**< Pointer to data according to param_type */
30                 fres_block_stream stream; /**< Unserialized (unknown) data */
31         } u;
32 };
33
34 struct fres_container {
35         struct fres_block blocks[FRES_NUM_BLOCKS];
36 };
37
38 #define FRES_BLOCK_TYPE_VALID(type)     \
39         ((type) < FRES_NUM_BLOCKS &&    \
40          (type) >= 0)
41
42
43 #endif