Hi,
while porting KNetworkManager to NM 0.7 I found a few issues which need fixing
in NM. Attached are three patches which apply cleanly against trunk.
1) allow_linking_with_cpp.patch:
As the filename indicates this patch adds support for using libnm_util and
libnm_glib from within C++.
2) fix_segfault.patch:
This patch fixes a segfault caused by some ssid being NULL. I don't know if it
is desired to have ssid's being NULL but in current trunk using my ipw2200
I've got a lot of these.
3) fix_memory_corruption.patch
The most important one (it took hours to find the cause). Call to g_object_get
writes a gint (4 byte) into the gint8 output buffer (1 byte) and thus
overwrites some other data (in my case the last_seen property).
Please have a look at the patches and commit to trunk.
Thanks,
Helmut
Index: libnm-util/nm-connection.h
===
--- libnm-util/nm-connection.h (Revision 2656)
+++ libnm-util/nm-connection.h (Arbeitskopie)
@@ -8,6 +8,10 @@
GHashTable *settings;
} NMConnection;
+#ifdef __cplusplus
+extern C {
+#endif
+
NMConnection *nm_connection_new (void);
NMConnection *nm_connection_new_from_hash (GHashTable *hash);
void nm_connection_add_setting (NMConnection *connection,
@@ -29,4 +33,8 @@
void nm_setting_parser_unregister (const char *name);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NM_CONNECTION_H */
Index: libnm-util/nm-setting.h
===
--- libnm-util/nm-setting.h (Revision 2656)
+++ libnm-util/nm-setting.h (Arbeitskopie)
@@ -21,6 +21,10 @@
NMSettingDestroyFn destroy_fn;
};
+#ifdef __cplusplus
+extern C {
+#endif
+
gbooleannm_settings_verify (GHashTable *all_settings);
GHashTable *nm_setting_to_hash (NMSetting *setting);
voidnm_setting_destroy (NMSetting *setting);
@@ -134,5 +138,8 @@
NMSetting *nm_setting_wireless_security_new (void);
NMSetting *nm_setting_wireless_security_new_from_hash (GHashTable *settings);
+#ifdef __cplusplus
+}
+#endif
#endif /* NM_SETTING_H */
Index: libnm-glib/nm-device-802-3-ethernet.h
===
--- libnm-glib/nm-device-802-3-ethernet.h (Revision 2656)
+++ libnm-glib/nm-device-802-3-ethernet.h (Arbeitskopie)
@@ -18,6 +18,10 @@
NMDeviceClass parent;
} NMDevice8023EthernetClass;
+#ifdef __cplusplus
+extern C {
+#endif
+
GType nm_device_802_3_ethernet_get_type (void);
NMDevice8023Ethernet *nm_device_802_3_ethernet_new (DBusGConnection *connection,
@@ -25,4 +29,8 @@
int nm_device_802_3_ethernet_get_speed (NMDevice8023Ethernet *device);
char *nm_device_802_3_ethernet_get_hw_address (NMDevice8023Ethernet *device);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NM_DEVICE_802_3_ETHERNET_H */
Index: libnm-glib/nm-access-point.h
===
--- libnm-glib/nm-access-point.h (Revision 2656)
+++ libnm-glib/nm-access-point.h (Arbeitskopie)
@@ -23,6 +23,10 @@
void (*strength_changed) (NMAccessPoint *ap, gint8 strength);
} NMAccessPointClass;
+#ifdef __cplusplus
+extern C {
+#endif
+
GType nm_access_point_get_type (void);
NMAccessPoint *nm_access_point_new (DBusGConnection *connection, const char *path);
@@ -36,4 +40,8 @@
guint32 nm_access_point_get_rate (NMAccessPoint *ap);
int nm_access_point_get_strength (NMAccessPoint *ap);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NM_ACCESS_POINT_H */
Index: libnm-glib/nm-device.h
===
--- libnm-glib/nm-device.h (Revision 2656)
+++ libnm-glib/nm-device.h (Arbeitskopie)
@@ -27,6 +27,10 @@
void (*state_changed) (NMDevice *device, NMDeviceState state);
} NMDeviceClass;
+#ifdef __cplusplus
+extern C {
+#endif
+
GType nm_device_get_type (void);
NMDevice*nm_device_new (DBusGConnection *connection,
@@ -49,4 +53,8 @@
NMDeviceType nm_device_type_for_path(DBusGConnection *connection,
const char *path);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NM_DEVICE_H */
Index: libnm-glib/nm-ip4-config.h
===
--- libnm-glib/nm-ip4-config.h (Revision 2656)
+++ libnm-glib/nm-ip4-config.h (Arbeitskopie)
@@ -21,6 +21,10 @@
NMObjectClass parent;
} NMIP4ConfigClass;
+#ifdef __cplusplus
+extern C {
+#endif
+
GType nm_ip4_config_get_type (void);
NMIP4Config *nm_ip4_config_new (DBusGConnection *connection,
@@ -36,5 +40,8 @@
char*nm_ip4_config_get_nis_domain (NMIP4Config *config);
GArray *nm_ip4_config_get_nis_servers (NMIP4Config *config);
+#ifdef __cplusplus
+}
+#endif
#endif /* NM_IP4_CONFIG_H */
Index: libnm-glib/nm-client.h
===
--- libnm-glib/nm-client.h (Revision 2656)
+++ libnm-glib/nm-client.h (Arbeitskopie)
@@ -36,6