blob: aa354e8f4899fb7c8b9d41a746dae77c489962aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
/*
* Copyright (C) 2017 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
/**
* @defgroup sw_collector_history_t sw_collector_history
* @{ @ingroup sw_collector
*/
#ifndef SW_COLLECTOR_HISTORY_H_
#define SW_COLLECTOR_HISTORY_H_
#include "sw_collector_db.h"
#include <library.h>
#include <utils/debug.h>
#include <utils/lexparser.h>
typedef struct sw_collector_history_t sw_collector_history_t;
typedef enum sw_collector_history_op_t sw_collector_history_op_t;
/**
* Define major history event operations
*/
enum sw_collector_history_op_t {
SW_OP_INSTALL,
SW_OP_UPGRADE,
SW_OP_REMOVE
};
/**
* Software collector history object
*/
struct sw_collector_history_t {
/**
* Extract timestamp from event in installation history
*
* @param args Arguments to be processed
* @param buf timestamp buffer for 21 byte RFC 3339 string
* @return TRUE if extraction succeeded
*/
bool (*extract_timestamp)(sw_collector_history_t *this, chunk_t args,
char *buf);
/**
* Extract packages from event in installation history
*
* @param args Arguments to be processed
* @param eid Primary key pointing to current event
* @param op Extraction operation
* @return TRUE if extraction succeeded
*/
bool (*extract_packages)(sw_collector_history_t *this, chunk_t args,
uint32_t eid, sw_collector_history_op_t op);
/**
* Merge packages from initial installation
*
* @return TRUE if merge succeeded
*/
bool (*merge_installed_packages)(sw_collector_history_t *this);
/**
* Destroy sw_collector_history_t object
*/
void (*destroy)(sw_collector_history_t *this);
};
/**
* Create an sw_collector_history_t instance
*
* @param db Internal reference to collector database
* @param source Software event source number
*/
sw_collector_history_t* sw_collector_history_create(sw_collector_db_t *db,
uint8_t source);
#endif /** SW_COLLECTOR_HISTORY_H_ @}*/
|