swid-gen: Share SWID generator between sw-collector, imc-swima and imc-swid
[strongswan.git] / src / libimcv / swid / swid_inventory.h
1 /*
2 * Copyright (C) 2013-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_inventory swid_inventory
18 * @{ @ingroup libimcv_swid
19 */
20
21 #ifndef SWID_INVENTORY_H_
22 #define SWID_INVENTORY_H_
23
24 #include <library.h>
25
26 /* Maximum size of a SWID Tag Inventory: 100 MB */
27 #define SWID_MAX_ATTR_SIZE 100000000
28
29 typedef struct swid_inventory_t swid_inventory_t;
30
31 /**
32 * Class managing SWID tag inventory
33 */
34 struct swid_inventory_t {
35
36 /**
37 * Collect the SWID tags stored on the endpoint
38 *
39 * @param directory SWID directory path
40 * @param targets List of target tag IDs
41 * @param pretty Generate indented XML SWID tags
42 * @param full Include file information in SWID tags
43 * @return TRUE if successful
44 */
45 bool (*collect)(swid_inventory_t *this, char *directory,
46 swid_inventory_t *targets, bool pretty, bool full);
47
48 /**
49 * Collect the SWID tags stored on the endpoint
50 *
51 * @param item SWID tag or tag ID to be added
52 */
53 void (*add)(swid_inventory_t *this, void *item);
54
55 /**
56 * Get the number of collected SWID tags
57 *
58 * @return Number of collected SWID tags
59 */
60 int (*get_count)(swid_inventory_t *this);
61
62 /**
63 * Create a SWID tag inventory enumerator
64 *
65 * @return Enumerator returning either tag ID or full tag
66 */
67 enumerator_t* (*create_enumerator)(swid_inventory_t *this);
68
69 /**
70 * Destroys a swid_inventory_t object.
71 */
72 void (*destroy)(swid_inventory_t *this);
73
74 };
75
76 /**
77 * Creates a swid_inventory_t object
78 *
79 * @param full_tags TRUE if full tags, FALSE if tag IDs only
80 */
81 swid_inventory_t* swid_inventory_create(bool full_tags);
82
83 #endif /** SWID_INVENTORY_H_ @}*/