diff options
author | Thomas Haller <thaller@redhat.com> | 2017-05-31 22:37:49 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2017-06-01 11:28:57 +0200 |
commit | b0f9571d3d6c5dff53c677ae2841126cd482e363 (patch) | |
tree | d3a88b2cd89df9f1ac91508827dc406d8e6cdf65 | |
parent | 1be01bd51f3e27d82335999586e8efff40b92b87 (diff) | |
download | NetworkManager-b0f9571d3d6c5dff53c677ae2841126cd482e363.tar.gz |
libnm: add _nm_connection_get_setting_bluetooth_for_nap()
If there is value in such a helper function (there is), then
it should go alongside the other nm_connection_get_setting*()
helpers. NMDevice is already large enough.
-rw-r--r-- | libnm-core/nm-connection.c | 11 | ||||
-rw-r--r-- | libnm-core/nm-core-internal.h | 4 | ||||
-rw-r--r-- | src/devices/nm-device.c | 19 |
3 files changed, 18 insertions, 16 deletions
diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c index 2be9007682..2b9a05ca19 100644 --- a/libnm-core/nm-connection.c +++ b/libnm-core/nm-connection.c @@ -2518,6 +2518,17 @@ nm_connection_get_setting_vlan (NMConnection *connection) return (NMSettingVlan *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VLAN); } +NMSettingBluetooth * +_nm_connection_get_setting_bluetooth_for_nap (NMConnection *connection) +{ + NMSettingBluetooth *s_bt = nm_connection_get_setting_bluetooth (connection); + + if ( s_bt + && nm_streq0 (nm_setting_bluetooth_get_connection_type (s_bt), NM_SETTING_BLUETOOTH_TYPE_NAP)) + return s_bt; + return NULL; +} + /*****************************************************************************/ static void diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h index 9bc54df387..102cd6575f 100644 --- a/libnm-core/nm-core-internal.h +++ b/libnm-core/nm-core-internal.h @@ -352,6 +352,10 @@ gboolean _nm_setting_bond_option_supported (const char *option, NMBondMode mode) /*****************************************************************************/ +NMSettingBluetooth *_nm_connection_get_setting_bluetooth_for_nap (NMConnection *connection); + +/*****************************************************************************/ + gboolean _nm_utils_inet6_is_token (const struct in6_addr *in6addr); /*****************************************************************************/ diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 8be901b297..65621006ad 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -4366,23 +4366,10 @@ dnsmasq_state_changed_cb (NMDnsMasqManager *manager, guint32 status, gpointer us const NMBtVTableNetworkServer *nm_bt_vtable_network_server = NULL; -static NMSettingBluetooth * -_setting_bluetooth_for_bt_nap (NMConnection *connection) -{ - NMSettingBluetooth *s_bt = nm_connection_get_setting_bluetooth (connection); - - if (!s_bt) - return NULL; - if (!nm_streq0 (nm_setting_bluetooth_get_connection_type (s_bt), NM_SETTING_BLUETOOTH_TYPE_NAP)) - return NULL; - - return s_bt; -} - static gboolean bt_network_server_available (NMConnection *connection) { - NMSettingBluetooth *s_bt = _setting_bluetooth_for_bt_nap (connection); + NMSettingBluetooth *s_bt = _nm_connection_get_setting_bluetooth_for_nap (connection); if (!s_bt) return TRUE; @@ -4396,7 +4383,7 @@ static gboolean bt_network_server_register (NMDevice *self) { NMConnection *connection = nm_device_get_applied_connection (self); - NMSettingBluetooth *s_bt = _setting_bluetooth_for_bt_nap (connection); + NMSettingBluetooth *s_bt = _nm_connection_get_setting_bluetooth_for_nap (connection); if (!s_bt) return TRUE; @@ -4415,7 +4402,7 @@ bt_network_server_unregister (NMDevice *self) if (!connection) return; - s_bt = _setting_bluetooth_for_bt_nap (connection); + s_bt = _nm_connection_get_setting_bluetooth_for_nap (connection); if (!s_bt) return; |