2 * @file fres_container_internal.h
3 * @author Michal Sojka <sojkam1@fel.cvut.cz>
5 * @brief Internal interface to fres_container.
7 * This header should only be included by files in frsh/fres library.
10 #ifndef FRES_CONTAINER_INTERNAL_H
11 #define FRES_CONTAINER_INTERNAL_H
13 #include <fres_contract_idl.h>
15 /** State of the block in container. */
16 enum fres_block_state {
17 /** There is no such block in the container. */
19 /** The container contains the block in the deserialized
22 /** The container contains the block in the serialized form
23 * (sequence of octets).*/
27 #define FRES_BLOCK_FLAG_ENDIAN_m 0x0001
28 #define FRES_BLOCK_LITTLE_ENDIAN 0x0001
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;
42 enum fres_block_state state; /**< State of the block */
44 /** Pointer to data according to param_type
45 * (state == FRES_BLOCK_DATA) */
48 /** Unserialized (unknown) data
49 * (state == FRES_BLOCK_STREAM) */
50 fres_block_stream_t stream;
55 * Container for contract blocks.
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.
61 struct fres_container {
62 struct fres_block blocks[FRES_NUM_BLOCKS];
65 /** Checks wheder the @a type is valid number of the block */
66 #define FRES_BLOCK_TYPE_VALID(type) \
67 ((type) < FRES_NUM_BLOCKS && \