]>
git.ipfire.org Git - people/ms/strongswan.git/blob - programs/charon/charon/encoding/generator.h
4 * @brief Interface of generator_t.
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 #include <encoding/payloads/encodings.h>
28 #include <encoding/payloads/payload.h>
31 * Generating is done in a data buffer.
32 * This is thehe start size of this buffer in bytes.
36 #define GENERATOR_DATA_BUFFER_SIZE 500
39 * Number of bytes to increase the buffer, if it is to small.
43 #define GENERATOR_DATA_BUFFER_INCREASE_VALUE 500
46 typedef struct generator_t generator_t
;
49 * @brief A generator_t class used to generate IKEv2 payloads.
51 * After creation, multiple payloads can be generated with the generate_payload
52 * method. The generated bytes are appended. After all payloads are added,
53 * the write_to_chunk method writes out all generated data since
54 * the creation of the generator. After that, the generator must be destroyed.
55 * The generater uses a set of encoding rules, which it can get from
56 * the supplied payload. With this rules, the generater can generate
57 * the payload and all substructures automatically.
60 * - generator_create()
67 * @brief Generates a specific payload from given payload object.
69 * Remember: Header and substructures are also handled as payloads.
71 * @param this generator_t object
72 * @param[in] payload interface payload_t implementing object
74 void (*generate_payload
) (generator_t
*this,payload_t
*payload
);
77 * @brief Writes all generated data of the generator to a chunk.
79 * @param this generator_t object
80 * @param[out] data chunk to write the data to
82 void (*write_to_chunk
) (generator_t
*this,chunk_t
*data
);
85 * @brief Destroys a generator_t object.
87 * @param this generator_t object
89 void (*destroy
) (generator_t
*this);
93 * @brief Constructor to create a generator.
95 * @return generator_t object.
99 generator_t
*generator_create();
101 #endif /*GENERATOR_H_*/