summaryrefslogtreecommitdiff
path: root/libnm/nm-libnm-utils.h
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-10-18 08:12:01 +0200
committerThomas Haller <thaller@redhat.com>2019-10-22 10:58:52 +0200
commit57aa5e2a9df99eb6e6286ae0726cf9f40c5992e6 (patch)
tree971e3714bc3aaba7c257b719c43725f017db7974 /libnm/nm-libnm-utils.h
parent35b024acaa3a74fc7b8c2fbccd1a5708bfe5cfa8 (diff)
downloadNetworkManager-57aa5e2a9df99eb6e6286ae0726cf9f40c5992e6.tar.gz
libnm: hide GObject structs from public API and embed private data
These types are all subclasses of NMObject. These instances are commonly created by NMClient itself. It makes no sense that a user would instantiate the type. Much less does it make sense to subclass them. Hide the object and class structures from public API. This is an API and ABI break, but of something that is very likely unused. This is mainly done to embed the private structure in the object itself. This has benefits for performance and debugability. But most importantly, we can obtain a static offset where to access the private data. That means, we can use the information to access the data pointer generically, as we will need later. This is not done for the internal types NMManager, NMRemoteSettings, and NMDnsManager. These types will be dropped later.
Diffstat (limited to 'libnm/nm-libnm-utils.h')
-rw-r--r--libnm/nm-libnm-utils.h96
1 files changed, 92 insertions, 4 deletions
diff --git a/libnm/nm-libnm-utils.h b/libnm/nm-libnm-utils.h
index ff070a587d..2e0c792aba 100644
--- a/libnm/nm-libnm-utils.h
+++ b/libnm/nm-libnm-utils.h
@@ -6,10 +6,6 @@
#ifndef __NM_LIBNM_UTILS_H__
#define __NM_LIBNM_UTILS_H__
-#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_PRIVATE)
-#error Cannot use this header.
-#endif
-
#include "nm-types.h"
/*****************************************************************************/
@@ -117,4 +113,96 @@ char *nm_utils_wincaps_to_dash (const char *caps);
char *nm_utils_fixup_vendor_string (const char *desc);
char *nm_utils_fixup_product_string (const char *desc);
+/*****************************************************************************/
+
+struct _NMObjectPrivate;
+
+struct _NMObject {
+ GObject parent;
+ struct _NMObjectPrivate *_priv;
+};
+
+struct _NMObjectClass {
+ GObjectClass parent;
+
+ void (*init_dbus) (struct _NMObject *object);
+
+ /* The "object-creation-failed" method is PRIVATE for libnm and
+ * is not meant for any external usage. It indicates that an error
+ * occurred during creation of an object.
+ */
+ void (*object_creation_failed) (struct _NMObject *master_object,
+ const char *failed_path);
+};
+
+/*****************************************************************************/
+
+struct _NMDevicePrivate;
+
+struct _NMDevice {
+ NMObject parent;
+ struct _NMDevicePrivate *_priv;
+};
+
+struct _NMDeviceClass {
+ struct _NMObjectClass parent;
+
+ /* Signals */
+ void (*state_changed) (NMDevice *device,
+ NMDeviceState new_state,
+ NMDeviceState old_state,
+ NMDeviceStateReason reason);
+
+ /* Methods */
+ gboolean (*connection_compatible) (NMDevice *device,
+ NMConnection *connection,
+ GError **error);
+
+ const char * (*get_type_description) (NMDevice *device);
+ const char * (*get_hw_address) (NMDevice *device);
+
+ GType (*get_setting_type) (NMDevice *device);
+};
+
+/*****************************************************************************/
+
+struct _NMActiveConnectionPrivate;
+
+struct _NMActiveConnection {
+ NMObject parent;
+ struct _NMActiveConnectionPrivate *_priv;
+};
+
+struct _NMActiveConnectionClass {
+ struct _NMObjectClass parent;
+};
+
+/*****************************************************************************/
+
+struct _NMDhcpConfigPrivate;
+
+struct _NMDhcpConfig {
+ NMObject parent;
+ struct _NMDhcpConfigPrivate *_priv;
+};
+
+struct _NMDhcpConfigClass {
+ struct _NMObjectClass parent;
+};
+
+/*****************************************************************************/
+
+struct _NMIPConfigPrivate;
+
+struct _NMIPConfig {
+ NMObject parent;
+ struct _NMIPConfigPrivate *_priv;
+};
+
+struct _NMIPConfigClass {
+ struct _NMObjectClass parent;
+};
+
+/*****************************************************************************/
+
#endif /* __NM_LIBNM_UTILS_H__ */