2 * Copyright (C) 2017 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
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>.
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
17 * @defgroup sw_collector_history_t sw_collector_history
18 * @{ @ingroup sw_collector
21 #ifndef SW_COLLECTOR_HISTORY_H_
22 #define SW_COLLECTOR_HISTORY_H_
24 #include "sw_collector_db.h"
27 #include <utils/debug.h>
28 #include <utils/lexparser.h>
30 typedef struct sw_collector_history_t sw_collector_history_t
;
31 typedef enum sw_collector_history_op_t sw_collector_history_op_t
;
34 * Define major history event operations
36 enum sw_collector_history_op_t
{
43 * Software collector history object
45 struct sw_collector_history_t
{
48 * Extract timestamp from event in installation history
50 * @param args Arguments to be processed
51 * @param buf timestamp buffer for 21 byte RFC 3339 string
52 * @return TRUE if extraction succeeded
54 bool (*extract_timestamp
)(sw_collector_history_t
*this, chunk_t args
,
58 * Extract packages from event in installation history
60 * @param args Arguments to be processed
61 * @param eid Primary key pointing to current event
62 * @param op Extraction operation
63 * @return TRUE if extraction succeeded
65 bool (*extract_packages
)(sw_collector_history_t
*this, chunk_t args
,
66 uint32_t eid
, sw_collector_history_op_t op
);
69 * Merge packages from initial installation
71 * @return TRUE if merge succeeded
73 bool (*merge_installed_packages
)(sw_collector_history_t
*this);
76 * Destroy sw_collector_history_t object
78 void (*destroy
)(sw_collector_history_t
*this);
83 * Create an sw_collector_history_t instance
85 * @param db Internal reference to collector database
86 * @param source Software event source number
88 sw_collector_history_t
* sw_collector_history_create(sw_collector_db_t
*db
,
91 #endif /** SW_COLLECTOR_HISTORY_H_ @}*/