typedef CORBA_boolean (fres_block_serialize_fnc_t)(CDR_Codec *codec, const void *block_data);
typedef CORBA_boolean (fres_block_deserialize_fnc_t)(CDR_Codec *codec, void **block_data);
-
+
+/**
+ * Description of contract blocks.
+ */
struct fres_block_desc {
const char *name; /**< Name of the block for use fres_container_to_string() */
size_t size; /**< Size of the block (used by fres_block_duplicate_default() and fres_container_ptr_deserialize()) */
*
* @brief Internal interface to fres_container.
*
- * This header should only be included by files in frsh/cm library.
+ * This header should only be included by files in frsh/fres library.
*
*/
#ifndef FRES_CONTAINER_INTERNAL_H
#define FRES_BLOCK_FLAG_ENDIAN_m 0x0001
#define FRES_BLOCK_LITTLE_ENDIAN 0x0001
-/**< Unserialized (unknown) contracts blocks */
+/** Unserialized (unknown) contracts blocks */
typedef struct fres_block_stream {
void *data; /**< Serialized data */
CORBA_unsigned_short flags; /**< Flags: bit 1 - little endian */
size_t length; /**< Length of the stream */
} fres_block_stream_t;
+/**
+ * Contract block.
+ *
+ */
struct fres_block {
- enum fres_block_state state;
+ enum fres_block_state state; /**< State of the block */
union {
/** Pointer to data according to param_type
* (state == FRES_BLOCK_DATA) */
} u;
};
+/**
+ * Container for contract blocks.
+ *
+ * This is currently implemented as fixed size array of ::fres_block
+ * structures, which means that the container cannot contain multiple
+ * blocks of the same type.
+ */
struct fres_container {
struct fres_block blocks[FRES_NUM_BLOCKS];
};
+/** Checks wheder the @a type is valid number of the block */
#define FRES_BLOCK_TYPE_VALID(type) \
((type) < FRES_NUM_BLOCKS && \
(type) >= 0)
+/**
+ * @file fres_contract.c
+ * @author Michal Sojka <sojkam1@fel.cvut.cz>
+ * @date Sun Nov 9 22:17:29 2008
+ *
+ * @brief Implementation of contract functions
+ *
+ *
+ */
#include <fres_contract.h>
#include <fres_container_internal.h>
#include <string.h>
+/**
+ * @file fres_contract.h
+ * @author Michal Sojka <sojkam1@fel.cvut.cz>
+ * @date Sun Nov 9 22:15:09 2008
+ *
+ * @brief Declaration of contract type and functions
+ *
+ *
+ */
#ifndef FRES_CONTRACT_H
#define FRES_CONTRACT_H
#include <fres_contract_idl.h>
#include <forb/server_id.h>
+/**
+ * Contract data type.
+ *
+ */
struct fres_contract {
- fres_contract_id_t id;
- struct fres_container *container; /**< Pointer to the container (opaque type). */
+ fres_contract_id_t id; /**< Global contract ID */
+ struct fres_container *container; /**< Pointer to the block container (opaque type). */
};
static inline int fres_contract_id_cmp(const fres_contract_id_t *a,