strongswan/src/libcharon/encoding/generator.h

74 lines
2.1 KiB
C
Raw Normal View History

2005-11-08 16:19:06 +00:00
/*
2009-05-18 12:06:48 +00:00
* Copyright (C) 2005-2009 Martin Willi
2006-07-07 08:49:06 +00:00
* Copyright (C) 2005 Jan Hutter
2005-11-08 16:19:06 +00:00
* Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
/**
* @defgroup generator generator
* @{ @ingroup encoding
2005-11-08 16:19:06 +00:00
*/
#ifndef GENERATOR_H_
#define GENERATOR_H_
typedef struct generator_t generator_t;
#include <library.h>
2005-11-23 09:57:18 +00:00
#include <encoding/payloads/encodings.h>
#include <encoding/payloads/payload.h>
2005-11-08 16:19:06 +00:00
/**
* A generator_t class used to generate IKEv2 payloads.
*
2005-12-06 13:44:22 +00:00
* After creation, multiple payloads can be generated with the generate_payload
* method. The generated bytes are appended. After all payloads are added,
2005-12-06 13:44:22 +00:00
* the write_to_chunk method writes out all generated data since
* the creation of the generator.
2005-12-06 13:44:22 +00:00
* The generater uses a set of encoding rules, which it can get from
* the supplied payload. With this rules, the generater can generate
* the payload and all substructures automatically.
2005-11-08 16:19:06 +00:00
*/
2005-11-24 09:17:51 +00:00
struct generator_t {
/**
* Generates a specific payload from given payload object.
*
2005-11-10 09:54:09 +00:00
* Remember: Header and substructures are also handled as payloads.
*
* @param payload interface payload_t implementing object
2005-11-08 16:19:06 +00:00
*/
void (*generate_payload) (generator_t *this,payload_t *payload);
/**
* Writes all generated data of the generator to a chunk.
*
2009-05-18 12:06:48 +00:00
* @param data chunk to write the data to
*/
void (*write_to_chunk) (generator_t *this,chunk_t *data);
2005-11-08 16:19:06 +00:00
/**
* Destroys a generator_t object.
2005-11-08 16:19:06 +00:00
*/
void (*destroy) (generator_t *this);
2005-11-08 16:19:06 +00:00
};
2005-11-09 08:40:33 +00:00
/**
* Constructor to create a generator.
*
2005-12-06 13:44:22 +00:00
* @return generator_t object.
2005-11-09 08:40:33 +00:00
*/
generator_t *generator_create(void);
2005-11-08 16:19:06 +00:00
#endif /** GENERATOR_H_ @}*/