]> git.ipfire.org Git - thirdparty/strongswan.git/blob - src/libstrongswan/metadata/metadata_factory.h
Update copyright headers after acquisition by secunet
[thirdparty/strongswan.git] / src / libstrongswan / metadata / metadata_factory.h
1 /*
2 * Copyright (C) 2021 Tobias Brunner
3 * Copyright (C) 2021 Thomas Egerer
4 *
5 * Copyright (C) secunet Security Networks AG
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 */
17
18 /**
19 * @defgroup metadata_factory metadata_factory
20 * @{ @ingroup metadata
21 */
22
23 #ifndef METADATA_FACTORY_H_
24 #define METADATA_FACTORY_H_
25
26 #include "metadata.h"
27
28 typedef struct metadata_factory_t metadata_factory_t;
29
30 /**
31 * Create a factory for dealing with metadata objects.
32 */
33 struct metadata_factory_t {
34
35 /**
36 * Create a metadata object of the given type.
37 *
38 * @param type type of the desired metadata object
39 * @param ... data to wrap into the metadata object
40 * @return metadata handler on success, NULL otherwise
41 */
42 metadata_t *(*create)(metadata_factory_t *this, const char *type, ...);
43
44 /**
45 * Register a constructor for a given type.
46 *
47 * @param type type to register
48 * @param create metadata constructor
49 */
50 void (*register_type)(metadata_factory_t *this, const char *type,
51 metadata_create_t create);
52
53 /**
54 * Destroy a metadata_factory_t instance.
55 */
56 void (*destroy)(metadata_factory_t *this);
57 };
58
59 /**
60 * Create a metadata_factory_t instance.
61 */
62 metadata_factory_t *metadata_factory_create();
63
64 #endif /** METADATA_FACTORY_H_ @}*/