diff --git a/cli/src/connections.c b/cli/src/connections.c index 2c490f822b..e893c21dd6 100644 --- a/cli/src/connections.c +++ b/cli/src/connections.c @@ -4321,6 +4321,7 @@ set_deftext (void) && edit_lib_symbols.rl_insert_text_func && edit_lib_symbols.rl_startup_hook_x) { edit_lib_symbols.rl_insert_text_func (pre_input_deftext); + g_free (pre_input_deftext); pre_input_deftext = NULL; *edit_lib_symbols.rl_startup_hook_x = NULL; } @@ -5301,7 +5302,7 @@ property_edit_submenu (NmCli *nmc, case NMC_EDITOR_SUB_CMD_CHANGE: *edit_lib_symbols.rl_startup_hook_x = set_deftext; - pre_input_deftext = nmc_setting_get_property (curr_setting, prop_name, NULL); + pre_input_deftext = nmc_setting_get_property_out2in (curr_setting, prop_name, NULL); tmp_prompt = g_strdup_printf (_("Edit '%s' value: "), prop_name); prop_val_user = readline_x (tmp_prompt); @@ -5360,9 +5361,9 @@ property_edit_submenu (NmCli *nmc, else printf (_("Unknown command argument: '%s'\n"), cmd_property_arg); } else { - printf ("%s: %s\n", - prop_name, - nmc_setting_get_property (curr_setting, prop_name, NULL)); + char *prop_val = nmc_setting_get_property (curr_setting, prop_name, NULL); + printf ("%s: %s\n", prop_name, prop_val); + g_free (prop_val); } break; diff --git a/cli/src/settings.c b/cli/src/settings.c index 4543605408..81e8779e5a 100644 --- a/cli/src/settings.c +++ b/cli/src/settings.c @@ -1414,6 +1414,7 @@ typedef gboolean (*NmcPropertySetFunc) (NMSetting *, const char *, cons typedef gboolean (*NmcPropertyRemoveFunc) (NMSetting *, const char *, const char *, guint32, GError **); typedef const char * (*NmcPropertyDescribeFunc) (NMSetting *, const char *); typedef const char * (*NmcPropertyValuesFunc) (NMSetting *, const char *); +typedef char * (*NmcPropertyOut2InFunc) (const char *); typedef struct { NmcPropertyGetFunc get_func; /* func getting property values */ @@ -1421,6 +1422,7 @@ typedef struct { NmcPropertyRemoveFunc remove_func; /* func removing items from container options */ NmcPropertyDescribeFunc describe_func; /* func returning property description */ NmcPropertyValuesFunc values_func; /* func returning allowed property values */ + NmcPropertyOut2InFunc out2in_func; /* func converting property values from output to input format */ } NmcPropertyFuncs; NMSetting * @@ -1931,6 +1933,17 @@ nmc_property_set_mac (NMSetting *setting, const char *prop, const char *val, GEr return TRUE; } +static gboolean +nmc_property_set_mtu (NMSetting *setting, const char *prop, const char *val, GError **error) +{ + const char *mtu = val; + + if (strcmp (mtu, "auto") == 0) + mtu = "0"; + + return nmc_property_set_uint (setting, prop, mtu, error); +} + static gboolean nmc_property_set_ifname (NMSetting *setting, const char *prop, const char *val, GError **error) { @@ -2051,6 +2064,16 @@ done: return TRUE; \ } +static char * +nmc_property_out2in_cut_paren (const char *out_format) +{ + const char *p; + size_t n; + + p = strstr (out_format, " ("); + n = p ? p - out_format : strlen (out_format); + return g_strndup (out_format, n); +} /* --- NM_SETTING_CONNECTION_SETTING_NAME property setter functions --- */ #if 0 @@ -2572,9 +2595,14 @@ nmc_property_ib_set_p_key (NMSetting *setting, const char *prop, const char *val p_key_valid = nmc_string_to_int_base (val + 2, 16, TRUE, 0, G_MAXUINT16, &p_key_int); else p_key_valid = nmc_string_to_int (val, TRUE, -1, G_MAXUINT16, &p_key_int); + if (!p_key_valid) { - g_set_error (error, 1, 0, _("'%s' is not a valid IBoIP P_Key"), val); - return FALSE; + if (strcmp (val, "default") == 0) + p_key_int = -1; + else { + g_set_error (error, 1, 0, _("'%s' is not a valid IBoIP P_Key"), val); + return FALSE; + } } g_object_set (setting, prop, (gint) p_key_int, NULL); return TRUE; @@ -2710,6 +2738,41 @@ nmc_property_ipv4_describe_addresses (NMSetting *setting, const char *prop) "Example: 192.168.1.5/24 192.168.1.1, 10.0.0.11/24\n"); } +/* + * from: { ip = 1.2.3.4/24, gw = 1.2.3.254 }; { ip = 2.2.2.2/16, gw = 5.5.5.5 } + * to: 1.2.3.4/24 1.2.3.254, 2.2.2.2/16 5.5.5.5 + * from: { ip = 11::22/64, gw = 22::33 }; { ip = ab::cd/64, gw = ab::1 } + * to: 11::22/64 22:33, ab::cd/64 ab::1 +*/ +static char * +nmc_property_out2in_addresses (const char *out_format) +{ + GRegex *regex; + GString *str; + char **strv; + int i; + + str = g_string_sized_new (128); + regex = g_regex_new ("\\{ ip = ([^/]+)/([^,]+), gw = ([^ ]+) \\}", 0, 0, NULL); + + strv = g_regex_split (regex, out_format, 0); + for (i = 1; strv && strv[i] && strv[i+1] && strv[i+2]; i=i+4) { + g_string_append (str, strv[i]); /* IP */ + g_string_append_c (str, '/'); + g_string_append (str, strv[i+1]); /* prefix */ + g_string_append_c (str, ' '); + g_string_append (str, strv[i+2]); /* gateway */ + g_string_append (str, ", "); + } + if (str->len > 0) + g_string_truncate (str, str->len - 2); + + g_strfreev (strv); + g_regex_unref (regex); + + return g_string_free (str, FALSE); +} + /* 'routes' */ static gboolean nmc_property_ipv4_set_routes (NMSetting *setting, const char *prop, const char *val, GError **error) @@ -2759,6 +2822,37 @@ nmc_property_ipv4_describe_routes (NMSetting *setting, const char *prop) "Example: 192.168.2.0/24 192.168.2.1 3, 10.1.0.0/16 10.0.0.254\n"); } +static char * +nmc_property_out2in_routes (const char *out_format) +{ + GRegex *regex; + GString *str; + char **strv; + int i; + + str = g_string_sized_new (128); + regex = g_regex_new ("\\{ dst = ([^/]+)/([^,]+), nh = ([^,]+), mt = ([^ ]+) \\}", 0, 0, NULL); + + strv = g_regex_split (regex, out_format, 0); + for (i = 1; strv && strv[i] && strv[i+1] && strv[i+2] && strv[i+3]; i=i+5) { + g_string_append (str, strv[i]); /* IP */ + g_string_append_c (str, '/'); + g_string_append (str, strv[i+1]); /* prefix */ + g_string_append_c (str, ' '); + g_string_append (str, strv[i+2]); /* next hop */ + g_string_append_c (str, ' '); + g_string_append (str, strv[i+3]); /* metric */ + g_string_append (str, ", "); + } + if (str->len > 0) + g_string_truncate (str, str->len - 2); + + g_strfreev (strv); + g_regex_unref (regex); + + return g_string_free (str, FALSE); +} + /* --- NM_SETTING_IP6_CONFIG_SETTING_NAME property setter functions --- */ /* 'method' */ static const char *ipv6_valid_methods[] = { @@ -3456,7 +3550,8 @@ nmc_add_prop_funcs (char *key, NmcPropertySetFunc set_func, NmcPropertyRemoveFunc remove_func, NmcPropertyDescribeFunc describe_func, - NmcPropertyValuesFunc values_func) + NmcPropertyValuesFunc values_func, + NmcPropertyOut2InFunc out2in_func) { NmcPropertyFuncs *item = g_malloc0 (sizeof (NmcPropertyFuncs)); item->get_func = get_func; @@ -3464,6 +3559,7 @@ nmc_add_prop_funcs (char *key, item->remove_func = remove_func; item->describe_func = describe_func; item->values_func = values_func; + item->out2in_func = out2in_func; g_hash_table_insert (nmc_properties, key, item); } @@ -3485,192 +3581,224 @@ nmc_properties_init (void) nmc_property_802_1X_set_eap, nmc_property_802_1X_remove_idx_eap, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, IDENTITY), nmc_property_802_1X_get_identity, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, ANONYMOUS_IDENTITY), nmc_property_802_1X_get_anonymous_identity, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, PAC_FILE), nmc_property_802_1X_get_pac_file, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, CA_CERT), nmc_property_802_1X_get_ca_cert, nmc_property_802_1X_set_ca_cert, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, CA_PATH), nmc_property_802_1X_get_ca_path, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, SUBJECT_MATCH), nmc_property_802_1X_get_subject_match, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, ALTSUBJECT_MATCHES), nmc_property_802_1X_get_altsubject_matches, nmc_property_802_1X_set_altsubject_matches, nmc_property_802_1X_remove_idx_altsubject_matches, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, CLIENT_CERT), nmc_property_802_1X_get_client_cert, nmc_property_802_1X_set_client_cert, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, PHASE1_PEAPVER), nmc_property_802_1X_get_phase1_peapver, nmc_property_802_1X_set_phase1_peapver, NULL, NULL, - nmc_property_802_1X_allowed_phase1_peapver); + nmc_property_802_1X_allowed_phase1_peapver, + NULL); nmc_add_prop_funcs (GLUE (802_1X, PHASE1_PEAPLABEL), nmc_property_802_1X_get_phase1_peaplabel, nmc_property_802_1X_set_phase1_peaplabel, NULL, NULL, - nmc_property_802_1X_allowed_phase1_peaplabel); + nmc_property_802_1X_allowed_phase1_peaplabel, + NULL); nmc_add_prop_funcs (GLUE (802_1X, PHASE1_FAST_PROVISIONING), nmc_property_802_1X_get_phase1_fast_provisioning, nmc_property_802_1X_set_phase1_fast_provisioning, NULL, NULL, - nmc_property_802_1X_allowed_phase1_fast_provisioning); + nmc_property_802_1X_allowed_phase1_fast_provisioning, + NULL); nmc_add_prop_funcs (GLUE (802_1X, PHASE2_AUTH), nmc_property_802_1X_get_phase2_auth, nmc_property_802_1X_set_phase2_auth, NULL, NULL, - nmc_property_802_1X_allowed_phase2_auth); + nmc_property_802_1X_allowed_phase2_auth, + NULL); nmc_add_prop_funcs (GLUE (802_1X, PHASE2_AUTHEAP), nmc_property_802_1X_get_phase2_autheap, nmc_property_802_1X_set_phase2_autheap, NULL, NULL, - nmc_property_802_1X_allowed_phase2_autheap); + nmc_property_802_1X_allowed_phase2_autheap, + NULL); nmc_add_prop_funcs (GLUE (802_1X, PHASE2_CA_CERT), nmc_property_802_1X_get_phase2_ca_cert, nmc_property_802_1X_set_phase2_ca_cert, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, PHASE2_CA_PATH), nmc_property_802_1X_get_phase2_ca_path, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, PHASE2_SUBJECT_MATCH), nmc_property_802_1X_get_phase2_subject_match, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, PHASE2_ALTSUBJECT_MATCHES), nmc_property_802_1X_get_phase2_altsubject_matches, nmc_property_802_1X_set_phase2_altsubject_matches, nmc_property_802_1X_remove_idx_phase2_altsubject_matches, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, PHASE2_CLIENT_CERT), nmc_property_802_1X_get_phase2_client_cert, nmc_property_802_1X_set_phase2_client_cert, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, PASSWORD), nmc_property_802_1X_get_password, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, PASSWORD_FLAGS), nmc_property_802_1X_get_password_flags, nmc_property_set_flags, NULL, NULL, - NULL); + NULL, + nmc_property_out2in_cut_paren); nmc_add_prop_funcs (GLUE (802_1X, PASSWORD_RAW), nmc_property_802_1X_get_password_raw, nmc_property_802_1X_set_password_raw, NULL, nmc_property_802_1X_describe_password_raw, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, PASSWORD_RAW_FLAGS), nmc_property_802_1X_get_password_raw_flags, nmc_property_set_flags, NULL, NULL, - NULL); + NULL, + nmc_property_out2in_cut_paren); nmc_add_prop_funcs (GLUE (802_1X, PRIVATE_KEY), nmc_property_802_1X_get_private_key, nmc_property_802_1X_set_private_key, NULL, nmc_property_802_1X_describe_private_key, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, PRIVATE_KEY_PASSWORD), nmc_property_802_1X_get_private_key_password, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, PRIVATE_KEY_PASSWORD_FLAGS), nmc_property_802_1X_get_private_key_password_flags, nmc_property_set_flags, NULL, NULL, - NULL); + NULL, + nmc_property_out2in_cut_paren); nmc_add_prop_funcs (GLUE (802_1X, PHASE2_PRIVATE_KEY), nmc_property_802_1X_get_phase2_private_key, nmc_property_802_1X_set_phase2_private_key, NULL, nmc_property_802_1X_describe_private_key, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, PHASE2_PRIVATE_KEY_PASSWORD), nmc_property_802_1X_get_phase2_private_key_password, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, PHASE2_PRIVATE_KEY_PASSWORD_FLAGS), nmc_property_802_1X_get_phase2_private_key_password_flags, nmc_property_set_flags, NULL, NULL, - NULL); + NULL, + nmc_property_out2in_cut_paren); nmc_add_prop_funcs (GLUE (802_1X, PIN), nmc_property_802_1X_get_pin, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (802_1X, PIN_FLAGS), nmc_property_802_1X_get_pin_flags, nmc_property_set_flags, NULL, NULL, - NULL); + NULL, + nmc_property_out2in_cut_paren); nmc_add_prop_funcs (GLUE (802_1X, SYSTEM_CA_CERTS), nmc_property_802_1X_get_system_ca_certs, nmc_property_set_bool, NULL, NULL, + NULL, NULL); /* Add editable properties for NM_SETTING_ADSL_SETTING_NAME */ @@ -3679,42 +3807,49 @@ nmc_properties_init (void) nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (ADSL, PASSWORD), nmc_property_adsl_get_password, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (ADSL, PASSWORD_FLAGS), nmc_property_adsl_get_password_flags, nmc_property_set_flags, NULL, NULL, - NULL); + NULL, + nmc_property_out2in_cut_paren); nmc_add_prop_funcs (GLUE (ADSL, PROTOCOL), nmc_property_adsl_get_protocol, nmc_property_adsl_set_protocol, NULL, NULL, - nmc_property_adsl_allowed_protocol); + nmc_property_adsl_allowed_protocol, + NULL); nmc_add_prop_funcs (GLUE (ADSL, ENCAPSULATION), nmc_property_adsl_get_encapsulation, nmc_property_adsl_set_encapsulation, NULL, NULL, - nmc_property_adsl_allowed_encapsulation); + nmc_property_adsl_allowed_encapsulation, + NULL); nmc_add_prop_funcs (GLUE (ADSL, VPI), nmc_property_adsl_get_vpi, nmc_property_set_uint, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (ADSL, VCI), nmc_property_adsl_get_vci, nmc_property_set_uint, NULL, NULL, + NULL, NULL); /* Add editable properties for NM_SETTING_BLUETOOTH_SETTING_NAME */ @@ -3723,12 +3858,14 @@ nmc_properties_init (void) nmc_property_set_mac, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (BLUETOOTH, TYPE), nmc_property_bluetooth_get_type, nmc_property_bluetooth_set_type, NULL, NULL, + NULL, NULL); /* Add editable properties for NM_SETTING_BOND_SETTING_NAME */ @@ -3737,13 +3874,15 @@ nmc_properties_init (void) nmc_property_set_ifname, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (BOND, OPTIONS), nmc_property_bond_get_options, nmc_property_bond_set_options, nmc_property_bond_remove_option_options, nmc_property_bond_describe_options, - nmc_property_bond_allowed_options); + nmc_property_bond_allowed_options, + NULL); /* Add editable properties for NM_SETTING_BRIDGE_SETTING_NAME */ nmc_add_prop_funcs (GLUE (BRIDGE, INTERFACE_NAME), @@ -3751,42 +3890,49 @@ nmc_properties_init (void) nmc_property_set_ifname, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (BRIDGE, STP), nmc_property_bridge_get_stp, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (BRIDGE, PRIORITY), nmc_property_bridge_get_priority, nmc_property_set_uint, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (BRIDGE, FORWARD_DELAY), nmc_property_bridge_get_forward_delay, nmc_property_set_uint, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (BRIDGE, HELLO_TIME), nmc_property_bridge_get_hello_time, nmc_property_set_uint, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (BRIDGE, MAX_AGE), nmc_property_bridge_get_max_age, nmc_property_set_uint, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (BRIDGE, AGEING_TIME), nmc_property_bridge_get_ageing_time, nmc_property_set_uint, NULL, NULL, + NULL, NULL); /* Add editable properties for NM_SETTING_BRIDGE_PORT_SETTING_NAME */ @@ -3795,18 +3941,21 @@ nmc_properties_init (void) nmc_property_set_uint, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (BRIDGE_PORT, PATH_COST), nmc_property_bridge_port_get_path_cost, nmc_property_set_uint, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (BRIDGE_PORT, HAIRPIN_MODE), nmc_property_bridge_port_get_hairpin_mode, nmc_property_set_bool, NULL, NULL, + NULL, NULL); /* Add editable properties for NM_SETTING_CDMA_SETTING_NAME */ @@ -3815,25 +3964,29 @@ nmc_properties_init (void) nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (CDMA, USERNAME), nmc_property_cdma_get_username, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (CDMA, PASSWORD), nmc_property_cdma_get_password, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (CDMA, PASSWORD_FLAGS), nmc_property_cdma_get_password_flags, nmc_property_set_flags, NULL, NULL, - NULL); + NULL, + nmc_property_out2in_cut_paren); /* Add editable properties for NM_SETTING_CONNECTION_SETTING_NAME */ nmc_add_prop_funcs (GLUE (CONNECTION, ID), @@ -3841,78 +3994,91 @@ nmc_properties_init (void) nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (CONNECTION, UUID), nmc_property_connection_get_uuid, NULL, /* forbid setting/removing UUID */ NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (CONNECTION, INTERFACE_NAME), nmc_property_connection_get_interface_name, nmc_property_set_ifname, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (CONNECTION, TYPE), nmc_property_connection_get_type, NULL, /* read-only */ NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (CONNECTION, AUTOCONNECT), nmc_property_connection_get_autoconnect, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (CONNECTION, TIMESTAMP), nmc_property_connection_get_timestamp, NULL, /* read-only */ NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (CONNECTION, READ_ONLY), nmc_property_connection_get_read_only, NULL, /* 'read-only' is read-only :-) */ NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (CONNECTION, PERMISSIONS), nmc_property_connection_get_permissions, nmc_property_connection_set_permissions, nmc_property_connection_remove_idx_permissions, nmc_property_connection_describe_permissions, + NULL, NULL); nmc_add_prop_funcs (GLUE (CONNECTION, ZONE), nmc_property_connection_get_zone, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (CONNECTION, MASTER), nmc_property_connection_get_master, nmc_property_con_set_master, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (CONNECTION, SLAVE_TYPE), nmc_property_connection_get_slave_type, nmc_property_con_set_slave_type, NULL, NULL, - nmc_property_con_allowed_slave_type); + nmc_property_con_allowed_slave_type, + NULL); nmc_add_prop_funcs (GLUE (CONNECTION, SECONDARIES), nmc_property_connection_get_secondaries, nmc_property_connection_set_secondaries, nmc_property_connection_remove_idx_secondaries, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (CONNECTION, GATEWAY_PING_TIMEOUT), nmc_property_connection_get_gateway_ping_timeout, nmc_property_set_uint, NULL, NULL, + NULL, NULL); /* Add editable properties for NM_SETTING_GSM_SETTING_NAME */ @@ -3921,66 +4087,77 @@ nmc_properties_init (void) nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (GSM, USERNAME), nmc_property_gsm_get_username, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (GSM, PASSWORD), nmc_property_gsm_get_password, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (GSM, PASSWORD_FLAGS), nmc_property_gsm_get_password_flags, nmc_property_set_flags, NULL, NULL, - NULL); + NULL, + nmc_property_out2in_cut_paren); nmc_add_prop_funcs (GLUE (GSM, APN), nmc_property_gsm_get_apn, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (GSM, NETWORK_ID), nmc_property_gsm_get_network_id, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (GSM, NETWORK_TYPE), nmc_property_gsm_get_network_type, nmc_property_set_int, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (GSM, ALLOWED_BANDS), nmc_property_gsm_get_allowed_bands, nmc_property_set_uint, NULL, NULL, - NULL); + NULL, + nmc_property_out2in_cut_paren); nmc_add_prop_funcs (GLUE (GSM, PIN), nmc_property_gsm_get_pin, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (GSM, PIN_FLAGS), nmc_property_gsm_get_pin_flags, nmc_property_set_flags, NULL, NULL, - NULL); + NULL, + nmc_property_out2in_cut_paren); nmc_add_prop_funcs (GLUE (GSM, HOME_ONLY), nmc_property_gsm_get_home_only, nmc_property_set_bool, NULL, NULL, + NULL, NULL); /* Add editable properties for NM_SETTING_INFINIBAND_SETTING_NAME */ @@ -3989,10 +4166,12 @@ nmc_properties_init (void) nmc_property_ib_set_mac, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (INFINIBAND, MTU), nmc_property_ib_get_mtu, - nmc_property_set_uint, + nmc_property_set_mtu, + NULL, NULL, NULL, NULL); @@ -4001,18 +4180,21 @@ nmc_properties_init (void) nmc_property_ib_set_transport_mode, NULL, NULL, - nmc_property_ib_allowed_transport_mode); + nmc_property_ib_allowed_transport_mode, + NULL); nmc_add_prop_funcs (GLUE (INFINIBAND, P_KEY), nmc_property_ib_get_p_key, nmc_property_ib_set_p_key, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (INFINIBAND, PARENT), nmc_property_ib_get_parent, nmc_property_set_ifname, NULL, NULL, + NULL, NULL); /* Add editable properties for NM_SETTING_IP4_CONFIG_SETTING_NAME */ @@ -4021,72 +4203,84 @@ nmc_properties_init (void) nmc_property_ipv4_set_method, NULL, NULL, - nmc_property_ipv4_allowed_method); + nmc_property_ipv4_allowed_method, + NULL); nmc_add_prop_funcs (GLUE (IP4_CONFIG, DNS), nmc_property_ipv4_get_dns, nmc_property_ipv4_set_dns, nmc_property_ipv4_remove_idx_dns, nmc_property_ipv4_describe_dns, + NULL, NULL); nmc_add_prop_funcs (GLUE (IP4_CONFIG, DNS_SEARCH), nmc_property_ipv4_get_dns_search, nmc_property_ipv4_set_dns_search, nmc_property_ipv4_remove_idx_dns_search, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (IP4_CONFIG, ADDRESSES), nmc_property_ipv4_get_addresses, nmc_property_ipv4_set_addresses, nmc_property_ipv4_remove_idx_addresses, nmc_property_ipv4_describe_addresses, - NULL); + NULL, + nmc_property_out2in_addresses); nmc_add_prop_funcs (GLUE (IP4_CONFIG, ROUTES), nmc_property_ipv4_get_routes, nmc_property_ipv4_set_routes, nmc_property_ipv4_remove_idx_routes, nmc_property_ipv4_describe_routes, - NULL); + NULL, + nmc_property_out2in_routes); nmc_add_prop_funcs (GLUE (IP4_CONFIG, IGNORE_AUTO_ROUTES), nmc_property_ipv4_get_ignore_auto_routes, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (IP4_CONFIG, IGNORE_AUTO_DNS), nmc_property_ipv4_get_ignore_auto_dns, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (IP4_CONFIG, DHCP_CLIENT_ID), nmc_property_ipv4_get_dhcp_client_id, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (IP4_CONFIG, DHCP_SEND_HOSTNAME), nmc_property_ipv4_get_dhcp_send_hostname, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (IP4_CONFIG, DHCP_HOSTNAME), nmc_property_ipv4_get_dhcp_hostname, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (IP4_CONFIG, NEVER_DEFAULT), nmc_property_ipv4_get_never_default, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (IP4_CONFIG, MAY_FAIL), nmc_property_ipv4_get_may_fail, nmc_property_set_bool, NULL, NULL, + NULL, NULL); /* Add editable properties for NM_SETTING_IP6_CONFIG_SETTING_NAME */ @@ -4095,66 +4289,77 @@ nmc_properties_init (void) nmc_property_ipv6_set_method, NULL, NULL, - nmc_property_ipv6_allowed_method); + nmc_property_ipv6_allowed_method, + NULL); nmc_add_prop_funcs (GLUE (IP6_CONFIG, DNS), nmc_property_ipv6_get_dns, nmc_property_ipv6_set_dns, nmc_property_ipv6_remove_idx_dns, nmc_property_ipv6_describe_dns, + NULL, NULL); nmc_add_prop_funcs (GLUE (IP6_CONFIG, DNS_SEARCH), nmc_property_ipv6_get_dns_search, nmc_property_ipv6_set_dns_search, nmc_property_ipv6_remove_idx_dns_search, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (IP6_CONFIG, ADDRESSES), nmc_property_ipv6_get_addresses, nmc_property_ipv6_set_addresses, nmc_property_ipv6_remove_idx_addresses, nmc_property_ipv6_describe_addresses, - NULL); + NULL, + nmc_property_out2in_addresses); nmc_add_prop_funcs (GLUE (IP6_CONFIG, ROUTES), nmc_property_ipv6_get_routes, nmc_property_ipv6_set_routes, nmc_property_ipv6_remove_idx_routes, nmc_property_ipv6_describe_routes, - NULL); + NULL, + nmc_property_out2in_routes); nmc_add_prop_funcs (GLUE (IP6_CONFIG, IGNORE_AUTO_ROUTES), nmc_property_ipv6_get_ignore_auto_routes, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (IP6_CONFIG, IGNORE_AUTO_DNS), nmc_property_ipv6_get_ignore_auto_dns, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (IP6_CONFIG, NEVER_DEFAULT), nmc_property_ipv6_get_never_default, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (IP6_CONFIG, MAY_FAIL), nmc_property_ipv6_get_may_fail, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (IP6_CONFIG, IP6_PRIVACY), nmc_property_ipv6_get_ip6_privacy, nmc_property_ipv6_set_ip6_privacy, NULL, NULL, - NULL); + NULL, + nmc_property_out2in_cut_paren); nmc_add_prop_funcs (GLUE (IP6_CONFIG, DHCP_HOSTNAME), nmc_property_ipv6_get_dhcp_hostname, nmc_property_set_string, NULL, NULL, + NULL, NULL); /* Add editable properties for NM_SETTING_OLPC_MESH_SETTING_NAME */ @@ -4163,18 +4368,21 @@ nmc_properties_init (void) nmc_property_set_ssid, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (OLPC_MESH, CHANNEL), nmc_property_olpc_get_channel, nmc_property_olpc_set_channel, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (OLPC_MESH, DHCP_ANYCAST_ADDRESS), nmc_property_olpc_get_anycast_address, nmc_property_set_mac, NULL, NULL, + NULL, NULL); /* Add editable properties for NM_SETTING_PPP_SETTING_NAME */ @@ -4183,94 +4391,110 @@ nmc_properties_init (void) nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (PPP, REFUSE_EAP), nmc_property_ppp_get_refuse_eap, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (PPP, REFUSE_PAP), nmc_property_ppp_get_refuse_pap, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (PPP, REFUSE_CHAP), nmc_property_ppp_get_refuse_chap, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (PPP, REFUSE_MSCHAP), nmc_property_ppp_get_refuse_mschap, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (PPP, REFUSE_MSCHAPV2), nmc_property_ppp_get_refuse_mschapv2, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (PPP, NOBSDCOMP), nmc_property_ppp_get_nobsdcomp, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (PPP, NODEFLATE), nmc_property_ppp_get_nodeflate, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (PPP, NO_VJ_COMP), nmc_property_ppp_get_no_vj_comp, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (PPP, REQUIRE_MPPE), nmc_property_ppp_get_require_mppe, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (PPP, REQUIRE_MPPE_128), nmc_property_ppp_get_require_mppe_128, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (PPP, MPPE_STATEFUL), nmc_property_ppp_get_mppe_stateful, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (PPP, CRTSCTS), nmc_property_ppp_get_crtscts, nmc_property_set_bool, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (PPP, BAUD), nmc_property_ppp_get_baud, nmc_property_set_uint, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (PPP, MRU), nmc_property_ppp_get_mru, nmc_property_set_uint, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (PPP, MTU), nmc_property_ppp_get_mtu, - nmc_property_set_uint, + nmc_property_set_mtu, + NULL, NULL, NULL, NULL); @@ -4279,12 +4503,14 @@ nmc_properties_init (void) nmc_property_set_uint, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (PPP, LCP_ECHO_INTERVAL), nmc_property_ppp_get_lcp_echo_interval, nmc_property_set_uint, NULL, NULL, + NULL, NULL); /* Add editable properties for NM_SETTING_PPPOE_SETTING_NAME */ @@ -4293,25 +4519,29 @@ nmc_properties_init (void) nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (PPPOE, USERNAME), nmc_property_pppoe_get_username, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (PPPOE, PASSWORD), nmc_property_pppoe_get_password, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (PPPOE, PASSWORD_FLAGS), nmc_property_pppoe_get_password_flags, nmc_property_set_flags, NULL, NULL, - NULL); + NULL, + nmc_property_out2in_cut_paren); /* Add editable properties for NM_SETTING_SERIAL_SETTING_NAME */ nmc_add_prop_funcs (GLUE (SERIAL, BAUD), @@ -4319,30 +4549,35 @@ nmc_properties_init (void) nmc_property_set_uint, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (SERIAL, BITS), nmc_property_serial_get_bits, nmc_property_set_uint, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (SERIAL, PARITY), nmc_property_serial_get_parity, nmc_property_serial_set_parity, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (SERIAL, STOPBITS), nmc_property_serial_get_stopbits, nmc_property_set_uint, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (SERIAL, SEND_DELAY), nmc_property_serial_get_send_delay, nmc_property_set_uint, NULL, NULL, + NULL, NULL); /* Add editable properties for NM_SETTING_TEAM_SETTING_NAME */ @@ -4351,12 +4586,14 @@ nmc_properties_init (void) nmc_property_set_ifname, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (TEAM, CONFIG), nmc_property_team_get_config, nmc_property_set_string, NULL, NULL, + NULL, NULL); /* Add editable properties for NM_SETTING_TEAM_PORT_SETTING_NAME */ @@ -4365,6 +4602,7 @@ nmc_properties_init (void) nmc_property_set_string, NULL, NULL, + NULL, NULL); /* Add editable properties for NM_SETTING_VLAN_SETTING_NAME */ @@ -4373,36 +4611,42 @@ nmc_properties_init (void) nmc_property_set_ifname, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (VLAN, PARENT), nmc_property_vlan_get_parent, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (VLAN, ID), nmc_property_vlan_get_id, nmc_property_set_uint, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (VLAN, FLAGS), nmc_property_vlan_get_flags, nmc_property_set_uint, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (VLAN, INGRESS_PRIORITY_MAP), nmc_property_vlan_get_ingress_priority_map, nmc_property_vlan_set_ingress_priority_map, nmc_property_vlan_remove_idx_ingress_priority_map, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (VLAN, EGRESS_PRIORITY_MAP), nmc_property_vlan_get_egress_priority_map, nmc_property_vlan_set_egress_priority_map, nmc_property_vlan_remove_idx_egress_priority_map, NULL, + NULL, NULL); /* Add editable properties for NM_SETTING_VPN_SETTING_NAME */ @@ -4411,24 +4655,28 @@ nmc_properties_init (void) nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (VPN, USER_NAME), nmc_property_vpn_get_user_name, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (VPN, DATA), nmc_property_vpn_get_data, nmc_property_vpn_set_data, nmc_property_vpn_remove_option_data, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (VPN, SECRETS), nmc_property_vpn_get_secrets, nmc_property_vpn_set_secrets, nmc_property_vpn_remove_option_secret, NULL, + NULL, NULL); /* Add editable properties for NM_SETTING_WIMAX_SETTING_NAME */ @@ -4437,12 +4685,14 @@ nmc_properties_init (void) nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIMAX, MAC_ADDRESS), nmc_property_wimax_get_mac_address, nmc_property_set_mac, NULL, NULL, + NULL, NULL); /* Add editable properties for NM_SETTING_WIRED_SETTING_NAME */ @@ -4451,46 +4701,54 @@ nmc_properties_init (void) NULL, /*nmc_property_wired_set_port,*/ NULL, NULL, - NULL); /*nmc_property_wired_allowed_port);*/ + NULL, /*nmc_property_wired_allowed_port,*/ + NULL); nmc_add_prop_funcs (GLUE (WIRED, SPEED), nmc_property_wired_get_speed, NULL, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRED, DUPLEX), nmc_property_wired_get_duplex, NULL, /*nmc_property_wired_set_duplex,*/ NULL, NULL, + NULL, NULL); /*nmc_property_wired_allowed_duplex);*/ nmc_add_prop_funcs (GLUE (WIRED, AUTO_NEGOTIATE), nmc_property_wired_get_auto_negotiate, NULL, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRED, MAC_ADDRESS), nmc_property_wired_get_mac_address, nmc_property_set_mac, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRED, CLONED_MAC_ADDRESS), nmc_property_wired_get_cloned_mac_address, nmc_property_set_mac, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRED, MAC_ADDRESS_BLACKLIST), nmc_property_wired_get_mac_address_blacklist, nmc_property_wired_set_mac_address_blacklist, nmc_property_wired_remove_idx_mac_address_blacklist, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRED, MTU), nmc_property_wired_get_mtu, - nmc_property_set_uint, + nmc_property_set_mtu, + NULL, NULL, NULL, NULL); @@ -4499,19 +4757,22 @@ nmc_properties_init (void) nmc_property_wired_set_s390_subchannels, NULL, nmc_property_wired_describe_s390_subchannels, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRED, S390_NETTYPE), nmc_property_wired_get_s390_nettype, nmc_property_wired_set_s390_nettype, NULL, NULL, - nmc_property_wired_allowed_s390_nettype); + nmc_property_wired_allowed_s390_nettype, + NULL); nmc_add_prop_funcs (GLUE (WIRED, S390_OPTIONS), nmc_property_wired_get_s390_options, nmc_property_wired_set_s390_options, nmc_property_wired_remove_option_s390_options, nmc_property_wired_describe_s390_options, - nmc_property_wired_allowed_s390_options); + nmc_property_wired_allowed_s390_options, + NULL); /* Add editable properties for NM_SETTING_WIRELESS_SETTING_NAME */ nmc_add_prop_funcs (GLUE (WIRELESS, SSID), @@ -4519,30 +4780,35 @@ nmc_properties_init (void) nmc_property_set_ssid, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRELESS, MODE), nmc_property_wireless_get_mode, nmc_property_wifi_set_mode, NULL, NULL, - nmc_property_wifi_allowed_mode); + nmc_property_wifi_allowed_mode, + NULL); nmc_add_prop_funcs (GLUE (WIRELESS, BAND), nmc_property_wireless_get_band, nmc_property_wifi_set_band, NULL, NULL, - nmc_property_wifi_allowed_band); + nmc_property_wifi_allowed_band, + NULL); nmc_add_prop_funcs (GLUE (WIRELESS, CHANNEL), nmc_property_wireless_get_channel, nmc_property_wifi_set_channel, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRELESS, BSSID), nmc_property_wireless_get_bssid, nmc_property_set_mac, NULL, NULL, + NULL, NULL); /* * Do not allow setting 'rate' and 'tx-power'. They are not implemented in @@ -4553,40 +4819,47 @@ nmc_properties_init (void) NULL, /* editing rate disabled */ NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRELESS, TX_POWER), nmc_property_wireless_get_tx_power, NULL, /* editing tx-power disabled */ NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRELESS, MAC_ADDRESS), nmc_property_wireless_get_mac_address, nmc_property_set_mac, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRELESS, CLONED_MAC_ADDRESS), nmc_property_wireless_get_cloned_mac_address, nmc_property_set_mac, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRELESS, MAC_ADDRESS_BLACKLIST), nmc_property_wireless_get_mac_address_blacklist, nmc_property_wireless_set_mac_address_blacklist, nmc_property_wireless_remove_idx_mac_address_blacklist, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRELESS, SEEN_BSSIDS), nmc_property_wireless_get_seen_bssids, NULL, /* read-only */ NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRELESS, MTU), nmc_property_wireless_get_mtu, - nmc_property_set_uint, + nmc_property_set_mtu, + NULL, NULL, NULL, NULL); @@ -4595,6 +4868,7 @@ nmc_properties_init (void) nmc_property_set_bool, NULL, NULL, + NULL, NULL); /* Add editable properties for NM_SETTING_WIRELESS_SECURITY_SETTING_NAME */ @@ -4603,103 +4877,120 @@ nmc_properties_init (void) nmc_property_wifi_sec_set_key_mgmt, NULL, NULL, - nmc_property_wifi_sec_allowed_key_mgmt); + nmc_property_wifi_sec_allowed_key_mgmt, + NULL); nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, WEP_TX_KEYIDX), nmc_property_wifi_sec_get_wep_tx_keyidx, nmc_property_set_uint, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, AUTH_ALG), nmc_property_wifi_sec_get_auth_alg, nmc_property_wifi_sec_set_auth_alg, NULL, NULL, - nmc_property_wifi_sec_allowed_auth_alg); + nmc_property_wifi_sec_allowed_auth_alg, + NULL); nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, PROTO), nmc_property_wifi_sec_get_proto, nmc_property_wifi_sec_set_proto, nmc_property_wifi_sec_remove_idx_proto, NULL, - nmc_property_wifi_sec_allowed_proto); + nmc_property_wifi_sec_allowed_proto, + NULL); nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, PAIRWISE), nmc_property_wifi_sec_get_pairwise, nmc_property_wifi_sec_set_pairwise, nmc_property_wifi_sec_remove_idx_pairwise, NULL, - nmc_property_wifi_sec_allowed_pairwise); + nmc_property_wifi_sec_allowed_pairwise, + NULL); nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, GROUP), nmc_property_wifi_sec_get_group, nmc_property_wifi_sec_set_group, nmc_property_wifi_sec_remove_idx_group, NULL, - nmc_property_wifi_sec_allowed_group); + nmc_property_wifi_sec_allowed_group, + NULL); nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, LEAP_USERNAME), nmc_property_wifi_sec_get_leap_username, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, WEP_KEY0), nmc_property_wifi_sec_get_wep_key0, nmc_property_wifi_set_wep_key, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, WEP_KEY1), nmc_property_wifi_sec_get_wep_key1, nmc_property_wifi_set_wep_key, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, WEP_KEY2), nmc_property_wifi_sec_get_wep_key2, nmc_property_wifi_set_wep_key, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, WEP_KEY3), nmc_property_wifi_sec_get_wep_key3, nmc_property_wifi_set_wep_key, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, WEP_KEY_FLAGS), nmc_property_wifi_sec_get_wep_key_flags, nmc_property_set_flags, NULL, NULL, - NULL); + NULL, + nmc_property_out2in_cut_paren); nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, WEP_KEY_TYPE), nmc_property_wifi_sec_get_wep_key_type, nmc_property_wifi_set_wep_key_type, NULL, nmc_property_wifi_describe_wep_key_type, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, PSK), nmc_property_wifi_sec_get_psk, nmc_property_wifi_set_psk, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, PSK_FLAGS), nmc_property_wifi_sec_get_psk_flags, nmc_property_set_flags, NULL, NULL, - NULL); + NULL, + nmc_property_out2in_cut_paren); nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, LEAP_PASSWORD), nmc_property_wifi_sec_get_leap_password, nmc_property_set_string, NULL, NULL, + NULL, NULL); nmc_add_prop_funcs (GLUE (WIRELESS_SECURITY, LEAP_PASSWORD_FLAGS), nmc_property_wifi_sec_get_leap_password_flags, nmc_property_set_flags, NULL, NULL, - NULL); + NULL, + nmc_property_out2in_cut_paren); } void @@ -4725,6 +5016,29 @@ nmc_properties_find (const char *s_name, const char *p_name) return item; } +static char * +get_property_val (NMSetting *setting, const char *prop, gboolean convert, GError **error) +{ + const NmcPropertyFuncs *item; + + g_return_val_if_fail (NM_IS_SETTING (setting), FALSE); + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + item = nmc_properties_find (nm_setting_get_name (setting), prop); + if (item && item->get_func) { + char *prop_val = item->get_func (setting); + if (convert && item->out2in_func) { + char *converted = item->out2in_func (prop_val); + g_free (prop_val); + return converted; + } else + return prop_val; + } + + g_set_error_literal (error, 1, 0, _("don't know how to get the property value")); + return NULL; +} + /* * Generic function for getting property value. * @@ -4735,17 +5049,17 @@ nmc_properties_find (const char *s_name, const char *p_name) char * nmc_setting_get_property (NMSetting *setting, const char *prop, GError **error) { - const NmcPropertyFuncs *item; + return get_property_val (setting, prop, FALSE, error); +} - g_return_val_if_fail (NM_IS_SETTING (setting), FALSE); - g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - - item = nmc_properties_find (nm_setting_get_name (setting), prop); - if (item && item->get_func) - return item->get_func (setting); - - g_set_error_literal (error, 1, 0, _("don't know how to get the property value")); - return NULL; +/* + * The same as nmc_setting_get_property(), but in addition converts + * usual output format into a simpler one, used as input in the editor. + */ +char * +nmc_setting_get_property_out2in (NMSetting *setting, const char *prop, GError **error) +{ + return get_property_val (setting, prop, TRUE, error); } /* diff --git a/cli/src/settings.h b/cli/src/settings.h index 8c14364c60..c6cfcfa5f3 100644 --- a/cli/src/settings.h +++ b/cli/src/settings.h @@ -62,6 +62,9 @@ const char *nmc_setting_get_property_allowed_values (NMSetting *setting, const c char *nmc_setting_get_property (NMSetting *setting, const char *prop, GError **error); +char *nmc_setting_get_property_out2in (NMSetting *setting, + const char *prop, + GError **error); gboolean nmc_setting_set_property (NMSetting *setting, const char *prop, const char *val,