summary refs log tree commit diff
path: root/libnm-util
diff options
context:
space:
mode:
Diffstat (limited to 'libnm-util')
-rw-r--r--libnm-util/NetworkManager.h14
-rw-r--r--libnm-util/nm-utils.c15
-rw-r--r--libnm-util/nm-version.h.in34
3 files changed, 48 insertions, 15 deletions
diff --git a/libnm-util/NetworkManager.h b/libnm-util/NetworkManager.h
index 4fa861e8..e8dec062 100644
--- a/libnm-util/NetworkManager.h
+++ b/libnm-util/NetworkManager.h
@@ -185,7 +185,7 @@ typedef enum {
  *
  * (Corresponds to the NM_DEVICE_CAP type in nm-device-wifi.xml.)
  **/
-typedef enum {
+typedef enum { /*< flags >*/
 	NM_DEVICE_CAP_NONE           = 0x00000000,
 	NM_DEVICE_CAP_NM_SUPPORTED   = 0x00000001,
 	NM_DEVICE_CAP_CARRIER_DETECT = 0x00000002,
@@ -212,7 +212,7 @@ typedef enum {
  *
  * (Corresponds to the NM_802_11_DEVICE_CAP type in nm-device-wifi.xml.)
  **/
-typedef enum {
+typedef enum { /*< flags >*/
 	NM_WIFI_DEVICE_CAP_NONE          = 0x00000000,
 	NM_WIFI_DEVICE_CAP_CIPHER_WEP40  = 0x00000001,
 	NM_WIFI_DEVICE_CAP_CIPHER_WEP104 = 0x00000002,
@@ -238,7 +238,7 @@ typedef enum {
  *
  * (Corresponds to the NM_802_11_AP_FLAGS type in nm-access-point.xml.)
  **/
-typedef enum {
+typedef enum { /*< underscore_name=nm_802_11_ap_flags, flags >*/
 	NM_802_11_AP_FLAGS_NONE    = 0x00000000,
 	NM_802_11_AP_FLAGS_PRIVACY = 0x00000001
 } NM80211ApFlags;
@@ -270,7 +270,7 @@ typedef enum {
  *
  * (Corresponds to the NM_802_11_AP_SEC type in nm-access-point.xml.)
  **/
-typedef enum {
+typedef enum { /*< underscore_name=nm_802_11_ap_security_flags, flags >*/
 	NM_802_11_AP_SEC_NONE            = 0x00000000,
 	NM_802_11_AP_SEC_PAIR_WEP40      = 0x00000001,
 	NM_802_11_AP_SEC_PAIR_WEP104     = 0x00000002,
@@ -301,7 +301,7 @@ typedef enum {
  *
  * (Corresponds to the NM_802_11_MODE type in generic-types.xml.)
  **/
-typedef enum {
+typedef enum { /*< underscore_name=nm_802_11_mode >*/
 	NM_802_11_MODE_UNKNOWN = 0,
 	NM_802_11_MODE_ADHOC,
 	NM_802_11_MODE_INFRA,
@@ -319,7 +319,7 @@ typedef enum {
  *
  * (Corresponds to the NM_BT_CAPABILITY type in nm-device-bt.xml.)
  **/
-typedef enum {
+typedef enum { /*< flags >*/
 	NM_BT_CAPABILITY_NONE = 0x00000000,
 	NM_BT_CAPABILITY_DUN  = 0x00000001,
 	NM_BT_CAPABILITY_NAP  = 0x00000002,
@@ -343,7 +343,7 @@ typedef enum {
  *
  * (Corresponds to the NM_DEVICE_MODEM_CAPABILITY type in nm-device-modem.xml.)
  **/
-typedef enum {
+typedef enum { /*< flags >*/
 	NM_DEVICE_MODEM_CAPABILITY_NONE      = 0x00000000,
 	NM_DEVICE_MODEM_CAPABILITY_POTS      = 0x00000001,
 	NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO = 0x00000002,
diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c
index d0c2ca31..143063e7 100644
--- a/libnm-util/nm-utils.c
+++ b/libnm-util/nm-utils.c
@@ -332,6 +332,21 @@ nm_utils_ssid_to_utf8 (const GByteArray *ssid)
 		                                     "UTF-8", e1, "?", NULL, NULL, NULL);
 	}
 
+	if (!converted) {
+		/* If there is still no converted string, the SSID probably
+		 * contains characters not valid in the current locale. Convert
+		 * the string to ASCII instead.
+		 */
+
+		/* Use the printable range of 0x20-0x7E */
+		gchar *valid_chars = " !\"#$%&'()*+,-./0123456789:;<=>?@"
+		                     "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`"
+		                     "abcdefghijklmnopqrstuvwxyz{|}~";
+
+		converted = g_strndup ((const gchar *)ssid->data, ssid->len);
+		g_strcanon (converted, valid_chars, '?');
+	}
+
 	return converted;
 }
 
diff --git a/libnm-util/nm-version.h.in b/libnm-util/nm-version.h.in
index bbbf993a..e00f4055 100644
--- a/libnm-util/nm-version.h.in
+++ b/libnm-util/nm-version.h.in
@@ -21,6 +21,8 @@
 #ifndef NM_VERSION_H
 #define NM_VERSION_H
 
+#include <glib.h>
+
 /**
  * NM_MAJOR_VERSION:
  *
@@ -67,9 +69,13 @@
 #define NM_VERSION_0_9_8  (NM_ENCODE_VERSION (0, 9, 8))
 #define NM_VERSION_0_9_10 (NM_ENCODE_VERSION (0, 9, 10))
 #define NM_VERSION_1_0    (NM_ENCODE_VERSION (1, 0, 0))
+#define NM_VERSION_1_0_2  (NM_ENCODE_VERSION (1, 0, 2))
+#define NM_VERSION_1_0_4  (NM_ENCODE_VERSION (1, 0, 4))
+#define NM_VERSION_1_0_6  (NM_ENCODE_VERSION (1, 0, 6))
+#define NM_VERSION_1_0_8  (NM_ENCODE_VERSION (1, 0, 8))
 
-#define NM_VERSION_CUR_STABLE  NM_VERSION_1_0
-#define NM_VERSION_NEXT_STABLE NM_VERSION_1_0
+#define NM_VERSION_CUR_STABLE  NM_VERSION_1_0_6
+#define NM_VERSION_NEXT_STABLE NM_VERSION_1_0_8
 
 #if !defined (NM_VERSION_MIN_REQUIRED) || (NM_VERSION_MIN_REQUIRED == 0)
 # undef NM_VERSION_MIN_REQUIRED
@@ -100,6 +106,12 @@
 # define NM_DEPRECATED_IN_0_9_10_FOR(f)
 #endif
 
+#if NM_VERSION_MAX_ALLOWED < NM_VERSION_0_9_10
+# define NM_AVAILABLE_IN_0_9_10         G_UNAVAILABLE(0.9,10)
+#else
+# define NM_AVAILABLE_IN_0_9_10
+#endif
+
 #if NM_VERSION_MIN_REQUIRED >= NM_VERSION_1_0
 # define NM_DEPRECATED_IN_1_0           G_DEPRECATED
 # define NM_DEPRECATED_IN_1_0_FOR(f)    G_DEPRECATED_FOR(f)
@@ -108,16 +120,22 @@
 # define NM_DEPRECATED_IN_1_0_FOR(f)
 #endif
 
-#if NM_VERSION_MAX_ALLOWED < NM_VERSION_0_9_10
-# define NM_AVAILABLE_IN_0_9_10         G_UNAVAILABLE(0.9,10)
-#else
-# define NM_AVAILABLE_IN_0_9_10
-#endif
-
 #if NM_VERSION_MAX_ALLOWED < NM_VERSION_1_0
 # define NM_AVAILABLE_IN_1_0            G_UNAVAILABLE(1,0)
 #else
 # define NM_AVAILABLE_IN_1_0
 #endif
 
+#if NM_VERSION_MAX_ALLOWED < NM_VERSION_1_0_4
+# define NM_AVAILABLE_IN_1_0_4          G_UNAVAILABLE(1,0.4)
+#else
+# define NM_AVAILABLE_IN_1_0_4
+#endif
+
+#if NM_VERSION_MAX_ALLOWED < NM_VERSION_1_0_6
+# define NM_AVAILABLE_IN_1_0_6          G_UNAVAILABLE(1,0.6)
+#else
+# define NM_AVAILABLE_IN_1_0_6
+#endif
+
 #endif  /* NM_VERSION_H */