Files
NetworkManager/clients/cli/settings.h
Thomas Haller 8a14851f93 cli: refactor property to string conversion
Instead of having a get_func() and out2in_func(), have only one
get_func() that accepts an argument of the output format.

This way, a conversion to parsable input format, doesn't have to go
first thourgh get_func() and mangle the pretty string in out2in_func().

This fixes conversions via nmc_property_out2in_cut_paren().
For example, nmc_property_802_1X_get_private_key_password_flags()
would return a localized string _("0 (none)"). There is no guarantee
that out2in_func() would find the expected output format after
localizing.

This also fixes nmc_property_out2in_routes() which expected
a format "dst =" (would be "ip =") and expects mandatory
'nh' and 'mt' arguments. In fact, the regex didn't match and
nmc_property_out2in_routes() always failed.

While at it, also combine the implementation of
nmc_property_ipv4_get_routes() and nmc_property_ipv6_get_routes().
2015-06-05 12:26:48 +02:00

67 lines
3.1 KiB
C

/* nmcli - command-line tool to control NetworkManager
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright 2010 - 2014 Red Hat, Inc.
*/
#ifndef NMC_SETTINGS_H
#define NMC_SETTINGS_H
#include "nmcli.h"
#include "utils.h"
/* --- Functions --- */
void nmc_properties_init (void);
void nmc_properties_cleanup (void);
NMSetting *nmc_setting_new_for_name (const char *name);
void nmc_setting_custom_init (NMSetting *setting);
void nmc_setting_ip4_connect_handlers (NMSettingIPConfig *setting);
void nmc_setting_ip6_connect_handlers (NMSettingIPConfig *setting);
void nmc_setting_wireless_connect_handlers (NMSettingWireless *setting);
void nmc_setting_connection_connect_handlers (NMSettingConnection *setting, NMConnection *connection);
char **nmc_setting_get_valid_properties (NMSetting *setting);
char *nmc_setting_get_property_desc (NMSetting *setting, const char *prop);
const char **nmc_setting_get_property_allowed_values (NMSetting *setting, const char *prop);
char *nmc_setting_get_property (NMSetting *setting,
const char *prop,
GError **error);
char *nmc_setting_get_property_parsable (NMSetting *setting,
const char *prop,
GError **error);
gboolean nmc_setting_set_property (NMSetting *setting,
const char *prop,
const char *val,
GError **error);
gboolean nmc_setting_reset_property (NMSetting *setting,
const char *prop,
GError **error);
gboolean nmc_setting_remove_property_option (NMSetting *setting,
const char *prop,
const char *option,
guint32 idx,
GError **error);
void nmc_property_set_default_value (NMSetting *setting, const char *prop);
gboolean nmc_property_get_gvalue (NMSetting *setting, const char *prop, GValue *value);
gboolean nmc_property_set_gvalue (NMSetting *setting, const char *prop, GValue *value);
gboolean setting_details (NMSetting *setting, NmCli *nmc, const char *one_prop, gboolean secrets);
#endif /* NMC_SETTINGS_H */