1 /*
2  * libosinfo: Main information database
3  *
4  * Copyright (C) 2009-2020 Red Hat, Inc.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library 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 GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
21 #include <glib-object.h>
22 #include <gio/gio.h>
23 #include <osinfo/osinfo_platform.h>
24 #include <osinfo/osinfo_os.h>
25 #include <osinfo/osinfo_device.h>
26 #include <osinfo/osinfo_platformlist.h>
27 #include <osinfo/osinfo_oslist.h>
28 #include <osinfo/osinfo_devicelist.h>
29 
30 #ifndef __OSINFO_DB_H__
31 # define __OSINFO_DB_H__
32 
33 # include "osinfo/osinfo_macros.h"
34 
35 # define OSINFO_TYPE_DB (osinfo_db_get_type ())
36 OSINFO_DECLARE_TYPE_WITH_PRIVATE_AND_CLASS(OsinfoDb,
37                                            osinfo_db,
38                                            OSINFO,
39                                            DB,
40                                            GObject)
41 
42 OsinfoDb *osinfo_db_new(void);
43 
44 OsinfoPlatform *osinfo_db_get_platform(OsinfoDb *db, const gchar *id);
45 OsinfoDevice *osinfo_db_get_device(OsinfoDb *db, const gchar *id);
46 OsinfoOs *osinfo_db_get_os(OsinfoDb *db, const gchar *id);
47 OsinfoDeployment *osinfo_db_get_deployment(OsinfoDb *db, const gchar *id);
48 OsinfoDatamap *osinfo_db_get_datamap(OsinfoDb *db, const gchar *id);
49 OsinfoInstallScript *osinfo_db_get_install_script(OsinfoDb *db, const gchar *id);
50 
51 OsinfoDeployment *osinfo_db_find_deployment(OsinfoDb *db,
52                                             OsinfoOs *os,
53                                             OsinfoPlatform *platform);
54 
55 OsinfoOsList *osinfo_db_get_os_list(OsinfoDb *db);
56 OsinfoPlatformList *osinfo_db_get_platform_list(OsinfoDb *db);
57 OsinfoDeviceList *osinfo_db_get_device_list(OsinfoDb *db);
58 OsinfoDeploymentList *osinfo_db_get_deployment_list(OsinfoDb *db);
59 OsinfoInstallScriptList *osinfo_db_get_install_script_list(OsinfoDb *db);
60 OsinfoDatamapList *osinfo_db_get_datamap_list(OsinfoDb *db);
61 
62 void osinfo_db_add_os(OsinfoDb *db, OsinfoOs *os);
63 void osinfo_db_add_platform(OsinfoDb *db, OsinfoPlatform *platform);
64 void osinfo_db_add_device(OsinfoDb *db, OsinfoDevice *device);
65 void osinfo_db_add_deployment(OsinfoDb *db, OsinfoDeployment *deployment);
66 void osinfo_db_add_datamap(OsinfoDb *db, OsinfoDatamap *datamap);
67 void osinfo_db_add_install_script(OsinfoDb *db, OsinfoInstallScript *script);
68 
69 G_DEPRECATED_FOR(osinfo_db_identify_media)
70 OsinfoOs *osinfo_db_guess_os_from_media(OsinfoDb *db,
71                                         OsinfoMedia *media,
72                                         OsinfoMedia **matched_media);
73 gboolean osinfo_db_identify_media(OsinfoDb *db,
74                                   OsinfoMedia *media);
75 
76 G_DEPRECATED_FOR(osinfo_db_identify_tree)
77 OsinfoOs *osinfo_db_guess_os_from_tree(OsinfoDb *db,
78                                        OsinfoTree *tree,
79                                        OsinfoTree **matched_tree);
80 gboolean osinfo_db_identify_tree(OsinfoDb *db,
81                                  OsinfoTree *tree);
82 
83 // Get me all unique values for property "vendor" among operating systems
84 GList *osinfo_db_unique_values_for_property_in_os(OsinfoDb *db, const gchar *propName);
85 
86 // Get me all unique values for property "vendor" among platforms
87 GList *osinfo_db_unique_values_for_property_in_platform(OsinfoDb *db, const gchar *propName);
88 
89 // Get me all unique values for property "vendor" among devices
90 GList *osinfo_db_unique_values_for_property_in_device(OsinfoDb *db, const gchar *propName);
91 
92 // Get me all unique values for property "vendor" among deployments
93 GList *osinfo_db_unique_values_for_property_in_deployment(OsinfoDb *db, const gchar *propName);
94 
95 // Get me all OSes that 'upgrade' another OS (or whatever relationship is specified)
96 OsinfoOsList *osinfo_db_unique_values_for_os_relationship(OsinfoDb *db, OsinfoProductRelationship relshp);
97 
98 // Get me all Platforms that 'upgrade' another Platform (or whatever relationship is specified)
99 OsinfoPlatformList *osinfo_db_unique_values_for_platform_relationship(OsinfoDb *db, OsinfoProductRelationship relshp);
100 
101 
102 #endif /* __OSINFO_DB_H__ */
103