core: use nm_connection_get_setting_<type>() whenever possible

Leads to shorter, easier to read code and improves type casting safety.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
This commit is contained in:
Thomas Graf
2011-12-05 12:27:47 +01:00
committed by Dan Williams
parent c1344ec097
commit 5b7503e95e
35 changed files with 325 additions and 346 deletions

View File

@@ -76,7 +76,7 @@ show_connection (NMConnection *data, gpointer user_data)
char timestamp_real_str[64];
const char *val1, *val2, *val3, *val4, *val5;
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
if (s_con) {
/* Get various info from NMSettingConnection and show it */
timestamp = nm_setting_connection_get_timestamp (s_con);

View File

@@ -169,7 +169,7 @@ get_connection_bt_type (NMConnection *connection)
NMSettingBluetooth *s_bt;
const char *bt_type;
s_bt = (NMSettingBluetooth *) nm_connection_get_setting (connection, NM_TYPE_SETTING_BLUETOOTH);
s_bt = nm_connection_get_setting_bluetooth (connection);
if (!s_bt)
return NM_BT_CAPABILITY_NONE;

View File

@@ -721,7 +721,7 @@ gboolean
nm_connection_verify (NMConnection *connection, GError **error)
{
NMConnectionPrivate *priv;
NMSetting *s_con;
NMSettingConnection *s_con;
GHashTableIter iter;
gpointer value;
GSList *all_settings = NULL;
@@ -743,7 +743,7 @@ nm_connection_verify (NMConnection *connection, GError **error)
priv = NM_CONNECTION_GET_PRIVATE (connection);
/* First, make sure there's at least 'connection' setting */
s_con = nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
if (!s_con) {
g_set_error_literal (error,
NM_CONNECTION_ERROR,
@@ -769,7 +769,7 @@ nm_connection_verify (NMConnection *connection, GError **error)
/* Now make sure the given 'type' setting can actually be the base setting
* of the connection. Can't have type=ppp for example.
*/
ctype = nm_setting_connection_get_connection_type (NM_SETTING_CONNECTION (s_con));
ctype = nm_setting_connection_get_connection_type (s_con);
if (!ctype) {
g_set_error_literal (error,
NM_CONNECTION_ERROR,
@@ -1286,7 +1286,7 @@ nm_connection_get_uuid (NMConnection *connection)
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
g_return_val_if_fail (s_con != NULL, NULL);
return nm_setting_connection_get_uuid (s_con);
@@ -1308,7 +1308,7 @@ nm_connection_get_id (NMConnection *connection)
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
g_return_val_if_fail (s_con != NULL, NULL);
return nm_setting_connection_get_id (s_con);

View File

@@ -921,7 +921,7 @@ test_connection_diff_different (void)
{
NMConnection *a, *b;
GHashTable *out_diffs = NULL;
NMSetting *s_ip4;
NMSettingIP4Config *s_ip4;
gboolean same;
const DiffSetting settings[] = {
{ NM_SETTING_IP4_CONFIG_SETTING_NAME, {
@@ -932,7 +932,7 @@ test_connection_diff_different (void)
a = new_test_connection ();
b = nm_connection_duplicate (a);
s_ip4 = nm_connection_get_setting (a, NM_TYPE_SETTING_IP4_CONFIG);
s_ip4 = nm_connection_get_setting_ip4_config (a);
g_assert (s_ip4);
g_object_set (G_OBJECT (s_ip4),
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
@@ -973,7 +973,7 @@ test_connection_diff_no_secrets (void)
b = nm_connection_duplicate (a);
/* Add a secret to B */
s_pppoe = nm_connection_get_setting (b, NM_TYPE_SETTING_PPPOE);
s_pppoe = NM_SETTING (nm_connection_get_setting_pppoe (b));
g_assert (s_pppoe);
g_object_set (G_OBJECT (s_pppoe),
NM_SETTING_PPPOE_PASSWORD, "secretpassword",

View File

@@ -527,7 +527,7 @@ test_update_secrets_wifi_single_setting (void)
g_assert (success);
/* Make sure the secret is now in the connection */
s_wsec = (NMSettingWirelessSecurity *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY);
s_wsec = nm_connection_get_setting_wireless_security (connection);
g_assert (s_wsec);
tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 0);
g_assert_cmpstr (tmp, ==, wepkey);
@@ -563,7 +563,7 @@ test_update_secrets_wifi_full_hash (void)
g_assert (success);
/* Make sure the secret is now in the connection */
s_wsec = (NMSettingWirelessSecurity *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY);
s_wsec = nm_connection_get_setting_wireless_security (connection);
g_assert (s_wsec);
tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 0);
g_assert_cmpstr (tmp, ==, wepkey);

View File

@@ -941,7 +941,7 @@ nm_utils_complete_generic (NMConnection *connection,
const char *method;
char *id, *uuid;
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
if (!s_con) {
s_con = (NMSettingConnection *) nm_setting_connection_new ();
nm_connection_add_setting (connection, NM_SETTING (s_con));
@@ -962,7 +962,7 @@ nm_utils_complete_generic (NMConnection *connection,
}
/* Add an 'auto' IPv4 connection if present */
s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (!s_ip4) {
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
@@ -975,7 +975,7 @@ nm_utils_complete_generic (NMConnection *connection,
}
/* Add an 'auto' IPv6 setting if allowed and not preset */
s_ip6 = (NMSettingIP6Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG);
s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (!s_ip6 && default_enable_ipv6) {
s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));

View File

@@ -169,7 +169,7 @@ create_connect_properties (NMConnection *connection)
GHashTable *properties;
const char *str;
setting = NM_SETTING_CDMA (nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA));
setting = nm_connection_get_setting_cdma (connection);
properties = value_hash_create ();
str = nm_setting_cdma_get_number (setting);
@@ -230,7 +230,7 @@ real_get_best_auto_connection (NMModem *modem,
NMConnection *connection = NM_CONNECTION (iter->data);
NMSettingConnection *s_con;
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (!nm_setting_connection_get_autoconnect (s_con))
@@ -252,7 +252,7 @@ real_check_connection_compatible (NMModem *modem,
NMSettingConnection *s_con;
NMSettingCdma *s_cdma;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_CDMA_SETTING_NAME)) {
@@ -262,7 +262,7 @@ real_check_connection_compatible (NMModem *modem,
return FALSE;
}
s_cdma = NM_SETTING_CDMA (nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA));
s_cdma = nm_connection_get_setting_cdma (connection);
if (!s_cdma) {
g_set_error (error,
NM_CDMA_ERROR, NM_CDMA_ERROR_CONNECTION_INVALID,
@@ -281,7 +281,7 @@ real_complete_connection (NMModem *modem,
{
NMSettingCdma *s_cdma;
s_cdma = (NMSettingCdma *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA);
s_cdma = nm_connection_get_setting_cdma (connection);
if (!s_cdma) {
s_cdma = (NMSettingCdma *) nm_setting_cdma_new ();
nm_connection_add_setting (connection, NM_SETTING (s_cdma));
@@ -308,7 +308,7 @@ real_get_user_pass (NMModem *modem,
{
NMSettingCdma *s_cdma;
s_cdma = (NMSettingCdma *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA);
s_cdma = nm_connection_get_setting_cdma (connection);
if (!s_cdma)
return FALSE;

View File

@@ -349,7 +349,7 @@ create_connect_properties (NMConnection *connection)
GHashTable *properties;
const char *str;
setting = NM_SETTING_GSM (nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM));
setting = nm_connection_get_setting_gsm (connection);
properties = value_hash_create ();
str = nm_setting_gsm_get_number (setting);
@@ -451,7 +451,7 @@ real_get_best_auto_connection (NMModem *modem,
NMConnection *connection = NM_CONNECTION (iter->data);
NMSettingConnection *s_con;
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (!nm_setting_connection_get_autoconnect (s_con))
@@ -473,7 +473,7 @@ real_check_connection_compatible (NMModem *modem,
NMSettingConnection *s_con;
NMSettingGsm *s_gsm;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_GSM_SETTING_NAME)) {
@@ -483,7 +483,7 @@ real_check_connection_compatible (NMModem *modem,
return FALSE;
}
s_gsm = NM_SETTING_GSM (nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM));
s_gsm = nm_connection_get_setting_gsm (connection);
if (!s_gsm) {
g_set_error (error,
NM_GSM_ERROR, NM_GSM_ERROR_CONNECTION_INVALID,
@@ -502,7 +502,7 @@ real_complete_connection (NMModem *modem,
{
NMSettingGsm *s_gsm;
s_gsm = (NMSettingGsm *) nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM);
s_gsm = nm_connection_get_setting_gsm (connection);
if (!s_gsm || !nm_setting_gsm_get_apn (s_gsm)) {
/* Need an APN at least */
g_set_error_literal (error,
@@ -533,7 +533,7 @@ real_get_user_pass (NMModem *modem,
{
NMSettingGsm *s_gsm;
s_gsm = (NMSettingGsm *) nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM);
s_gsm = nm_connection_get_setting_gsm (connection);
if (!s_gsm)
return FALSE;

View File

@@ -154,7 +154,7 @@ get_connection_bt_type (NMConnection *connection)
NMSettingBluetooth *s_bt;
const char *bt_type;
s_bt = (NMSettingBluetooth *) nm_connection_get_setting (connection, NM_TYPE_SETTING_BLUETOOTH);
s_bt = nm_connection_get_setting_bluetooth (connection);
if (!s_bt)
return NM_BT_CAPABILITY_NONE;
@@ -182,7 +182,7 @@ real_get_best_auto_connection (NMDevice *device,
NMSettingConnection *s_con;
guint32 bt_type;
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (!nm_setting_connection_get_autoconnect (s_con))
@@ -213,7 +213,7 @@ real_check_connection_compatible (NMDevice *device,
int addr_match = FALSE;
guint32 bt_type;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_BLUETOOTH_SETTING_NAME)) {
@@ -223,7 +223,7 @@ real_check_connection_compatible (NMDevice *device,
return FALSE;
}
s_bt = NM_SETTING_BLUETOOTH (nm_connection_get_setting (connection, NM_TYPE_SETTING_BLUETOOTH));
s_bt = nm_connection_get_setting_bluetooth (connection);
if (!s_bt) {
g_set_error (error,
NM_BT_ERROR, NM_BT_ERROR_CONNECTION_INVALID,
@@ -275,12 +275,12 @@ real_complete_connection (NMDevice *device,
NMSettingPPP *s_ppp;
const char *format = NULL, *preferred = NULL;
s_gsm = (NMSettingGsm *) nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM);
s_cdma = (NMSettingCdma *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA);
s_gsm = nm_connection_get_setting_gsm (connection);
s_cdma = nm_connection_get_setting_cdma (connection);
s_serial = (NMSettingSerial *) nm_connection_get_setting (connection, NM_TYPE_SETTING_SERIAL);
s_ppp = (NMSettingPPP *) nm_connection_get_setting (connection, NM_TYPE_SETTING_PPP);
s_ppp = nm_connection_get_setting_ppp (connection);
s_bt = (NMSettingBluetooth *) nm_connection_get_setting (connection, NM_TYPE_SETTING_BLUETOOTH);
s_bt = nm_connection_get_setting_bluetooth (connection);
if (!s_bt) {
s_bt = (NMSettingBluetooth *) nm_setting_bluetooth_new ();
nm_connection_add_setting (connection, NM_SETTING (s_bt));

View File

@@ -650,7 +650,7 @@ real_get_best_auto_connection (NMDevice *dev,
const GSList *mac_blacklist, *mac_blacklist_iter;
gboolean mac_blacklist_found = FALSE;
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
connection_type = nm_setting_connection_get_connection_type (s_con);
@@ -670,7 +670,7 @@ real_get_best_auto_connection (NMDevice *dev,
if (!nm_setting_connection_get_autoconnect (s_con))
continue;
s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
s_wired = nm_connection_get_setting_wired (connection);
/* Wired setting optional for PPPoE */
if (!is_pppoe && !s_wired)
continue;
@@ -881,7 +881,7 @@ build_supplicant_config (NMDeviceEthernet *self)
if (!config)
return NULL;
security = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
security = nm_connection_get_setting_802_1x (connection);
if (!nm_supplicant_config_add_setting_8021x (config, security, con_path, TRUE)) {
nm_log_warn (LOGD_DEVICE, "Couldn't add 802.1X security setting to supplicant config.");
g_object_unref (config);
@@ -1149,7 +1149,7 @@ nm_8021x_stage2_config (NMDeviceEthernet *self, NMDeviceStateReason *reason)
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
connection = nm_act_request_get_connection (nm_device_get_act_request (NM_DEVICE (self)));
security = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
security = nm_connection_get_setting_802_1x (connection);
if (!security) {
nm_log_err (LOGD_DEVICE, "Invalid or missing 802.1X security");
*reason = NM_DEVICE_STATE_REASON_CONFIG_FAILED;
@@ -1235,7 +1235,7 @@ pppoe_stage3_ip4_config_start (NMDeviceEthernet *self, NMDeviceStateReason *reas
connection = nm_act_request_get_connection (req);
g_assert (req);
s_pppoe = (NMSettingPPPOE *) nm_connection_get_setting (connection, NM_TYPE_SETTING_PPPOE);
s_pppoe = nm_connection_get_setting_pppoe (connection);
g_assert (s_pppoe);
priv->ppp_manager = nm_ppp_manager_new (nm_device_get_iface (NM_DEVICE (self)));
@@ -1370,7 +1370,7 @@ real_check_connection_compatible (NMDevice *device,
gboolean try_mac = TRUE;
const GSList *mac_blacklist, *mac_blacklist_iter;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
connection_type = nm_setting_connection_get_connection_type (s_con);
@@ -1389,7 +1389,7 @@ real_check_connection_compatible (NMDevice *device,
if (!strcmp (connection_type, NM_SETTING_BOND_SETTING_NAME))
is_bond = TRUE;
s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
s_wired = nm_connection_get_setting_wired (connection);
/* Wired setting is optional for PPPoE */
if (!is_pppoe && !s_wired && !is_bond) {
g_set_error (error,
@@ -1451,7 +1451,7 @@ real_complete_connection (NMDevice *device,
NMSettingPPPOE *s_pppoe;
const GByteArray *setting_mac;
s_pppoe = (NMSettingPPPOE *) nm_connection_get_setting (connection, NM_TYPE_SETTING_PPPOE);
s_pppoe = nm_connection_get_setting_pppoe (connection);
/* We can't telepathically figure out the service name or username, so if
* those weren't given, we can't complete the connection.
@@ -1469,7 +1469,7 @@ real_complete_connection (NMDevice *device,
NULL,
s_pppoe ? FALSE : TRUE); /* No IPv6 by default yet for PPPoE */
s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
s_wired = nm_connection_get_setting_wired (connection);
if (!s_wired) {
s_wired = (NMSettingWired *) nm_setting_wired_new ();
nm_connection_add_setting (connection, NM_SETTING (s_wired));
@@ -1526,7 +1526,7 @@ wired_match_config (NMDevice *self, NMConnection *connection)
const GByteArray *s_ether;
gboolean try_mac = TRUE;
s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
s_wired = nm_connection_get_setting_wired (connection);
if (!s_wired)
return FALSE;
@@ -1556,7 +1556,7 @@ connection_match_config (NMDevice *self, const GSList *connections)
for (iter = connections; iter; iter = iter->next) {
NMConnection *candidate = NM_CONNECTION (iter->data);
s_con = (NMSettingConnection *) nm_connection_get_setting (candidate, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (candidate);
g_assert (s_con);
if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_WIRED_SETTING_NAME))
continue;
@@ -1564,8 +1564,8 @@ connection_match_config (NMDevice *self, const GSList *connections)
/* Can't assume 802.1x or PPPoE connections; they have too much state
* that's impossible to get on-the-fly from PPPoE or the supplicant.
*/
if ( nm_connection_get_setting (candidate, NM_TYPE_SETTING_802_1X)
|| nm_connection_get_setting (candidate, NM_TYPE_SETTING_PPPOE))
if ( nm_connection_get_setting_802_1x (candidate)
|| nm_connection_get_setting_pppoe (candidate))
continue;
if (!wired_match_config (self, candidate))

View File

@@ -261,7 +261,7 @@ real_check_connection_compatible (NMDevice *device,
NMSettingConnection *s_con;
NMSettingOlpcMesh *s_mesh;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_OLPC_MESH_SETTING_NAME)) {
@@ -271,7 +271,7 @@ real_check_connection_compatible (NMDevice *device,
return FALSE;
}
s_mesh = NM_SETTING_OLPC_MESH (nm_connection_get_setting (connection, NM_TYPE_SETTING_OLPC_MESH));
s_mesh = nm_connection_get_setting_olpc_mesh (connection);
if (!s_mesh) {
g_set_error (error,
NM_OLPC_MESH_ERROR, NM_OLPC_MESH_ERROR_CONNECTION_INVALID,
@@ -294,7 +294,7 @@ real_complete_connection (NMDevice *device,
NMSettingOlpcMesh *s_mesh;
GByteArray *tmp;
s_mesh = (NMSettingOlpcMesh *) nm_connection_get_setting (connection, NM_TYPE_SETTING_OLPC_MESH);
s_mesh = nm_connection_get_setting_olpc_mesh (connection);
if (!s_mesh) {
s_mesh = (NMSettingOlpcMesh *) nm_setting_olpc_mesh_new ();
nm_connection_add_setting (connection, NM_SETTING (s_mesh));
@@ -439,7 +439,7 @@ real_act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason)
connection = nm_act_request_get_connection (req);
g_assert (connection);
s_mesh = NM_SETTING_OLPC_MESH (nm_connection_get_setting (connection, NM_TYPE_SETTING_OLPC_MESH));
s_mesh = nm_connection_get_setting_olpc_mesh (connection);
g_assert (s_mesh);
channel = nm_setting_olpc_mesh_get_channel (s_mesh);

View File

@@ -975,7 +975,7 @@ real_check_connection_compatible (NMDevice *device,
const GByteArray *mac;
const GSList *mac_blacklist, *mac_blacklist_iter;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_WIRELESS_SETTING_NAME)) {
@@ -985,7 +985,7 @@ real_check_connection_compatible (NMDevice *device,
return FALSE;
}
s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS));
s_wireless = nm_connection_get_setting_wireless (connection);
if (!s_wireless) {
g_set_error (error,
NM_WIFI_ERROR, NM_WIFI_ERROR_CONNECTION_INVALID,
@@ -1272,7 +1272,7 @@ real_get_best_auto_connection (NMDevice *dev,
NMSettingIP4Config *s_ip4;
const char *method = NULL;
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
if (s_con == NULL)
continue;
if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_WIRELESS_SETTING_NAME))
@@ -1280,7 +1280,7 @@ real_get_best_auto_connection (NMDevice *dev,
if (!nm_setting_connection_get_autoconnect (s_con))
continue;
s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
s_wireless = nm_connection_get_setting_wireless (connection);
if (!s_wireless)
continue;
@@ -1308,7 +1308,7 @@ real_get_best_auto_connection (NMDevice *dev,
continue;
/* Use the connection if it's a shared connection */
s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (s_ip4)
method = nm_setting_ip4_config_get_method (s_ip4);
@@ -1433,7 +1433,7 @@ scanning_allowed (NMDeviceWifi *self)
/* Don't scan when a shared connection is active; it makes drivers mad */
connection = nm_act_request_get_connection (req);
s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (s_ip4)
ip4_method = nm_setting_ip4_config_get_method (s_ip4);
@@ -1444,7 +1444,7 @@ scanning_allowed (NMDeviceWifi *self)
* intra-ESS roaming (which requires periodic scanning) isn't being
* used due to the specific AP lock. (bgo #513820)
*/
s_wifi = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
s_wifi = nm_connection_get_setting_wireless (connection);
g_assert (s_wifi);
bssid = nm_setting_wireless_get_bssid (s_wifi);
if (bssid && bssid->len == ETH_ALEN)
@@ -2347,7 +2347,7 @@ build_supplicant_config (NMDeviceWifi *self,
g_return_val_if_fail (self != NULL, NULL);
s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
s_wireless = nm_connection_get_setting_wireless (connection);
g_return_val_if_fail (s_wireless != NULL, NULL);
config = nm_supplicant_config_new ();
@@ -2388,13 +2388,13 @@ build_supplicant_config (NMDeviceWifi *self,
goto error;
}
s_wireless_sec = (NMSettingWirelessSecurity *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY);
s_wireless_sec = nm_connection_get_setting_wireless_security (connection);
if (s_wireless_sec) {
NMSetting8021x *s_8021x;
const char *con_path = nm_connection_get_path (connection);
g_assert (con_path);
s_8021x = (NMSetting8021x *) nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X);
s_8021x = nm_connection_get_setting_802_1x (connection);
if (!nm_supplicant_config_add_setting_wireless_security (config,
s_wireless_sec,
s_8021x,
@@ -2532,7 +2532,7 @@ real_act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
g_return_val_if_fail (connection != NULL, NM_ACT_STAGE_RETURN_FAILURE);
/* Set spoof MAC to the interface */
s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
s_wireless = nm_connection_get_setting_wireless (connection);
g_assert (s_wireless);
cloned_mac = nm_setting_wireless_get_cloned_mac_address (s_wireless);
@@ -2608,7 +2608,7 @@ real_act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason)
connection = nm_act_request_get_connection (req);
g_assert (connection);
s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
s_wireless = nm_connection_get_setting_wireless (connection);
g_assert (s_wireless);
/* If we need secrets, get them */
@@ -2791,7 +2791,7 @@ real_act_stage4_ip4_config_timeout (NMDevice *dev, NMDeviceStateReason *reason)
connection = nm_act_request_get_connection (req);
g_assert (connection);
s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (s_ip4)
may_fail = nm_setting_ip4_config_get_may_fail (s_ip4);
@@ -2816,7 +2816,7 @@ real_act_stage4_ip6_config_timeout (NMDevice *dev, NMDeviceStateReason *reason)
connection = nm_act_request_get_connection (req);
g_assert (connection);
s_ip6 = (NMSettingIP6Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG);
s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (s_ip6)
may_fail = nm_setting_ip6_config_get_may_fail (s_ip6);

View File

@@ -1491,7 +1491,7 @@ dhcp4_start (NMDevice *self,
NMSettingIP4Config *s_ip4;
guint8 *anycast = NULL;
s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (priv->dhcp_anycast_address)
anycast = priv->dhcp_anycast_address->data;
@@ -3471,7 +3471,7 @@ dispose (GObject *object)
* All IPv6 connections can be left up, so we don't have
* to check that.
*/
s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (s_ip4)
method = nm_setting_ip4_config_get_method (s_ip4);
if ( !method

View File

@@ -541,7 +541,7 @@ nm_auth_uid_in_acl (NMConnection *connection,
g_return_val_if_fail (connection != NULL, FALSE);
g_return_val_if_fail (smon != NULL, FALSE);
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
/* Reject the request if the request comes from no session at all */

View File

@@ -653,11 +653,11 @@ might_be_vpn (NMConnection *connection)
NMSettingConnection *s_con;
const char *ctype = NULL;
if (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN))
if (nm_connection_get_setting_vpn (connection))
return TRUE;
/* Make sure it's not a VPN, which we can't autocomplete yet */
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
if (s_con)
ctype = nm_setting_connection_get_connection_type (s_con);
@@ -669,7 +669,7 @@ try_complete_vpn (NMConnection *connection, GSList *existing, GError **error)
{
g_assert (might_be_vpn (connection) == TRUE);
if (!nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN)) {
if (!nm_connection_get_setting_vpn (connection)) {
g_set_error_literal (error,
NM_MANAGER_ERROR,
NM_MANAGER_ERROR_UNSUPPORTED_CONNECTION_TYPE,
@@ -1655,14 +1655,14 @@ bluez_manager_find_connection (NMManager *manager,
const char *con_type;
const char *bt_type;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (candidate, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (candidate);
g_assert (s_con);
con_type = nm_setting_connection_get_connection_type (s_con);
g_assert (con_type);
if (!g_str_equal (con_type, NM_SETTING_BLUETOOTH_SETTING_NAME))
continue;
s_bt = (NMSettingBluetooth *) nm_connection_get_setting (candidate, NM_TYPE_SETTING_BLUETOOTH);
s_bt = nm_connection_get_setting_bluetooth (candidate);
if (!s_bt)
continue;
@@ -2030,7 +2030,7 @@ nm_manager_activate_connection (NMManager *manager,
}
}
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (!strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_VPN_SETTING_NAME)) {

View File

@@ -114,7 +114,7 @@ get_best_ip4_device (NMManager *manager, NMActRequest **out_req)
g_assert (connection);
/* Never set the default route through an IPv4LL-addressed device */
s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (s_ip4)
method = nm_setting_ip4_config_get_method (s_ip4);
@@ -189,7 +189,7 @@ get_best_ip6_device (NMManager *manager, NMActRequest **out_req)
g_assert (connection);
/* Never set the default route through an IPv4LL-addressed device */
s_ip6 = (NMSettingIP6Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG);
s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (s_ip6)
method = nm_setting_ip6_config_get_method (s_ip6);
@@ -469,7 +469,7 @@ update_ip4_routing_and_dns (NMPolicy *policy, gboolean force_update)
can_default = FALSE;
/* Check the user's preference from the NMConnection */
s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (vpn_connection, NM_TYPE_SETTING_IP4_CONFIG);
s_ip4 = nm_connection_get_setting_ip4_config (vpn_connection);
if (s_ip4 && nm_setting_ip4_config_get_never_default (s_ip4))
can_default = FALSE;
@@ -545,7 +545,7 @@ update_ip4_routing_and_dns (NMPolicy *policy, gboolean force_update)
nm_act_request_set_default (best_req, TRUE);
if (connection)
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
connection_id = s_con ? nm_setting_connection_get_id (s_con) : NULL;
if (connection_id) {
@@ -596,7 +596,7 @@ update_ip6_routing_and_dns (NMPolicy *policy, gboolean force_update)
/* If it's marked 'never-default', don't make it default */
vpn_connection = nm_vpn_connection_get_connection (candidate);
g_assert (vpn_connection);
s_ip6 = (NMSettingIP6Config *) nm_connection_get_setting (vpn_connection, NM_TYPE_SETTING_IP6_CONFIG);
s_ip6 = nm_connection_get_setting_ip6_config (vpn_connection);
if (s_ip6 && nm_setting_ip6_config_get_never_default (s_ip6))
can_default = FALSE;
@@ -672,7 +672,7 @@ update_ip6_routing_and_dns (NMPolicy *policy, gboolean force_update)
nm_act_request_set_default6 (best_req, TRUE);
if (connection)
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
connection_id = s_con ? nm_setting_connection_get_id (s_con) : NULL;
if (connection_id) {

View File

@@ -634,7 +634,7 @@ nm_ap_new_fake_from_connection (NMConnection *connection)
g_return_val_if_fail (connection != NULL, NULL);
s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS));
s_wireless = nm_connection_get_setting_wireless (connection);
g_return_val_if_fail (s_wireless != NULL, NULL);
ssid = nm_setting_wireless_get_ssid (s_wireless);
@@ -671,7 +671,7 @@ nm_ap_new_fake_from_connection (NMConnection *connection)
nm_ap_set_freq (ap, freq);
}
s_wireless_sec = (NMSettingWirelessSecurity *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY);
s_wireless_sec = nm_connection_get_setting_wireless_security (connection);
/* Assume presence of a security setting means the AP is encrypted */
if (!s_wireless_sec)
goto done;
@@ -1129,7 +1129,7 @@ nm_ap_check_compatible (NMAccessPoint *self,
priv = NM_AP_GET_PRIVATE (self);
s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS));
s_wireless = nm_connection_get_setting_wireless (connection);
if (s_wireless == NULL)
return FALSE;
@@ -1167,8 +1167,7 @@ nm_ap_check_compatible (NMAccessPoint *self,
return FALSE;
}
s_wireless_sec = (NMSettingWirelessSecurity *) nm_connection_get_setting (connection,
NM_TYPE_SETTING_WIRELESS_SECURITY);
s_wireless_sec = nm_connection_get_setting_wireless_security (connection);
return nm_setting_wireless_ap_security_compatible (s_wireless,
s_wireless_sec,

View File

@@ -374,7 +374,7 @@ extract_details_from_connection (NMConnection *connection,
g_return_val_if_fail (username != NULL, FALSE);
g_return_val_if_fail (password != NULL, FALSE);
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
connection_type = nm_setting_connection_get_connection_type (s_con);
@@ -579,7 +579,7 @@ impl_ppp_manager_set_ip4_config (NMPPPManager *manager,
g_object_set_data (G_OBJECT (connection), PPP_MANAGER_SECRET_TRIES, NULL);
/* Merge in custom MTU */
s_ppp = (NMSettingPPP *) nm_connection_get_setting (connection, NM_TYPE_SETTING_PPP);
s_ppp = nm_connection_get_setting_ppp (connection);
if (s_ppp) {
guint32 mtu = nm_setting_ppp_get_mtu (s_ppp);
@@ -999,7 +999,7 @@ nm_ppp_manager_start (NMPPPManager *manager,
connection = nm_act_request_get_connection (req);
g_assert (connection);
s_ppp = (NMSettingPPP *) nm_connection_get_setting (connection, NM_TYPE_SETTING_PPP);
s_ppp = nm_connection_get_setting_ppp (connection);
if (!s_ppp) {
/* If the PPP settings are all default we may not have a PPP setting yet,
* so just make a default one here.
@@ -1008,7 +1008,7 @@ nm_ppp_manager_start (NMPPPManager *manager,
s_ppp_created = TRUE;
}
pppoe_setting = (NMSettingPPPOE *) nm_connection_get_setting (connection, NM_TYPE_SETTING_PPPOE);
pppoe_setting = nm_connection_get_setting_pppoe (connection);
if (pppoe_setting)
pppoe_fill_defaults (s_ppp);

View File

@@ -962,7 +962,7 @@ get_next_cb (Request *req)
* we use the 'modify.own' permission instead of 'modify.system'. If the
* request affects more than just the caller, require 'modify.system'.
*/
s_con = (NMSettingConnection *) nm_connection_get_setting (req->connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (req->connection);
g_assert (s_con);
if (nm_setting_connection_get_num_permissions (s_con) == 1)
perm = NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN;

View File

@@ -221,7 +221,7 @@ nm_settings_connection_recheck_visibility (NMSettingsConnection *self)
priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
s_con = (NMSettingConnection *) nm_connection_get_setting (NM_CONNECTION (self), NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (NM_CONNECTION (self));
g_assert (s_con);
/* Check every user in the ACL for a session */
@@ -1024,7 +1024,7 @@ check_writable (NMConnection *connection, GError **error)
g_return_val_if_fail (connection != NULL, FALSE);
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
if (!s_con) {
g_set_error_literal (error,
NM_SETTINGS_ERROR,
@@ -1175,11 +1175,11 @@ get_modify_permission_update (NMConnection *old, NMConnection *new)
NMSettingConnection *s_con;
guint32 orig_num = 0, new_num = 0;
s_con = (NMSettingConnection *) nm_connection_get_setting (old, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (old);
g_assert (s_con);
orig_num = nm_setting_connection_get_num_permissions (s_con);
s_con = (NMSettingConnection *) nm_connection_get_setting (new, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (new);
g_assert (s_con);
new_num = nm_setting_connection_get_num_permissions (s_con);
@@ -1283,7 +1283,7 @@ get_modify_permission_basic (NMSettingsConnection *connection)
* we use the 'modify.own' permission instead of 'modify.system'. If the
* request affects more than just the caller, require 'modify.system'.
*/
s_con = (NMSettingConnection *) nm_connection_get_setting (NM_CONNECTION (connection), NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (NM_CONNECTION (connection));
g_assert (s_con);
if (nm_setting_connection_get_num_permissions (s_con) == 1)
return NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN;

View File

@@ -269,9 +269,9 @@ connection_sort (gconstpointer pa, gconstpointer pb)
NMSettingConnection *con_b;
guint64 ts_a, ts_b;
con_a = (NMSettingConnection *) nm_connection_get_setting (a, NM_TYPE_SETTING_CONNECTION);
con_a = nm_connection_get_setting_connection (a);
g_assert (con_a);
con_b = (NMSettingConnection *) nm_connection_get_setting (b, NM_TYPE_SETTING_CONNECTION);
con_b = nm_connection_get_setting_connection (b);
g_assert (con_b);
if (nm_setting_connection_get_autoconnect (con_a) != nm_setting_connection_get_autoconnect (con_b)) {
@@ -1092,7 +1092,7 @@ nm_settings_add_connection (NMSettings *self,
* we use the 'modify.own' permission instead of 'modify.system'. If the
* request affects more than just the caller, require 'modify.system'.
*/
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (nm_setting_connection_get_num_permissions (s_con) == 1)
perm = NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN;
@@ -1363,8 +1363,7 @@ default_wired_deleted (NMDefaultWiredConnection *wired,
* connection for that device again.
*/
s_con = (NMSettingConnection *) nm_connection_get_setting (NM_CONNECTION (wired),
NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (NM_CONNECTION (wired));
g_assert (s_con);
/* Ignore removals of read-only connections, since they couldn't have

View File

@@ -569,7 +569,7 @@ impl_ifcfgrh_get_ifcfg_details (SCPluginIfcfg *plugin,
return FALSE;
}
s_con = (NMSettingConnection *) nm_connection_get_setting (NM_CONNECTION (connection), NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (NM_CONNECTION (connection));
if (!s_con) {
g_set_error (error,
NM_SETTINGS_ERROR,

File diff suppressed because it is too large Load Diff

View File

@@ -456,7 +456,7 @@ write_8021x_setting (NMConnection *connection,
gboolean success = FALSE;
GString *phase2_auth;
s_8021x = (NMSetting8021x *) nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X);
s_8021x = nm_connection_get_setting_802_1x (connection);
if (!s_8021x) {
/* If wired, clear KEY_MGMT */
if (wired)
@@ -554,7 +554,7 @@ write_wireless_security_setting (NMConnection *connection,
guint32 i, num;
GString *str;
s_wsec = (NMSettingWirelessSecurity *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY);
s_wsec = nm_connection_get_setting_wireless_security (connection);
if (!s_wsec) {
g_set_error (error, IFCFG_PLUGIN_ERROR, 0,
"Missing '%s' setting", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
@@ -761,7 +761,7 @@ write_wireless_setting (NMConnection *connection,
gboolean adhoc = FALSE, hex_ssid = FALSE;
const GSList *macaddr_blacklist;
s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
s_wireless = nm_connection_get_setting_wireless (connection);
if (!s_wireless) {
g_set_error (error, IFCFG_PLUGIN_ERROR, 0,
"Missing '%s' setting", NM_SETTING_WIRELESS_SETTING_NAME);
@@ -955,7 +955,7 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
GString *str;
const GSList *macaddr_blacklist;
s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
s_wired = nm_connection_get_setting_wired (connection);
if (!s_wired) {
g_set_error (error, IFCFG_PLUGIN_ERROR, 0,
"Missing '%s' setting", NM_SETTING_WIRED_SETTING_NAME);
@@ -1174,7 +1174,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
gboolean fake_ip4 = FALSE;
const char *method = NULL;
s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (s_ip4)
method = nm_setting_ip4_config_get_method (s_ip4);
@@ -1511,7 +1511,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
GString *ip_str1, *ip_str2, *ip_ptr;
char *route6_path;
s_ip6 = (NMSettingIP6Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG);
s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (!s_ip6) {
g_set_error (error, IFCFG_PLUGIN_ERROR, 0,
"Missing '%s' setting", NM_SETTING_IP6_CONFIG_SETTING_NAME);
@@ -1589,7 +1589,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
}
/* Write out DNS - 'DNS' key is used both for IPv4 and IPv6 */
s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
s_ip4 = nm_connection_get_setting_ip4_config (connection);
num4 = s_ip4 ? nm_setting_ip4_config_get_num_dns (s_ip4) : 0; /* from where to start with IPv6 entries */
num = nm_setting_ip6_config_get_num_dns (s_ip6);
for (i = 0; i < 254; i++) {
@@ -1701,7 +1701,7 @@ write_connection (NMConnection *connection,
gboolean no_8021x = FALSE;
gboolean wired = FALSE;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
if (!s_con) {
g_set_error (error, IFCFG_PLUGIN_ERROR, 0,
"Missing '%s' setting", NM_SETTING_CONNECTION_SETTING_NAME);
@@ -1761,7 +1761,7 @@ write_connection (NMConnection *connection,
if (!strcmp (type, NM_SETTING_WIRED_SETTING_NAME)) {
// FIXME: can't write PPPoE at this time
if (nm_connection_get_setting (connection, NM_TYPE_SETTING_PPPOE)) {
if (nm_connection_get_setting_pppoe (connection)) {
g_set_error (error, IFCFG_PLUGIN_ERROR, 0,
"Can't write connection type '%s'",
NM_SETTING_PPPOE_SETTING_NAME);
@@ -1788,7 +1788,7 @@ write_connection (NMConnection *connection,
if (!write_ip4_setting (connection, ifcfg, error))
goto out;
s_ip6 = (NMSettingIP6Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG);
s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (s_ip6) {
if (!write_ip6_setting (connection, ifcfg, error))
goto out;

View File

@@ -69,9 +69,7 @@ update_connection_id (NMConnection *connection, const char *conn_name)
idstr = g_strdup_printf ("%s (%s)", get_prefix (), conn_name);
uuid_base = idstr;
uuid = nm_utils_uuid_generate_from_string (uuid_base);
setting =
(NMSettingConnection *) nm_connection_get_setting (connection,
NM_TYPE_SETTING_CONNECTION);
setting = nm_connection_get_setting_connection (connection);
g_object_set (setting, NM_SETTING_CONNECTION_ID, idstr,
NM_SETTING_CONNECTION_UUID, uuid, NULL);
PLUGIN_PRINT (IFNET_PLUGIN_NAME,
@@ -1660,9 +1658,7 @@ ifnet_update_connection_from_config_block (const char *conn_name, GError **error
connection = nm_connection_new ();
if (!connection)
return NULL;
setting =
(NMSettingConnection *) nm_connection_get_setting (connection,
NM_TYPE_SETTING_CONNECTION);
setting = nm_connection_get_setting_connection (connection);
if (!setting) {
setting = NM_SETTING_CONNECTION (nm_setting_connection_new ());
g_assert (setting);
@@ -2015,10 +2011,7 @@ write_8021x_setting (NMConnection *connection,
GString *phase2_auth;
GString *phase1;
s_8021x =
(NMSetting8021x *) nm_connection_get_setting (connection,
NM_TYPE_SETTING_802_1X);
s_8021x = nm_connection_get_setting_802_1x (connection);
if (!s_8021x) {
return TRUE;
}
@@ -2113,9 +2106,7 @@ write_wireless_security_setting (NMConnection * connection,
guint32 i, num;
GString *str;
s_wsec =
(NMSettingWirelessSecurity *) nm_connection_get_setting (connection,
NM_TYPE_SETTING_WIRELESS_SECURITY);
s_wsec = nm_connection_get_setting_wireless_security (connection);
if (!s_wsec) {
g_set_error (error, ifnet_plugin_error_quark (), 0,
"Missing '%s' setting",
@@ -2281,7 +2272,7 @@ write_wireless_setting (NMConnection *connection,
gboolean adhoc = FALSE, hex_ssid = FALSE;
gchar *ssid_str, *tmp;
s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
s_wireless = nm_connection_get_setting_wireless (connection);
if (!s_wireless) {
g_set_error (error, ifnet_plugin_error_quark (), 0,
"Missing '%s' setting",
@@ -2400,9 +2391,7 @@ write_wired_setting (NMConnection *connection,
char *tmp;
guint32 mtu;
s_wired =
(NMSettingWired *) nm_connection_get_setting (connection,
NM_TYPE_SETTING_WIRED);
s_wired = nm_connection_get_setting_wired (connection);
if (!s_wired) {
g_set_error (error, ifnet_plugin_error_quark (), 0,
"Missing '%s' setting",
@@ -2456,9 +2445,7 @@ write_ip4_setting (NMConnection *connection, const char *conn_name, GError **err
gboolean has_def_route = FALSE;
gboolean success = FALSE;
s_ip4 =
(NMSettingIP4Config *) nm_connection_get_setting (connection,
NM_TYPE_SETTING_IP4_CONFIG);
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (!s_ip4) {
g_set_error (error, ifnet_plugin_error_quark (), 0,
"Missing '%s' setting",
@@ -2662,9 +2649,7 @@ write_ip6_setting (NMConnection *connection, const char *conn_name, GError **err
NMIP6Address *addr;
const struct in6_addr *ip;
s_ip6 =
(NMSettingIP6Config *) nm_connection_get_setting (connection,
NM_TYPE_SETTING_IP6_CONFIG);
s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (!s_ip6) {
g_set_error (error, ifnet_plugin_error_quark (), 0,
"Missing '%s' setting",
@@ -2850,7 +2835,7 @@ ifnet_update_parsers_by_connection (NMConnection *connection,
NMSettingPPPOE *s_pppoe;
/* Writing pppoe setting */
s_pppoe = NM_SETTING_PPPOE (nm_connection_get_setting (connection, NM_TYPE_SETTING_PPPOE));
s_pppoe = nm_connection_get_setting_pppoe (connection);
if (!write_pppoe_setting (conn_name, s_pppoe))
goto out;
pppoe = TRUE;
@@ -2878,7 +2863,7 @@ ifnet_update_parsers_by_connection (NMConnection *connection,
if (!write_ip4_setting (connection, conn_name, error))
goto out;
s_ip6 = (NMSettingIP6Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG);
s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (s_ip6) {
/* IPv6 Setting */
if (!write_ip6_setting (connection, conn_name, error))
@@ -2966,9 +2951,7 @@ get_wireless_name (NMConnection * connection)
char buf[33];
int i = 0;
s_wireless =
(NMSettingWireless *) nm_connection_get_setting (connection,
NM_TYPE_SETTING_WIRELESS);
s_wireless = nm_connection_get_setting_wireless (connection);
if (!s_wireless)
return NULL;
@@ -3014,7 +2997,7 @@ ifnet_add_new_connection (NMConnection *connection,
const char *type;
gchar *new_type, *new_name = NULL;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
type = nm_setting_connection_get_connection_type (s_con);
g_assert (type);

View File

@@ -189,8 +189,7 @@ commit_cb (NMSettingsConnection *connection, GError *error, gpointer unused)
} else {
NMSettingConnection *s_con;
s_con = (NMSettingConnection *) nm_connection_get_setting (NM_CONNECTION (connection),
NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (NM_CONNECTION (connection));
g_assert (s_con);
PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Connection %s updated",
nm_setting_connection_get_id (s_con));

View File

@@ -311,8 +311,7 @@ update_wireless_security_setting_from_if_block(NMConnection *connection,
return;
}
s_wireless = NM_SETTING_WIRELESS(nm_connection_get_setting(connection,
NM_TYPE_SETTING_WIRELESS));
s_wireless = nm_connection_get_setting_wireless(connection);
g_return_if_fail(s_wireless);
PLUGIN_PRINT ("SCPlugin-Ifupdown","update wireless security settings (%s).", block->name);
@@ -537,7 +536,7 @@ ifupdown_update_connection_from_if_block (NMConnection *connection,
NMSettingConnection *s_con;
gboolean success = FALSE;
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
if(!s_con) {
s_con = NM_SETTING_CONNECTION (nm_setting_connection_new());
g_assert (s_con);

View File

@@ -188,8 +188,8 @@ bind_device_to_connection (SCPluginIfupdown *self,
NMIfupdownConnection *exported)
{
GByteArray *mac_address;
NMSetting *s_wired = NULL;
NMSetting *s_wifi = NULL;
NMSettingWired *s_wired;
NMSettingWireless *s_wifi;
const char *iface, *address;
iface = g_udev_device_get_name (device);
@@ -211,8 +211,8 @@ bind_device_to_connection (SCPluginIfupdown *self,
return;
}
s_wired = nm_connection_get_setting (NM_CONNECTION (exported), NM_TYPE_SETTING_WIRED);
s_wifi = nm_connection_get_setting (NM_CONNECTION (exported), NM_TYPE_SETTING_WIRELESS);
s_wired = nm_connection_get_setting_wired (NM_CONNECTION (exported));
s_wifi = nm_connection_get_setting_wireless (NM_CONNECTION (exported));
if (s_wired) {
PLUGIN_PRINT ("SCPluginIfupdown", "locking wired connection setting");
g_object_set (s_wired, NM_SETTING_WIRED_MAC_ADDRESS, mac_address, NULL);
@@ -426,13 +426,13 @@ SCPluginIfupdown_init (NMSystemConfigInterface *config)
keys = g_hash_table_get_keys (priv->iface_connections);
for (iter = keys; iter; iter = g_list_next (iter)) {
NMIfupdownConnection *exported;
NMSetting *setting;
NMSettingConnection *setting;
if (!g_hash_table_lookup (auto_ifaces, iter->data))
continue;
exported = g_hash_table_lookup (priv->iface_connections, iter->data);
setting = NM_SETTING (nm_connection_get_setting (NM_CONNECTION (exported), NM_TYPE_SETTING_CONNECTION));
setting = nm_connection_get_setting_connection (NM_CONNECTION (exported));
g_object_set (setting, NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, NULL);
nm_settings_connection_commit_changes (NM_SETTINGS_CONNECTION (exported), ignore_cb, NULL);

View File

@@ -1327,7 +1327,7 @@ nm_keyfile_plugin_connection_from_file (const char *filename, GError **error)
* the keyfile didn't include it, which can happen when the base
* device type setting is all default values (like ethernet).
*/
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
if (s_con) {
ctype = nm_setting_connection_get_connection_type (s_con);
setting = nm_connection_get_setting_by_name (connection, ctype);
@@ -1341,7 +1341,7 @@ nm_keyfile_plugin_connection_from_file (const char *filename, GError **error)
if (vpn_secrets) {
NMSettingVPN *s_vpn;
s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
s_vpn = nm_connection_get_setting_vpn (connection);
if (s_vpn)
read_vpn_secrets (key_file, s_vpn);
}

View File

@@ -95,7 +95,7 @@ test_read_valid_wired_connection (void)
/* ===== CONNECTION SETTING ===== */
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
ASSERT (s_con != NULL,
"connection-verify-connection", "failed to verify %s: missing %s setting",
TEST_WIRED_FILE,
@@ -144,7 +144,7 @@ test_read_valid_wired_connection (void)
/* ===== WIRED SETTING ===== */
s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED));
s_wired = nm_connection_get_setting_wired (connection);
ASSERT (s_wired != NULL,
"connection-verify-wired", "failed to verify %s: missing %s setting",
TEST_WIRED_FILE,
@@ -176,7 +176,7 @@ test_read_valid_wired_connection (void)
/* ===== IPv4 SETTING ===== */
s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG));
s_ip4 = nm_connection_get_setting_ip4_config (connection);
ASSERT (s_ip4 != NULL,
"connection-verify-ip4", "failed to verify %s: missing %s setting",
TEST_WIRED_FILE,
@@ -299,7 +299,7 @@ test_read_valid_wired_connection (void)
/* ===== IPv6 SETTING ===== */
s_ip6 = NM_SETTING_IP6_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG));
s_ip6 = nm_connection_get_setting_ip6_config (connection);
ASSERT (s_ip6 != NULL,
"connection-verify-ip6", "failed to verify %s: missing %s setting",
TEST_WIRED_FILE,
@@ -747,7 +747,7 @@ test_read_ip6_wired_connection (void)
/* ===== CONNECTION SETTING ===== */
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
ASSERT (s_con != NULL,
"connection-verify-connection", "failed to verify %s: missing %s setting",
TEST_WIRED_IP6_FILE,
@@ -781,7 +781,7 @@ test_read_ip6_wired_connection (void)
/* ===== WIRED SETTING ===== */
s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED));
s_wired = nm_connection_get_setting_wired (connection);
ASSERT (s_wired != NULL,
"connection-verify-wired", "failed to verify %s: missing %s setting",
TEST_WIRED_IP6_FILE,
@@ -789,7 +789,7 @@ test_read_ip6_wired_connection (void)
/* ===== IPv4 SETTING ===== */
s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG));
s_ip4 = nm_connection_get_setting_ip4_config (connection);
ASSERT (s_ip4 != NULL,
"connection-verify-ip4", "failed to verify %s: missing %s setting",
TEST_WIRED_IP6_FILE,
@@ -811,7 +811,7 @@ test_read_ip6_wired_connection (void)
/* ===== IPv6 SETTING ===== */
s_ip6 = NM_SETTING_IP6_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG));
s_ip6 = nm_connection_get_setting_ip6_config (connection);
ASSERT (s_ip6 != NULL,
"connection-verify-ip6", "failed to verify %s: missing %s setting",
TEST_WIRED_IP6_FILE,
@@ -1003,7 +1003,7 @@ test_read_wired_mac_case (void)
/* ===== CONNECTION SETTING ===== */
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
ASSERT (s_con != NULL,
"connection-verify-connection", "failed to verify %s: missing %s setting",
TEST_WIRED_MAC_CASE_FILE,
@@ -1037,7 +1037,7 @@ test_read_wired_mac_case (void)
/* ===== WIRED SETTING ===== */
s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED));
s_wired = nm_connection_get_setting_wired (connection);
ASSERT (s_wired != NULL,
"connection-verify-wired", "failed to verify %s: missing %s setting",
TEST_WIRED_MAC_CASE_FILE,
@@ -1089,7 +1089,7 @@ test_read_valid_wireless_connection (void)
/* ===== CONNECTION SETTING ===== */
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
ASSERT (s_con != NULL,
"connection-verify-connection", "failed to verify %s: missing %s setting",
TEST_WIRELESS_FILE,
@@ -1138,7 +1138,7 @@ test_read_valid_wireless_connection (void)
/* ===== WIRED SETTING ===== */
s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS));
s_wireless = nm_connection_get_setting_wireless (connection);
ASSERT (s_wireless != NULL,
"connection-verify-wireless", "failed to verify %s: missing %s setting",
TEST_WIRELESS_FILE,
@@ -1164,7 +1164,7 @@ test_read_valid_wireless_connection (void)
/* ===== IPv4 SETTING ===== */
s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG));
s_ip4 = nm_connection_get_setting_ip4_config (connection);
ASSERT (s_ip4 != NULL,
"connection-verify-ip4", "failed to verify %s: missing %s setting",
TEST_WIRELESS_FILE,
@@ -1317,7 +1317,7 @@ test_read_string_ssid (void)
/* ===== WIRELESS SETTING ===== */
s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS));
s_wireless = nm_connection_get_setting_wireless (connection);
ASSERT (s_wireless != NULL,
"connection-verify-wireless", "failed to verify %s: missing %s setting",
TEST_STRING_SSID_FILE,
@@ -1834,7 +1834,7 @@ test_read_bt_dun_connection (void)
/* ===== CONNECTION SETTING ===== */
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
ASSERT (s_con != NULL,
"connection-verify-connection", "failed to verify %s: missing %s setting",
TEST_BT_DUN_FILE,
@@ -1868,7 +1868,7 @@ test_read_bt_dun_connection (void)
/* ===== BLUETOOTH SETTING ===== */
s_bluetooth = NM_SETTING_BLUETOOTH (nm_connection_get_setting (connection, NM_TYPE_SETTING_BLUETOOTH));
s_bluetooth = nm_connection_get_setting_bluetooth (connection);
ASSERT (s_bluetooth != NULL,
"connection-verify-bt", "failed to verify %s: missing %s setting",
TEST_WIRELESS_FILE,
@@ -1907,7 +1907,7 @@ test_read_bt_dun_connection (void)
/* ===== GSM SETTING ===== */
s_gsm = NM_SETTING_GSM (nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM));
s_gsm = nm_connection_get_setting_gsm (connection);
ASSERT (s_gsm != NULL,
"connection-verify-gsm", "failed to verify %s: missing %s setting",
TEST_BT_DUN_FILE,
@@ -2083,7 +2083,7 @@ test_read_gsm_connection (void)
NMSettingConnection *s_con;
NMSettingSerial *s_serial;
NMSettingGsm *s_gsm;
NMSetting *s_bluetooth;
NMSettingBluetooth *s_bluetooth;
GError *error = NULL;
const char *tmp;
const char *expected_id = "AT&T Data Connect";
@@ -2102,7 +2102,7 @@ test_read_gsm_connection (void)
/* ===== CONNECTION SETTING ===== */
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
ASSERT (s_con != NULL,
"connection-verify-connection", "failed to verify %s: missing %s setting",
TEST_GSM_FILE,
@@ -2136,7 +2136,7 @@ test_read_gsm_connection (void)
/* ===== BLUETOOTH SETTING ===== */
/* Plain GSM, so no BT setting expected */
s_bluetooth = nm_connection_get_setting (connection, NM_TYPE_SETTING_BLUETOOTH);
s_bluetooth = nm_connection_get_setting_bluetooth (connection);
ASSERT (s_bluetooth == NULL,
"connection-verify-bt", "unexpected %s setting",
TEST_GSM_FILE,
@@ -2144,7 +2144,7 @@ test_read_gsm_connection (void)
/* ===== GSM SETTING ===== */
s_gsm = NM_SETTING_GSM (nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM));
s_gsm = nm_connection_get_setting_gsm (connection);
ASSERT (s_gsm != NULL,
"connection-verify-gsm", "failed to verify %s: missing %s setting",
TEST_GSM_FILE,
@@ -2326,7 +2326,7 @@ static void
test_read_wired_8021x_tls_blob_connection (void)
{
NMConnection *connection;
NMSetting *s_wired;
NMSettingWired *s_wired;
NMSetting8021x *s_8021x;
GError *error = NULL;
const char *tmp;
@@ -2348,11 +2348,11 @@ test_read_wired_8021x_tls_blob_connection (void)
}
/* ===== Wired Setting ===== */
s_wired = nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
s_wired = nm_connection_get_setting_wired (connection);
g_assert (s_wired != NULL);
/* ===== 802.1x Setting ===== */
s_8021x = (NMSetting8021x *) nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X);
s_8021x = nm_connection_get_setting_802_1x (connection);
g_assert (s_8021x != NULL);
g_assert (nm_setting_802_1x_get_num_eap_methods (s_8021x) == 1);
@@ -2391,7 +2391,7 @@ static void
test_read_wired_8021x_tls_bad_path_connection (void)
{
NMConnection *connection;
NMSetting *s_wired;
NMSettingWired *s_wired;
NMSetting8021x *s_8021x;
GError *error = NULL;
const char *tmp;
@@ -2413,11 +2413,11 @@ test_read_wired_8021x_tls_bad_path_connection (void)
}
/* ===== Wired Setting ===== */
s_wired = nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
s_wired = nm_connection_get_setting_wired (connection);
g_assert (s_wired != NULL);
/* ===== 802.1x Setting ===== */
s_8021x = (NMSetting8021x *) nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X);
s_8021x = nm_connection_get_setting_802_1x (connection);
g_assert (s_8021x != NULL);
g_assert (nm_setting_802_1x_get_num_eap_methods (s_8021x) == 1);
@@ -2453,7 +2453,7 @@ static void
test_read_wired_8021x_tls_old_connection (void)
{
NMConnection *connection;
NMSetting *s_wired;
NMSettingWired *s_wired;
NMSetting8021x *s_8021x;
GError *error = NULL;
const char *tmp;
@@ -2474,11 +2474,11 @@ test_read_wired_8021x_tls_old_connection (void)
}
/* ===== Wired Setting ===== */
s_wired = nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
s_wired = nm_connection_get_setting_wired (connection);
g_assert (s_wired != NULL);
/* ===== 802.1x Setting ===== */
s_8021x = (NMSetting8021x *) nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X);
s_8021x = nm_connection_get_setting_802_1x (connection);
g_assert (s_8021x != NULL);
g_assert (nm_setting_802_1x_get_num_eap_methods (s_8021x) == 1);
@@ -2509,7 +2509,7 @@ static void
test_read_wired_8021x_tls_new_connection (void)
{
NMConnection *connection;
NMSetting *s_wired;
NMSettingWired *s_wired;
NMSetting8021x *s_8021x;
GError *error = NULL;
const char *tmp;
@@ -2531,11 +2531,11 @@ test_read_wired_8021x_tls_new_connection (void)
}
/* ===== Wired Setting ===== */
s_wired = nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
s_wired = nm_connection_get_setting_wired (connection);
g_assert (s_wired != NULL);
/* ===== 802.1x Setting ===== */
s_8021x = (NMSetting8021x *) nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X);
s_8021x = nm_connection_get_setting_802_1x (connection);
g_assert (s_8021x != NULL);
g_assert (nm_setting_802_1x_get_num_eap_methods (s_8021x) == 1);
@@ -2781,7 +2781,7 @@ test_write_wired_8021x_tls_connection_blob (void)
g_assert (testfile);
/* Check that the new certs got written out */
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
uuid = nm_setting_connection_get_uuid (s_con);
g_assert (uuid);
@@ -2807,7 +2807,7 @@ test_write_wired_8021x_tls_connection_blob (void)
}
/* Ensure the re-read connection's certificates use the path scheme */
s_8021x = (NMSetting8021x *) nm_connection_get_setting (reread, NM_TYPE_SETTING_802_1X);
s_8021x = nm_connection_get_setting_802_1x (reread);
g_assert (s_8021x);
g_assert (nm_setting_802_1x_get_ca_cert_scheme (s_8021x) == NM_SETTING_802_1X_CK_SCHEME_PATH);
g_assert (nm_setting_802_1x_get_client_cert_scheme (s_8021x) == NM_SETTING_802_1X_CK_SCHEME_PATH);

View File

@@ -162,7 +162,7 @@ fill_wifi_empty (NMConnection *connection)
{
NMSettingWireless *s_wifi;
s_wifi = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
s_wifi = nm_connection_get_setting_wireless (connection);
if (!s_wifi) {
s_wifi = (NMSettingWireless *) nm_setting_wireless_new ();
nm_connection_add_setting (connection, NM_SETTING (s_wifi));
@@ -175,7 +175,7 @@ fill_wifi (NMConnection *connection, const KeyData items[])
{
NMSettingWireless *s_wifi;
s_wifi = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
s_wifi = nm_connection_get_setting_wireless (connection);
if (!s_wifi) {
s_wifi = (NMSettingWireless *) nm_setting_wireless_new ();
nm_connection_add_setting (connection, NM_SETTING (s_wifi));
@@ -190,7 +190,7 @@ fill_wsec (NMConnection *connection, const KeyData items[])
{
NMSettingWirelessSecurity *s_wsec;
s_wsec = (NMSettingWirelessSecurity *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY);
s_wsec = nm_connection_get_setting_wireless_security (connection);
if (!s_wsec) {
s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
nm_connection_add_setting (connection, NM_SETTING (s_wsec));
@@ -205,7 +205,7 @@ fill_8021x (NMConnection *connection, const KeyData items[])
{
NMSetting8021x *s_8021x;
s_8021x = (NMSetting8021x *) nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X);
s_8021x = nm_connection_get_setting_802_1x (connection);
if (!s_8021x) {
s_8021x = (NMSetting8021x *) nm_setting_802_1x_new ();
nm_connection_add_setting (connection, NM_SETTING (s_8021x));

View File

@@ -258,10 +258,10 @@ static const char *
nm_vpn_connection_get_service (NMVPNConnection *connection)
{
NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
NMSettingVPN *setting;
NMSettingVPN *s_vpn;
setting = (NMSettingVPN *) nm_connection_get_setting (priv->connection, NM_TYPE_SETTING_VPN);
return nm_setting_vpn_get_service_type (setting);
s_vpn = nm_connection_get_setting_vpn (priv->connection);
return nm_setting_vpn_get_service_type (s_vpn);
}
static void
@@ -558,7 +558,7 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy,
print_vpn_config (config, priv->ip4_internal_gw, priv->ip_iface, priv->banner);
/* Merge in user overrides from the NMConnection's IPv4 setting */
s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (priv->connection, NM_TYPE_SETTING_IP4_CONFIG));
s_ip4 = nm_connection_get_setting_ip4_config (priv->connection);
nm_utils_merge_ip4_config (config, s_ip4);
nm_system_iface_set_up (priv->ip_ifindex, TRUE, NULL);
@@ -645,22 +645,22 @@ static GHashTable *
_hash_with_username (NMConnection *connection, const char *username)
{
NMConnection *dup;
NMSetting *s_vpn;
NMSettingVPN *s_vpn;
GHashTable *hash;
const char *existing;
/* Shortcut if we weren't given a username or if there already was one in
* the VPN setting; don't bother duplicating the connection and everything.
*/
s_vpn = nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
s_vpn = nm_connection_get_setting_vpn (connection);
g_assert (s_vpn);
existing = nm_setting_vpn_get_user_name (NM_SETTING_VPN (s_vpn));
existing = nm_setting_vpn_get_user_name (s_vpn);
if (username == NULL || existing)
return nm_connection_to_hash (connection, NM_SETTING_HASH_FLAG_ALL);
dup = nm_connection_duplicate (connection);
g_assert (dup);
s_vpn = nm_connection_get_setting (dup, NM_TYPE_SETTING_VPN);
s_vpn = nm_connection_get_setting_vpn (dup);
g_assert (s_vpn);
g_object_set (s_vpn, NM_SETTING_VPN_USER_NAME, username, NULL);
hash = nm_connection_to_hash (dup, NM_SETTING_HASH_FLAG_ALL);
@@ -747,14 +747,14 @@ const char *
nm_vpn_connection_get_name (NMVPNConnection *connection)
{
NMVPNConnectionPrivate *priv;
NMSettingConnection *setting;
NMSettingConnection *s_con;
g_return_val_if_fail (NM_IS_VPN_CONNECTION (connection), NULL);
priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
setting = (NMSettingConnection *) nm_connection_get_setting (priv->connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (priv->connection);
return nm_setting_connection_get_id (setting);
return nm_setting_connection_get_id (s_con);
}
NMConnection *

View File

@@ -185,7 +185,7 @@ nm_vpn_manager_activate_connection (NMVPNManager *manager,
return NULL;
}
vpn_setting = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
vpn_setting = nm_connection_get_setting_vpn (connection);
if (!vpn_setting) {
g_set_error (error,
NM_VPN_MANAGER_ERROR, NM_VPN_MANAGER_ERROR_CONNECTION_INVALID,

View File

@@ -118,7 +118,7 @@ nm_wimax_nsp_check_compatible (NMWimaxNsp *self,
priv = GET_PRIVATE (self);
s_wimax = NM_SETTING_WIMAX (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIMAX));
s_wimax = nm_connection_get_setting_wimax (connection);
if (!s_wimax)
return FALSE;

View File

@@ -627,7 +627,7 @@ detail_vpn (gpointer data, gpointer user_data)
connection = get_connection_for_active (active);
g_return_if_fail (connection != NULL);
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
g_return_if_fail (s_con != NULL);
print_header ("VPN", NULL, nm_setting_connection_get_id (s_con));