Commit e1d60712 authored by Thomas Haller's avatar Thomas Haller

cli: add property-info for the rest

parent 10fca1ae
......@@ -148,12 +148,6 @@ NmcOutputField nmc_fields_con_show[] = {
#define NMC_FIELDS_CON_SHOW_COMMON "NAME,UUID,TYPE,DEVICE"
/* Helper macro to define fields */
#define SETTING_FIELD(setting, props) \
{ \
.name = setting, \
.name_l10n = N_(setting), \
.group_list = props, \
}
#define SETTING_FIELD_TYPE(setting, setting_type) \
{ \
.name = setting, \
......@@ -170,34 +164,34 @@ NmcOutputField nmc_fields_settings_names[] = {
SETTING_FIELD_TYPE (NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, NM_META_SETTING_TYPE_WIRELESS_SECURITY), /* 4 */
SETTING_FIELD_TYPE (NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_META_SETTING_TYPE_IP4_CONFIG), /* 5 */
SETTING_FIELD_TYPE (NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_META_SETTING_TYPE_IP6_CONFIG), /* 6 */
SETTING_FIELD (NM_SETTING_SERIAL_SETTING_NAME, nmc_fields_setting_serial + 1), /* 7 */
SETTING_FIELD_TYPE (NM_SETTING_SERIAL_SETTING_NAME, NM_META_SETTING_TYPE_SERIAL), /* 7 */
SETTING_FIELD_TYPE (NM_SETTING_PPP_SETTING_NAME, NM_META_SETTING_TYPE_PPP), /* 8 */
SETTING_FIELD_TYPE (NM_SETTING_PPPOE_SETTING_NAME, NM_META_SETTING_TYPE_PPPOE), /* 9 */
SETTING_FIELD (NM_SETTING_GSM_SETTING_NAME, nmc_fields_setting_gsm + 1), /* 10 */
SETTING_FIELD (NM_SETTING_CDMA_SETTING_NAME, nmc_fields_setting_cdma + 1), /* 11 */
SETTING_FIELD (NM_SETTING_BLUETOOTH_SETTING_NAME, nmc_fields_setting_bluetooth + 1), /* 12 */
SETTING_FIELD (NM_SETTING_OLPC_MESH_SETTING_NAME, nmc_fields_setting_olpc_mesh + 1), /* 13 */
SETTING_FIELD (NM_SETTING_VPN_SETTING_NAME, nmc_fields_setting_vpn + 1), /* 14 */
SETTING_FIELD_TYPE (NM_SETTING_GSM_SETTING_NAME, NM_META_SETTING_TYPE_GSM), /* 10 */
SETTING_FIELD_TYPE (NM_SETTING_CDMA_SETTING_NAME, NM_META_SETTING_TYPE_CDMA), /* 11 */
SETTING_FIELD_TYPE (NM_SETTING_BLUETOOTH_SETTING_NAME, NM_META_SETTING_TYPE_BLUETOOTH), /* 12 */
SETTING_FIELD_TYPE (NM_SETTING_OLPC_MESH_SETTING_NAME, NM_META_SETTING_TYPE_OLPC_MESH), /* 13 */
SETTING_FIELD_TYPE (NM_SETTING_VPN_SETTING_NAME, NM_META_SETTING_TYPE_VPN), /* 14 */
SETTING_FIELD_TYPE (NM_SETTING_WIMAX_SETTING_NAME, NM_META_SETTING_TYPE_WIMAX), /* 15 */
SETTING_FIELD (NM_SETTING_INFINIBAND_SETTING_NAME, nmc_fields_setting_infiniband + 1), /* 16 */
SETTING_FIELD (NM_SETTING_BOND_SETTING_NAME, nmc_fields_setting_bond + 1), /* 17 */
SETTING_FIELD (NM_SETTING_VLAN_SETTING_NAME, nmc_fields_setting_vlan + 1), /* 18 */
SETTING_FIELD_TYPE (NM_SETTING_INFINIBAND_SETTING_NAME, NM_META_SETTING_TYPE_INFINIBAND), /* 16 */
SETTING_FIELD_TYPE (NM_SETTING_BOND_SETTING_NAME, NM_META_SETTING_TYPE_BOND), /* 17 */
SETTING_FIELD_TYPE (NM_SETTING_VLAN_SETTING_NAME, NM_META_SETTING_TYPE_VLAN), /* 18 */
SETTING_FIELD_TYPE (NM_SETTING_ADSL_SETTING_NAME, NM_META_SETTING_TYPE_ADSL), /* 19 */
SETTING_FIELD (NM_SETTING_BRIDGE_SETTING_NAME, nmc_fields_setting_bridge + 1), /* 20 */
SETTING_FIELD (NM_SETTING_BRIDGE_PORT_SETTING_NAME, nmc_fields_setting_bridge_port + 1), /* 21 */
SETTING_FIELD (NM_SETTING_TEAM_SETTING_NAME, nmc_fields_setting_team + 1), /* 22 */
SETTING_FIELD (NM_SETTING_TEAM_PORT_SETTING_NAME, nmc_fields_setting_team_port + 1), /* 23 */
SETTING_FIELD_TYPE (NM_SETTING_BRIDGE_SETTING_NAME, NM_META_SETTING_TYPE_BRIDGE), /* 20 */
SETTING_FIELD_TYPE (NM_SETTING_BRIDGE_PORT_SETTING_NAME, NM_META_SETTING_TYPE_BRIDGE_PORT), /* 21 */
SETTING_FIELD_TYPE (NM_SETTING_TEAM_SETTING_NAME, NM_META_SETTING_TYPE_TEAM), /* 22 */
SETTING_FIELD_TYPE (NM_SETTING_TEAM_PORT_SETTING_NAME, NM_META_SETTING_TYPE_TEAM_PORT), /* 23 */
SETTING_FIELD_TYPE (NM_SETTING_DCB_SETTING_NAME, NM_META_SETTING_TYPE_DCB), /* 24 */
SETTING_FIELD (NM_SETTING_TUN_SETTING_NAME, nmc_fields_setting_tun + 1), /* 25 */
SETTING_FIELD (NM_SETTING_IP_TUNNEL_SETTING_NAME, nmc_fields_setting_ip_tunnel + 1), /* 26 */
SETTING_FIELD (NM_SETTING_MACSEC_SETTING_NAME, nmc_fields_setting_macsec + 1), /* 27 */
SETTING_FIELD (NM_SETTING_MACVLAN_SETTING_NAME, nmc_fields_setting_macvlan + 1), /* 28 */
SETTING_FIELD (NM_SETTING_VXLAN_SETTING_NAME, nmc_fields_setting_vxlan + 1), /* 29 */
SETTING_FIELD_TYPE (NM_SETTING_TUN_SETTING_NAME, NM_META_SETTING_TYPE_TUN), /* 25 */
SETTING_FIELD_TYPE (NM_SETTING_IP_TUNNEL_SETTING_NAME, NM_META_SETTING_TYPE_IP_TUNNEL), /* 26 */
SETTING_FIELD_TYPE (NM_SETTING_MACSEC_SETTING_NAME, NM_META_SETTING_TYPE_MACSEC), /* 27 */
SETTING_FIELD_TYPE (NM_SETTING_MACVLAN_SETTING_NAME, NM_META_SETTING_TYPE_MACVLAN), /* 28 */
SETTING_FIELD_TYPE (NM_SETTING_VXLAN_SETTING_NAME, NM_META_SETTING_TYPE_VXLAN), /* 29 */
SETTING_FIELD_TYPE (NM_SETTING_PROXY_SETTING_NAME, NM_META_SETTING_TYPE_PROXY), /* 30 */
SETTING_FIELD (NM_SETTING_DUMMY_SETTING_NAME, nmc_fields_setting_dummy + 1), /* 31 */
SETTING_FIELD_TYPE (NM_SETTING_DUMMY_SETTING_NAME, NM_META_SETTING_TYPE_DUMMY), /* 31 */
{NULL, NULL, 0, NULL, NULL, FALSE, FALSE, 0}
};
#define NMC_FIELDS_SETTINGS_NAMES_ALL_X NM_SETTING_CONNECTION_SETTING_NAME","\
#define NMC_FIELDS_SETTINGS_NAMES_ALL NM_SETTING_CONNECTION_SETTING_NAME","\
NM_SETTING_WIRED_SETTING_NAME","\
NM_SETTING_802_1X_SETTING_NAME","\
NM_SETTING_WIRELESS_SETTING_NAME","\
......@@ -227,7 +221,8 @@ NmcOutputField nmc_fields_settings_names[] = {
NM_SETTING_MACVLAN_SETTING_NAME"," \
NM_SETTING_VXLAN_SETTING_NAME"," \
NM_SETTING_PROXY_SETTING_NAME
#define NMC_FIELDS_SETTINGS_NAMES_ALL NMC_FIELDS_SETTINGS_NAMES_ALL_X
// NM_SETTING_DUMMY_SETTING_NAME
// NM_SETTING_WIMAX_SETTING_NAME
/* Active connection data */
/* Available fields for GENERAL group */
......
......@@ -146,6 +146,8 @@ complete_fields (const char *prefix)
complete_field (h, NULL, nmc_fields_dev_show_sections);
complete_field (h, NULL, nmc_fields_dev_lldp_list);
/* FIXME: just iterate over the list, but ensure that the setting name
* is identical to setting_info's setting_name. */
complete_field_new (h, "connection", NM_META_SETTING_TYPE_CONNECTION);
complete_field_new (h, "802-3-ethernet", NM_META_SETTING_TYPE_WIRED);
complete_field_new (h, "802-1x", NM_META_SETTING_TYPE_802_1X);
......@@ -153,28 +155,30 @@ complete_fields (const char *prefix)
complete_field_new (h, "802-11-wireless-security", NM_META_SETTING_TYPE_WIRELESS_SECURITY);
complete_field_new (h, "ipv4", NM_META_SETTING_TYPE_IP4_CONFIG);
complete_field_new (h, "ipv6", NM_META_SETTING_TYPE_IP6_CONFIG);
complete_field (h, "serial", nmc_fields_setting_serial);
complete_field_new (h, "serial", NM_META_SETTING_TYPE_SERIAL);
complete_field_new (h, "dummy", NM_META_SETTING_TYPE_DUMMY);
complete_field_new (h, "ppp", NM_META_SETTING_TYPE_PPP);
complete_field_new (h, "pppoe", NM_META_SETTING_TYPE_PPPOE);
complete_field_new (h, "adsl", NM_META_SETTING_TYPE_ADSL);
complete_field (h, "gsm", nmc_fields_setting_gsm);
complete_field (h, "cdma", nmc_fields_setting_cdma);
complete_field (h, "bluetooth", nmc_fields_setting_bluetooth);
complete_field (h, "802-11-olpc-mesh", nmc_fields_setting_olpc_mesh);
complete_field (h, "vpn", nmc_fields_setting_vpn);
complete_field_new (h, "gsm", NM_META_SETTING_TYPE_GSM);
complete_field_new (h, "macsec", NM_META_SETTING_TYPE_MACSEC);
complete_field_new (h, "cdma", NM_META_SETTING_TYPE_CDMA);
complete_field_new (h, "bluetooth", NM_META_SETTING_TYPE_BLUETOOTH);
complete_field_new (h, "802-11-olpc-mesh", NM_META_SETTING_TYPE_OLPC_MESH);
complete_field_new (h, "vpn", NM_META_SETTING_TYPE_VPN);
complete_field_new (h, "wimax", NM_META_SETTING_TYPE_WIMAX);
complete_field (h, "infiniband", nmc_fields_setting_infiniband);
complete_field (h, "bond", nmc_fields_setting_bond);
complete_field (h, "vlan", nmc_fields_setting_vlan);
complete_field (h, "bridge", nmc_fields_setting_bridge);
complete_field (h, "bridge-port", nmc_fields_setting_bridge_port);
complete_field (h, "team", nmc_fields_setting_team);
complete_field (h, "team-port", nmc_fields_setting_team_port);
complete_field_new (h, "infiniband", NM_META_SETTING_TYPE_INFINIBAND);
complete_field_new (h, "bond", NM_META_SETTING_TYPE_BOND);
complete_field_new (h, "vlan", NM_META_SETTING_TYPE_VLAN);
complete_field_new (h, "bridge", NM_META_SETTING_TYPE_BRIDGE);
complete_field_new (h, "bridge-port", NM_META_SETTING_TYPE_BRIDGE_PORT);
complete_field_new (h, "team", NM_META_SETTING_TYPE_TEAM);
complete_field_new (h, "team-port", NM_META_SETTING_TYPE_TEAM_PORT);
complete_field_new (h, "dcb", NM_META_SETTING_TYPE_DCB);
complete_field (h, "tun", nmc_fields_setting_tun);
complete_field (h, "ip-tunnel", nmc_fields_setting_ip_tunnel);
complete_field (h, "macvlan", nmc_fields_setting_macvlan);
complete_field (h, "vxlan", nmc_fields_setting_vxlan);
complete_field_new (h, "tun", NM_META_SETTING_TYPE_TUN);
complete_field_new (h, "ip-tunnel", NM_META_SETTING_TYPE_IP_TUNNEL);
complete_field_new (h, "macvlan", NM_META_SETTING_TYPE_MACVLAN);
complete_field_new (h, "vxlan", NM_META_SETTING_TYPE_VXLAN);
complete_field_new (h, "proxy", NM_META_SETTING_TYPE_PROXY);
g_hash_table_foreach (h, complete_one, (gpointer) prefix);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -32,6 +32,12 @@ typedef enum {
NMC_PROPERTY_GET_PARSABLE,
} NmcPropertyGetType;
typedef enum {
NMC_PROPERTY_TYPE_MAC_MODE_DEFAULT,
NMC_PROPERTY_TYPE_MAC_MODE_CLONED,
NMC_PROPERTY_TYPE_MAC_MODE_INFINIBAND,
} NmcPropertyTypeMacMode;
typedef struct _NmcSettingInfo NmcSettingInfo;
typedef struct _NmcPropertyInfo NmcPropertyInfo;
typedef struct _NmcPropertyType NmcPropertyType;
......@@ -88,6 +94,9 @@ struct _NmcPropertyTypData {
struct {
guint32 (*get_fcn) (NMSetting *setting);
} mtu;
struct {
NmcPropertyTypeMacMode mode;
} mac;
};
const char *const*values_static;
};
......@@ -111,11 +120,6 @@ struct _NmcPropertyInfo {
struct _NmcSettingInfo {
const NMMetaSettingInfo *general;
gboolean (*get_setting_details) (const NmcSettingInfo *setting_info,
NMSetting *setting,
NmCli *nmc,
const char *one_prop,
gboolean secrets);
/* the order of the properties matter. The first *must* be the
* "name", and then the order is as they are listed by default. */
const NmcPropertyInfo *properties;
......@@ -126,9 +130,6 @@ extern const NmcSettingInfo nmc_setting_infos[_NM_META_SETTING_TYPE_NUM];
/*****************************************************************************/
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);
......@@ -165,24 +166,4 @@ gboolean nmc_property_set_gvalue (NMSetting *setting, const char *prop, GValue *
gboolean setting_details (NMSetting *setting, NmCli *nmc, const char *one_prop, gboolean secrets);
extern NmcOutputField nmc_fields_setting_serial[];
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_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_tun[];
extern NmcOutputField nmc_fields_setting_ip_tunnel[];
extern NmcOutputField nmc_fields_setting_macvlan[];
extern NmcOutputField nmc_fields_setting_macsec[];
extern NmcOutputField nmc_fields_setting_vxlan[];
extern NmcOutputField nmc_fields_setting_dummy[];
#endif /* NMC_SETTINGS_H */
......@@ -185,6 +185,11 @@ const NMMetaSettingInfo nm_meta_setting_infos[] = {
.setting_name = N_ (NM_SETTING_DCB_SETTING_NAME),
.get_setting_gtype = nm_setting_dcb_get_type,
},
[NM_META_SETTING_TYPE_DUMMY] = {
.meta_type = NM_META_SETTING_TYPE_DUMMY,
.setting_name = N_ (NM_SETTING_DUMMY_SETTING_NAME),
.get_setting_gtype = nm_setting_dummy_get_type,
},
[NM_META_SETTING_TYPE_GSM] = {
.meta_type = NM_META_SETTING_TYPE_GSM,
.setting_name = N_ (NM_SETTING_GSM_SETTING_NAME),
......
......@@ -65,6 +65,7 @@ typedef enum {
NM_META_SETTING_TYPE_CDMA,
NM_META_SETTING_TYPE_CONNECTION,
NM_META_SETTING_TYPE_DCB,
NM_META_SETTING_TYPE_DUMMY,
NM_META_SETTING_TYPE_GSM,
NM_META_SETTING_TYPE_INFINIBAND,
NM_META_SETTING_TYPE_IP4_CONFIG,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment