]> rtime.felk.cvut.cz Git - frescor/frsh.git/blob - fres/contract/fres_container_internal.h
Added some doxygen comments
[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/fres library.
8  * 
9  */
10 #ifndef FRES_CONTAINER_INTERNAL_H
11 #define FRES_CONTAINER_INTERNAL_H
12
13 #include <fres_contract_idl.h>
14
15 /** State of the block in container. */
16 enum fres_block_state {
17         /** There is no such block in the container. */
18         FRES_BLOCK_EMPTY,
19         /** The container contains the block in the deserialized
20          * form. */
21         FRES_BLOCK_DATA,
22         /** The container contains the block in the serialized form
23          * (sequence of octets).*/
24         FRES_BLOCK_STREAM
25 };
26
27 #define FRES_BLOCK_FLAG_ENDIAN_m 0x0001
28 #define FRES_BLOCK_LITTLE_ENDIAN 0x0001
29
30 /** Unserialized (unknown) contracts blocks */
31 typedef struct fres_block_stream {
32         void *data; /**< Serialized data */
33         CORBA_unsigned_short flags; /**< Flags: bit 1 - little endian */
34         size_t length;              /**< Length of the stream */
35 } fres_block_stream_t;
36
37 /**
38  * Contract block.
39  * 
40  */
41 struct fres_block {
42         enum fres_block_state state; /**< State of the block */
43         union {
44                 /** Pointer to data according to param_type
45                  * (state == FRES_BLOCK_DATA) */
46                 void *data;
47                 
48                 /** Unserialized (unknown) data
49                  * (state == FRES_BLOCK_STREAM) */
50                 fres_block_stream_t stream;
51         } u;
52 };
53
54 /**
55  * Container for contract blocks.
56  *
57  * This is currently implemented as fixed size array of ::fres_block
58  * structures, which means that the container cannot contain multiple
59  * blocks of the same type.
60  */
61 struct fres_container {
62         struct fres_block blocks[FRES_NUM_BLOCKS];
63 };
64
65 /** Checks wheder the @a type is valid number of the block */
66 #define FRES_BLOCK_TYPE_VALID(type)     \
67         ((type) < FRES_NUM_BLOCKS &&    \
68          (type) >= 0)
69
70
71 #endif