2010-03-31 17:14:35 +02:00
|
|
|
/* 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.
|
|
|
|
|
*
|
2014-10-27 12:55:55 +01:00
|
|
|
* Copyright 2010 - 2014 Red Hat, Inc.
|
2010-03-31 17:14:35 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef NMC_SETTINGS_H
|
|
|
|
|
#define NMC_SETTINGS_H
|
|
|
|
|
|
2017-03-24 16:27:29 +01:00
|
|
|
#include "nm-setting-metadata.h"
|
|
|
|
|
|
2010-03-31 17:14:35 +02:00
|
|
|
#include "nmcli.h"
|
|
|
|
|
#include "utils.h"
|
|
|
|
|
|
2017-03-24 16:27:29 +01:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-03-24 17:32:04 +01:00
|
|
|
typedef enum {
|
|
|
|
|
NMC_PROPERTY_GET_PRETTY,
|
|
|
|
|
NMC_PROPERTY_GET_PARSABLE,
|
|
|
|
|
} NmcPropertyGetType;
|
|
|
|
|
|
2017-03-24 16:27:29 +01:00
|
|
|
typedef struct _NmcSettingInfo NmcSettingInfo;
|
2017-03-24 17:32:04 +01:00
|
|
|
typedef struct _NmcPropertyInfo NmcPropertyInfo;
|
|
|
|
|
|
|
|
|
|
struct _NmcPropertyInfo {
|
|
|
|
|
const char *property_name;
|
|
|
|
|
|
|
|
|
|
/* the property list for now must contain as first field the
|
|
|
|
|
* "name", which isn't a regular property. This is required by
|
|
|
|
|
* NmcOutputField and this first field is ignored for the
|
|
|
|
|
* group_list/setting_info. */
|
|
|
|
|
bool is_name:1;
|
|
|
|
|
|
|
|
|
|
char *(*get_fcn) (const NmcSettingInfo *setting_info,
|
|
|
|
|
const NmcPropertyInfo *property_info,
|
|
|
|
|
NMSetting *setting,
|
|
|
|
|
NmcPropertyGetType get_type);
|
|
|
|
|
union {
|
|
|
|
|
const char *(*get_direct) (NMSetting *setting);
|
|
|
|
|
char *(*get_nmc) (NMSetting *setting, NmcPropertyGetType get_type);
|
2017-03-25 15:52:03 +01:00
|
|
|
gboolean (*get_gobject_with_default_fcn) (NMSetting *setting);
|
2017-03-24 17:32:04 +01:00
|
|
|
} get_data;
|
2017-03-25 13:20:11 +01:00
|
|
|
|
|
|
|
|
gboolean (*set_fcn) (const NmcSettingInfo *setting_info,
|
|
|
|
|
const NmcPropertyInfo *property_info,
|
|
|
|
|
NMSetting *setting,
|
|
|
|
|
const char *value,
|
|
|
|
|
GError **error);
|
|
|
|
|
union {
|
|
|
|
|
gboolean (*set_nmc) (NMSetting *setting, const char *property_name, const char *value, GError **error);
|
|
|
|
|
} set_data;
|
2017-03-25 13:20:11 +01:00
|
|
|
|
|
|
|
|
gboolean (*remove_fcn) (const NmcSettingInfo *setting_info,
|
|
|
|
|
const NmcPropertyInfo *property_info,
|
|
|
|
|
NMSetting *setting,
|
|
|
|
|
const char *option,
|
|
|
|
|
guint32 idx,
|
|
|
|
|
GError **error);
|
|
|
|
|
union {
|
|
|
|
|
gboolean (*remove_nmc) (NMSetting *setting, const char *property_name, const char *option, guint32 idx, GError **error);
|
|
|
|
|
} remove_data;
|
2017-03-25 13:20:11 +01:00
|
|
|
|
|
|
|
|
const char *describe_message;
|
2017-03-25 13:20:11 +01:00
|
|
|
|
2017-03-25 15:52:03 +01:00
|
|
|
const char *const*(*values_fcn) (const NmcSettingInfo *setting_info,
|
|
|
|
|
const NmcPropertyInfo *property_info);
|
|
|
|
|
union {
|
|
|
|
|
union {
|
|
|
|
|
struct {
|
|
|
|
|
GType (*get_gtype) (void);
|
|
|
|
|
bool has_minmax:1;
|
|
|
|
|
int min;
|
|
|
|
|
int max;
|
|
|
|
|
} gobject_enum;
|
|
|
|
|
} values_data;
|
|
|
|
|
const char *const*values_static;
|
|
|
|
|
};
|
2017-03-24 17:32:04 +01:00
|
|
|
};
|
2017-03-24 16:27:29 +01:00
|
|
|
|
|
|
|
|
struct _NmcSettingInfo {
|
|
|
|
|
const NMMetaSettingInfo *general;
|
|
|
|
|
gboolean (*get_setting_details) (const NmcSettingInfo *setting_info,
|
|
|
|
|
NMSetting *setting,
|
|
|
|
|
NmCli *nmc,
|
|
|
|
|
const char *one_prop,
|
|
|
|
|
gboolean secrets);
|
2017-03-25 15:45:28 +01:00
|
|
|
/* the order of the properties matter. The first *must* be the
|
|
|
|
|
* "name", and then the order is as they are listed by default. */
|
2017-03-24 17:32:04 +01:00
|
|
|
const NmcPropertyInfo *properties;
|
|
|
|
|
guint properties_num;
|
2017-03-24 16:27:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern const NmcSettingInfo nmc_setting_infos[_NM_META_SETTING_TYPE_NUM];
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2013-01-18 15:21:00 +01:00
|
|
|
|
|
|
|
|
void nmc_properties_init (void);
|
|
|
|
|
void nmc_properties_cleanup (void);
|
|
|
|
|
|
2013-06-05 16:04:06 -05:00
|
|
|
NMSetting *nmc_setting_new_for_name (const char *name);
|
2013-01-18 15:21:00 +01:00
|
|
|
void nmc_setting_custom_init (NMSetting *setting);
|
2014-10-19 17:30:10 -04:00
|
|
|
void nmc_setting_ip4_connect_handlers (NMSettingIPConfig *setting);
|
|
|
|
|
void nmc_setting_ip6_connect_handlers (NMSettingIPConfig *setting);
|
2016-08-16 05:56:00 +05:30
|
|
|
void nmc_setting_proxy_connect_handlers (NMSettingProxy *setting);
|
2014-02-13 12:20:52 +01:00
|
|
|
void nmc_setting_wireless_connect_handlers (NMSettingWireless *setting);
|
2014-10-27 12:55:55 +01:00
|
|
|
void nmc_setting_connection_connect_handlers (NMSettingConnection *setting, NMConnection *connection);
|
2013-01-18 15:21:00 +01:00
|
|
|
|
|
|
|
|
char **nmc_setting_get_valid_properties (NMSetting *setting);
|
|
|
|
|
char *nmc_setting_get_property_desc (NMSetting *setting, const char *prop);
|
2017-03-25 13:20:11 +01:00
|
|
|
const char *const*nmc_setting_get_property_allowed_values (NMSetting *setting, const char *prop);
|
2013-01-18 15:21:00 +01:00
|
|
|
char *nmc_setting_get_property (NMSetting *setting,
|
|
|
|
|
const char *prop,
|
|
|
|
|
GError **error);
|
2015-05-21 13:00:40 +02:00
|
|
|
char *nmc_setting_get_property_parsable (NMSetting *setting,
|
|
|
|
|
const char *prop,
|
|
|
|
|
GError **error);
|
2013-01-18 15:21:00 +01:00
|
|
|
gboolean nmc_setting_set_property (NMSetting *setting,
|
|
|
|
|
const char *prop,
|
|
|
|
|
const char *val,
|
|
|
|
|
GError **error);
|
2013-09-06 14:56:41 +02:00
|
|
|
gboolean nmc_setting_reset_property (NMSetting *setting,
|
|
|
|
|
const char *prop,
|
|
|
|
|
GError **error);
|
2013-01-18 15:21:00 +01:00
|
|
|
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);
|
|
|
|
|
|
2013-03-20 10:21:19 +01:00
|
|
|
gboolean nmc_property_get_gvalue (NMSetting *setting, const char *prop, GValue *value);
|
|
|
|
|
gboolean nmc_property_set_gvalue (NMSetting *setting, const char *prop, GValue *value);
|
2010-03-31 17:14:35 +02:00
|
|
|
|
2014-09-29 12:22:39 +02:00
|
|
|
gboolean setting_details (NMSetting *setting, NmCli *nmc, const char *one_prop, gboolean secrets);
|
2010-03-31 17:14:35 +02:00
|
|
|
|
2016-07-27 16:24:30 +02:00
|
|
|
extern NmcOutputField nmc_fields_setting_wired[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_8021X[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_wireless[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_wireless_security[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_serial[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_ppp[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_pppoe[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_adsl[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_gsm[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_cdma[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_bluetooth[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_olpc_mesh[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_vpn[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_wimax[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_infiniband[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_bond[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_vlan[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_bridge[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_bridge_port[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_team[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_team_port[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_dcb[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_tun[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_ip_tunnel[];
|
|
|
|
|
extern NmcOutputField nmc_fields_setting_macvlan[];
|
2016-07-01 11:56:33 +02:00
|
|
|
extern NmcOutputField nmc_fields_setting_macsec[];
|
2016-07-27 16:24:30 +02:00
|
|
|
extern NmcOutputField nmc_fields_setting_vxlan[];
|
2016-08-16 05:56:00 +05:30
|
|
|
extern NmcOutputField nmc_fields_setting_proxy[];
|
2017-02-01 15:19:29 +01:00
|
|
|
extern NmcOutputField nmc_fields_setting_dummy[];
|
2016-07-27 16:24:30 +02:00
|
|
|
|
2010-03-31 17:14:35 +02:00
|
|
|
#endif /* NMC_SETTINGS_H */
|