satyr  0.42
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 <json.h>
34 #include <stdbool.h>
35 
37 {
38  char *name;
39  char *version;
40  char *architecture;
41  char *cpe;
42  /* Uptime in seconds. */
43  uint64_t uptime;
44  char *desktop;
45  char *variant;
46 };
47 
48 struct sr_operating_system *
49 sr_operating_system_new(void);
50 
51 void
52 sr_operating_system_init(struct sr_operating_system *operating_system);
53 
54 void
55 sr_operating_system_free(struct sr_operating_system *operating_system);
56 
57 char *
58 sr_operating_system_to_json(struct sr_operating_system *operating_system);
59 
60 struct sr_operating_system *
61 sr_operating_system_from_json(json_object *root, char **error_message);
62 
63 bool
64 sr_operating_system_parse_etc_system_release(const char *etc_system_release,
65  char **name,
66  char **version);
67 bool
68 sr_operating_system_parse_etc_os_release(const char *etc_os_release,
69  struct sr_operating_system *operating_system);
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif