satyr  0.28
operating_system.h
Go to the documentation of this file.
1 /*
2  operating_system.h
3 
4  Copyright (C) 2012 Red Hat, Inc.
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License along
17  with this program; if not, write to the Free Software Foundation, Inc.,
18  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20 #ifndef SATYR_OPERATING_SYSTEM_H
21 #define SATYR_OPERATING_SYSTEM_H
22 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include <inttypes.h>
33 #include <stdbool.h>
34 
35 struct sr_json_value;
36 
38 {
39  char *name;
40  char *version;
41  char *architecture;
42  char *cpe;
43  /* Uptime in seconds. */
44  uint64_t uptime;
45  char *desktop;
46  char *variant;
47 };
48 
49 struct sr_operating_system *
50 sr_operating_system_new(void);
51 
52 void
53 sr_operating_system_init(struct sr_operating_system *operating_system);
54 
55 void
56 sr_operating_system_free(struct sr_operating_system *operating_system);
57 
58 char *
59 sr_operating_system_to_json(struct sr_operating_system *operating_system);
60 
61 struct sr_operating_system *
62 sr_operating_system_from_json(struct sr_json_value *root, char **error_message);
63 
64 bool
65 sr_operating_system_parse_etc_system_release(const char *etc_system_release,
66  char **name,
67  char **version);
68 bool
69 sr_operating_system_parse_etc_os_release(const char *etc_os_release,
70  struct sr_operating_system *operating_system);
71 
72 #ifdef __cplusplus
73 }
74 #endif
75 
76 #endif