- removed generator context object and implemented payload-interface in generator

This commit is contained in:
Jan Hutter
2005-11-14 08:12:59 +00:00
parent cc0fbc3c24
commit 1e8bb886d1
7 changed files with 326 additions and 468 deletions
+6 -43
View File
@@ -38,23 +38,6 @@
*/
#define GENERATOR_DATA_BUFFER_INCREASE_VALUE 1000
/**
* Used for generator operations internaly to store a generator context.
*/
typedef struct generator_context_s generator_context_t;
struct generator_context_s {
/**
* @brief Destroys a generator_infos_t object and its containing buffer
*
* @param generator_infos_t generator_infos_t object
* @return always SUCCESSFUL
*/
status_t (*destroy) (generator_context_t *this);
};
/**
*A generator_t object which generates payloads of specific type.
*/
@@ -63,46 +46,29 @@ typedef struct generator_s generator_t;
struct generator_s {
/**
* Creates a generator_context_t object holding necessary informations
* for generating (buffer, data_struct, etc).
*
* After using, this context has to get destroyed!
*
* @param data_struct data struct where the specific payload informations are stored
* @return
* - pointer to created generator_infos_t object
* - NULL if memory allocation failed
*/
generator_context_t * (*create_context) (generator_t *this);
/**
* @brief Generates a specific payload from given data struct.
* @brief Generates a specific payload from given payload object.
*
* Remember: Header and substructures are also handled as payloads.
*
* @param this generator_t object
* @param payload_type payload type to generate using the given data struct
* @param[in] data_struct data struct where the needed data for generating are stored
* @param generator_context generator context to use when generating
* @param this generator_t object
* @param[in] payload interface payload_t implementing object
* @return
* - SUCCESSFUL if succeeded
* - NOT_SUPPORTED if payload_type is not supported
* - OUT_OF_RES if out of ressources
*/
status_t (*generate_payload) (generator_t *this,payload_type_t payload_type,void * data_struct,generator_context_t *generator_context);
status_t (*generate_payload) (generator_t *this,payload_t *payload);
/**
* Writes all generated data of current context to a chunk
* Writes all generated data of current generator context to a chunk
*
* @param this generator_t object
* @param generator_context generator context to use when generating
* * @param[out] data chunk to write the data to
* @return
* @return
* - SUCCESSFUL if succeeded
* - OUT_OF_RES otherwise
*/
status_t (*write_to_chunk) (generator_t *this,generator_context_t *generator_context, chunk_t *data);
status_t (*write_to_chunk) (generator_t *this,chunk_t *data);
/**
* @brief Destroys a generator_t object.
@@ -117,9 +83,6 @@ struct generator_s {
/**
* Constructor to create a generator
*
* @param payload_infos pointer to the payload_info_t-array containing
* all the payload informations needed to
* automatic generate a specific payload
*/
generator_t * generator_create();