swid-gen: Share SWID generator between sw-collector, imc-swima and imc-swid
[strongswan.git] / src / libimcv / swid_gen / swid_gen.h
1 /*
2 * Copyright (C) 2017 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup swid_gen swid_gen
18 * @{ @ingroup libimcv
19 */
20
21 #ifndef SWID_GEN_H_
22 #define SWID_GEN_H_
23
24 #include <library.h>
25
26 typedef struct swid_gen_t swid_gen_t;
27
28 /**
29 * Class generating a either a full or a minimalistic ISO 19770-2:2015 SWID tag
30 */
31 struct swid_gen_t {
32
33 /**
34 * Generate a SWID tag
35 *
36 * @param sw_id Software identifier
37 * @param package Package name (can be NULL)
38 * @param version Package version (can be NULL)
39 * @param full Generate full SWID tags with file information
40 * @param pretty Generate SWID tags with pretty formating
41 * @return SWID tag
42 */
43 char* (*generate_tag)(swid_gen_t *this, char *sw_id, char *package,
44 char *version, bool full, bool pretty);
45
46 /**
47 * Generate a SWID tag
48 *
49 * @param sw_id_only Return software identifier only
50 * @param full Generate full SWID tags with file information
51 * @param pretty Generate SWID tags with pretty formating
52 * @return Tag enumerator (sw_id, tag)
53 */
54 enumerator_t* (*create_tag_enumerator)(swid_gen_t *this, bool sw_id_only,
55 bool full, bool pretty);
56
57 /**
58 * Destroys a swid_gen_t object.
59 */
60 void (*destroy)(swid_gen_t *this);
61
62 };
63
64 /**
65 * Creates a swid_gen_t object
66 */
67 swid_gen_t* swid_gen_create(void);
68
69 #endif /** SWID_GEN_H_ @}*/