release: bump version to 1.9.1-dev after 1.8.0 release

After 1.8.0 is released, merge it back into master so that
1.8.0 is part of the history of master. That means,
  $ git log --first-parent master
will also traverse 1.8.0 and 1.8-rc*.

Also bump the micro version to 1.9.1-dev to indicate that this is
after 1.8.0 is out.
This commit is contained in:
Thomas Haller 2017-05-10 15:11:57 +02:00
commit 5dd335584c
149 changed files with 305643 additions and 187997 deletions

10
.gitignore vendored
View file

@ -58,7 +58,7 @@ test-*.trs
/dispatcher/tests/test-dispatcher-envp
/clients/cli/nmcli
/clients/cli/settings-docs.c
/clients/common/settings-docs.c
/clients/tui/newt/libnmt-newt.a
/clients/tui/nmtui
/clients/nm-online
@ -271,6 +271,8 @@ test-*.trs
/src/tests/test-utils
/src/tests/test-wired-defname
/clients/common/tests/test-general
/vapi/*.vapi
# The following names are no longer present on this branch,
@ -304,8 +306,4 @@ test-*.trs
/libnm/nm-keyfile-docs.xml
/libnm/nm-setting-docs.xml
/libnm/nm-setting-docs-overrides.xml
# The following names are present on newer upstream. Ignore them
# also when switching branches
/clients/common/settings-docs.c
/clients/common/tests
/clients/cli/settings-docs.c

View file

@ -28,6 +28,7 @@ examples_DATA =
CLEANFILES =
DISTCLEANFILES =
EXTRA_DIST =
EXTRA_LTLIBRARIES =
dist_hook =
dist_dependencies =
dist_configure_check =
@ -414,9 +415,10 @@ libnm_core_lib_h_pub_real = \
libnm_core_lib_h_pub_mkenums = \
libnm-core/nm-core-enum-types.h
libnm_core_lib_h_priv = \
shared/nm-utils/nm-enum-utils.h \
shared/nm-utils/nm-shared-utils.h \
shared/nm-utils/nm-udev-utils.h \
shared/nm-setting-metadata.h \
shared/nm-meta-setting.h \
libnm-core/crypto.h \
libnm-core/nm-connection-private.h \
libnm-core/nm-core-internal.h \
@ -427,9 +429,10 @@ libnm_core_lib_h_priv = \
libnm-core/nm-setting-private.h \
libnm-core/nm-utils-private.h
libnm_core_lib_c_real = \
shared/nm-utils/nm-enum-utils.c \
shared/nm-utils/nm-shared-utils.c \
shared/nm-utils/nm-udev-utils.c \
shared/nm-setting-metadata.c \
shared/nm-meta-setting.c \
libnm-core/crypto.c \
libnm-core/nm-connection.c \
libnm-core/nm-dbus-utils.c \
@ -3141,6 +3144,121 @@ clients_nm_online_LDADD = \
$(clients_nm_online_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
###############################################################################
# clients/common
###############################################################################
clients_cppflags = \
-I$(srcdir)/shared \
-I$(builddir)/shared \
-I$(srcdir)/libnm-core \
-I$(builddir)/libnm-core \
-I$(srcdir)/libnm \
-I$(builddir)/libnm \
-I$(srcdir)/clients/common \
-I$(builddir)/clients/common \
$(GLIB_CFLAGS) \
-DNMLOCALEDIR=\"$(datadir)/locale\"
check_ltlibraries += clients/common/libnmc-base.la
clients_common_libnmc_base_la_SOURCES = \
clients/common/nm-secret-agent-simple.c \
clients/common/nm-secret-agent-simple.h \
clients/common/nm-vpn-helpers.c \
clients/common/nm-vpn-helpers.h
clients_common_libnmc_base_la_CPPFLAGS = \
$(clients_cppflags) \
-DG_LOG_DOMAIN=\""libnmc"\"
clients_common_libnmc_base_la_LIBADD = \
libnm/libnm.la \
$(GLIB_LIBS)
$(clients_common_libnmc_base_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
clients_common_settings_doc_c = clients/common/settings-docs.c
if HAVE_INTROSPECTION
$(clients_common_settings_doc_c): clients/common/settings-docs.xsl libnm/nm-property-docs.xml clients/common/.dirstamp
$(AM_V_GEN) $(XSLTPROC) --output $@ $< $(word 2,$^)
DISTCLEANFILES += $(clients_common_settings_doc_c)
check-local-settings-docs: $(clients_common_settings_doc_c)
@if test -z "$$NMTST_NO_CHECK_SETTINGS_DOCS" ; then \
if ! cmp -s "$(srcdir)/$(clients_common_settings_doc_c).in" "$(builddir)/$(clients_common_settings_doc_c)" ; then \
echo "The generated file \"$(builddir)/$(clients_common_settings_doc_c)\" differs from the source file \"$(srcdir)/$(clients_common_settings_doc_c).in\". You probably should copy the generated file over to the source file. You can skip this test by setting \$$NMTST_NO_CHECK_SETTINGS_DOCS=yes"; \
false; \
fi;\
fi
check_local += check-local-settings-docs
else
$(clients_common_settings_doc_c): $(clients_common_settings_doc_c).in clients/common/.dirstamp
$(AM_V_GEN) cp "$(srcdir)/$(clients_common_settings_doc_c).in" "$(builddir)/$(clients_common_settings_doc_c)"
check-local-settings-docs:
endif
EXTRA_DIST += \
$(clients_common_settings_doc_c) \
$(clients_common_settings_doc_c).in
if HAVE_INTROSPECTION
check_ltlibraries += clients/common/libnmc.la
else
EXTRA_LTLIBRARIES += clients/common/libnmc.la
endif
clients_common_libnmc_la_SOURCES = \
shared/nm-utils/nm-enum-utils.c \
shared/nm-utils/nm-enum-utils.h \
shared/nm-utils/nm-shared-utils.c \
shared/nm-utils/nm-shared-utils.h \
\
shared/nm-meta-setting.c \
shared/nm-meta-setting.h \
\
clients/common/nm-client-utils.c \
clients/common/nm-client-utils.h \
clients/common/nm-meta-setting-desc.c \
clients/common/nm-meta-setting-desc.h \
clients/common/nm-meta-setting-access.c \
clients/common/nm-meta-setting-access.h \
$(NULL)
clients_common_libnmc_la_CPPFLAGS = \
$(clients_cppflags) \
-DG_LOG_DOMAIN=\""libnmc"\"
clients_common_libnmc_la_LIBADD = \
libnm/libnm.la \
clients/common/libnmc-base.la \
$(GLIB_LIBS)
$(clients_common_libnmc_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
$(clients_common_libnmc_la_OBJECTS): $(clients_common_settings_doc_c)
$(clients_common_libnmc_la_OBJECTS): clients/common/.dirstamp
if HAVE_INTROSPECTION
check_programs += clients/common/tests/test-general
else
if BUILD_NMCLI
check_programs += clients/common/tests/test-general
endif
endif
clients_common_tests_test_general_CPPFLAGS = \
-I$(srcdir)/clients/common/tests \
$(clients_cppflags) \
-DG_LOG_DOMAIN=\""libnmc"\"
clients_common_tests_test_general_LDADD = \
libnm/libnm.la \
clients/common/libnmc-base.la \
clients/common/libnmc.la \
$(GLIB_LIBS)
$(clients_common_tests_test_general_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
###############################################################################
# clients/cli
###############################################################################
@ -3150,50 +3268,38 @@ if BUILD_NMCLI
bin_PROGRAMS += clients/cli/nmcli
clients_cli_nmcli_SOURCES = \
\
clients/cli/agent.c \
clients/cli/agent.h \
clients/cli/common.c \
clients/cli/common.h \
clients/cli/utils.c \
clients/cli/utils.h \
clients/cli/agent.c \
clients/cli/agent.h \
clients/cli/general.c \
clients/cli/general.h \
clients/cli/connections.c \
clients/cli/connections.h \
clients/cli/devices.c \
clients/cli/devices.h \
clients/cli/general.c \
clients/cli/general.h \
clients/cli/settings.c \
clients/cli/settings.h \
clients/cli/nmcli.c \
clients/cli/nmcli.h \
clients/cli/utils.c \
clients/cli/utils.h \
clients/cli/polkit-agent.c \
clients/cli/polkit-agent.h \
\
clients/common/nm-secret-agent-simple.c \
clients/common/nm-secret-agent-simple.h \
clients/common/nm-vpn-helpers.c \
clients/common/nm-vpn-helpers.h \
$(NULL)
clients_cli_nmcli_CPPFLAGS = \
-I$(srcdir)/shared \
-I$(builddir)/shared \
-I$(srcdir)/libnm-core \
-I$(builddir)/libnm-core \
-I$(srcdir)/libnm \
-I$(builddir)/libnm \
-I$(srcdir)/clients/cli \
-I$(builddir)/clients/cli \
-I$(srcdir)/clients/common \
$(GLIB_CFLAGS) \
$(clients_cppflags) \
-DG_LOG_DOMAIN=\""nmcli"\" \
-DNMCLI_LOCALEDIR=\"$(datadir)/locale\"
clients_cli_nmcli_LDADD = \
libnm/libnm.la \
clients/common/libnmc-base.la \
clients/common/libnmc.la \
$(GLIB_LIBS) \
$(READLINE_LIBS) \
libnm/libnm.la
$(READLINE_LIBS)
if WITH_POLKIT_AGENT
clients_cli_nmcli_CPPFLAGS += $(POLKIT_CFLAGS)
@ -3206,8 +3312,7 @@ endif
clients_cli_nmcli_LDFLAGS = \
-Wl,--version-script="$(srcdir)/linker-script-binary.ver"
$(clients_cli_nmcli_OBJECTS): $(clients_cli_settings_doc_c)
$(clients_cli_nmcli_OBJECTS): clients/cli/.dirstamp
$(clients_cli_nmcli_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
install-data-hook-nmcli:
$(mkinstalldirs) $(DESTDIR)$(completiondir)
@ -3222,25 +3327,9 @@ uninstall_hook += uninstall-hook-nmcli
endif
clients_cli_settings_doc_c = clients/cli/settings-docs.c
if HAVE_INTROSPECTION
$(clients_cli_settings_doc_c): clients/cli/settings-docs.xsl libnm/nm-property-docs.xml
$(AM_V_GEN) $(XSLTPROC) --output $@ $< $(word 2,$^)
$(clients_cli_settings_doc_c): clients/cli/.dirstamp
DISTCLEANFILES += $(clients_cli_settings_doc_c)
else
$(clients_cli_settings_doc_c):
@echo "to generate $(clients_cli_settings_doc_c), configure with --enable-introspection"
@echo "alternatively, build --without-nmcli"
@false
endif
EXTRA_DIST += $(clients_cli_settings_doc_c)
EXTRA_DIST += \
clients/cli/nmcli-completion \
clients/cli/settings-docs.xsl
clients/common/settings-docs.xsl
###############################################################################
# clients/tui
@ -3390,26 +3479,14 @@ clients_tui_nmtui_SOURCES = \
clients/tui/nmt-utils.h \
clients/tui/nmt-widget-list.c \
clients/tui/nmt-widget-list.h \
clients/common/nm-secret-agent-simple.c \
clients/common/nm-secret-agent-simple.h \
clients/common/nm-vpn-helpers.c \
clients/common/nm-vpn-helpers.h \
$(NULL)
clients_tui_nmtui_CPPFLAGS = \
-I$(srcdir)/shared \
-I$(builddir)/shared \
-I$(srcdir)/libnm-core \
-I$(builddir)/libnm-core \
-I$(srcdir)/libnm \
-I$(builddir)/libnm \
-I$(srcdir)/clients/tui/newt \
-I$(srcdir)/clients/common \
$(GLIB_CFLAGS) \
$(clients_cppflags) \
$(NEWT_CFLAGS) \
-DG_LOG_DOMAIN=\""nmtui"\" \
-DLOCALEDIR=\""$(localedir)"\" \
$(NULL)
-DLOCALEDIR=\""$(localedir)"\"
clients_tui_nmtui_LDFLAGS = \
-Wl,--version-script="$(srcdir)/linker-script-binary.ver"
@ -3417,6 +3494,7 @@ clients_tui_nmtui_LDFLAGS = \
clients_tui_nmtui_LDADD = \
libnm/libnm.la \
clients/tui/newt/libnmt-newt.a \
clients/common/libnmc-base.la \
$(GLIB_LIBS) \
$(NEWT_LIBS) \
$(NULL)

View file

@ -21,6 +21,8 @@
#include "nm-default.h"
#include "agent.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@ -31,7 +33,6 @@
#include "utils.h"
#include "nm-secret-agent-simple.h"
#include "polkit-agent.h"
#include "agent.h"
static void
usage (void)
@ -125,7 +126,7 @@ secrets_requested (NMSecretAgentSimple *agent,
NmCli *nmc = (NmCli *) user_data;
gboolean success = FALSE;
if (nmc->print_output == NMC_PRINT_PRETTY)
if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY)
nmc_terminal_erase_line ();
success = get_secrets_from_user (request_id, title, msg, secrets);

View file

@ -21,6 +21,8 @@
#include "nm-default.h"
#include "common.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@ -30,145 +32,176 @@
#include <readline/history.h>
#include "nm-vpn-helpers.h"
#include "common.h"
#include "nm-client-utils.h"
#include "utils.h"
extern GMainLoop *loop;
/*****************************************************************************/
/* Available fields for IPv4 group */
NmcOutputField nmc_fields_ip4_config[] = {
{"GROUP", N_("GROUP")}, /* 0 */
{"ADDRESS", N_("ADDRESS")}, /* 1 */
{"GATEWAY", N_("GATEWAY")}, /* 2 */
{"ROUTE", N_("ROUTE")}, /* 3 */
{"DNS", N_("DNS")}, /* 4 */
{"DOMAIN", N_("DOMAIN")}, /* 5 */
{"WINS", N_("WINS")}, /* 6 */
{NULL, NULL}
static gconstpointer
_metagen_ip4_config_get_fcn (const NMMetaEnvironment *environment,
gpointer environment_user_data,
const NmcMetaGenericInfo *info,
gpointer target,
NMMetaAccessorGetType get_type,
NMMetaAccessorGetFlags get_flags,
NMMetaAccessorGetOutFlags *out_flags,
gpointer *out_to_free)
{
NMIPConfig *cfg4 = target;
GPtrArray *ptr_array;
char **arr;
const char *const*arrc;
guint i = 0;
nm_assert (info->info_type < _NMC_GENERIC_INFO_TYPE_IP4_CONFIG_NUM);
NMC_HANDLE_TERMFORMAT (NM_META_TERM_COLOR_NORMAL);
switch (info->info_type) {
case NMC_GENERIC_INFO_TYPE_IP4_CONFIG_ADDRESS:
if (!NM_FLAGS_HAS (get_flags, NM_META_ACCESSOR_GET_FLAGS_ACCEPT_STRV))
return NULL;
ptr_array = nm_ip_config_get_addresses (cfg4);
if (ptr_array) {
arr = g_new (char *, ptr_array->len + 1);
for (i = 0; i < ptr_array->len; i++) {
NMIPAddress *addr = g_ptr_array_index (ptr_array, i);
arr[i] = g_strdup_printf ("%s/%u",
nm_ip_address_get_address (addr),
nm_ip_address_get_prefix (addr));
}
arr[i] = NULL;
} else
arr = NULL;
goto arr_out;
case NMC_GENERIC_INFO_TYPE_IP4_CONFIG_GATEWAY:
return nm_ip_config_get_gateway (cfg4);
case NMC_GENERIC_INFO_TYPE_IP4_CONFIG_ROUTE:
if (!NM_FLAGS_HAS (get_flags, NM_META_ACCESSOR_GET_FLAGS_ACCEPT_STRV))
return NULL;
ptr_array = nm_ip_config_get_routes (cfg4);
if (ptr_array) {
arr = g_new (char *, ptr_array->len + 1);
for (i = 0; i < ptr_array->len; i++) {
NMIPRoute *route = g_ptr_array_index (ptr_array, i);
const char *next_hop;
next_hop = nm_ip_route_get_next_hop (route);
if (!next_hop)
next_hop = "0.0.0.0";
arr[i] = g_strdup_printf ("dst = %s/%u, nh = %s%c mt = %u",
nm_ip_route_get_dest (route),
nm_ip_route_get_prefix (route),
next_hop,
nm_ip_route_get_metric (route) == -1 ? '\0' : ',',
(guint32) nm_ip_route_get_metric (route));
}
arr[i] = NULL;
} else
arr = NULL;
goto arr_out;
case NMC_GENERIC_INFO_TYPE_IP4_CONFIG_DNS:
if (!NM_FLAGS_HAS (get_flags, NM_META_ACCESSOR_GET_FLAGS_ACCEPT_STRV))
return NULL;
arrc = nm_ip_config_get_nameservers (cfg4);
goto arrc_out;
case NMC_GENERIC_INFO_TYPE_IP4_CONFIG_DOMAIN:
if (!NM_FLAGS_HAS (get_flags, NM_META_ACCESSOR_GET_FLAGS_ACCEPT_STRV))
return NULL;
arrc = nm_ip_config_get_domains (cfg4);
goto arrc_out;
case NMC_GENERIC_INFO_TYPE_IP4_CONFIG_WINS:
if (!NM_FLAGS_HAS (get_flags, NM_META_ACCESSOR_GET_FLAGS_ACCEPT_STRV))
return NULL;
arrc = nm_ip_config_get_wins_servers (cfg4);
goto arrc_out;
default:
break;
}
g_return_val_if_reached (NULL);
arrc_out:
*out_flags |= NM_META_ACCESSOR_GET_OUT_FLAGS_STRV;
return arrc;
arr_out:
*out_flags |= NM_META_ACCESSOR_GET_OUT_FLAGS_STRV;
*out_to_free = arr;
return arr;
}
const NmcMetaGenericInfo *const metagen_ip4_config[_NMC_GENERIC_INFO_TYPE_IP4_CONFIG_NUM + 1] = {
#define _METAGEN_IP4_CONFIG(type, name) \
[type] = NMC_META_GENERIC(name, .info_type = type, .get_fcn = _metagen_ip4_config_get_fcn)
_METAGEN_IP4_CONFIG (NMC_GENERIC_INFO_TYPE_IP4_CONFIG_ADDRESS, "ADDRESS"),
_METAGEN_IP4_CONFIG (NMC_GENERIC_INFO_TYPE_IP4_CONFIG_GATEWAY, "GATEWAY"),
_METAGEN_IP4_CONFIG (NMC_GENERIC_INFO_TYPE_IP4_CONFIG_ROUTE, "ROUTE"),
_METAGEN_IP4_CONFIG (NMC_GENERIC_INFO_TYPE_IP4_CONFIG_DNS, "DNS"),
_METAGEN_IP4_CONFIG (NMC_GENERIC_INFO_TYPE_IP4_CONFIG_DOMAIN, "DOMAIN"),
_METAGEN_IP4_CONFIG (NMC_GENERIC_INFO_TYPE_IP4_CONFIG_WINS, "WINS"),
};
#define NMC_FIELDS_IP4_CONFIG_ALL "GROUP,ADDRESS,GATEWAY,ROUTE,DNS,DOMAIN,WINS"
/* Available fields for DHCPv4 group */
NmcOutputField nmc_fields_dhcp4_config[] = {
{"GROUP", N_("GROUP")}, /* 0 */
{"OPTION", N_("OPTION")}, /* 1 */
{NULL, NULL}
static const NmcMetaGenericInfo *const metagen_ip4_config_group[] = {
NMC_META_GENERIC_WITH_NESTED ("IP4", metagen_ip4_config, .name_header = N_("GROUP")),
NULL,
};
#define NMC_FIELDS_DHCP4_CONFIG_ALL "GROUP,OPTION"
/* Available fields for IPv6 group */
NmcOutputField nmc_fields_ip6_config[] = {
{"GROUP", N_("GROUP")}, /* 0 */
{"ADDRESS", N_("ADDRESS")}, /* 1 */
{"GATEWAY", N_("GATEWAY")}, /* 2 */
{"ROUTE", N_("ROUTE")}, /* 3 */
{"DNS", N_("DNS")}, /* 4 */
{"DOMAIN", N_("DOMAIN")}, /* 5 */
{NULL, NULL}
/*****************************************************************************/
const NmcMetaGenericInfo *const nmc_fields_dhcp4_config[] = {
NMC_META_GENERIC ("GROUP"), /* 0 */
NMC_META_GENERIC ("OPTION"), /* 1 */
NULL,
};
#define NMC_FIELDS_IP6_CONFIG_ALL "GROUP,ADDRESS,GATEWAY,ROUTE,DNS,DOMAIN"
/* Available fields for DHCPv6 group */
NmcOutputField nmc_fields_dhcp6_config[] = {
{"GROUP", N_("GROUP")}, /* 0 */
{"OPTION", N_("OPTION")}, /* 1 */
{NULL, NULL}
const NmcMetaGenericInfo *const nmc_fields_ip6_config[] = {
NMC_META_GENERIC ("GROUP"), /* 0 */
NMC_META_GENERIC ("ADDRESS"), /* 1 */
NMC_META_GENERIC ("GATEWAY"), /* 2 */
NMC_META_GENERIC ("ROUTE"), /* 3 */
NMC_META_GENERIC ("DNS"), /* 4 */
NMC_META_GENERIC ("DOMAIN"), /* 5 */
NULL,
};
#define NMC_FIELDS_DHCP6_CONFIG_ALL "GROUP,OPTION"
const NmcMetaGenericInfo *const nmc_fields_dhcp6_config[] = {
NMC_META_GENERIC ("GROUP"), /* 0 */
NMC_META_GENERIC ("OPTION"), /* 1 */
NULL,
};
gboolean
print_ip4_config (NMIPConfig *cfg4,
NmCli *nmc,
const char *group_prefix,
const NmcConfig *nmc_config,
const char *one_field)
{
GPtrArray *ptr_array;
char **addr_arr = NULL;
char **route_arr = NULL;
char **dns_arr = NULL;
char **domain_arr = NULL;
char **wins_arr = NULL;
int i = 0;
NmcOutputField *tmpl, *arr;
size_t tmpl_len;
gs_free_error GError *error = NULL;
gs_free char *field_str = NULL;
if (cfg4 == NULL)
return FALSE;
tmpl = nmc_fields_ip4_config;
tmpl_len = sizeof (nmc_fields_ip4_config);
nmc->print_fields.indices = parse_output_fields (one_field ? one_field : NMC_FIELDS_IP4_CONFIG_ALL,
tmpl, FALSE, NULL, NULL);
arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
g_ptr_array_add (nmc->output_data, arr);
if (one_field)
field_str = g_strdup_printf ("IP4.%s", one_field);
/* addresses */
ptr_array = nm_ip_config_get_addresses (cfg4);
if (ptr_array) {
addr_arr = g_new (char *, ptr_array->len + 1);
for (i = 0; i < ptr_array->len; i++) {
NMIPAddress *addr = (NMIPAddress *) g_ptr_array_index (ptr_array, i);
addr_arr[i] = g_strdup_printf ("%s/%u",
nm_ip_address_get_address (addr),
nm_ip_address_get_prefix (addr));
}
addr_arr[i] = NULL;
if (!nmc_print (nmc_config,
(gpointer[]) { cfg4, NULL },
NULL,
(const NMMetaAbstractInfo *const*) metagen_ip4_config_group,
field_str,
&error)) {
return FALSE;
}
/* routes */
ptr_array = nm_ip_config_get_routes (cfg4);
if (ptr_array) {
route_arr = g_new (char *, ptr_array->len + 1);
for (i = 0; i < ptr_array->len; i++) {
NMIPRoute *route = (NMIPRoute *) g_ptr_array_index (ptr_array, i);
const char *next_hop;
next_hop = nm_ip_route_get_next_hop (route);
if (!next_hop)
next_hop = "0.0.0.0";
route_arr[i] = g_strdup_printf ("dst = %s/%u, nh = %s%c mt = %u",
nm_ip_route_get_dest (route),
nm_ip_route_get_prefix (route),
next_hop,
nm_ip_route_get_metric (route) == -1 ? '\0' : ',',
(guint32) nm_ip_route_get_metric (route));
}
route_arr[i] = NULL;
}
/* DNS */
dns_arr = g_strdupv ((char **) nm_ip_config_get_nameservers (cfg4));
/* domains */
domain_arr = g_strdupv ((char **) nm_ip_config_get_domains (cfg4));
/* WINS */
wins_arr = g_strdupv ((char **) nm_ip_config_get_wins_servers (cfg4));
arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
set_val_strc (arr, 0, group_prefix);
set_val_arr (arr, 1, addr_arr);
set_val_strc (arr, 2, nm_ip_config_get_gateway (cfg4));
set_val_arr (arr, 3, route_arr);
set_val_arr (arr, 4, dns_arr);
set_val_arr (arr, 5, domain_arr);
set_val_arr (arr, 6, wins_arr);
g_ptr_array_add (nmc->output_data, arr);
print_data (nmc); /* Print all data */
/* Remove any previous data */
nmc_empty_output_fields (nmc);
return TRUE;
}
gboolean
print_ip6_config (NMIPConfig *cfg6,
NmCli *nmc,
const NmcConfig *nmc_config,
const char *group_prefix,
const char *one_field)
{
@ -178,18 +211,18 @@ print_ip6_config (NMIPConfig *cfg6,
char **dns_arr = NULL;
char **domain_arr = NULL;
int i = 0;
NmcOutputField *tmpl, *arr;
size_t tmpl_len;
const NMMetaAbstractInfo *const*tmpl;
NmcOutputField *arr;
NMC_OUTPUT_DATA_DEFINE_SCOPED (out);
if (cfg6 == NULL)
return FALSE;
tmpl = nmc_fields_ip6_config;
tmpl_len = sizeof (nmc_fields_ip6_config);
nmc->print_fields.indices = parse_output_fields (one_field ? one_field : NMC_FIELDS_IP6_CONFIG_ALL,
tmpl, FALSE, NULL, NULL);
arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
g_ptr_array_add (nmc->output_data, arr);
tmpl = (const NMMetaAbstractInfo *const*) nmc_fields_ip6_config;
out_indices = parse_output_fields (one_field,
tmpl, FALSE, NULL, NULL);
arr = nmc_dup_fields_array (tmpl, NMC_OF_FLAG_FIELD_NAMES);
g_ptr_array_add (out.output_data, arr);
/* addresses */
ptr_array = nm_ip_config_get_addresses (cfg6);
@ -233,32 +266,30 @@ print_ip6_config (NMIPConfig *cfg6,
/* domains */
domain_arr = g_strdupv ((char **) nm_ip_config_get_domains (cfg6));
arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
arr = nmc_dup_fields_array (tmpl, NMC_OF_FLAG_SECTION_PREFIX);
set_val_strc (arr, 0, group_prefix);
set_val_arr (arr, 1, addr_arr);
set_val_strc (arr, 2, nm_ip_config_get_gateway (cfg6));
set_val_arr (arr, 3, route_arr);
set_val_arr (arr, 4, dns_arr);
set_val_arr (arr, 5, domain_arr);
g_ptr_array_add (nmc->output_data, arr);
g_ptr_array_add (out.output_data, arr);
print_data (nmc); /* Print all data */
/* Remove any previous data */
nmc_empty_output_fields (nmc);
print_data_prepare_width (out.output_data);
print_data (nmc_config, out_indices, NULL, 0, &out);
return TRUE;
}
gboolean
print_dhcp4_config (NMDhcpConfig *dhcp4,
NmCli *nmc,
const NmcConfig *nmc_config,
const char *group_prefix,
const char *one_field)
{
GHashTable *table;
NmcOutputField *tmpl, *arr;
size_t tmpl_len;
const NMMetaAbstractInfo *const*tmpl;
NmcOutputField *arr;
if (dhcp4 == NULL)
return FALSE;
@ -269,13 +300,13 @@ print_dhcp4_config (NMDhcpConfig *dhcp4,
gpointer key, value;
char **options_arr = NULL;
int i = 0;
NMC_OUTPUT_DATA_DEFINE_SCOPED (out);
tmpl = nmc_fields_dhcp4_config;
tmpl_len = sizeof (nmc_fields_dhcp4_config);
nmc->print_fields.indices = parse_output_fields (one_field ? one_field : NMC_FIELDS_DHCP4_CONFIG_ALL,
tmpl, FALSE, NULL, NULL);
arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
g_ptr_array_add (nmc->output_data, arr);
tmpl = (const NMMetaAbstractInfo *const*) nmc_fields_dhcp4_config;
out_indices = parse_output_fields (one_field,
tmpl, FALSE, NULL, NULL);
arr = nmc_dup_fields_array (tmpl, NMC_OF_FLAG_FIELD_NAMES);
g_ptr_array_add (out.output_data, arr);
options_arr = g_new (char *, g_hash_table_size (table) + 1);
g_hash_table_iter_init (&table_iter, table);
@ -283,15 +314,13 @@ print_dhcp4_config (NMDhcpConfig *dhcp4,
options_arr[i++] = g_strdup_printf ("%s = %s", (char *) key, (char *) value);
options_arr[i] = NULL;
arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
arr = nmc_dup_fields_array (tmpl, NMC_OF_FLAG_SECTION_PREFIX);
set_val_strc (arr, 0, group_prefix);
set_val_arr (arr, 1, options_arr);
g_ptr_array_add (nmc->output_data, arr);
g_ptr_array_add (out.output_data, arr);
print_data (nmc); /* Print all data */
/* Remove any previous data */
nmc_empty_output_fields (nmc);
print_data_prepare_width (out.output_data);
print_data (nmc_config, out_indices, NULL, 0, &out);
return TRUE;
}
@ -300,13 +329,13 @@ print_dhcp4_config (NMDhcpConfig *dhcp4,
gboolean
print_dhcp6_config (NMDhcpConfig *dhcp6,
NmCli *nmc,
const NmcConfig *nmc_config,
const char *group_prefix,
const char *one_field)
{
GHashTable *table;
NmcOutputField *tmpl, *arr;
size_t tmpl_len;
const NMMetaAbstractInfo *const*tmpl;
NmcOutputField *arr;
if (dhcp6 == NULL)
return FALSE;
@ -317,13 +346,13 @@ print_dhcp6_config (NMDhcpConfig *dhcp6,
gpointer key, value;
char **options_arr = NULL;
int i = 0;
NMC_OUTPUT_DATA_DEFINE_SCOPED (out);
tmpl = nmc_fields_dhcp6_config;
tmpl_len = sizeof (nmc_fields_dhcp6_config);
nmc->print_fields.indices = parse_output_fields (one_field ? one_field : NMC_FIELDS_DHCP6_CONFIG_ALL,
tmpl, FALSE, NULL, NULL);
arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
g_ptr_array_add (nmc->output_data, arr);
tmpl = (const NMMetaAbstractInfo *const*) nmc_fields_dhcp6_config;
out_indices = parse_output_fields (one_field,
tmpl, FALSE, NULL, NULL);
arr = nmc_dup_fields_array (tmpl, NMC_OF_FLAG_FIELD_NAMES);
g_ptr_array_add (out.output_data, arr);
options_arr = g_new (char *, g_hash_table_size (table) + 1);
g_hash_table_iter_init (&table_iter, table);
@ -331,209 +360,19 @@ print_dhcp6_config (NMDhcpConfig *dhcp6,
options_arr[i++] = g_strdup_printf ("%s = %s", (char *) key, (char *) value);
options_arr[i] = NULL;
arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
arr = nmc_dup_fields_array (tmpl, NMC_OF_FLAG_SECTION_PREFIX);
set_val_strc (arr, 0, group_prefix);
set_val_arr (arr, 1, options_arr);
g_ptr_array_add (nmc->output_data, arr);
g_ptr_array_add (out.output_data, arr);
print_data (nmc); /* Print all data */
/* Remove any previous data */
nmc_empty_output_fields (nmc);
print_data_prepare_width (out.output_data);
print_data (nmc_config, out_indices, NULL, 0, &out);
return TRUE;
}
return FALSE;
}
/*
* Parse IP address from string to NMIPAddress stucture.
* ip_str is the IP address in the form address/prefix
*/
NMIPAddress *
nmc_parse_and_build_address (int family, const char *ip_str, GError **error)
{
int max_prefix = (family == AF_INET) ? 32 : 128;
NMIPAddress *addr = NULL;
const char *ip;
char *tmp;
char *plen;
long int prefix;
GError *local = NULL;
g_return_val_if_fail (ip_str != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
tmp = g_strdup (ip_str);
plen = strchr (tmp, '/'); /* prefix delimiter */
if (plen)
*plen++ = '\0';
ip = tmp;
prefix = max_prefix;
if (plen) {
if (!nmc_string_to_int (plen, TRUE, 1, max_prefix, &prefix)) {
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
_("invalid prefix '%s'; <1-%d> allowed"), plen, max_prefix);
goto finish;
}
}
addr = nm_ip_address_new (family, ip, (guint32) prefix, &local);
if (!addr) {
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
_("invalid IP address: %s"), local->message);
g_clear_error (&local);
}
finish:
g_free (tmp);
return addr;
}
/*
* nmc_parse_and_build_route:
* @family: AF_INET or AF_INET6
* @str: route string to be parsed
* @error: location to store GError
*
* Parse route from string and return an #NMIPRoute
*
* Returns: a new #NMIPRoute or %NULL on error
*/
NMIPRoute *
nmc_parse_and_build_route (int family,
const char *str,
GError **error)
{
int max_prefix = (family == AF_INET) ? 32 : 128;
char *plen = NULL;
const char *next_hop = NULL;
const char *canon_dest;
long int prefix = max_prefix;
unsigned long int tmp_ulong;
NMIPRoute *route = NULL;
gboolean success = FALSE;
GError *local = NULL;
gint64 metric = -1;
guint i, len;
gs_strfreev char **routev = NULL;
gs_free char *value = NULL;
gs_free char *dest = NULL;
gs_unref_hashtable GHashTable *attrs = NULL;
GHashTable *tmp_attrs;
const char *syntax = _("The valid syntax is: 'ip[/prefix] [next-hop] [metric] [attribute=val]... [,ip[/prefix] ...]'");
g_return_val_if_fail (family == AF_INET || family == AF_INET6, FALSE);
g_return_val_if_fail (str, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
value = g_strdup (str);
routev = nmc_strsplit_set (g_strstrip (value), " \t", 0);
len = g_strv_length (routev);
if (len < 1) {
g_set_error (error, 1, 0, "%s", syntax);
g_prefix_error (error, "'%s' is not valid. ", str);
goto finish;
}
dest = g_strdup (routev[0]);
plen = strchr (dest, '/'); /* prefix delimiter */
if (plen)
*plen++ = '\0';
if (plen) {
if (!nmc_string_to_int (plen, TRUE, 1, max_prefix, &prefix)) {
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
_("invalid prefix '%s'; <1-%d> allowed"),
plen, max_prefix);
goto finish;
}
}
for (i = 1; i < len; i++) {
if (nm_utils_ipaddr_valid (family, routev[i])) {
if (metric != -1 || attrs) {
g_set_error (error, 1, 0, _("the next hop ('%s') must be first"), routev[i]);
goto finish;
}
next_hop = routev[i];
} else if (nmc_string_to_uint (routev[i], TRUE, 0, G_MAXUINT32, &tmp_ulong)) {
if (attrs) {
g_set_error (error, 1, 0, _("the metric ('%s') must be before attributes"), routev[i]);
goto finish;
}
metric = tmp_ulong;
} else if (strchr (routev[i], '=')) {
GHashTableIter iter;
char *iter_key;
GVariant *iter_value;
tmp_attrs = nm_utils_parse_variant_attributes (routev[i], ' ', '=', FALSE,
nm_ip_route_get_variant_attribute_spec(),
error);
if (!tmp_attrs) {
g_prefix_error (error, "invalid option '%s': ", routev[i]);
goto finish;
}
if (!attrs)
attrs = g_hash_table_new (g_str_hash, g_str_equal);
g_hash_table_iter_init (&iter, tmp_attrs);
while (g_hash_table_iter_next (&iter, (gpointer *) &iter_key, (gpointer *) &iter_value)) {
if (!nm_ip_route_attribute_validate (iter_key, iter_value, family, NULL, error)) {
g_prefix_error (error, "%s: ", iter_key);
g_hash_table_unref (tmp_attrs);
goto finish;
}
g_hash_table_insert (attrs, iter_key, iter_value);
g_hash_table_iter_steal (&iter);
}
g_hash_table_unref (tmp_attrs);
} else {
g_set_error (error, 1, 0, "%s", syntax);
goto finish;
}
}
route = nm_ip_route_new (family, dest, prefix, next_hop, metric, &local);
if (!route) {
g_set_error (error, 1, 0, "%s", syntax);
g_prefix_error (error, _("invalid route: %s. "), local->message);
g_clear_error (&local);
goto finish;
}
/* We don't accept default routes as NetworkManager handles it
* itself. But we have to check this after @route has normalized the
* dest string.
*/
canon_dest = nm_ip_route_get_dest (route);
if (!strcmp (canon_dest, "0.0.0.0") || !strcmp (canon_dest, "::")) {
g_set_error_literal (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
_("default route cannot be added (NetworkManager handles it by itself)"));
g_clear_pointer (&route, nm_ip_route_unref);
goto finish;
}
if (attrs) {
GHashTableIter iter;
char *name;
GVariant *variant;
g_hash_table_iter_init (&iter, attrs);
while (g_hash_table_iter_next (&iter, (gpointer *) &name, (gpointer *) &variant))
nm_ip_route_set_attribute (route, name, variant);
}
success = TRUE;
finish:
return route;
}
const char *
nmc_device_state_to_string (NMDeviceState state)
{
@ -783,240 +622,6 @@ nmc_device_reason_to_string (NMDeviceStateReason reason)
}
}
/* Max priority values from libnm-core/nm-setting-vlan.c */
#define MAX_SKB_PRIO G_MAXUINT32
#define MAX_8021P_PRIO 7 /* Max 802.1p priority */
/*
* Parse VLAN priority mappings from the following format: 2:1,3:4,7:3
* and verify if the priority numbers are valid
*
* Return: string array with split maps, or NULL on error
* Caller is responsible for freeing the array.
*/
char **
nmc_vlan_parse_priority_maps (const char *priority_map,
NMVlanPriorityMap map_type,
GError **error)
{
char **mapping = NULL, **iter;
unsigned long from, to, from_max, to_max;
g_return_val_if_fail (priority_map != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (map_type == NM_VLAN_INGRESS_MAP) {
from_max = MAX_8021P_PRIO;
to_max = MAX_SKB_PRIO;
} else {
from_max = MAX_SKB_PRIO;
to_max = MAX_8021P_PRIO;
}
mapping = g_strsplit (priority_map, ",", 0);
for (iter = mapping; iter && *iter; iter++) {
char *left, *right;
left = g_strstrip (*iter);
right = strchr (left, ':');
if (!right) {
g_set_error (error, 1, 0, _("invalid priority map '%s'"), *iter);
g_strfreev (mapping);
return NULL;
}
*right++ = '\0';
if (!nmc_string_to_uint (left, TRUE, 0, from_max, &from)) {
g_set_error (error, 1, 0, _("priority '%s' is not valid (<0-%ld>)"),
left, from_max);
g_strfreev (mapping);
return NULL;
}
if (!nmc_string_to_uint (right, TRUE, 0, to_max, &to)) {
g_set_error (error, 1, 0, _("priority '%s' is not valid (<0-%ld>)"),
right, to_max);
g_strfreev (mapping);
return NULL;
}
*(right-1) = ':'; /* Put back ':' */
}
return mapping;
}
const char *
nmc_bond_validate_mode (const char *mode, GError **error)
{
unsigned long mode_int;
static const char *valid_modes[] = { "balance-rr",
"active-backup",
"balance-xor",
"broadcast",
"802.3ad",
"balance-tlb",
"balance-alb",
NULL };
if (nmc_string_to_uint (mode, TRUE, 0, 6, &mode_int)) {
/* Translate bonding mode numbers to mode names:
* https://www.kernel.org/doc/Documentation/networking/bonding.txt
*/
return valid_modes[mode_int];
} else
return nmc_string_is_valid (mode, valid_modes, error);
}
/*
* nmc_team_check_config:
* @config: file name with team config, or raw team JSON config data
* @out_config: raw team JSON config data
* The value must be freed with g_free().
* @error: location to store error, or %NUL
*
* Check team config from @config parameter and return the checked
* config in @out_config.
*
* Returns: %TRUE if the config is valid, %FALSE if it is invalid
*/
gboolean
nmc_team_check_config (const char *config, char **out_config, GError **error)
{
enum {
_TEAM_CONFIG_TYPE_GUESS,
_TEAM_CONFIG_TYPE_FILE,
_TEAM_CONFIG_TYPE_JSON,
} desired_type = _TEAM_CONFIG_TYPE_GUESS;
const char *filename = NULL;
size_t c_len = 0;
gs_free char *config_clone = NULL;
*out_config = NULL;
if (!config || !config[0])
return TRUE;
if (g_str_has_prefix (config, "file://")) {
config += NM_STRLEN ("file://");
desired_type = _TEAM_CONFIG_TYPE_FILE;
} else if (g_str_has_prefix (config, "json://")) {
config += NM_STRLEN ("json://");
desired_type = _TEAM_CONFIG_TYPE_JSON;
}
if (NM_IN_SET (desired_type, _TEAM_CONFIG_TYPE_FILE, _TEAM_CONFIG_TYPE_GUESS)) {
gs_free char *contents = NULL;
if (!g_file_get_contents (config, &contents, &c_len, NULL)) {
if (desired_type == _TEAM_CONFIG_TYPE_FILE) {
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
_("cannot read team config from file '%s'"),
config);
return FALSE;
}
} else {
if (c_len != strlen (contents)) {
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
_("team config file '%s' contains non-valid utf-8"),
config);
return FALSE;
}
filename = config;
config = config_clone = g_steal_pointer (&contents);
}
}
if (!nm_utils_is_json_object (config, NULL)) {
if (filename) {
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
_("'%s' does not contain a valid team configuration"), filename);
} else {
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
_("team configuration must be a JSON object"));
}
return FALSE;
}
*out_config = (config == config_clone)
? g_steal_pointer (&config_clone)
: g_strdup (config);
return TRUE;
}
/*
* nmc_proxy_check_script:
* @script: file name with PAC script, or raw PAC Script data
* @out_script: raw PAC Script (with removed new-line characters)
* @error: location to store error, or %NULL
*
* Check PAC Script from @script parameter and return the checked/sanitized
* config in @out_script.
*
* Returns: %TRUE if the script is valid, %FALSE if it is invalid
*/
gboolean
nmc_proxy_check_script (const char *script, char **out_script, GError **error)
{
enum {
_PAC_SCRIPT_TYPE_GUESS,
_PAC_SCRIPT_TYPE_FILE,
_PAC_SCRIPT_TYPE_JSON,
} desired_type = _PAC_SCRIPT_TYPE_GUESS;
const char *filename = NULL;
size_t c_len = 0;
gs_free char *script_clone = NULL;
*out_script = NULL;
if (!script || !script[0])
return TRUE;
if (g_str_has_prefix (script, "file://")) {
script += NM_STRLEN ("file://");
desired_type = _PAC_SCRIPT_TYPE_FILE;
} else if (g_str_has_prefix (script, "js://")) {
script += NM_STRLEN ("js://");
desired_type = _PAC_SCRIPT_TYPE_JSON;
}
if (NM_IN_SET (desired_type, _PAC_SCRIPT_TYPE_FILE, _PAC_SCRIPT_TYPE_GUESS)) {
gs_free char *contents = NULL;
if (!g_file_get_contents (script, &contents, &c_len, NULL)) {
if (desired_type == _PAC_SCRIPT_TYPE_FILE) {
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
_("cannot read pac-script from file '%s'"),
script);
return FALSE;
}
} else {
if (c_len != strlen (contents)) {
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
_("file '%s' contains non-valid utf-8"),
script);
return FALSE;
}
filename = script;
script = script_clone = g_steal_pointer (&contents);
}
}
if ( !strstr (script, "FindProxyForURL")
|| !g_utf8_validate (script, -1, NULL)) {
if (filename) {
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
_("'%s' does not contain a valid PAC Script"), filename);
} else {
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
_("Not a valid PAC Script"));
}
return FALSE;
}
*out_script = (script == script_clone)
? g_steal_pointer (&script_clone)
: g_strdup (script);
return TRUE;
}
/*
* nmc_find_connection:
* @connections: array of NMConnections to search in
@ -1261,7 +866,7 @@ nmc_secrets_requested (NMSecretAgentSimple *agent,
gboolean success = FALSE;
const GPtrArray *connections;
if (nmc->print_output == NMC_PRINT_PRETTY)
if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY)
nmc_terminal_erase_line ();
/* Find the connection for the request */
@ -1275,8 +880,8 @@ nmc_secrets_requested (NMSecretAgentSimple *agent,
g_free (path);
}
success = get_secrets_from_user (request_id, title, msg, connection, nmc->in_editor || nmc->ask,
nmc->show_secrets, nmc->pwds_hash, secrets);
success = get_secrets_from_user (request_id, title, msg, connection, nmc->nmc_config.in_editor || nmc->ask,
nmc->nmc_config.show_secrets, nmc->pwds_hash, secrets);
if (success)
nm_secret_agent_simple_response (agent, request_id, secrets);
else {
@ -1394,7 +999,7 @@ read_again:
if (nmc_seen_sigint ()) {
/* Ctrl-C */
nmc_clear_sigint ();
if ( nm_cli.in_editor
if ( nm_cli.nmc_config.in_editor
|| (rl_string && *rl_string)) {
/* In editor, or the line is not empty */
/* Call readline again to get new prompt (repeat) */
@ -1501,7 +1106,7 @@ nmc_readline_echo (gboolean echo_on, const char *prompt_fmt, ...)
* See e.g. http://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC49
*/
char *
nmc_rl_gen_func_basic (const char *text, int state, const char **words)
nmc_rl_gen_func_basic (const char *text, int state, const char *const*words)
{
static int list_idx, len;
const char *name;
@ -1521,6 +1126,43 @@ nmc_rl_gen_func_basic (const char *text, int state, const char **words)
return NULL;
}
static struct {
bool initialized;
guint idx;
char **values;
} _rl_compentry_func_wrap = { 0 };
static char *
_rl_compentry_func_wrap_fcn (const char *text, int state)
{
g_return_val_if_fail (_rl_compentry_func_wrap.initialized, NULL);
while ( _rl_compentry_func_wrap.values
&& _rl_compentry_func_wrap.values[_rl_compentry_func_wrap.idx]
&& !g_str_has_prefix (_rl_compentry_func_wrap.values[_rl_compentry_func_wrap.idx], text))
_rl_compentry_func_wrap.idx++;
if ( !_rl_compentry_func_wrap.values
|| !_rl_compentry_func_wrap.values[_rl_compentry_func_wrap.idx]) {
g_strfreev (_rl_compentry_func_wrap.values);
_rl_compentry_func_wrap.values = NULL;
_rl_compentry_func_wrap.initialized = FALSE;
return NULL;
}
return g_strdup (_rl_compentry_func_wrap.values[_rl_compentry_func_wrap.idx++]);
}
NmcCompEntryFunc
nmc_rl_compentry_func_wrap (const char *const*values)
{
g_strfreev (_rl_compentry_func_wrap.values);
_rl_compentry_func_wrap.values = g_strdupv ((char **) values);
_rl_compentry_func_wrap.idx = 0;
_rl_compentry_func_wrap.initialized = TRUE;
return _rl_compentry_func_wrap_fcn;
}
char *
nmc_rl_gen_func_ifnames (const char *text, int state)
{
@ -1606,8 +1248,6 @@ nmc_parse_lldp_capabilities (guint value)
return g_string_free (str, FALSE);
}
extern GMainLoop *loop;
static void
command_done (GObject *object, GAsyncResult *res, gpointer user_data)
{

View file

@ -25,27 +25,15 @@
#include "nmcli.h"
#include "nm-secret-agent-simple.h"
gboolean print_ip4_config (NMIPConfig *cfg4, NmCli *nmc, const char *group_prefix, const char *one_field);
gboolean print_ip6_config (NMIPConfig *cfg6, NmCli *nmc, const char *group_prefix, const char *one_field);
gboolean print_dhcp4_config (NMDhcpConfig *dhcp4, NmCli *nmc, const char *group_prefix, const char *one_field);
gboolean print_dhcp6_config (NMDhcpConfig *dhcp6, NmCli *nmc, const char *group_prefix, const char *one_field);
NMIPAddress *nmc_parse_and_build_address (int family, const char *ip_str, GError **error);
NMIPRoute *nmc_parse_and_build_route (int family, const char *str, GError **error);
gboolean print_ip4_config (NMIPConfig *cfg4, const NmcConfig *nmc_config, const char *one_field);
gboolean print_ip6_config (NMIPConfig *cfg6, const NmcConfig *nmc_config, const char *group_prefix, const char *one_field);
gboolean print_dhcp4_config (NMDhcpConfig *dhcp4, const NmcConfig *nmc_config, const char *group_prefix, const char *one_field);
gboolean print_dhcp6_config (NMDhcpConfig *dhcp6, const NmcConfig *nmc_config, const char *group_prefix, const char *one_field);
const char * nmc_device_state_to_string (NMDeviceState state);
const char * nmc_device_reason_to_string (NMDeviceStateReason reason);
const char * nmc_device_metered_to_string (NMMetered value);
char **
nmc_vlan_parse_priority_maps (const char *priority_map,
NMVlanPriorityMap map_type,
GError **error);
const char *nmc_bond_validate_mode (const char *mode, GError **error);
gboolean nmc_team_check_config (const char *config, char **out_config, GError **error);
gboolean nmc_proxy_check_script (const char *script, char **out_script, GError **error);
NMConnection *nmc_find_connection (const GPtrArray *connections,
const char *filter_type,
const char *filter_val,
@ -65,7 +53,8 @@ char *nmc_unique_connection_name (const GPtrArray *connections,
void nmc_cleanup_readline (void);
char *nmc_readline (const char *prompt_fmt, ...) G_GNUC_PRINTF (1, 2);
char *nmc_readline_echo (gboolean echo_on, const char *prompt_fmt, ...) G_GNUC_PRINTF (2, 3);
char *nmc_rl_gen_func_basic (const char *text, int state, const char **words);
NmcCompEntryFunc nmc_rl_compentry_func_wrap (const char *const*values);
char *nmc_rl_gen_func_basic (const char *text, int state, const char *const*words);
char *nmc_rl_gen_func_ifnames (const char *text, int state);
gboolean nmc_get_in_readline (void);
void nmc_set_in_readline (gboolean in_readline);
@ -92,9 +81,9 @@ void nmc_complete_bool (const char *prefix);
const char *nmc_error_get_simple_message (GError *error);
extern NmcOutputField nmc_fields_ip4_config[];
extern NmcOutputField nmc_fields_dhcp4_config[];
extern NmcOutputField nmc_fields_ip6_config[];
extern NmcOutputField nmc_fields_dhcp6_config[];
extern const NmcMetaGenericInfo *const metagen_ip4_config[];
extern const NmcMetaGenericInfo *const nmc_fields_dhcp4_config[];
extern const NmcMetaGenericInfo *const nmc_fields_ip6_config[];
extern const NmcMetaGenericInfo *const nmc_fields_dhcp6_config[];
#endif /* NMC_COMMON_H */

File diff suppressed because it is too large Load diff

View file

@ -33,12 +33,11 @@ nmc_read_connection_properties (NmCli *nmc,
char ***argv,
GError **error);
void nmc_active_connection_state_to_color (NMActiveConnectionState state, NmcTermColor *color);
void nmc_active_connection_state_to_color (NMActiveConnectionState state, NMMetaTermColor *color);
extern NmcOutputField nmc_fields_con_show[];
extern NmcOutputField nmc_fields_settings_names[];
extern NmcOutputField nmc_fields_con_active_details_general[];
extern NmcOutputField nmc_fields_con_active_details_vpn[];
extern NmcOutputField nmc_fields_con_active_details_groups[];
extern const NmcMetaGenericInfo *const nmc_fields_con_show[];
extern const NmcMetaGenericInfo *const nmc_fields_con_active_details_general[];
extern const NmcMetaGenericInfo *const nmc_fields_con_active_details_vpn[];
extern const NmcMetaGenericInfo *const nmc_fields_con_active_details_groups[];
#endif /* NMC_CONNECTIONS_H */

File diff suppressed because it is too large Load diff

View file

@ -32,22 +32,22 @@ void monitor_devices (NmCli *nmc);
NMDevice ** nmc_get_devices_sorted (NMClient *client);
void nmc_device_state_to_color (NMDeviceState state, NmcTermColor *color, NmcTermFormat *color_fmt);
void nmc_device_state_to_color (NMDeviceState state, NMMetaTermColor *color, NMMetaTermFormat *color_fmt);
extern NmcOutputField nmc_fields_dev_status[];
extern NmcOutputField nmc_fields_dev_show_general[];
extern NmcOutputField nmc_fields_dev_show_connections[];
extern NmcOutputField nmc_fields_dev_show_cap[];
extern NmcOutputField nmc_fields_dev_show_wired_prop[];
extern NmcOutputField nmc_fields_dev_show_wifi_prop[];
extern NmcOutputField nmc_fields_dev_show_wimax_prop[];
extern NmcOutputField nmc_fields_dev_wifi_list[];
extern NmcOutputField nmc_fields_dev_wimax_list[];
extern NmcOutputField nmc_fields_dev_show_master_prop[];
extern NmcOutputField nmc_fields_dev_show_team_prop[];
extern NmcOutputField nmc_fields_dev_show_vlan_prop[];
extern NmcOutputField nmc_fields_dev_show_bluetooth[];
extern NmcOutputField nmc_fields_dev_show_sections[];
extern NmcOutputField nmc_fields_dev_lldp_list[];
extern const NmcMetaGenericInfo *const nmc_fields_dev_status[];
extern const NmcMetaGenericInfo *const nmc_fields_dev_show_general[];
extern const NmcMetaGenericInfo *const nmc_fields_dev_show_connections[];
extern const NmcMetaGenericInfo *const nmc_fields_dev_show_cap[];
extern const NmcMetaGenericInfo *const nmc_fields_dev_show_wired_prop[];
extern const NmcMetaGenericInfo *const nmc_fields_dev_show_wifi_prop[];
extern const NmcMetaGenericInfo *const nmc_fields_dev_show_wimax_prop[];
extern const NmcMetaGenericInfo *const nmc_fields_dev_wifi_list[];
extern const NmcMetaGenericInfo *const nmc_fields_dev_wimax_list[];
extern const NmcMetaGenericInfo *const nmc_fields_dev_show_master_prop[];
extern const NmcMetaGenericInfo *const nmc_fields_dev_show_team_prop[];
extern const NmcMetaGenericInfo *const nmc_fields_dev_show_vlan_prop[];
extern const NmcMetaGenericInfo *const nmc_fields_dev_show_bluetooth[];
extern const NmcMetaGenericInfo *const nmc_fields_dev_show_sections[];
extern const NmcMetaGenericInfo *const nmc_fields_dev_lldp_list[];
#endif /* NMC_DEVICES_H */

View file

@ -19,34 +19,246 @@
#include "nm-default.h"
#include "general.h"
#include <string.h>
#include <stdlib.h>
#include "nm-common-macros.h"
#include "nm-client-utils.h"
#include "polkit-agent.h"
#include "utils.h"
#include "common.h"
#include "general.h"
#include "common.h"
#include "nm-common-macros.h"
#include "devices.h"
#include "connections.h"
/* Available fields for 'general status' */
static NmcOutputField nmc_fields_nm_status[] = {
{"RUNNING", N_("RUNNING")}, /* 0 */
{"VERSION", N_("VERSION")}, /* 1 */
{"STATE", N_("STATE")}, /* 2 */
{"STARTUP", N_("STARTUP")}, /* 3 */
{"CONNECTIVITY", N_("CONNECTIVITY")}, /* 4 */
{"NETWORKING", N_("NETWORKING")}, /* 5 */
{"WIFI-HW", N_("WIFI-HW")}, /* 6 */
{"WIFI", N_("WIFI")}, /* 7 */
{"WWAN-HW", N_("WWAN-HW")}, /* 8 */
{"WWAN", N_("WWAN")}, /* 9 */
{"WIMAX-HW", N_("WIMAX-HW")}, /* 10 */
{"WIMAX", N_("WIMAX")}, /* 11 */
{NULL, NULL}
/*****************************************************************************/
NM_UTILS_LOOKUP_STR_DEFINE_STATIC (nm_state_to_string_no_l10n, NMState,
NM_UTILS_LOOKUP_DEFAULT (N_("unknown")),
NM_UTILS_LOOKUP_ITEM (NM_STATE_ASLEEP, N_("asleep")),
NM_UTILS_LOOKUP_ITEM (NM_STATE_CONNECTING, N_("connecting")),
NM_UTILS_LOOKUP_ITEM (NM_STATE_CONNECTED_LOCAL, N_("connected (local only)")),
NM_UTILS_LOOKUP_ITEM (NM_STATE_CONNECTED_SITE, N_("connected (site only)")),
NM_UTILS_LOOKUP_ITEM (NM_STATE_CONNECTED_GLOBAL, N_("connected")),
NM_UTILS_LOOKUP_ITEM (NM_STATE_DISCONNECTING, N_("disconnecting")),
NM_UTILS_LOOKUP_ITEM (NM_STATE_DISCONNECTED, N_("disconnected")),
NM_UTILS_LOOKUP_ITEM_IGNORE (NM_STATE_UNKNOWN),
);
static const char *
nm_state_to_string (NMState state)
{
return _(nm_state_to_string_no_l10n (state));
}
static NMMetaTermColor
state_to_color (NMState state)
{
switch (state) {
case NM_STATE_CONNECTING:
return NM_META_TERM_COLOR_YELLOW;
case NM_STATE_CONNECTED_LOCAL:
case NM_STATE_CONNECTED_SITE:
case NM_STATE_CONNECTED_GLOBAL:
return NM_META_TERM_COLOR_GREEN;
case NM_STATE_DISCONNECTING:
return NM_META_TERM_COLOR_YELLOW;
case NM_STATE_ASLEEP:
case NM_STATE_DISCONNECTED:
return NM_META_TERM_COLOR_RED;
default:
return NM_META_TERM_COLOR_NORMAL;
}
}
NM_UTILS_LOOKUP_STR_DEFINE_STATIC (nm_connectivity_to_string_no_l10n, NMConnectivityState,
NM_UTILS_LOOKUP_DEFAULT (N_("unknown")),
NM_UTILS_LOOKUP_ITEM (NM_CONNECTIVITY_NONE, N_("none")),
NM_UTILS_LOOKUP_ITEM (NM_CONNECTIVITY_PORTAL, N_("portal")),
NM_UTILS_LOOKUP_ITEM (NM_CONNECTIVITY_LIMITED, N_("limited")),
NM_UTILS_LOOKUP_ITEM (NM_CONNECTIVITY_FULL, N_("full")),
NM_UTILS_LOOKUP_ITEM_IGNORE (NM_CONNECTIVITY_UNKNOWN),
);
static const char *
nm_connectivity_to_string (NMConnectivityState connectivity)
{
return _(nm_connectivity_to_string_no_l10n (connectivity));
}
static NMMetaTermColor
connectivity_to_color (NMConnectivityState connectivity)
{
switch (connectivity) {
case NM_CONNECTIVITY_NONE:
return NM_META_TERM_COLOR_RED;
case NM_CONNECTIVITY_PORTAL:
case NM_CONNECTIVITY_LIMITED:
return NM_META_TERM_COLOR_YELLOW;
case NM_CONNECTIVITY_FULL:
return NM_META_TERM_COLOR_GREEN;
default:
return NM_META_TERM_COLOR_NORMAL;
}
}
static const char *
permission_to_string (NMClientPermission perm)
{
switch (perm) {
case NM_CLIENT_PERMISSION_ENABLE_DISABLE_NETWORK:
return NM_AUTH_PERMISSION_ENABLE_DISABLE_NETWORK;
case NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIFI:
return NM_AUTH_PERMISSION_ENABLE_DISABLE_WIFI;
case NM_CLIENT_PERMISSION_ENABLE_DISABLE_WWAN:
return NM_AUTH_PERMISSION_ENABLE_DISABLE_WWAN;
case NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIMAX:
return NM_AUTH_PERMISSION_ENABLE_DISABLE_WIMAX;
case NM_CLIENT_PERMISSION_SLEEP_WAKE:
return NM_AUTH_PERMISSION_SLEEP_WAKE;
case NM_CLIENT_PERMISSION_NETWORK_CONTROL:
return NM_AUTH_PERMISSION_NETWORK_CONTROL;
case NM_CLIENT_PERMISSION_WIFI_SHARE_PROTECTED:
return NM_AUTH_PERMISSION_WIFI_SHARE_PROTECTED;
case NM_CLIENT_PERMISSION_WIFI_SHARE_OPEN:
return NM_AUTH_PERMISSION_WIFI_SHARE_OPEN;
case NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM:
return NM_AUTH_PERMISSION_SETTINGS_MODIFY_SYSTEM;
case NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN:
return NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN;
case NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME:
return NM_AUTH_PERMISSION_SETTINGS_MODIFY_HOSTNAME;
case NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS:
return NM_AUTH_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS;
case NM_CLIENT_PERMISSION_RELOAD:
return NM_AUTH_PERMISSION_RELOAD;
case NM_CLIENT_PERMISSION_CHECKPOINT_ROLLBACK:
return NM_AUTH_PERMISSION_CHECKPOINT_ROLLBACK;
case NM_CLIENT_PERMISSION_ENABLE_DISABLE_STATISTICS:
return NM_AUTH_PERMISSION_ENABLE_DISABLE_STATISTICS;
default:
return _("unknown");
}
}
NM_UTILS_LOOKUP_STR_DEFINE_STATIC (permission_result_to_string_no_l10n, NMClientPermissionResult,
NM_UTILS_LOOKUP_DEFAULT (N_("unknown")),
NM_UTILS_LOOKUP_ITEM (NM_CLIENT_PERMISSION_RESULT_YES, N_("yes")),
NM_UTILS_LOOKUP_ITEM (NM_CLIENT_PERMISSION_RESULT_NO, N_("no")),
NM_UTILS_LOOKUP_ITEM (NM_CLIENT_PERMISSION_RESULT_AUTH, N_("auth")),
NM_UTILS_LOOKUP_ITEM_IGNORE (NM_CLIENT_PERMISSION_RESULT_UNKNOWN),
);
_NM_UTILS_LOOKUP_DEFINE (static, permission_result_to_color, NMClientPermissionResult, NMMetaTermColor,
NM_UTILS_LOOKUP_DEFAULT (NM_META_TERM_COLOR_NORMAL),
NM_UTILS_LOOKUP_ITEM (NM_CLIENT_PERMISSION_RESULT_YES, NM_META_TERM_COLOR_GREEN),
NM_UTILS_LOOKUP_ITEM (NM_CLIENT_PERMISSION_RESULT_NO, NM_META_TERM_COLOR_RED),
NM_UTILS_LOOKUP_ITEM (NM_CLIENT_PERMISSION_RESULT_AUTH, NM_META_TERM_COLOR_YELLOW),
NM_UTILS_LOOKUP_ITEM_IGNORE (NM_CLIENT_PERMISSION_RESULT_UNKNOWN),
);
/*****************************************************************************/
static const NmcMetaGenericInfo *const metagen_general_status[];
static gconstpointer
_metagen_general_status_get_fcn (const NMMetaEnvironment *environment,
gpointer environment_user_data,
const NmcMetaGenericInfo *info,
gpointer target,
NMMetaAccessorGetType get_type,
NMMetaAccessorGetFlags get_flags,
NMMetaAccessorGetOutFlags *out_flags,
gpointer *out_to_free)
{
NmCli *nmc = target;
const char *value;
gboolean v_bool;
NMState state;
NMConnectivityState connectivity;
switch (info->info_type) {
case NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_RUNNING:
NMC_HANDLE_TERMFORMAT (NM_META_TERM_COLOR_NORMAL);
value = N_("running");
goto translate_and_out;
case NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_VERSION:
NMC_HANDLE_TERMFORMAT (NM_META_TERM_COLOR_NORMAL);
value = nm_client_get_version (nmc->client);
goto clone_and_out;
case NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_STATE:
state = nm_client_get_state (nmc->client);
NMC_HANDLE_TERMFORMAT (state_to_color (state));
value = nm_state_to_string_no_l10n (state);
goto translate_and_out;
case NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_STARTUP:
v_bool = nm_client_get_startup (nmc->client);
NMC_HANDLE_TERMFORMAT (v_bool ? NM_META_TERM_COLOR_YELLOW : NM_META_TERM_COLOR_GREEN);
value = v_bool ? N_("starting") : N_("started");
goto translate_and_out;
case NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_CONNECTIVITY:
connectivity = nm_client_get_connectivity (nmc->client);
NMC_HANDLE_TERMFORMAT (connectivity_to_color (connectivity));
value = nm_connectivity_to_string_no_l10n (connectivity);
goto translate_and_out;
case NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_NETWORKING:
v_bool = nm_client_networking_get_enabled (nmc->client);
goto enabled_out;
case NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WIFI_HW:
v_bool = nm_client_wireless_hardware_get_enabled (nmc->client);
goto enabled_out;
case NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WIFI:
v_bool = nm_client_wireless_get_enabled (nmc->client);
goto enabled_out;
case NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WWAN_HW:
v_bool = nm_client_wwan_hardware_get_enabled (nmc->client);
goto enabled_out;
case NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WWAN:
v_bool = nm_client_wwan_get_enabled (nmc->client);
goto enabled_out;
case NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WIMAX_HW:
case NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WIMAX:
/* deprected fields. Don't return anything. */
return NULL;
default:
break;
}
g_return_val_if_reached (NULL);
enabled_out:
NMC_HANDLE_TERMFORMAT (v_bool ? NM_META_TERM_COLOR_GREEN : NM_META_TERM_COLOR_RED);
value = v_bool ? N_("enabled") : N_("disabled");
goto translate_and_out;
clone_and_out:
return (*out_to_free = g_strdup (value));
translate_and_out:
if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY)
return _(value);
return value;
}
static const NmcMetaGenericInfo *const metagen_general_status[_NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_NUM + 1] = {
#define _METAGEN_GENERAL_STATUS(type, name) \
[type] = NMC_META_GENERIC(name, .info_type = type, .get_fcn = _metagen_general_status_get_fcn)
_METAGEN_GENERAL_STATUS (NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_RUNNING, "RUNNING"),
_METAGEN_GENERAL_STATUS (NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_VERSION, "VERSION"),
_METAGEN_GENERAL_STATUS (NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_STATE, "STATE"),
_METAGEN_GENERAL_STATUS (NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_STARTUP, "STARTUP"),
_METAGEN_GENERAL_STATUS (NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_CONNECTIVITY, "CONNECTIVITY"),
_METAGEN_GENERAL_STATUS (NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_NETWORKING, "NETWORKING"),
_METAGEN_GENERAL_STATUS (NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WIFI_HW, "WIFI-HW"),
_METAGEN_GENERAL_STATUS (NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WIFI, "WIFI"),
_METAGEN_GENERAL_STATUS (NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WWAN_HW, "WWAN-HW"),
_METAGEN_GENERAL_STATUS (NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WWAN, "WWAN"),
_METAGEN_GENERAL_STATUS (NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WIMAX_HW, "WIMAX-HW"),
_METAGEN_GENERAL_STATUS (NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WIMAX, "WIMAX"),
};
#define NMC_FIELDS_NM_STATUS_ALL "RUNNING,VERSION,STATE,STARTUP,CONNECTIVITY,NETWORKING,WIFI-HW,WIFI,WWAN-HW,WWAN"
#define NMC_FIELDS_NM_STATUS_SWITCH "NETWORKING,WIFI-HW,WIFI,WWAN-HW,WWAN"
@ -58,29 +270,96 @@ static NmcOutputField nmc_fields_nm_status[] = {
#define NMC_FIELDS_NM_WIMAX "WIMAX"
#define NMC_FIELDS_NM_CONNECTIVITY "CONNECTIVITY"
/*****************************************************************************/
/* Available fields for 'general permissions' */
static NmcOutputField nmc_fields_nm_permissions[] = {
{"PERMISSION", N_("PERMISSION")}, /* 0 */
{"VALUE", N_("VALUE")}, /* 1 */
{NULL, NULL}
static gconstpointer
_metagen_general_permissions_get_fcn (const NMMetaEnvironment *environment,
gpointer environment_user_data,
const NmcMetaGenericInfo *info,
gpointer target,
NMMetaAccessorGetType get_type,
NMMetaAccessorGetFlags get_flags,
NMMetaAccessorGetOutFlags *out_flags,
gpointer *out_to_free)
{
NMClientPermission perm = GPOINTER_TO_UINT (target);
NmCli *nmc = environment_user_data;
NMClientPermissionResult perm_result;
const char *s;
switch (info->info_type) {
case NMC_GENERIC_INFO_TYPE_GENERAL_PERMISSIONS_PERMISSION:
NMC_HANDLE_TERMFORMAT (NM_META_TERM_COLOR_NORMAL);
return permission_to_string (perm);
case NMC_GENERIC_INFO_TYPE_GENERAL_PERMISSIONS_VALUE:
perm_result = nm_client_get_permission_result (nmc->client, perm);
NMC_HANDLE_TERMFORMAT (permission_result_to_color (perm_result));
s = permission_result_to_string_no_l10n (perm_result);
if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY)
return _(s);
return s;
default:
break;
}
g_return_val_if_reached (NULL);
}
static const NmcMetaGenericInfo *const metagen_general_permissions[_NMC_GENERIC_INFO_TYPE_GENERAL_PERMISSIONS_NUM + 1] = {
#define _METAGEN_GENERAL_PERMISSIONS(type, name) \
[type] = NMC_META_GENERIC(name, .info_type = type, .get_fcn = _metagen_general_permissions_get_fcn)
_METAGEN_GENERAL_PERMISSIONS (NMC_GENERIC_INFO_TYPE_GENERAL_PERMISSIONS_PERMISSION, "PERMISSION"),
_METAGEN_GENERAL_PERMISSIONS (NMC_GENERIC_INFO_TYPE_GENERAL_PERMISSIONS_VALUE, "VALUE"),
};
#define NMC_FIELDS_NM_PERMISSIONS_ALL "PERMISSION,VALUE"
#define NMC_FIELDS_NM_PERMISSIONS_COMMON "PERMISSION,VALUE"
/* Available fields for 'general logging' */
static NmcOutputField nmc_fields_nm_logging[] = {
{"LEVEL", N_("LEVEL")}, /* 0 */
{"DOMAINS", N_("DOMAINS")}, /* 1 */
{NULL, NULL}
/*****************************************************************************/
typedef struct {
bool initialized;
char **level;
char **domains;
} GetGeneralLoggingData;
static gconstpointer
_metagen_general_logging_get_fcn (const NMMetaEnvironment *environment,
gpointer environment_user_data,
const NmcMetaGenericInfo *info,
gpointer target,
NMMetaAccessorGetType get_type,
NMMetaAccessorGetFlags get_flags,
NMMetaAccessorGetOutFlags *out_flags,
gpointer *out_to_free)
{
NmCli *nmc = environment_user_data;
GetGeneralLoggingData *d = target;
nm_assert (info->info_type < _NMC_GENERIC_INFO_TYPE_GENERAL_LOGGING_NUM);
NMC_HANDLE_TERMFORMAT (NM_META_TERM_COLOR_NORMAL);
if (!d->initialized) {
d->initialized = TRUE;
if (!nm_client_get_logging (nmc->client,
d->level,
d->domains,
NULL))
return NULL;
}
if (info->info_type == NMC_GENERIC_INFO_TYPE_GENERAL_LOGGING_LEVEL)
return *d->level;
else
return *d->domains;
}
static const NmcMetaGenericInfo *const metagen_general_logging[_NMC_GENERIC_INFO_TYPE_GENERAL_LOGGING_NUM + 1] = {
#define _METAGEN_GENERAL_LOGGING(type, name) \
[type] = NMC_META_GENERIC(name, .info_type = type, .get_fcn = _metagen_general_logging_get_fcn)
_METAGEN_GENERAL_LOGGING (NMC_GENERIC_INFO_TYPE_GENERAL_LOGGING_LEVEL, "LEVEL"),
_METAGEN_GENERAL_LOGGING (NMC_GENERIC_INFO_TYPE_GENERAL_LOGGING_DOMAINS, "DOMAINS"),
};
#define NMC_FIELDS_NM_LOGGING_ALL "LEVEL,DOMAINS"
#define NMC_FIELDS_NM_LOGGING_COMMON "LEVEL,DOMAINS"
/* glib main loop variable - defined in nmcli.c */
extern GMainLoop *loop;
/*****************************************************************************/
static void
usage_general (void)
@ -221,106 +500,19 @@ usage_monitor (void)
"Prints a line whenever a change occurs in NetworkManager\n\n"));
}
/* quit main loop */
static void
quit (void)
{
g_main_loop_quit (loop); /* quit main loop */
}
static const char *
nm_state_to_string (NMState state)
{
switch (state) {
case NM_STATE_ASLEEP:
return _("asleep");
case NM_STATE_CONNECTING:
return _("connecting");
case NM_STATE_CONNECTED_LOCAL:
return _("connected (local only)");
case NM_STATE_CONNECTED_SITE:
return _("connected (site only)");
case NM_STATE_CONNECTED_GLOBAL:
return _("connected");
case NM_STATE_DISCONNECTING:
return _("disconnecting");
case NM_STATE_DISCONNECTED:
return _("disconnected");
case NM_STATE_UNKNOWN:
default:
return _("unknown");
}
}
static NmcTermColor
state_to_color (NMState state)
{
switch (state) {
case NM_STATE_CONNECTING:
return NMC_TERM_COLOR_YELLOW;
case NM_STATE_CONNECTED_LOCAL:
case NM_STATE_CONNECTED_SITE:
case NM_STATE_CONNECTED_GLOBAL:
return NMC_TERM_COLOR_GREEN;
case NM_STATE_DISCONNECTING:
return NMC_TERM_COLOR_YELLOW;
case NM_STATE_ASLEEP:
case NM_STATE_DISCONNECTED:
return NMC_TERM_COLOR_RED;
default:
return NMC_TERM_COLOR_NORMAL;
}
}
static const char *
nm_connectivity_to_string (NMConnectivityState connectivity)
{
switch (connectivity) {
case NM_CONNECTIVITY_NONE:
return _("none");
case NM_CONNECTIVITY_PORTAL:
return _("portal");
case NM_CONNECTIVITY_LIMITED:
return _("limited");
case NM_CONNECTIVITY_FULL:
return _("full");
case NM_CONNECTIVITY_UNKNOWN:
default:
return _("unknown");
}
}
static NmcTermColor
connectivity_to_color (NMConnectivityState connectivity)
{
switch (connectivity) {
case NM_CONNECTIVITY_NONE:
return NMC_TERM_COLOR_RED;
case NM_CONNECTIVITY_PORTAL:
case NM_CONNECTIVITY_LIMITED:
return NMC_TERM_COLOR_YELLOW;
case NM_CONNECTIVITY_FULL:
return NMC_TERM_COLOR_GREEN;
default:
return NMC_TERM_COLOR_NORMAL;
}
g_main_loop_quit (loop);
}
static gboolean
show_nm_status (NmCli *nmc, const char *pretty_header_name, const char *print_flds)
{
gboolean startup = FALSE;
NMState state = NM_STATE_UNKNOWN;
NMConnectivityState connectivity = NM_CONNECTIVITY_UNKNOWN;
gboolean net_enabled;
gboolean wireless_hw_enabled, wireless_enabled;
gboolean wwan_hw_enabled, wwan_enabled;
GError *error = NULL;
gs_free_error GError *error = NULL;
const char *fields_str;
const char *fields_all = print_flds ? print_flds : NMC_FIELDS_NM_STATUS_ALL;
const char *fields_common = print_flds ? print_flds : NMC_FIELDS_NM_STATUS_COMMON;
NmcOutputField *tmpl, *arr;
size_t tmpl_len;
if (!nmc->required_fields || strcasecmp (nmc->required_fields, "common") == 0)
fields_str = fields_common;
@ -329,56 +521,16 @@ show_nm_status (NmCli *nmc, const char *pretty_header_name, const char *print_fl
else
fields_str = nmc->required_fields;
tmpl = nmc_fields_nm_status;
tmpl_len = sizeof (nmc_fields_nm_status);
nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, FALSE, NULL, &error);
if (error) {
if (!nmc_print (&nmc->nmc_config,
(gpointer[]) { nmc, NULL },
pretty_header_name ?: N_("NetworkManager status"),
(const NMMetaAbstractInfo *const*) metagen_general_status,
fields_str,
&error)) {
g_string_printf (nmc->return_text, _("Error: only these fields are allowed: %s"), fields_all);
g_error_free (error);
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
return FALSE;
}
state = nm_client_get_state (nmc->client);
startup = nm_client_get_startup (nmc->client);
connectivity = nm_client_get_connectivity (nmc->client);
net_enabled = nm_client_networking_get_enabled (nmc->client);
wireless_hw_enabled = nm_client_wireless_hardware_get_enabled (nmc->client);
wireless_enabled = nm_client_wireless_get_enabled (nmc->client);
wwan_hw_enabled = nm_client_wwan_hardware_get_enabled (nmc->client);
wwan_enabled = nm_client_wwan_get_enabled (nmc->client);
nmc->print_fields.header_name = pretty_header_name ? (char *) pretty_header_name : _("NetworkManager status");
arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_MAIN_HEADER_ADD | NMC_OF_FLAG_FIELD_NAMES);
g_ptr_array_add (nmc->output_data, arr);
arr = nmc_dup_fields_array (tmpl, tmpl_len, 0);
set_val_strc (arr, 0, _("running"));
set_val_strc (arr, 1, nm_client_get_version (nmc->client));
set_val_strc (arr, 2, nm_state_to_string (state));
set_val_strc (arr, 3, startup ? _("starting") : _("started"));
set_val_strc (arr, 4, nm_connectivity_to_string (connectivity));
set_val_strc (arr, 5, net_enabled ? _("enabled") : _("disabled"));
set_val_strc (arr, 6, wireless_hw_enabled ? _("enabled") : _("disabled"));
set_val_strc (arr, 7, wireless_enabled ? _("enabled") : _("disabled"));
set_val_strc (arr, 8, wwan_hw_enabled ? _("enabled") : _("disabled"));
set_val_strc (arr, 9, wwan_enabled ? _("enabled") : _("disabled"));
/* Set colors */
arr[2].color = state_to_color (state);
arr[3].color = startup ? NMC_TERM_COLOR_YELLOW : NMC_TERM_COLOR_GREEN;
arr[4].color = connectivity_to_color (connectivity);
arr[5].color = net_enabled ? NMC_TERM_COLOR_GREEN : NMC_TERM_COLOR_RED;
arr[6].color = wireless_hw_enabled ? NMC_TERM_COLOR_GREEN : NMC_TERM_COLOR_RED;
arr[7].color = wireless_enabled ? NMC_TERM_COLOR_GREEN : NMC_TERM_COLOR_RED;
arr[8].color = wwan_hw_enabled ? NMC_TERM_COLOR_GREEN : NMC_TERM_COLOR_RED;
arr[9].color = wwan_enabled ? NMC_TERM_COLOR_GREEN : NMC_TERM_COLOR_RED;
g_ptr_array_add (nmc->output_data, arr);
print_data (nmc); /* Print all data */
return TRUE;
}
@ -393,60 +545,6 @@ do_general_status (NmCli *nmc, int argc, char **argv)
return nmc->return_value;
}
static const char *
permission_to_string (NMClientPermission perm)
{
switch (perm) {
case NM_CLIENT_PERMISSION_ENABLE_DISABLE_NETWORK:
return NM_AUTH_PERMISSION_ENABLE_DISABLE_NETWORK;
case NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIFI:
return NM_AUTH_PERMISSION_ENABLE_DISABLE_WIFI;
case NM_CLIENT_PERMISSION_ENABLE_DISABLE_WWAN:
return NM_AUTH_PERMISSION_ENABLE_DISABLE_WWAN;
case NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIMAX:
return NM_AUTH_PERMISSION_ENABLE_DISABLE_WIMAX;
case NM_CLIENT_PERMISSION_SLEEP_WAKE:
return NM_AUTH_PERMISSION_SLEEP_WAKE;
case NM_CLIENT_PERMISSION_NETWORK_CONTROL:
return NM_AUTH_PERMISSION_NETWORK_CONTROL;
case NM_CLIENT_PERMISSION_WIFI_SHARE_PROTECTED:
return NM_AUTH_PERMISSION_WIFI_SHARE_PROTECTED;
case NM_CLIENT_PERMISSION_WIFI_SHARE_OPEN:
return NM_AUTH_PERMISSION_WIFI_SHARE_OPEN;
case NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM:
return NM_AUTH_PERMISSION_SETTINGS_MODIFY_SYSTEM;
case NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN:
return NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN;
case NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME:
return NM_AUTH_PERMISSION_SETTINGS_MODIFY_HOSTNAME;
case NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS:
return NM_AUTH_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS;
case NM_CLIENT_PERMISSION_RELOAD:
return NM_AUTH_PERMISSION_RELOAD;
case NM_CLIENT_PERMISSION_CHECKPOINT_ROLLBACK:
return NM_AUTH_PERMISSION_CHECKPOINT_ROLLBACK;
case NM_CLIENT_PERMISSION_ENABLE_DISABLE_STATISTICS:
return NM_AUTH_PERMISSION_ENABLE_DISABLE_STATISTICS;
default:
return _("unknown");
}
}
static const char *
permission_result_to_string (NMClientPermissionResult perm_result)
{
switch (perm_result) {
case NM_CLIENT_PERMISSION_RESULT_YES:
return _("yes");
case NM_CLIENT_PERMISSION_RESULT_NO:
return _("no");
case NM_CLIENT_PERMISSION_RESULT_AUTH:
return _("auth");
default:
return _("unknown");
}
}
static gboolean
timeout_cb (gpointer user_data)
{
@ -462,47 +560,31 @@ static int
print_permissions (void *user_data)
{
NmCli *nmc = user_data;
gs_free_error GError *error = NULL;
const char *fields_str = NULL;
NMClientPermission perm;
GError *error = NULL;
const char *fields_str;
const char *fields_all = NMC_FIELDS_NM_PERMISSIONS_ALL;
const char *fields_common = NMC_FIELDS_NM_PERMISSIONS_COMMON;
NmcOutputField *tmpl, *arr;
size_t tmpl_len;
guint i;
gpointer permissions[NM_CLIENT_PERMISSION_LAST + 1];
if (!nmc->required_fields || strcasecmp (nmc->required_fields, "common") == 0)
fields_str = fields_common;
else if (!nmc->required_fields || strcasecmp (nmc->required_fields, "all") == 0)
fields_str = fields_all;
else
if (!nmc->required_fields || strcasecmp (nmc->required_fields, "common") == 0) {
} else if (strcasecmp (nmc->required_fields, "all") == 0) {
} else
fields_str = nmc->required_fields;
tmpl = nmc_fields_nm_permissions;
tmpl_len = sizeof (nmc_fields_nm_permissions);
nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, FALSE, NULL, &error);
for (i = 0, perm = NM_CLIENT_PERMISSION_NONE + 1; perm <= NM_CLIENT_PERMISSION_LAST; perm++)
permissions[i++] = GINT_TO_POINTER (perm);
permissions[i++] = NULL;
if (error) {
if (!nmc_print (&nmc->nmc_config,
permissions,
_("NetworkManager permissions"),
(const NMMetaAbstractInfo *const*) metagen_general_permissions,
fields_str,
&error)) {
g_string_printf (nmc->return_text, _("Error: 'general permissions': %s"), error->message);
g_error_free (error);
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
return FALSE;
}
nmc->print_fields.header_name = _("NetworkManager permissions");
arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_MAIN_HEADER_ADD | NMC_OF_FLAG_FIELD_NAMES);
g_ptr_array_add (nmc->output_data, arr);
for (perm = NM_CLIENT_PERMISSION_NONE + 1; perm <= NM_CLIENT_PERMISSION_LAST; perm++) {
NMClientPermissionResult perm_result = nm_client_get_permission_result (nmc->client, perm);
arr = nmc_dup_fields_array (tmpl, tmpl_len, 0);
set_val_strc (arr, 0, permission_to_string (perm));
set_val_strc (arr, 1, permission_result_to_string (perm_result));
g_ptr_array_add (nmc->output_data, arr);
}
print_data (nmc); /* Print all data */
quit ();
return G_SOURCE_REMOVE;
}
@ -568,56 +650,32 @@ do_general_permissions (NmCli *nmc, int argc, char **argv)
return nmc->return_value;
}
static gboolean
static void
show_general_logging (NmCli *nmc)
{
char *level = NULL;
char *domains = NULL;
GError *error = NULL;
const char *fields_str;
const char *fields_all = NMC_FIELDS_NM_LOGGING_ALL;
const char *fields_common = NMC_FIELDS_NM_LOGGING_COMMON;
NmcOutputField *tmpl, *arr;
size_t tmpl_len;
gs_free char *level_cache = NULL;
gs_free char *domains_cache = NULL;
gs_free GError *error = NULL;
const char *fields_str = NULL;
GetGeneralLoggingData d = {
.level = &level_cache,
.domains = &domains_cache,
};
if (!nmc->required_fields || strcasecmp (nmc->required_fields, "common") == 0)
fields_str = fields_common;
else if (!nmc->required_fields || strcasecmp (nmc->required_fields, "all") == 0)
fields_str = fields_all;
else
if (!nmc->required_fields || strcasecmp (nmc->required_fields, "common") == 0) {
} else if (strcasecmp (nmc->required_fields, "all") == 0) {
} else
fields_str = nmc->required_fields;
tmpl = nmc_fields_nm_logging;
tmpl_len = sizeof (nmc_fields_nm_logging);
nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, FALSE, NULL, &error);
if (error) {
if (!nmc_print (&nmc->nmc_config,
(gpointer const []) { &d, NULL },
_("NetworkManager logging"),
(const NMMetaAbstractInfo *const*) metagen_general_logging,
fields_str,
&error)) {
g_string_printf (nmc->return_text, _("Error: 'general logging': %s"), error->message);
g_error_free (error);
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
return FALSE;
}
nm_client_get_logging (nmc->client, &level, &domains, &error);
if (error) {
g_string_printf (nmc->return_text, _("Error: %s."), error->message);
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
g_error_free (error);
return FALSE;
}
nmc->print_fields.header_name = _("NetworkManager logging");
arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_MAIN_HEADER_ADD | NMC_OF_FLAG_FIELD_NAMES);
g_ptr_array_add (nmc->output_data, arr);
arr = nmc_dup_fields_array (tmpl, tmpl_len, 0);
set_val_str (arr, 0, level);
set_val_str (arr, 1, domains);
g_ptr_array_add (nmc->output_data, arr);
print_data (nmc); /* Print all data */
return TRUE;
}
static void
@ -788,8 +846,8 @@ nmc_switch_show (NmCli *nmc, const char *switch_name, const char *header)
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
return FALSE;
}
if (nmc->print_output == NMC_PRINT_NORMAL)
nmc->print_output = NMC_PRINT_TERSE;
if (nmc->nmc_config.print_output == NMC_PRINT_NORMAL)
nmc->nmc_config_mutable.print_output = NMC_PRINT_TERSE;
if (!nmc->required_fields)
nmc->required_fields = g_strdup (switch_name);
@ -856,7 +914,7 @@ do_networking_connectivity (NmCli *nmc, int argc, char **argv)
if (!argc) {
/* no arguments -> get current state */
nmc_switch_show (nmc, NMC_FIELDS_NM_CONNECTIVITY, _("Connectivity"));
nmc_switch_show (nmc, NMC_FIELDS_NM_CONNECTIVITY, N_("Connectivity"));
} else if (matches (*argv, "check")) {
gs_free_error GError *error = NULL;
@ -868,7 +926,7 @@ do_networking_connectivity (NmCli *nmc, int argc, char **argv)
g_string_printf (nmc->return_text, _("Error: %s."), error->message);
nmc->return_value = NMC_RESULT_ERROR_UNKNOWN;
} else
nmc_switch_show (nmc, NMC_FIELDS_NM_CONNECTIVITY, _("Connectivity"));
nmc_switch_show (nmc, NMC_FIELDS_NM_CONNECTIVITY, N_("Connectivity"));
} else {
usage_networking ();
g_string_printf (nmc->return_text, _("Error: 'networking' command '%s' is not valid."), *argv);
@ -885,7 +943,7 @@ do_networking_show (NmCli *nmc, int argc, char **argv)
if (nmc->complete)
return nmc->return_value;
nmc_switch_show (nmc, NMC_FIELDS_NM_NETWORKING, _("Networking"));
nmc_switch_show (nmc, NMC_FIELDS_NM_NETWORKING, N_("Networking"));
return nmc->return_value;
}
@ -920,7 +978,7 @@ do_radio_all (NmCli *nmc, int argc, char **argv)
return nmc->return_value;
/* no argument, show all radio switches */
show_nm_status (nmc, _("Radio switches"), NMC_FIELDS_NM_STATUS_RADIO);
show_nm_status (nmc, N_("Radio switches"), NMC_FIELDS_NM_STATUS_RADIO);
} else {
if (nmc->complete) {
if (argc == 1)
@ -950,7 +1008,7 @@ do_radio_wifi (NmCli *nmc, int argc, char **argv)
return nmc->return_value;
/* no argument, show current WiFi state */
nmc_switch_show (nmc, NMC_FIELDS_NM_WIFI, _("Wi-Fi radio switch"));
nmc_switch_show (nmc, NMC_FIELDS_NM_WIFI, N_("Wi-Fi radio switch"));
} else {
if (nmc->complete) {
if (argc == 1)
@ -977,7 +1035,7 @@ do_radio_wwan (NmCli *nmc, int argc, char **argv)
return nmc->return_value;
/* no argument, show current WWAN (mobile broadband) state */
nmc_switch_show (nmc, NMC_FIELDS_NM_WWAN, _("WWAN radio switch"));
nmc_switch_show (nmc, NMC_FIELDS_NM_WWAN, N_("WWAN radio switch"));
} else {
if (nmc->complete) {
if (argc == 1)
@ -1023,9 +1081,9 @@ networkmanager_running (NMClient *client, GParamSpec *param, NmCli *nmc)
char *str;
running = nm_client_get_nm_running (client);
str = nmc_colorize (nmc,
running ? NMC_TERM_COLOR_GREEN : NMC_TERM_COLOR_RED,
NMC_TERM_FORMAT_NORMAL,
str = nmc_colorize (nmc->nmc_config.use_colors,
running ? NM_META_TERM_COLOR_GREEN : NM_META_TERM_COLOR_RED,
NM_META_TERM_FORMAT_NORMAL,
running ? _("NetworkManager has started") : _("NetworkManager has stopped"));
g_print ("%s\n", str);
g_free (str);
@ -1065,7 +1123,7 @@ client_connectivity (NMClient *client, GParamSpec *param, NmCli *nmc)
char *str;
g_object_get (client, NM_CLIENT_CONNECTIVITY, &connectivity, NULL);
str = nmc_colorize (nmc, connectivity_to_color (connectivity), NMC_TERM_FORMAT_NORMAL,
str = nmc_colorize (nmc->nmc_config.use_colors, connectivity_to_color (connectivity), NM_META_TERM_FORMAT_NORMAL,
_("Connectivity is now '%s'\n"), nm_connectivity_to_string (connectivity));
g_print ("%s", str);
g_free (str);
@ -1078,7 +1136,7 @@ client_state (NMClient *client, GParamSpec *param, NmCli *nmc)
char *str;
g_object_get (client, NM_CLIENT_STATE, &state, NULL);
str = nmc_colorize (nmc, state_to_color (state), NMC_TERM_FORMAT_NORMAL,
str = nmc_colorize (nmc->nmc_config.use_colors, state_to_color (state), NM_META_TERM_FORMAT_NORMAL,
_("Networkmanager is now in the '%s' state\n"),
nm_state_to_string (state));
g_print ("%s", str);
@ -1122,12 +1180,12 @@ device_overview (NmCli *nmc, NMDevice *device)
if (!nm_device_get_autoconnect (device))
g_string_append_printf (outbuf, "%s, ", _("autoconnect"));
if (nm_device_get_firmware_missing (device)) {
tmp = nmc_colorize (nmc, NMC_TERM_COLOR_RED, NMC_TERM_FORMAT_NORMAL, _("fw missing"));
tmp = nmc_colorize (nmc->nmc_config.use_colors, NM_META_TERM_COLOR_RED, NM_META_TERM_FORMAT_NORMAL, _("fw missing"));
g_string_append_printf (outbuf, "%s, ", tmp);
g_free (tmp);
}
if (nm_device_get_nm_plugin_missing (device)) {
tmp = nmc_colorize (nmc, NMC_TERM_COLOR_RED, NMC_TERM_FORMAT_NORMAL, _("plugin missing"));
tmp = nmc_colorize (nmc->nmc_config.use_colors, NM_META_TERM_COLOR_RED, NM_META_TERM_FORMAT_NORMAL, _("plugin missing"));
g_string_append_printf (outbuf, "%s, ", tmp);
g_free (tmp);
}
@ -1228,7 +1286,7 @@ do_overview (NmCli *nmc, int argc, char **argv)
NMDevice **devices;
const GPtrArray *p;
NMActiveConnection *ac;
NmcTermColor color;
NMMetaTermColor color;
NMDnsEntry *dns;
char *tmp;
int i;
@ -1250,7 +1308,7 @@ do_overview (NmCli *nmc, int argc, char **argv)
state = nm_active_connection_get_state (ac);
nmc_active_connection_state_to_color (state, &color);
tmp = nmc_colorize (nmc, color, NMC_TERM_FORMAT_NORMAL, _("%s VPN connection"),
tmp = nmc_colorize (nmc->nmc_config.use_colors, color, NM_META_TERM_FORMAT_NORMAL, _("%s VPN connection"),
nm_active_connection_get_id (ac));
g_print ("%s\n", tmp);
g_free (tmp);
@ -1261,14 +1319,14 @@ do_overview (NmCli *nmc, int argc, char **argv)
devices = nmc_get_devices_sorted (nmc->client);
for (i = 0; devices[i]; i++) {
NmcTermFormat color_fmt;
NMMetaTermFormat color_fmt;
NMDeviceState state;
ac = nm_device_get_active_connection (devices[i]);
state = nm_device_get_state (devices[i]);
nmc_device_state_to_color (state, &color, &color_fmt);
tmp = nmc_colorize (nmc, color, color_fmt, "%s: %s%s%s",
tmp = nmc_colorize (nmc->nmc_config.use_colors, color, color_fmt, "%s: %s%s%s",
nm_device_get_iface (devices[i]),
nmc_device_state_to_string (state),
ac ? " to " : "",
@ -1352,7 +1410,7 @@ do_monitor (NmCli *nmc, int argc, char **argv)
if (!nm_client_get_nm_running (nmc->client)) {
char *str;
str = nmc_colorize (nmc, NMC_TERM_COLOR_RED, NMC_TERM_FORMAT_NORMAL,
str = nmc_colorize (nmc->nmc_config.use_colors, NM_META_TERM_COLOR_RED, NM_META_TERM_FORMAT_NORMAL,
_("Networkmanager is not running (waiting for it)\n"));
g_print ("%s", str);
g_free (str);

View file

@ -21,6 +21,8 @@
#include "nm-default.h"
#include "nmcli.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@ -32,8 +34,9 @@
#include <readline/readline.h>
#include <readline/history.h>
#include "nm-client-utils.h"
#include "polkit-agent.h"
#include "nmcli.h"
#include "utils.h"
#include "common.h"
#include "connections.h"
@ -49,10 +52,10 @@
#endif
/* Global NmCli object */
// FIXME: Currently, we pass NmCli over in most APIs, but we might refactor
// that and use the global variable directly instead.
NmCli nm_cli;
/*****************************************************************************/
typedef struct {
NmCli *nmc;
int argc;
@ -66,16 +69,25 @@ struct termios termios_orig;
NM_CACHED_QUARK_FCN ("nmcli-error-quark", nmcli_error_quark)
static void
complete_field (GHashTable *h, const char *setting, NmcOutputField field[])
complete_field_setting (GHashTable *h, NMMetaSettingType setting_type)
{
const NMMetaSettingInfoEditor *setting_info = &nm_meta_setting_infos_editor[setting_type];
guint i;
for (i = 0; i < setting_info->properties_num; i++) {
g_hash_table_add (h, g_strdup_printf ("%s.%s",
setting_info->general->setting_name,
setting_info->properties[i]->property_name));
}
}
static void
complete_field (GHashTable *h, const NmcMetaGenericInfo *const*field)
{
int i;
for (i = 0; field[i].name; i++) {
if (setting)
g_hash_table_add (h, g_strdup_printf ("%s.%s", setting, field[i].name));
else
g_hash_table_add (h, g_strdup (field[i].name));
}
for (i = 0; field[i]; i++)
g_hash_table_add (h, g_strdup (field[i]->name));
}
static void
@ -100,65 +112,37 @@ complete_one (gpointer key, gpointer value, gpointer user_data)
static void
complete_fields (const char *prefix)
{
guint i;
GHashTable *h;
h = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
complete_field (h, NULL, nmc_fields_ip4_config);
complete_field (h, NULL, nmc_fields_dhcp4_config);
complete_field (h, NULL, nmc_fields_ip6_config);
complete_field (h, NULL, nmc_fields_dhcp6_config);
complete_field (h, NULL, nmc_fields_con_show);
complete_field (h, NULL, nmc_fields_settings_names);
complete_field (h, NULL, nmc_fields_con_active_details_general);
complete_field (h, NULL, nmc_fields_con_active_details_vpn);
complete_field (h, NULL, nmc_fields_con_active_details_groups);
complete_field (h, NULL, nmc_fields_dev_status);
complete_field (h, NULL, nmc_fields_dev_show_general);
complete_field (h, NULL, nmc_fields_dev_show_connections);
complete_field (h, NULL, nmc_fields_dev_show_cap);
complete_field (h, NULL, nmc_fields_dev_show_wired_prop);
complete_field (h, NULL, nmc_fields_dev_show_wifi_prop);
complete_field (h, NULL, nmc_fields_dev_show_wimax_prop);
complete_field (h, NULL, nmc_fields_dev_wifi_list);
complete_field (h, NULL, nmc_fields_dev_wimax_list);
complete_field (h, NULL, nmc_fields_dev_show_master_prop);
complete_field (h, NULL, nmc_fields_dev_show_team_prop);
complete_field (h, NULL, nmc_fields_dev_show_vlan_prop);
complete_field (h, NULL, nmc_fields_dev_show_bluetooth);
complete_field (h, NULL, nmc_fields_dev_show_sections);
complete_field (h, NULL, nmc_fields_dev_lldp_list);
complete_field (h, metagen_ip4_config);
complete_field (h, nmc_fields_dhcp4_config);
complete_field (h, nmc_fields_ip6_config);
complete_field (h, nmc_fields_dhcp6_config);
complete_field (h, nmc_fields_con_show);
complete_field (h, nmc_fields_con_active_details_general);
complete_field (h, nmc_fields_con_active_details_vpn);
complete_field (h, nmc_fields_con_active_details_groups);
complete_field (h, nmc_fields_dev_status);
complete_field (h, nmc_fields_dev_show_general);
complete_field (h, nmc_fields_dev_show_connections);
complete_field (h, nmc_fields_dev_show_cap);
complete_field (h, nmc_fields_dev_show_wired_prop);
complete_field (h, nmc_fields_dev_show_wifi_prop);
complete_field (h, nmc_fields_dev_show_wimax_prop);
complete_field (h, nmc_fields_dev_wifi_list);
complete_field (h, nmc_fields_dev_wimax_list);
complete_field (h, nmc_fields_dev_show_master_prop);
complete_field (h, nmc_fields_dev_show_team_prop);
complete_field (h, nmc_fields_dev_show_vlan_prop);
complete_field (h, nmc_fields_dev_show_bluetooth);
complete_field (h, nmc_fields_dev_show_sections);
complete_field (h, nmc_fields_dev_lldp_list);
complete_field (h, "connection", nmc_fields_setting_connection);
complete_field (h, "802-3-ethernet", nmc_fields_setting_wired);
complete_field (h, "802-1x", nmc_fields_setting_8021X);
complete_field (h, "802-11-wireless", nmc_fields_setting_wireless);
complete_field (h, "802-11-wireless-security", nmc_fields_setting_wireless_security);
complete_field (h, "ipv4", nmc_fields_setting_ip4_config);
complete_field (h, "ipv6", nmc_fields_setting_ip6_config);
complete_field (h, "serial", nmc_fields_setting_serial);
complete_field (h, "ppp", nmc_fields_setting_ppp);
complete_field (h, "pppoe", nmc_fields_setting_pppoe);
complete_field (h, "adsl", nmc_fields_setting_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 (h, "wimax", nmc_fields_setting_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 (h, "dcb", nmc_fields_setting_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);
for (i = 0; i < _NM_META_SETTING_TYPE_NUM; i++)
complete_field_setting (h, i);
g_hash_table_foreach (h, complete_one, (gpointer) prefix);
g_hash_table_destroy (h);
@ -245,31 +229,31 @@ process_command_line (NmCli *nmc, int argc, char **argv)
}
if (matches (opt, "-terse")) {
if (nmc->print_output == NMC_PRINT_TERSE) {
if (nmc->nmc_config.print_output == NMC_PRINT_TERSE) {
g_string_printf (nmc->return_text, _("Error: Option '--terse' is specified the second time."));
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
return FALSE;
}
else if (nmc->print_output == NMC_PRINT_PRETTY) {
else if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY) {
g_string_printf (nmc->return_text, _("Error: Option '--terse' is mutually exclusive with '--pretty'."));
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
return FALSE;
}
else
nmc->print_output = NMC_PRINT_TERSE;
nmc->nmc_config_mutable.print_output = NMC_PRINT_TERSE;
} else if (matches (opt, "-pretty")) {
if (nmc->print_output == NMC_PRINT_PRETTY) {
if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY) {
g_string_printf (nmc->return_text, _("Error: Option '--pretty' is specified the second time."));
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
return FALSE;
}
else if (nmc->print_output == NMC_PRINT_TERSE) {
else if (nmc->nmc_config.print_output == NMC_PRINT_TERSE) {
g_string_printf (nmc->return_text, _("Error: Option '--pretty' is mutually exclusive with '--terse'."));
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
return FALSE;
}
else
nmc->print_output = NMC_PRINT_PRETTY;
nmc->nmc_config_mutable.print_output = NMC_PRINT_PRETTY;
} else if (matches (opt, "-mode")) {
nmc->mode_specified = TRUE;
argc--;
@ -282,9 +266,9 @@ process_command_line (NmCli *nmc, int argc, char **argv)
if (argc == 1 && nmc->complete)
nmc_complete_strings (argv[0], "tabular", "multiline", NULL);
if (matches (argv[0], "tabular"))
nmc->multiline_output = FALSE;
nmc->nmc_config_mutable.multiline_output = FALSE;
else if (matches (argv[0], "multiline"))
nmc->multiline_output = TRUE;
nmc->nmc_config_mutable.multiline_output = TRUE;
else {
g_string_printf (nmc->return_text, _("Error: '%s' is not valid argument for '%s' option."), argv[0], opt);
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
@ -301,11 +285,11 @@ process_command_line (NmCli *nmc, int argc, char **argv)
if (argc == 1 && nmc->complete)
nmc_complete_strings (argv[0], "yes", "no", "auto", NULL);
if (matches (argv[0], "auto"))
nmc->use_colors = NMC_USE_COLOR_AUTO;
nmc->nmc_config_mutable.use_colors = NMC_USE_COLOR_AUTO;
else if (matches (argv[0], "yes"))
nmc->use_colors = NMC_USE_COLOR_YES;
nmc->nmc_config_mutable.use_colors = NMC_USE_COLOR_YES;
else if (matches (argv[0], "no"))
nmc->use_colors = NMC_USE_COLOR_NO;
nmc->nmc_config_mutable.use_colors = NMC_USE_COLOR_NO;
else {
g_string_printf (nmc->return_text, _("Error: '%s' is not valid argument for '%s' option."), argv[0], opt);
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
@ -322,9 +306,9 @@ process_command_line (NmCli *nmc, int argc, char **argv)
if (argc == 1 && nmc->complete)
nmc_complete_strings (argv[0], "yes", "no", NULL);
if (matches (argv[0], "yes"))
nmc->escape_values = TRUE;
nmc->nmc_config_mutable.escape_values = TRUE;
else if (matches (argv[0], "no"))
nmc->escape_values = FALSE;
nmc->nmc_config_mutable.escape_values = FALSE;
else {
g_string_printf (nmc->return_text, _("Error: '%s' is not valid argument for '%s' option."), argv[0], opt);
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
@ -352,7 +336,7 @@ process_command_line (NmCli *nmc, int argc, char **argv)
if (argc == 1 && nmc->complete)
complete_fields (argv[0]);
nmc->required_fields = g_strdup (argv[0]);
nmc->print_output = NMC_PRINT_TERSE;
nmc->nmc_config_mutable.print_output = NMC_PRINT_TERSE;
/* We want fixed tabular mode here, but just set the mode specified and rely on the initialization
* in nmc_init: in this way we allow use of "-m multiline" to swap the output mode also if placed
* before the "-g <field>" option (-g may be still more practical and easy to remember than -t -f).
@ -545,22 +529,19 @@ nmc_init (NmCli *nmc)
nmc->should_wait = 0;
nmc->nowait_flag = TRUE;
nmc->print_output = NMC_PRINT_NORMAL;
nmc->multiline_output = FALSE;
nmc->nmc_config_mutable.print_output = NMC_PRINT_NORMAL;
nmc->nmc_config_mutable.multiline_output = FALSE;
nmc->mode_specified = FALSE;
nmc->escape_values = TRUE;
nmc->nmc_config_mutable.escape_values = TRUE;
nmc->required_fields = NULL;
nmc->output_data = g_ptr_array_new_full (20, g_free);
memset (&nmc->print_fields, '\0', sizeof (NmcPrintFields));
nmc->ask = FALSE;
nmc->complete = FALSE;
nmc->show_secrets = FALSE;
nmc->use_colors = NMC_USE_COLOR_AUTO;
nmc->in_editor = FALSE;
nmc->nmc_config_mutable.show_secrets = FALSE;
nmc->nmc_config_mutable.use_colors = NMC_USE_COLOR_AUTO;
nmc->nmc_config_mutable.in_editor = FALSE;
nmc->editor_status_line = FALSE;
nmc->editor_save_confirmation = TRUE;
nmc->editor_show_secrets = FALSE;
nmc->editor_prompt_color = NMC_TERM_COLOR_NORMAL;
nmc->editor_prompt_color = NM_META_TERM_COLOR_NORMAL;
}
static void
@ -579,8 +560,6 @@ nmc_cleanup (NmCli *nmc)
g_hash_table_destroy (nmc->pwds_hash);
g_free (nmc->required_fields);
nmc_empty_output_fields (nmc);
g_ptr_array_unref (nmc->output_data);
nmc_polkit_agent_fini (nmc);
}

View file

@ -23,6 +23,8 @@
#include "NetworkManager.h"
#include "nm-secret-agent-old.h"
#include "nm-meta-setting-desc.h"
#if WITH_POLKIT_AGENT
#include "nm-polkit-listener.h"
#else
@ -30,6 +32,8 @@
typedef gpointer NMPolkitListener;
#endif
typedef char *(*NmcCompEntryFunc) (const char *, int);
/* nmcli exit codes */
typedef enum {
/* Indicates successful execution */
@ -69,28 +73,6 @@ typedef enum {
NMC_RESULT_COMPLETE_FILE = 65,
} NMCResultCode;
typedef enum {
NMC_TERM_COLOR_NORMAL = 0,
NMC_TERM_COLOR_BLACK = 1,
NMC_TERM_COLOR_RED = 2,
NMC_TERM_COLOR_GREEN = 3,
NMC_TERM_COLOR_YELLOW = 4,
NMC_TERM_COLOR_BLUE = 5,
NMC_TERM_COLOR_MAGENTA = 6,
NMC_TERM_COLOR_CYAN = 7,
NMC_TERM_COLOR_WHITE = 8
} NmcTermColor;
typedef enum {
NMC_TERM_FORMAT_NORMAL,
NMC_TERM_FORMAT_BOLD,
NMC_TERM_FORMAT_DIM,
NMC_TERM_FORMAT_UNDERLINE,
NMC_TERM_FORMAT_BLINK,
NMC_TERM_FORMAT_REVERSE,
NMC_TERM_FORMAT_HIDDEN,
} NmcTermFormat;
typedef enum {
NMC_PRINT_TERSE = 0,
NMC_PRINT_NORMAL = 1,
@ -98,30 +80,29 @@ typedef enum {
} NMCPrintOutput;
/* === Output fields === */
/* Flags for NmcOutputField */
#define NMC_OF_FLAG_FIELD_NAMES 0x00000001 /* Print field names instead of values */
#define NMC_OF_FLAG_SECTION_PREFIX 0x00000002 /* Use the first value as section prefix for the other field names - just in multiline */
#define NMC_OF_FLAG_MAIN_HEADER_ADD 0x00000004 /* Print main header in addition to values/field names */
#define NMC_OF_FLAG_MAIN_HEADER_ONLY 0x00000008 /* Print main header only */
typedef struct _NmcOutputField {
const char *name; /* Field's name */
const char *name_l10n; /* Field's name for translation */
typedef enum {
NMC_OF_FLAG_FIELD_NAMES = 0x00000001, /* Print field names instead of values */
NMC_OF_FLAG_SECTION_PREFIX = 0x00000002, /* Use the first value as section prefix for the other field names - just in multiline */
NMC_OF_FLAG_MAIN_HEADER_ADD = 0x00000004, /* Print main header in addition to values/field names */
NMC_OF_FLAG_MAIN_HEADER_ONLY = 0x00000008, /* Print main header only */
} NmcOfFlags;
extern const const NMMetaType nmc_meta_type_generic_info;
typedef struct _NmcOutputField NmcOutputField;
typedef struct _NmcMetaGenericInfo NmcMetaGenericInfo;
struct _NmcOutputField {
const NMMetaAbstractInfo *info;
int width; /* Width in screen columns */
struct _NmcOutputField *group; /* Points to an array with available section field names if this is a section (group) field */
void *value; /* Value of current field - char* or char** (NULL-terminated array) */
gboolean value_is_array; /* Whether value is char** instead of char* */
gboolean free_value; /* Whether to free the value */
guint32 flags; /* Flags - whether and how to print values/field names/headers */
NmcTermColor color; /* Use this color to print value */
NmcTermFormat color_fmt; /* Use this terminal format to print value */
} NmcOutputField;
typedef struct {
GArray *indices; /* Array of field indices to the array of allowed fields */
char *header_name; /* Name of the output */
int indent; /* Indent by this number of spaces */
} NmcPrintFields;
NmcOfFlags flags; /* Flags - whether and how to print values/field names/headers */
NMMetaTermColor color; /* Use this color to print value */
NMMetaTermFormat color_fmt; /* Use this terminal format to print value */
};
typedef enum {
NMC_USE_COLOR_AUTO,
@ -129,6 +110,19 @@ typedef enum {
NMC_USE_COLOR_NO,
} NmcColorOption;
typedef struct _NmcConfig {
NMCPrintOutput print_output; /* Output mode */
NmcColorOption use_colors; /* Whether to use colors for output: option '--color' */
bool multiline_output; /* Multiline output instead of default tabular */
bool escape_values; /* Whether to escape ':' and '\' in terse tabular mode */
bool in_editor; /* Whether running the editor - nmcli con edit' */
bool show_secrets; /* Whether to display secrets (both input and output): option '--show-secrets' */
} NmcConfig;
typedef struct _NmcOutputData {
GPtrArray *output_data; /* GPtrArray of arrays of NmcOutputField structs - accumulates data for output */
} NmcOutputData;
/* NmCli - main structure */
typedef struct _NmCli {
NMClient *client; /* Pointer to NMClient of libnm */
@ -144,22 +138,17 @@ typedef struct _NmCli {
int should_wait; /* Semaphore indicating whether nmcli should not end or not yet */
gboolean nowait_flag; /* '--nowait' option; used for passing to callbacks */
NMCPrintOutput print_output; /* Output mode */
gboolean multiline_output; /* Multiline output instead of default tabular */
gboolean mode_specified; /* Whether tabular/multiline mode was specified via '--mode' option */
NmcColorOption use_colors; /* Whether to use colors for output: option '--color' */
gboolean escape_values; /* Whether to escape ':' and '\' in terse tabular mode */
union {
const NmcConfig nmc_config;
NmcConfig nmc_config_mutable;
};
char *required_fields; /* Required fields in output: '--fields' option */
GPtrArray *output_data; /* GPtrArray of arrays of NmcOutputField structs - accumulates data for output */
NmcPrintFields print_fields; /* Structure with field indices to print */
gboolean ask; /* Ask for missing parameters: option '--ask' */
gboolean complete; /* Autocomplete the command line */
gboolean show_secrets; /* Whether to display secrets (both input and output): option '--show-secrets' */
gboolean in_editor; /* Whether running the editor - nmcli con edit' */
gboolean editor_status_line; /* Whether to display status line in connection editor */
gboolean editor_save_confirmation; /* Whether to ask for confirmation on saving connections with 'autoconnect=yes' */
gboolean editor_show_secrets; /* Whether to display secrets in the editor' */
NmcTermColor editor_prompt_color; /* Color of prompt in connection editor */
NMMetaTermColor editor_prompt_color; /* Color of prompt in connection editor */
} NmCli;
extern NmCli nm_cli;
@ -168,9 +157,19 @@ extern NmCli nm_cli;
#define NMCLI_ERROR (nmcli_error_quark ())
GQuark nmcli_error_quark (void);
extern GMainLoop *loop;
gboolean nmc_seen_sigint (void);
void nmc_clear_sigint (void);
void nmc_set_sigquit_internal (void);
void nmc_exit (void);
void nmc_empty_output_fields (NmcOutputData *output_data);
#define NMC_OUTPUT_DATA_DEFINE_SCOPED(out) \
gs_unref_array GArray *out##_indices = NULL; \
nm_auto (nmc_empty_output_fields) NmcOutputData out = { \
.output_data = g_ptr_array_new_full (20, g_free), \
}
#endif /* NMC_NMCLI_H */

View file

@ -21,13 +21,15 @@
#if WITH_POLKIT_AGENT
#include "polkit-agent.h"
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include "polkit-agent.h"
#include "nm-polkit-listener.h"
#include "common.h"
static char *

View file

@ -1,86 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output
method="text"
doctype-public="-//OASIS//DTD DocBook XML V4.3//EN"
doctype-system="http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
/>
<xsl:template match="nm-setting-docs">/* Generated file. Do not edit. */
typedef struct {
const char *name;
const char *docs;
} NmcPropertyDesc;
<xsl:apply-templates select="setting" mode="properties"><xsl:sort select="@name"/></xsl:apply-templates>
typedef struct {
const char *name;
NmcPropertyDesc *properties;
int n_properties;
} NmcSettingDesc;
NmcSettingDesc all_settings[] = {
<xsl:apply-templates select="setting" mode="settings"><xsl:sort select="@name"/></xsl:apply-templates>
};
static int
find_by_name (gconstpointer keyv, gconstpointer cmpv)
{
const char *key = keyv;
struct { const char *name; gpointer data; } *cmp = (gpointer)cmpv;
return strcmp (key, cmp->name);
}
static const char *
nmc_setting_get_property_doc (NMSetting *setting, const char *prop)
{
NmcSettingDesc *setting_desc;
NmcPropertyDesc *property_desc;
setting_desc = bsearch (nm_setting_get_name (setting),
all_settings, G_N_ELEMENTS (all_settings),
sizeof (NmcSettingDesc), find_by_name);
if (!setting_desc)
return NULL;
property_desc = bsearch (prop,
setting_desc->properties, setting_desc->n_properties,
sizeof (NmcPropertyDesc), find_by_name);
if (!property_desc)
return NULL;
return property_desc->docs;
}
</xsl:template>
<xsl:template match="setting" mode="properties">
NmcPropertyDesc setting_<xsl:value-of select="translate(@name,'-','_')"/>[] = {<xsl:apply-templates select="property"><xsl:sort select="@name"/></xsl:apply-templates>
};
</xsl:template>
<xsl:template match="property">
<xsl:variable name="docs">
<xsl:call-template name="escape_quotes">
<xsl:with-param name="string" select="@description"/>
</xsl:call-template>
</xsl:variable>
{ "<xsl:value-of select="@name"/>", "<xsl:value-of select="$docs"/>" },</xsl:template>
<xsl:template match="setting" mode="settings">
{ "<xsl:value-of select="@name"/>", setting_<xsl:value-of select="translate(@name,'-','_')"/>, <xsl:value-of select="count(./property)"/> },</xsl:template>
<xsl:template name="escape_quotes">
<xsl:param name="string" />
<xsl:choose>
<xsl:when test="contains($string, '&quot;')">
<xsl:value-of select="substring-before($string, '&quot;')" />\&quot;<xsl:call-template name="escape_quotes"><xsl:with-param name="string" select="substring-after($string, '&quot;')" /></xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

File diff suppressed because it is too large Load diff

View file

@ -20,16 +20,13 @@
#ifndef NMC_SETTINGS_H
#define NMC_SETTINGS_H
#include "nm-meta-setting.h"
#include "nm-meta-setting-desc.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_proxy_connect_handlers (NMSettingProxy *setting);
@ -38,7 +35,7 @@ void nmc_setting_connection_connect_handlers (NMSettingConnection *setting, NMCo
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);
const char *const*nmc_setting_get_property_allowed_values (NMSetting *setting, const char *prop, char ***out_to_free);
char *nmc_setting_get_property (NMSetting *setting,
const char *prop,
GError **error);
@ -62,39 +59,6 @@ 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);
extern NmcOutputField nmc_fields_setting_connection[];
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_ip4_config[];
extern NmcOutputField nmc_fields_setting_ip6_config[];
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[];
extern NmcOutputField nmc_fields_setting_macsec[];
extern NmcOutputField nmc_fields_setting_vxlan[];
extern NmcOutputField nmc_fields_setting_proxy[];
extern NmcOutputField nmc_fields_setting_dummy[];
gboolean setting_details (const NmcConfig *nmc_config, NMSetting *setting, const char *one_prop);
#endif /* NMC_SETTINGS_H */

File diff suppressed because it is too large Load diff

View file

@ -32,74 +32,135 @@ typedef struct {
gboolean found;
} nmc_arg_t;
typedef enum {
NMC_TRI_STATE_NO,
NMC_TRI_STATE_YES,
NMC_TRI_STATE_UNKNOWN,
} NMCTriStateValue;
/* === Functions === */
gboolean matches (const char *cmd, const char *pattern);
int next_arg (NmCli *nmc, int *argc, char ***argv, ...);
gboolean nmc_arg_is_help (const char *arg);
gboolean nmc_arg_is_option (const char *arg, const char *opt_name);
gboolean nmc_parse_args (nmc_arg_t *arg_arr, gboolean last, int *argc, char ***argv, GError **error);
char *ssid_to_hex (const char *str, gsize len);
gboolean nmc_string_to_int_base (const char *str,
int base,
gboolean range_check,
long int min,
long int max,
long int *value);
gboolean nmc_string_to_uint_base (const char *str,
int base,
gboolean range_check,
unsigned long int min,
unsigned long int max,
unsigned long int *value);
gboolean nmc_string_to_int (const char *str,
gboolean range_check,
long int min,
long int max,
long int *value);
gboolean nmc_string_to_uint (const char *str,
gboolean range_check,
unsigned long int min,
unsigned long int max,
unsigned long int *value);
gboolean nmc_string_to_bool (const char *str, gboolean *val_bool, GError **error);
gboolean nmc_string_to_tristate (const char *str, NMCTriStateValue *val, GError **error);
void nmc_terminal_erase_line (void);
void nmc_terminal_show_progress (const char *str);
const char *nmc_term_color_sequence (NmcTermColor color);
const char *nmc_term_format_sequence (NmcTermFormat format);
NmcTermColor nmc_term_color_parse_string (const char *str, GError **error);
char *nmc_colorize (NmCli *nmc, NmcTermColor color, NmcTermFormat format, const char * fmt, ...) _nm_printf (4, 5);
const char *nmc_term_color_sequence (NMMetaTermColor color);
const char *nmc_term_format_sequence (NMMetaTermFormat format);
NMMetaTermColor nmc_term_color_parse_string (const char *str, GError **error);
char *nmc_colorize (NmcColorOption color_option, NMMetaTermColor color, NMMetaTermFormat format, const char * fmt, ...) _nm_printf (4, 5);
void nmc_filter_out_colors_inplace (char *str);
char *nmc_filter_out_colors (const char *str);
char *nmc_get_user_input (const char *ask_str);
int nmc_string_to_arg_array (const char *line, const char *delim, gboolean unquote,
char ***argv, int *argc);
const char *nmc_string_is_valid (const char *input, const char **allowed, GError **error);
char * nmc_util_strv_for_display (const char **strv, gboolean brackets);
char * nmc_util_strv_for_display (const char *const*strv, gboolean brackets);
char **nmc_strsplit_set (const char *str, const char *delimiter, int max_tokens);
int nmc_string_screen_width (const char *start, const char *end);
void set_val_str (NmcOutputField fields_array[], guint32 index, char *value);
void set_val_strc (NmcOutputField fields_array[], guint32 index, const char *value);
void set_val_arr (NmcOutputField fields_array[], guint32 index, char **value);
void set_val_arrc (NmcOutputField fields_array[], guint32 index, const char **value);
void set_val_color_all (NmcOutputField fields_array[], NmcTermColor color);
void set_val_color_fmt_all (NmcOutputField fields_array[], NmcTermFormat format);
void set_val_color_all (NmcOutputField fields_array[], NMMetaTermColor color);
void set_val_color_fmt_all (NmcOutputField fields_array[], NMMetaTermFormat format);
void nmc_free_output_field_values (NmcOutputField fields_array[]);
GArray *parse_output_fields (const char *fields_str,
const NmcOutputField fields_array[],
const NMMetaAbstractInfo *const* fields_array,
gboolean parse_groups,
GPtrArray **group_fields,
GError **error);
char *nmc_get_allowed_fields (const NmcOutputField fields_array[], int group_idx);
NmcOutputField *nmc_dup_fields_array (NmcOutputField fields[], size_t size, guint32 flags);
void nmc_empty_output_fields (NmCli *nmc);
void print_required_fields (NmCli *nmc, const NmcOutputField field_values[]);
void print_data (NmCli *nmc);
NmcOutputField *nmc_dup_fields_array (const NMMetaAbstractInfo *const*fields, NmcOfFlags flags);
void nmc_empty_output_fields (NmcOutputData *output_data);
void print_required_fields (const NmcConfig *nmc_config,
NmcOfFlags of_flags,
const GArray *indices,
const char *header_name,
int indent,
const NmcOutputField *field_values);
void print_data_prepare_width (GPtrArray *output_data);
void print_data (const NmcConfig *nmc_config,
const GArray *indices,
const char *header_name,
int indent,
const NmcOutputData *out);
/*****************************************************************************/
extern const NMMetaEnvironment *const nmc_meta_environment;
extern NmCli *const nmc_meta_environment_arg;
typedef enum {
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_RUNNING = 0,
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_VERSION,
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_STATE,
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_STARTUP,
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_CONNECTIVITY,
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_NETWORKING,
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WIFI_HW,
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WIFI,
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WWAN_HW,
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WWAN,
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WIMAX_HW,
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WIMAX,
_NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_NUM,
NMC_GENERIC_INFO_TYPE_GENERAL_PERMISSIONS_PERMISSION = 0,
NMC_GENERIC_INFO_TYPE_GENERAL_PERMISSIONS_VALUE,
_NMC_GENERIC_INFO_TYPE_GENERAL_PERMISSIONS_NUM,
NMC_GENERIC_INFO_TYPE_GENERAL_LOGGING_LEVEL = 0,
NMC_GENERIC_INFO_TYPE_GENERAL_LOGGING_DOMAINS,
_NMC_GENERIC_INFO_TYPE_GENERAL_LOGGING_NUM,
NMC_GENERIC_INFO_TYPE_IP4_CONFIG_ADDRESS = 0,
NMC_GENERIC_INFO_TYPE_IP4_CONFIG_GATEWAY,
NMC_GENERIC_INFO_TYPE_IP4_CONFIG_ROUTE,
NMC_GENERIC_INFO_TYPE_IP4_CONFIG_DNS,
NMC_GENERIC_INFO_TYPE_IP4_CONFIG_DOMAIN,
NMC_GENERIC_INFO_TYPE_IP4_CONFIG_WINS,
_NMC_GENERIC_INFO_TYPE_IP4_CONFIG_NUM,
} NmcGenericInfoType;
#define NMC_HANDLE_TERMFORMAT(color) \
G_STMT_START { \
if (get_type == NM_META_ACCESSOR_GET_TYPE_TERMFORMAT) \
return nm_meta_termformat_pack ((color), NM_META_TERM_FORMAT_NORMAL); \
} G_STMT_END
struct _NmcMetaGenericInfo {
const NMMetaType *meta_type;
NmcGenericInfoType info_type;
const char *name;
const char *name_header;
const NmcMetaGenericInfo *const*nested;
gconstpointer (*get_fcn) (const NMMetaEnvironment *environment,
gpointer environment_user_data,
const NmcMetaGenericInfo *info,
gpointer target,
NMMetaAccessorGetType get_type,
NMMetaAccessorGetFlags get_flags,
NMMetaAccessorGetOutFlags *out_flags,
gpointer *out_to_free);
};
#define NMC_META_GENERIC(n, ...) \
(&((NmcMetaGenericInfo) { \
.meta_type = &nmc_meta_type_generic_info, \
.name = n, \
__VA_ARGS__ \
}))
#define NMC_META_GENERIC_WITH_NESTED(n, nest, ...) \
NMC_META_GENERIC (n, .nested = (nest), __VA_ARGS__)
/*****************************************************************************/
gboolean nmc_print (const NmcConfig *nmc_config,
gpointer const *targets,
const char *header_name_no_l10n,
const NMMetaAbstractInfo *const*fields,
const char *fields_str,
GError **error);
/*****************************************************************************/
#endif /* NMC_UTILS_H */

View file

@ -0,0 +1,247 @@
/* 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 - 2017 Red Hat, Inc.
*/
#include "nm-default.h"
#include "nm-client-utils.h"
/*
* Convert string to signed integer.
* If required, the resulting number is checked to be in the <min,max> range.
*/
gboolean
nmc_string_to_int_base (const char *str,
int base,
gboolean range_check,
long int min,
long int max,
long int *value)
{
char *end;
long int tmp;
errno = 0;
tmp = strtol (str, &end, base);
if (errno || *end != '\0' || (range_check && (tmp < min || tmp > max))) {
return FALSE;
}
*value = tmp;
return TRUE;
}
/*
* Convert string to unsigned integer.
* If required, the resulting number is checked to be in the <min,max> range.
*/
gboolean
nmc_string_to_uint_base (const char *str,
int base,
gboolean range_check,
unsigned long int min,
unsigned long int max,
unsigned long int *value)
{
char *end;
unsigned long int tmp;
errno = 0;
tmp = strtoul (str, &end, base);
if (errno || *end != '\0' || (range_check && (tmp < min || tmp > max))) {
return FALSE;
}
*value = tmp;
return TRUE;
}
gboolean
nmc_string_to_int (const char *str,
gboolean range_check,
long int min,
long int max,
long int *value)
{
return nmc_string_to_int_base (str, 10, range_check, min, max, value);
}
gboolean
nmc_string_to_uint (const char *str,
gboolean range_check,
unsigned long int min,
unsigned long int max,
unsigned long int *value)
{
return nmc_string_to_uint_base (str, 10, range_check, min, max, value);
}
gboolean
nmc_string_to_bool (const char *str, gboolean *val_bool, GError **error)
{
const char *s_true[] = { "true", "yes", "on", "1", NULL };
const char *s_false[] = { "false", "no", "off", "0", NULL };
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
if (g_strcmp0 (str, "o") == 0) {
g_set_error (error, 1, 0,
/* Translators: the first %s is the partial value entered by
* the user, the second %s a list of compatible values.
*/
_("'%s' is ambiguous (%s)"), str, "on x off");
return FALSE;
}
if (nmc_string_is_valid (str, s_true, NULL))
*val_bool = TRUE;
else if (nmc_string_is_valid (str, s_false, NULL))
*val_bool = FALSE;
else {
g_set_error (error, 1, 0,
_("'%s' is not valid; use [%s] or [%s]"),
str, "true, yes, on", "false, no, off");
return FALSE;
}
return TRUE;
}
gboolean
nmc_string_to_tristate (const char *str, NMCTriStateValue *val, GError **error)
{
const char *s_true[] = { "true", "yes", "on", NULL };
const char *s_false[] = { "false", "no", "off", NULL };
const char *s_unknown[] = { "unknown", NULL };
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
if (g_strcmp0 (str, "o") == 0) {
g_set_error (error, 1, 0,
/* Translators: the first %s is the partial value entered by
* the user, the second %s a list of compatible values.
*/
_("'%s' is ambiguous (%s)"), str, "on x off");
return FALSE;
}
if (nmc_string_is_valid (str, s_true, NULL))
*val = NMC_TRI_STATE_YES;
else if (nmc_string_is_valid (str, s_false, NULL))
*val = NMC_TRI_STATE_NO;
else if (nmc_string_is_valid (str, s_unknown, NULL))
*val = NMC_TRI_STATE_UNKNOWN;
else {
g_set_error (error, 1, 0,
_("'%s' is not valid; use [%s], [%s] or [%s]"),
str, "true, yes, on", "false, no, off", "unknown");
return FALSE;
}
return TRUE;
}
/*
* Check whether 'input' is contained in 'allowed' array. It performs case
* insensitive comparison and supports shortcut strings if they are unique.
* Returns: a pointer to found string in allowed array on success or NULL.
* On failure: error->code : 0 - string not found; 1 - string is ambiguous
*/
const char *
nmc_string_is_valid (const char *input, const char **allowed, GError **error)
{
const char **p;
size_t input_ln, p_len;
gboolean prev_match = FALSE;
const char *ret = NULL;
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (!input || !*input)
goto finish;
input_ln = strlen (input);
for (p = allowed; p && *p; p++) {
p_len = strlen (*p);
if (g_ascii_strncasecmp (input, *p, input_ln) == 0) {
if (input_ln == p_len) {
ret = *p;
break;
}
if (!prev_match)
ret = *p;
else {
g_set_error (error, 1, 1, _("'%s' is ambiguous (%s x %s)"),
input, ret, *p);
return NULL;
}
prev_match = TRUE;
}
}
finish:
if (ret == NULL) {
char *valid_vals = g_strjoinv (", ", (char **) allowed);
if (!input || !*input)
g_set_error (error, 1, 0, _("missing name, try one of [%s]"), valid_vals);
else
g_set_error (error, 1, 0, _("'%s' not among [%s]"), input, valid_vals);
g_free (valid_vals);
}
return ret;
}
/*
* Wrapper function for g_strsplit_set() that removes empty strings
* from the vector as they are not useful in most cases.
*/
char **
nmc_strsplit_set (const char *str, const char *delimiter, int max_tokens)
{
/* remove empty strings */
return _nm_utils_strv_cleanup (g_strsplit_set (str, delimiter, max_tokens),
FALSE, TRUE, FALSE);
}
gboolean
matches (const char *cmd, const char *pattern)
{
size_t len = strlen (cmd);
if (!len || len > strlen (pattern))
return FALSE;
return memcmp (pattern, cmd, len) == 0;
}
const char *
nmc_bond_validate_mode (const char *mode, GError **error)
{
unsigned long mode_int;
static const char *valid_modes[] = { "balance-rr",
"active-backup",
"balance-xor",
"broadcast",
"802.3ad",
"balance-tlb",
"balance-alb",
NULL };
if (nmc_string_to_uint (mode, TRUE, 0, 6, &mode_int)) {
/* Translate bonding mode numbers to mode names:
* https://www.kernel.org/doc/Documentation/networking/bonding.txt
*/
return valid_modes[mode_int];
} else
return nmc_string_is_valid (mode, valid_modes, error);
}

View file

@ -0,0 +1,66 @@
/* 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 - 2017 Red Hat, Inc.
*/
#ifndef __NM_CLIENT_UTILS_H__
#define __NM_CLIENT_UTILS_H__
#include "nm-meta-setting.h"
typedef enum {
NMC_TRI_STATE_NO,
NMC_TRI_STATE_YES,
NMC_TRI_STATE_UNKNOWN,
} NMCTriStateValue;
const char *nmc_string_is_valid (const char *input, const char **allowed, GError **error);
char **nmc_strsplit_set (const char *str, const char *delimiter, int max_tokens);
gboolean nmc_string_to_int_base (const char *str,
int base,
gboolean range_check,
long int min,
long int max,
long int *value);
gboolean nmc_string_to_uint_base (const char *str,
int base,
gboolean range_check,
unsigned long int min,
unsigned long int max,
unsigned long int *value);
gboolean nmc_string_to_int (const char *str,
gboolean range_check,
long int min,
long int max,
long int *value);
gboolean nmc_string_to_uint (const char *str,
gboolean range_check,
unsigned long int min,
unsigned long int max,
unsigned long int *value);
gboolean nmc_string_to_bool (const char *str, gboolean *val_bool, GError **error);
gboolean nmc_string_to_tristate (const char *str, NMCTriStateValue *val, GError **error);
gboolean matches (const char *cmd, const char *pattern);
/* FIXME: don't expose this function on it's own, at least not from this file. */
const char *nmc_bond_validate_mode (const char *mode, GError **error);
#endif /* __NM_CLIENT_UTILS_H__ */

View file

@ -0,0 +1,621 @@
/* 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 - 2017 Red Hat, Inc.
*/
#include "nm-default.h"
#include "nm-meta-setting-access.h"
/*****************************************************************************/
const NMMetaSettingInfoEditor *
nm_meta_setting_info_editor_find_by_name (const char *setting_name, gboolean use_alias)
{
const NMMetaSettingInfo *meta_setting_info;
const NMMetaSettingInfoEditor *setting_info;
guint i;
g_return_val_if_fail (setting_name, NULL);
meta_setting_info = nm_meta_setting_infos_by_name (setting_name);
setting_info = NULL;
if (meta_setting_info) {
nm_assert (nm_streq0 (meta_setting_info->setting_name, setting_name));
if (meta_setting_info->meta_type < G_N_ELEMENTS (nm_meta_setting_infos_editor)) {
setting_info = &nm_meta_setting_infos_editor[meta_setting_info->meta_type];
nm_assert (setting_info->general == meta_setting_info);
}
}
if (!setting_info && use_alias) {
for (i = 0; i < _NM_META_SETTING_TYPE_NUM; i++) {
if (nm_streq0 (nm_meta_setting_infos_editor[i].alias, setting_name)) {
setting_info = &nm_meta_setting_infos_editor[i];
break;
}
}
}
return setting_info;
}
const NMMetaSettingInfoEditor *
nm_meta_setting_info_editor_find_by_gtype (GType gtype)
{
const NMMetaSettingInfo *meta_setting_info;
const NMMetaSettingInfoEditor *setting_info;
meta_setting_info = nm_meta_setting_infos_by_gtype (gtype);
if (!meta_setting_info)
return NULL;
g_return_val_if_fail (meta_setting_info->get_setting_gtype, NULL);
g_return_val_if_fail (meta_setting_info->get_setting_gtype () == gtype, NULL);
if (meta_setting_info->meta_type >= G_N_ELEMENTS (nm_meta_setting_infos_editor))
return NULL;
setting_info = &nm_meta_setting_infos_editor[meta_setting_info->meta_type];
g_return_val_if_fail (setting_info->general == meta_setting_info, NULL);
return setting_info;
}
const NMMetaSettingInfoEditor *
nm_meta_setting_info_editor_find_by_setting (NMSetting *setting)
{
const NMMetaSettingInfoEditor *setting_info;
g_return_val_if_fail (NM_IS_SETTING (setting), NULL);
setting_info = nm_meta_setting_info_editor_find_by_gtype (G_OBJECT_TYPE (setting));
nm_assert (setting_info == nm_meta_setting_info_editor_find_by_name (nm_setting_get_name (setting), FALSE));
nm_assert (!setting_info || G_TYPE_CHECK_INSTANCE_TYPE (setting, setting_info->general->get_setting_gtype ()));
return setting_info;
}
const NMMetaPropertyInfo *
nm_meta_setting_info_editor_get_property_info (const NMMetaSettingInfoEditor *setting_info, const char *property_name)
{
guint i;
g_return_val_if_fail (setting_info, NULL);
g_return_val_if_fail (property_name, NULL);
for (i = 0; i < setting_info->properties_num; i++) {
nm_assert (setting_info->properties[i]->property_name);
nm_assert (setting_info->properties[i]->setting_info == setting_info);
if (nm_streq (setting_info->properties[i]->property_name, property_name))
return setting_info->properties[i];
}
return NULL;
}
const NMMetaPropertyInfo *
nm_meta_property_info_find_by_name (const char *setting_name, const char *property_name)
{
const NMMetaSettingInfoEditor *setting_info;
const NMMetaPropertyInfo *property_info;
setting_info = nm_meta_setting_info_editor_find_by_name (setting_name, FALSE);
if (!setting_info)
return NULL;
property_info = nm_meta_setting_info_editor_get_property_info (setting_info, property_name);
if (!property_info)
return NULL;
nm_assert (property_info->setting_info == setting_info);
return property_info;
}
const NMMetaPropertyInfo *
nm_meta_property_info_find_by_setting (NMSetting *setting, const char *property_name)
{
const NMMetaSettingInfoEditor *setting_info;
const NMMetaPropertyInfo *property_info;
setting_info = nm_meta_setting_info_editor_find_by_setting (setting);
if (!setting_info)
return NULL;
property_info = nm_meta_setting_info_editor_get_property_info (setting_info, property_name);
if (!property_info)
return NULL;
nm_assert (property_info->setting_info == setting_info);
nm_assert (property_info == nm_meta_property_info_find_by_name (nm_setting_get_name (setting), property_name));
return property_info;
}
NMSetting *
nm_meta_setting_info_editor_new_setting (const NMMetaSettingInfoEditor *setting_info,
NMMetaAccessorSettingInitType init_type)
{
NMSetting *setting;
g_return_val_if_fail (setting_info, NULL);
setting = g_object_new (setting_info->general->get_setting_gtype (), NULL);
if ( setting_info->setting_init_fcn
&& init_type != NM_META_ACCESSOR_SETTING_INIT_TYPE_DEFAULT) {
setting_info->setting_init_fcn (setting_info,
setting,
init_type);
}
return setting;
}
/*****************************************************************************/
const NMMetaSettingInfoEditor *const*
nm_meta_setting_infos_editor_p (void)
{
static const NMMetaSettingInfoEditor *cache[_NM_META_SETTING_TYPE_NUM + 1] = { NULL };
guint i;
if (G_UNLIKELY (!cache[0])) {
for (i = 0; i < _NM_META_SETTING_TYPE_NUM; i++)
cache[i] = &nm_meta_setting_infos_editor[i];
}
return cache;
}
/*****************************************************************************/
const char *
nm_meta_abstract_info_get_name (const NMMetaAbstractInfo *abstract_info, gboolean for_header)
{
const char *n;
nm_assert (abstract_info);
nm_assert (abstract_info->meta_type);
nm_assert (abstract_info->meta_type->get_name);
n = abstract_info->meta_type->get_name (abstract_info, for_header);
nm_assert (n && n[0]);
return n;
}
const NMMetaAbstractInfo *const*
nm_meta_abstract_info_get_nested (const NMMetaAbstractInfo *abstract_info,
guint *out_len,
gpointer *nested_to_free)
{
const NMMetaAbstractInfo *const*nested;
guint l = 0;
gs_free gpointer f = NULL;
nm_assert (abstract_info);
nm_assert (abstract_info->meta_type);
nm_assert (nested_to_free && !*nested_to_free);
if (abstract_info->meta_type->get_nested) {
nested = abstract_info->meta_type->get_nested (abstract_info, &l, &f);
nm_assert ((nested ? g_strv_length ((char **) nested) : 0) == l);
if (nested && nested[0]) {
NM_SET_OUT (out_len, l);
*nested_to_free = g_steal_pointer (&f);
return nested;
}
}
NM_SET_OUT (out_len, 0);
return NULL;
}
gconstpointer
nm_meta_abstract_info_get (const NMMetaAbstractInfo *abstract_info,
const NMMetaEnvironment *environment,
gpointer environment_user_data,
gpointer target,
NMMetaAccessorGetType get_type,
NMMetaAccessorGetFlags get_flags,
NMMetaAccessorGetOutFlags *out_flags,
gpointer *out_to_free)
{
nm_assert (abstract_info);
nm_assert (abstract_info->meta_type);
nm_assert (!out_to_free || !*out_to_free);
nm_assert (out_flags);
*out_flags = NM_META_ACCESSOR_GET_OUT_FLAGS_NONE;
if (!abstract_info->meta_type->get_fcn)
g_return_val_if_reached (NULL);
return abstract_info->meta_type->get_fcn (abstract_info,
environment,
environment_user_data,
target,
get_type,
get_flags,
out_flags,
out_to_free);
}
const char *const*
nm_meta_abstract_info_complete (const NMMetaAbstractInfo *abstract_info,
const NMMetaEnvironment *environment,
gpointer environment_user_data,
const NMMetaOperationContext *operation_context,
const char *text,
char ***out_to_free)
{
const char *const*values;
gsize i, j, text_len;
nm_assert (abstract_info);
nm_assert (abstract_info->meta_type);
nm_assert (out_to_free && !*out_to_free);
*out_to_free = NULL;
if (!abstract_info->meta_type->complete_fcn)
return NULL;
values = abstract_info->meta_type->complete_fcn (abstract_info,
environment,
environment_user_data,
operation_context,
text,
out_to_free);
nm_assert (!*out_to_free || values == (const char *const*) *out_to_free);
if (!text || !text[0] || !values || !values[0])
return values;
/* for convenience, we all the complete_fcn() implementations to
* ignore "text". We filter out invalid matches here. */
text_len = strlen (text);
if (*out_to_free) {
char **v = *out_to_free;
for (i =0, j = 0; v[i]; i++) {
if (strncmp (v[i], text, text_len) != 0)
continue;
v[j++] = v[i];
}
v[j++] = NULL;
return (const char *const*) *out_to_free;
} else {
const char *const*v = values;
char **r;
for (i = 0, j = 0; v[i]; i++) {
if (strncmp (v[i], text, text_len) != 0)
continue;
j++;
}
if (j == i)
return values;
r = g_new (char *, j + 1);
v = values;
for (i = 0, j = 0; v[i]; i++) {
if (strncmp (v[i], text, text_len) != 0)
continue;
r[j++] = g_strdup (v[i]);
}
r[j++] = NULL;
return (const char *const*) (*out_to_free = r);
}
}
/*****************************************************************************/
char *
nm_meta_abstract_info_get_nested_names_str (const NMMetaAbstractInfo *abstract_info, const char *name_prefix)
{
gs_free gpointer nested_to_free = NULL;
guint i;
const NMMetaAbstractInfo *const*nested;
GString *allowed_fields;
nested = nm_meta_abstract_info_get_nested (abstract_info, NULL, &nested_to_free);
if (!nested)
return NULL;
allowed_fields = g_string_sized_new (256);
if (!name_prefix)
name_prefix = nm_meta_abstract_info_get_name (abstract_info, FALSE);
for (i = 0; nested[i]; i++) {
g_string_append_printf (allowed_fields, "%s.%s,",
name_prefix, nm_meta_abstract_info_get_name (nested[i], FALSE));
}
g_string_truncate (allowed_fields, allowed_fields->len - 1);
return g_string_free (allowed_fields, FALSE);
}
char *
nm_meta_abstract_infos_get_names_str (const NMMetaAbstractInfo *const*fields_array, const char *name_prefix)
{
GString *allowed_fields;
guint i;
if (!fields_array || !fields_array[0])
return NULL;
allowed_fields = g_string_sized_new (256);
for (i = 0; fields_array[i]; i++) {
if (name_prefix)
g_string_append_printf (allowed_fields, "%s.", name_prefix);
g_string_append_printf (allowed_fields, "%s,", nm_meta_abstract_info_get_name (fields_array[i], FALSE));
}
g_string_truncate (allowed_fields, allowed_fields->len - 1);
return g_string_free (allowed_fields, FALSE);
}
/*****************************************************************************/
typedef struct {
guint idx;
gsize self_offset_plus_1;
gsize sub_offset_plus_1;
} OutputSelectionItem;
static NMMetaSelectionResultList *
_output_selection_pack (const NMMetaAbstractInfo *const* fields_array,
GArray *array,
GString *str)
{
NMMetaSelectionResultList *result;
guint i;
guint len;
len = array ? array->len : 0;
/* re-organize the collected output data in one buffer that can be freed using
* g_free(). This makes allocation more complicated, but saves us from special
* handling for free. */
result = g_malloc0 (sizeof (NMMetaSelectionResultList) + (len * sizeof (NMMetaSelectionItem)) + (str ? str->len : 0));
*((guint *) &result->num) = len;
if (len > 0) {
char *pdata = &((char *) result)[sizeof (NMMetaSelectionResultList) + (len * sizeof (NMMetaSelectionItem))];
if (str)
memcpy (pdata, str->str, str->len);
for (i = 0; i < len; i++) {
const OutputSelectionItem *a = &g_array_index (array, OutputSelectionItem, i);
NMMetaSelectionItem *p = (NMMetaSelectionItem *) &result->items[i];
p->info = fields_array[a->idx];
p->idx = a->idx;
if (a->self_offset_plus_1 > 0)
p->self_selection = &pdata[a->self_offset_plus_1 - 1];
if (a->sub_offset_plus_1 > 0)
p->sub_selection = &pdata[a->sub_offset_plus_1 - 1];
}
}
return result;
}
static gboolean
_output_selection_select_one (const NMMetaAbstractInfo *const* fields_array,
const char *fields_prefix,
const char *fields_str,
gboolean validate_nested,
GArray **p_array,
GString **p_str,
GError **error)
{
guint i, j;
const char *i_name;
const char *right;
gboolean found = FALSE;
const NMMetaAbstractInfo *fields_array_failure = NULL;
gs_free char *fields_str_clone = NULL;
nm_assert (fields_str);
nm_assert (p_array);
nm_assert (p_str);
nm_assert (!error || !*error);
right = strchr (fields_str, '.');
if (right) {
fields_str_clone = g_strdup (fields_str);
fields_str_clone[right - fields_str] = '\0';
i_name = fields_str_clone;
right = &fields_str_clone[right - fields_str + 1];
} else
i_name = fields_str;
if (!fields_array)
goto not_found;
for (i = 0; fields_array[i]; i++) {
const NMMetaAbstractInfo *fi = fields_array[i];
const NMMetaAbstractInfo *const*nested;
gs_free gpointer nested_to_free = NULL;
if (g_ascii_strcasecmp (i_name, nm_meta_abstract_info_get_name (fi, FALSE)) != 0)
continue;
if (!right || !validate_nested) {
found = TRUE;
break;
}
nested = nm_meta_abstract_info_get_nested (fi, NULL, &nested_to_free);
if (nested) {
for (j = 0; nested[j]; nested++) {
if (g_ascii_strcasecmp (right, nm_meta_abstract_info_get_name (nested[j], FALSE)) == 0) {
found = TRUE;
break;
}
}
}
fields_array_failure = fields_array[i];
break;
}
if (!found) {
not_found:
if ( !right
&& !fields_prefix
&& ( !g_ascii_strcasecmp (i_name, "all")
|| !g_ascii_strcasecmp (i_name, "common")))
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN, _("field '%s' has to be alone"), i_name);
else {
gs_free char *allowed_fields = NULL;
if (fields_array_failure) {
gs_free char *p = NULL;
if (fields_prefix) {
p = g_strdup_printf ("%s.%s", fields_prefix,
nm_meta_abstract_info_get_name (fields_array_failure, FALSE));
}
allowed_fields = nm_meta_abstract_info_get_nested_names_str (fields_array_failure, p);
} else
allowed_fields = nm_meta_abstract_infos_get_names_str (fields_array, NULL);
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN, _("invalid field '%s%s%s%s%s'; %s%s%s"),
fields_prefix ?: "", fields_prefix ? "." : "",
i_name, right ? "." : "", right ?: "",
NM_PRINT_FMT_QUOTED (allowed_fields, "allowed fields: ", allowed_fields, "", "no fields"));
}
return FALSE;
}
{
GString *str;
OutputSelectionItem s = {
.idx = i,
};
if (!*p_str)
*p_str = g_string_sized_new (64);
str = *p_str;
s.self_offset_plus_1 = str->len + 1;
if (fields_prefix) {
g_string_append (str, fields_prefix);
g_string_append_c (str, '.');
}
g_string_append_len (str, i_name, strlen (i_name) + 1);
if (right) {
s.sub_offset_plus_1 = str->len + 1;
g_string_append_len (str, right, strlen (right) + 1);
}
if (!*p_array)
*p_array = g_array_new (FALSE, FALSE, sizeof (OutputSelectionItem));
g_array_append_val (*p_array, s);
}
return TRUE;
}
NMMetaSelectionResultList *
nm_meta_selection_create_all (const NMMetaAbstractInfo *const* fields_array)
{
gs_unref_array GArray *array = NULL;
guint i;
if (fields_array) {
array = g_array_new (FALSE, FALSE, sizeof (OutputSelectionItem));
for (i = 0; fields_array[i]; i++) {
OutputSelectionItem s = {
.idx = i,
};
g_array_append_val (array, s);
}
}
return _output_selection_pack (fields_array, array, NULL);
}
NMMetaSelectionResultList *
nm_meta_selection_create_parse_one (const NMMetaAbstractInfo *const* fields_array,
const char *fields_prefix,
const char *fields_str, /* one field selector (contains no commas) and is already stripped of spaces. */
gboolean validate_nested,
GError **error)
{
gs_unref_array GArray *array = NULL;
nm_auto_free_gstring GString *str = NULL;
g_return_val_if_fail (!error || !*error, NULL);
nm_assert (fields_str && !strchr (fields_str, ','));
if (!_output_selection_select_one (fields_array,
fields_prefix,
fields_str,
validate_nested,
&array,
&str,
error))
return NULL;
return _output_selection_pack (fields_array, array, str);
}
NMMetaSelectionResultList *
nm_meta_selection_create_parse_list (const NMMetaAbstractInfo *const* fields_array,
const char *fields_prefix,
const char *fields_str, /* a comma separated list of selectors */
gboolean validate_nested,
GError **error)
{
gs_unref_array GArray *array = NULL;
nm_auto_free_gstring GString *str = NULL;
gs_free char *fields_str_clone = NULL;
char *fields_str_cur;
char *fields_str_next;
g_return_val_if_fail (!error || !*error, NULL);
if (!fields_str)
return nm_meta_selection_create_all (fields_array);
fields_str_clone = g_strdup (fields_str);
for (fields_str_cur = fields_str_clone; fields_str_cur; fields_str_cur = fields_str_next) {
fields_str_cur = nm_str_skip_leading_spaces (fields_str_cur);
fields_str_next = strchr (fields_str_cur, ',');
if (fields_str_next)
*fields_str_next++ = '\0';
g_strchomp (fields_str_cur);
if (!fields_str_cur[0])
continue;
if (!_output_selection_select_one (fields_array,
fields_prefix,
fields_str_cur,
validate_nested,
&array,
&str,
error))
return NULL;
}
return _output_selection_pack (fields_array, array, str);
}

View file

@ -0,0 +1,101 @@
/* 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 - 2017 Red Hat, Inc.
*/
#ifndef _NM_META_SETTING_ACCESS_H__
#define _NM_META_SETTING_ACCESS_H__
#include "nm-meta-setting.h"
#include "nm-meta-setting-desc.h"
/*****************************************************************************/
NMSetting *nm_meta_setting_info_editor_new_setting (const NMMetaSettingInfoEditor *setting_info,
NMMetaAccessorSettingInitType init_type);
const NMMetaSettingInfoEditor *nm_meta_setting_info_editor_find_by_name (const char *setting_name, gboolean use_alias);
const NMMetaSettingInfoEditor *nm_meta_setting_info_editor_find_by_gtype (GType gtype);
const NMMetaSettingInfoEditor *nm_meta_setting_info_editor_find_by_setting (NMSetting *setting);
const NMMetaPropertyInfo *nm_meta_setting_info_editor_get_property_info (const NMMetaSettingInfoEditor *setting_info,
const char *property_name);
const NMMetaPropertyInfo *nm_meta_property_info_find_by_name (const char *setting_name,
const char *property_name);
const NMMetaPropertyInfo *nm_meta_property_info_find_by_setting (NMSetting *setting,
const char *property_name);
/*****************************************************************************/
const NMMetaSettingInfoEditor *const*nm_meta_setting_infos_editor_p (void);
/*****************************************************************************/
const char *nm_meta_abstract_info_get_name (const NMMetaAbstractInfo *abstract_info, gboolean for_header);
const NMMetaAbstractInfo *const*nm_meta_abstract_info_get_nested (const NMMetaAbstractInfo *abstract_info,
guint *out_len,
gpointer *nested_to_free);
gconstpointer nm_meta_abstract_info_get (const NMMetaAbstractInfo *abstract_info,
const NMMetaEnvironment *environment,
gpointer environment_user_data,
gpointer target,
NMMetaAccessorGetType get_type,
NMMetaAccessorGetFlags get_flags,
NMMetaAccessorGetOutFlags *out_flags,
gpointer *out_to_free);
const char *const*nm_meta_abstract_info_complete (const NMMetaAbstractInfo *abstract_info,
const NMMetaEnvironment *environment,
gpointer environment_user_data,
const NMMetaOperationContext *operation_context,
const char *text,
char ***out_to_free);
/*****************************************************************************/
char *nm_meta_abstract_info_get_nested_names_str (const NMMetaAbstractInfo *abstract_info, const char *name_prefix);
char *nm_meta_abstract_infos_get_names_str (const NMMetaAbstractInfo *const*fields_array, const char *name_prefix);
/*****************************************************************************/
typedef struct {
const NMMetaAbstractInfo *info;
const char *self_selection;
const char *sub_selection;
guint idx;
} NMMetaSelectionItem;
typedef struct {
const guint num;
const NMMetaSelectionItem items[];
} NMMetaSelectionResultList;
NMMetaSelectionResultList *nm_meta_selection_create_all (const NMMetaAbstractInfo *const* fields_array);
NMMetaSelectionResultList *nm_meta_selection_create_parse_one (const NMMetaAbstractInfo *const* fields_array,
const char *fields_prefix,
const char *fields_str,
gboolean validate_nested,
GError **error);
NMMetaSelectionResultList *nm_meta_selection_create_parse_list (const NMMetaAbstractInfo *const* fields_array,
const char *fields_prefix,
const char *fields_str,
gboolean validate_nested,
GError **error);
#endif /* _NM_META_SETTING_ACCESS_H__ */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,413 @@
/* 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 - 2017 Red Hat, Inc.
*/
#ifndef __NM_META_SETTING_DESC_H__
#define __NM_META_SETTING_DESC_H__
#include "nm-meta-setting.h"
struct _NMDevice;
#define NM_META_TEXT_HIDDEN N_("<hidden>")
#define NM_META_TEXT_PROMPT_ADSL_PROTO N_("Protocol")
#define NM_META_TEXT_PROMPT_ADSL_PROTO_CHOICES "(" NM_SETTING_ADSL_PROTOCOL_PPPOA "/" NM_SETTING_ADSL_PROTOCOL_PPPOE "/" NM_SETTING_ADSL_PROTOCOL_IPOATM ")"
#define NM_META_TEXT_PROMPT_ADSL_ENCAP N_("ADSL encapsulation")
#define NM_META_TEXT_PROMPT_ADSL_ENCAP_CHOICES "(" NM_SETTING_ADSL_ENCAPSULATION_VCMUX "/" NM_SETTING_ADSL_ENCAPSULATION_LLC ") [none]"
#define NM_META_TEXT_PROMPT_CON_TYPE N_("Connection type")
#define NM_META_TEXT_PROMPT_IFNAME N_("Interface name [*]")
#define NM_META_TEXT_PROMPT_VPN_TYPE N_("VPN type")
#define NM_META_TEXT_PROMPT_MASTER N_("Master")
#define NM_META_TEXT_PROMPT_IB_MODE N_("Transport mode")
#define NM_META_TEXT_WORD_DATAGRAM "datagram"
#define NM_META_TEXT_WORD_CONNECTED "connected"
#define NM_META_TEXT_PROMPT_IB_MODE_CHOICES "(" NM_META_TEXT_WORD_DATAGRAM "/" NM_META_TEXT_WORD_CONNECTED ") [" NM_META_TEXT_WORD_DATAGRAM "]"
#define NM_META_TEXT_PROMPT_BT_TYPE N_("Bluetooth type")
#define NM_META_TEXT_WORD_PANU "panu"
#define NM_META_TEXT_WORD_DUN_GSM "dun-gsm"
#define NM_META_TEXT_WORD_DUN_CDMA "dun-cdma"
#define NM_META_TEXT_PROMPT_BT_TYPE_CHOICES "(" NM_META_TEXT_WORD_PANU "/" NM_META_TEXT_WORD_DUN_GSM "/" NM_META_TEXT_WORD_DUN_CDMA ") [" NM_META_TEXT_WORD_PANU "]"
#define NM_META_TEXT_PROMPT_BOND_MODE N_("Bonding mode")
#define NM_META_TEXT_PROMPT_BOND_MON_MODE N_("Bonding monitoring mode")
#define NM_META_TEXT_WORD_MIIMON "miimon"
#define NM_META_TEXT_WORD_ARP "arp"
#define NM_META_TEXT_PROMPT_BOND_MON_MODE_CHOICES "(" NM_META_TEXT_WORD_MIIMON "/" NM_META_TEXT_WORD_ARP ") [" NM_META_TEXT_WORD_MIIMON "]"
#define NM_META_TEXT_PROMPT_WIFI_MODE N_("Wi-Fi mode")
#define NM_META_TEXT_WORD_INFRA "infrastructure"
#define NM_META_TEXT_WORD_AP "ap"
#define NM_META_TEXT_WORD_ADHOC "adhoc"
#define NM_META_TEXT_PROMPT_WIFI_MODE_CHOICES "(" NM_META_TEXT_WORD_INFRA "/" NM_META_TEXT_WORD_AP "/" NM_META_TEXT_WORD_ADHOC ") [" NM_META_TEXT_WORD_INFRA "]"
#define NM_META_TEXT_PROMPT_TUN_MODE N_("Tun mode")
#define NM_META_TEXT_WORD_TUN "tun"
#define NM_META_TEXT_WORD_TAP "tap"
#define NM_META_TEXT_PROMPT_TUN_MODE_CHOICES "(" NM_META_TEXT_WORD_TUN "/" NM_META_TEXT_WORD_TAP ") [" NM_META_TEXT_WORD_TUN "]"
#define NM_META_TEXT_PROMPT_IP_TUNNEL_MODE N_("IP Tunnel mode")
#define NM_META_TEXT_PROMPT_MACVLAN_MODE N_("MACVLAN mode")
#define NM_META_TEXT_PROMPT_MACSEC_MODE N_("MACsec mode")
#define NM_META_TEXT_WORD_PSK "psk"
#define NM_META_TEXT_WORD_EAP "eap"
#define NM_META_TEXT_PROMPT_MACSEC_MODE_CHOICES "(" NM_META_TEXT_WORD_PSK "/" NM_META_TEXT_WORD_EAP ")"
#define NM_META_TEXT_PROMPT_PROXY_METHOD N_("Proxy method")
#define NM_META_TEXT_WORD_NONE "none"
#define NM_META_TEXT_WORD_AUTO "auto"
#define NM_META_TEXT_PROMPT_PROXY_METHOD_CHOICES "(" NM_META_TEXT_WORD_NONE "/" NM_META_TEXT_WORD_AUTO ") [" NM_META_TEXT_WORD_NONE "]"
typedef enum {
NM_META_TERM_COLOR_NORMAL = 0,
NM_META_TERM_COLOR_BLACK = 1,
NM_META_TERM_COLOR_RED = 2,
NM_META_TERM_COLOR_GREEN = 3,
NM_META_TERM_COLOR_YELLOW = 4,
NM_META_TERM_COLOR_BLUE = 5,
NM_META_TERM_COLOR_MAGENTA = 6,
NM_META_TERM_COLOR_CYAN = 7,
NM_META_TERM_COLOR_WHITE = 8,
} NMMetaTermColor;
typedef enum {
NM_META_TERM_FORMAT_NORMAL = 0,
NM_META_TERM_FORMAT_BOLD = 1,
NM_META_TERM_FORMAT_DIM = 2,
NM_META_TERM_FORMAT_UNDERLINE = 3,
NM_META_TERM_FORMAT_BLINK = 4,
NM_META_TERM_FORMAT_REVERSE = 5,
NM_META_TERM_FORMAT_HIDDEN = 6,
} NMMetaTermFormat;
typedef enum {
NM_META_ACCESSOR_GET_TYPE_PRETTY,
NM_META_ACCESSOR_GET_TYPE_PARSABLE,
NM_META_ACCESSOR_GET_TYPE_TERMFORMAT,
} NMMetaAccessorGetType;
typedef enum {
NM_META_ACCESSOR_SETTING_INIT_TYPE_DEFAULT,
NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI,
} NMMetaAccessorSettingInitType;
static inline void
nm_meta_termformat_unpack (gconstpointer value, NMMetaTermColor *out_color, NMMetaTermFormat *out_format)
{
/* get_fcn() with NM_META_ACCESSOR_GET_TYPE_TERMFORMAT returns a pointer
* that encodes NMMetaTermColor and NMMetaTermFormat. Unpack it. */
if (!value) {
/* by default, objects that don't support NM_META_ACCESSOR_GET_TYPE_TERMFORMAT
* return NULL. This allows for an explicit fallback value here... */
NM_SET_OUT (out_color, NM_META_TERM_COLOR_NORMAL);
NM_SET_OUT (out_format, NM_META_TERM_FORMAT_NORMAL);
} else {
NM_SET_OUT (out_color, GPOINTER_TO_UINT (value) & 0xFF);
NM_SET_OUT (out_format, (GPOINTER_TO_UINT (value) & 0xFF00) >> 8);
}
}
static inline gconstpointer
nm_meta_termformat_pack (NMMetaTermColor color, NMMetaTermFormat format)
{
/* get_fcn() with NM_META_ACCESSOR_GET_TYPE_TERMFORMAT returns a pointer
* that encodes NMMetaTermColor and NMMetaTermFormat. Pack it. */
return GUINT_TO_POINTER (((guint) 0x10000) | (((guint) color) & 0xFFu) | ((((guint) format) & 0xFFu) << 8));
}
#define NM_META_TERMFORMAT_DEFAULT() (nm_meta_termformat_pack (NM_META_TERM_COLOR_NORMAL, NM_META_TERM_FORMAT_NORMAL))
typedef enum {
NM_META_ACCESSOR_GET_FLAGS_NONE = 0,
NM_META_ACCESSOR_GET_FLAGS_ACCEPT_STRV = (1LL << 0),
NM_META_ACCESSOR_GET_FLAGS_SHOW_SECRETS = (1LL << 1),
} NMMetaAccessorGetFlags;
typedef enum {
NM_META_ACCESSOR_GET_OUT_FLAGS_NONE = 0,
NM_META_ACCESSOR_GET_OUT_FLAGS_STRV = (1LL << 0),
} NMMetaAccessorGetOutFlags;
typedef enum {
NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_NUMERIC = (1LL << 0),
NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_NUMERIC_HEX = (1LL << 1),
NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT = (1LL << 2),
NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT_L10N = (1LL << 3),
NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_NUMERIC = (1LL << 4),
NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_NUMERIC_HEX = (1LL << 5),
NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT = (1LL << 6),
} NMMetaPropertyTypFlags;
typedef enum {
NM_META_PROPERTY_TYPE_MAC_MODE_DEFAULT,
NM_META_PROPERTY_TYPE_MAC_MODE_CLONED,
NM_META_PROPERTY_TYPE_MAC_MODE_INFINIBAND,
} NMMetaPropertyTypeMacMode;
typedef struct _NMMetaEnvironment NMMetaEnvironment;
typedef struct _NMMetaType NMMetaType;
typedef struct _NMMetaAbstractInfo NMMetaAbstractInfo;
typedef struct _NMMetaSettingInfoEditor NMMetaSettingInfoEditor;
typedef struct _NMMetaPropertyInfo NMMetaPropertyInfo;
typedef struct _NMMetaPropertyType NMMetaPropertyType;
typedef struct _NMMetaPropertyTypData NMMetaPropertyTypData;
typedef struct _NMMetaOperationContext NMMetaOperationContext;
typedef struct _NMMetaNestedPropertyInfo NMMetaNestedPropertyInfo;
typedef struct _NMMetaPropertyTypDataNested NMMetaPropertyTypDataNested;
/* this gives some context information for virtual functions.
* This command actually violates layering, and should be considered
* a hack. In the future, try to replace it's use. */
struct _NMMetaOperationContext {
NMConnection *connection;
};
struct _NMMetaPropertyType {
/* should return a translated string */
const char *(*describe_fcn) (const NMMetaPropertyInfo *property_info,
char **out_to_free);
gconstpointer (*get_fcn) (const NMMetaPropertyInfo *property_info,
const NMMetaEnvironment *environment,
gpointer environment_user_data,
NMSetting *setting,
NMMetaAccessorGetType get_type,
NMMetaAccessorGetFlags get_flags,
NMMetaAccessorGetOutFlags *out_flags,
gpointer *out_to_free);
gboolean (*set_fcn) (const NMMetaPropertyInfo *property_info,
const NMMetaEnvironment *environment,
gpointer environment_user_data,
NMSetting *setting,
const char *value,
GError **error);
gboolean (*remove_fcn) (const NMMetaPropertyInfo *property_info,
const NMMetaEnvironment *environment,
gpointer environment_user_data,
NMSetting *setting,
const char *option,
guint32 idx,
GError **error);
const char *const*(*values_fcn) (const NMMetaPropertyInfo *property_info,
char ***out_to_free);
const char *const*(*complete_fcn) (const NMMetaPropertyInfo *property_info,
const NMMetaEnvironment *environment,
gpointer environment_user_data,
const NMMetaOperationContext *operation_context,
const char *text,
char ***out_to_free);
};
struct _NMUtilsEnumValueInfo;
struct _NMMetaPropertyTypData {
union {
struct {
gboolean (*fcn) (NMSetting *setting);
} get_with_default;
struct {
GType (*get_gtype) (void);
int min;
int max;
const struct _NMUtilsEnumValueInfo *value_infos;
} gobject_enum;
struct {
guint32 (*get_fcn) (NMSetting *setting);
} mtu;
struct {
NMMetaPropertyTypeMacMode mode;
} mac;
} subtype;
const char *const*values_static;
const NMMetaPropertyTypDataNested *nested;
NMMetaPropertyTypFlags typ_flags;
};
typedef enum {
NM_META_PROPERTY_INF_FLAG_NONE = 0x00,
NM_META_PROPERTY_INF_FLAG_REQD = 0x01, /* Don't ask to ask. */
NM_META_PROPERTY_INF_FLAG_DONT_ASK = 0x02, /* Don't ask interactively by default */
NM_META_PROPERTY_INF_FLAG_MULTI = 0x04, /* Ask multiple times, do an append instead of set. */
} NMMetaPropertyInfFlags;
enum {
_NM_META_PROPERTY_TYPE_VPN_SERVICE_TYPE = 0,
_NM_META_PROPERTY_TYPE_CONNECTION_TYPE = 4,
};
#define nm_meta_property_info_connection_type (nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_CONNECTION].properties[_NM_META_PROPERTY_TYPE_CONNECTION_TYPE])
#define nm_meta_property_info_vpn_service_type (nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_VPN].properties[_NM_META_PROPERTY_TYPE_VPN_SERVICE_TYPE])
struct _NMMetaPropertyInfo {
const NMMetaType *meta_type;
const NMMetaSettingInfoEditor *setting_info;
const char *property_name;
const char *property_alias;
NMMetaPropertyInfFlags inf_flags;
bool is_secret:1;
bool is_cli_option:1;
const char *prompt;
const char *def_hint;
const char *describe_doc;
/* a non-translated but translatable static description (marked with N_()). */
const char *describe_message;
const NMMetaPropertyType *property_type;
const NMMetaPropertyTypData *property_typ_data;
};
typedef struct _NMMetaSettingValidPartItem {
const NMMetaSettingInfoEditor *setting_info;
bool mandatory;
} NMMetaSettingValidPartItem;
struct _NMMetaSettingInfoEditor {
const NMMetaType *meta_type;
const NMMetaSettingInfo *general;
const char *alias;
const char *pretty_name;
const NMMetaPropertyInfo *const*properties;
guint properties_num;
/* a NMConnection has a main type (connection.type), which is a
* main NMSetting instance. Depending on the type, a connection
* may have a list of other allowed settings.
*
* For example, a connection of type "vlan" may have settings
* of type "connection", "vlan", and "wired".
*
* Some setting types a not a main type (NMSettingProxy). They
* don't have valid_settings but are usually referenced by other
* settings to be valid for them. */
const NMMetaSettingValidPartItem *const*valid_parts;
void (*setting_init_fcn) (const NMMetaSettingInfoEditor *setting_info,
NMSetting *setting,
NMMetaAccessorSettingInitType init_type);
};
struct _NMMetaType {
const char *type_name;
const char *(*get_name) (const NMMetaAbstractInfo *abstract_info,
gboolean for_header);
const NMMetaAbstractInfo *const*(*get_nested) (const NMMetaAbstractInfo *abstract_info,
guint *out_len,
gpointer *out_to_free);
gconstpointer (*get_fcn) (const NMMetaAbstractInfo *info,
const NMMetaEnvironment *environment,
gpointer environment_user_data,
gpointer target,
NMMetaAccessorGetType get_type,
NMMetaAccessorGetFlags get_flags,
NMMetaAccessorGetOutFlags *out_flags,
gpointer *out_to_free);
const char *const*(*complete_fcn) (const NMMetaAbstractInfo *info,
const NMMetaEnvironment *environment,
gpointer environment_user_data,
const NMMetaOperationContext *operation_context,
const char *text,
char ***out_to_free);
};
struct _NMMetaAbstractInfo {
const NMMetaType *meta_type;
};
extern const NMMetaType nm_meta_type_setting_info_editor;
extern const NMMetaType nm_meta_type_property_info;
extern const NMMetaSettingInfoEditor nm_meta_setting_infos_editor[_NM_META_SETTING_TYPE_NUM];
extern const NMMetaSettingValidPartItem *const nm_meta_setting_info_valid_parts_default[];
const NMMetaSettingValidPartItem *const*nm_meta_setting_info_valid_parts_for_slave_type (const char *slave_type, const char **out_slave_name);
/*****************************************************************************/
typedef enum {
NM_META_ENV_WARN_LEVEL_INFO,
NM_META_ENV_WARN_LEVEL_WARN,
} NMMetaEnvWarnLevel;
/* the settings-meta data is supposed to be independent of an actual client
* implementation. Hence, there is a need for hooks to the meta-data.
* The meta-data handlers may call back to the enviroment with certain
* actions. */
struct _NMMetaEnvironment {
void (*warn_fcn) (const NMMetaEnvironment *environment,
gpointer environment_user_data,
NMMetaEnvWarnLevel warn_level,
const char *fmt_l10n, /* the untranslated format string, but it is marked for translation using N_(). */
va_list ap);
struct _NMDevice *const*(*get_nm_devices) (const NMMetaEnvironment *environment,
gpointer environment_user_data,
guint *out_len);
struct _NMRemoteConnection *const*(*get_nm_connections) (const NMMetaEnvironment *environment,
gpointer environment_user_data,
guint *out_len);
};
/*****************************************************************************/
/* NMSettingBond is special in that it has nested properties.
* We will add API to proper handle such types (Bond, VPN, User),
* but for now just expose the type info directly. */
extern const NMMetaType nm_meta_type_nested_property_info;
struct _NMMetaNestedPropertyInfo {
union {
const NMMetaType *meta_type;
NMMetaPropertyInfo base;
};
const NMMetaPropertyInfo *parent_info;
};
struct _NMMetaPropertyTypDataNested {
const NMMetaNestedPropertyInfo *nested;
guint nested_len;
};
const NMMetaPropertyTypDataNested nm_meta_property_typ_data_bond;
/*****************************************************************************/
#endif /* __NM_META_SETTING_DESC_H__ */

View file

@ -399,20 +399,20 @@ add_vpn_secrets (NMSecretAgentSimpleRequest *request,
{
NMSettingVpn *s_vpn = nm_connection_get_setting_vpn (request->connection);
const VpnPasswordName *secret_names, *p;
char *tmp = NULL;
const char *vpn_msg = NULL;
char **iter;
/* If hints are given, then always ask for what the hints require */
if (request->hints && g_strv_length (request->hints)) {
for (iter = request->hints; iter && *iter; iter++) {
if (!tmp && g_str_has_prefix (*iter, VPN_MSG_TAG))
tmp = g_strdup (*iter + strlen (VPN_MSG_TAG));
if (request->hints) {
for (iter = request->hints; *iter; iter++) {
if (!vpn_msg && g_str_has_prefix (*iter, VPN_MSG_TAG))
vpn_msg = &(*iter)[NM_STRLEN (VPN_MSG_TAG)];
else
add_vpn_secret_helper (secrets, s_vpn, *iter, *iter);
}
}
if (msg)
*msg = g_strdup (tmp);
NM_SET_OUT (msg, g_strdup (vpn_msg));
/* Now add what client thinks might be required, because hints may be empty or incomplete */
p = secret_names = nm_vpn_get_secret_names (nm_setting_vpn_get_service_type (s_vpn));

View file

@ -115,22 +115,33 @@ nm_vpn_supports_ipv6 (NMConnection *connection)
const VpnPasswordName *
nm_vpn_get_secret_names (const char *service_type)
{
static const VpnPasswordName const generic_vpn_secrets[] = {
{ "password", N_("Password") },
{ 0 }
};
static const VpnPasswordName const openvpn_secrets[] = {
{ "password", N_("Password") },
{ "cert-pass", N_("Certificate password") },
{ "http-proxy-password", N_("HTTP proxy password") },
{ 0 }
};
static const VpnPasswordName const vpnc_secrets[] = {
{ "Xauth password", N_("Password") },
{ "IPSec secret", N_("Group password") },
{ 0 }
};
static const VpnPasswordName const swan_secrets[] = {
{ "xauthpassword", N_("Password") },
{ "pskvalue", N_("Group password") },
{ 0 }
};
static const VpnPasswordName const openconnect_secrets[] = {
{ "gateway", N_("Gateway") },
{ "cookie", N_("Cookie") },
{ "gwcert", N_("Gateway certificate hash") },
{ 0 }
};
const char *type;
static VpnPasswordName generic_vpn_secrets[] = { {"password", N_("Password")}, {NULL, NULL} };
static VpnPasswordName openvpn_secrets[] = { {"password", N_("Password")},
{"cert-pass", N_("Certificate password")},
{"http-proxy-password", N_("HTTP proxy password")},
{NULL, NULL} };
static VpnPasswordName vpnc_secrets[] = { {"Xauth password", N_("Password")},
{"IPSec secret", N_("Group password")},
{NULL, NULL} };
static VpnPasswordName swan_secrets[] = { {"xauthpassword", N_("Password")},
{"pskvalue", N_("Group password")},
{NULL, NULL} };
static VpnPasswordName openconnect_secrets[] = { {"gateway", N_("Gateway")},
{"cookie", N_("Cookie")},
{"gwcert", N_("Gateway certificate hash")},
{NULL, NULL} };
if (!service_type)
return NULL;

View file

@ -0,0 +1,341 @@
/* Generated file. Do not edit. */
#define DESCRIBE_DOC_NM_SETTING_OLPC_MESH_CHANNEL N_("Channel on which the mesh network to join is located.")
#define DESCRIBE_DOC_NM_SETTING_OLPC_MESH_DHCP_ANYCAST_ADDRESS N_("Anycast DHCP MAC address used when requesting an IP address via DHCP. The specific anycast address used determines which DHCP server class answers the request.")
#define DESCRIBE_DOC_NM_SETTING_OLPC_MESH_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_OLPC_MESH_SSID N_("SSID of the mesh network to join.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_BAND N_("802.11 frequency band of the network. One of \"a\" for 5GHz 802.11a or \"bg\" for 2.4GHz 802.11. This will lock associations to the Wi-Fi network to the specific band, i.e. if \"a\" is specified, the device will not associate with the same network in the 2.4GHz band even if the network's settings are compatible. This setting depends on specific driver capability and may not work with all drivers.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_BSSID N_("If specified, directs the device to only associate with the given access point. This capability is highly driver dependent and not supported by all devices. Note: this property does not control the BSSID used when creating an Ad-Hoc network and is unlikely to in the future.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_CHANNEL N_("Wireless channel to use for the Wi-Fi connection. The device will only join (or create for Ad-Hoc networks) a Wi-Fi network on the specified channel. Because channel numbers overlap between bands, this property also requires the \"band\" property to be set.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS N_("If specified, request that the device use this MAC address instead. This is known as MAC cloning or spoofing. Beside explicitly specifing a MAC address, the special values \"preserve\", \"permanent\", \"random\" and \"stable\" are supported. \"preserve\" means not to touch the MAC address on activation. \"permanent\" means to use the permanent hardware address of the device. \"random\" creates a random MAC address on each connect. \"stable\" creates a hashed MAC address based on connection.stable-id and a machine dependent key. If unspecified, the value can be overwritten via global defaults, see manual of NetworkManager.conf. If still unspecified, it defaults to \"preserve\" (older versions of NetworkManager may use a different default value). On D-Bus, this field is expressed as \"assigned-mac-address\" or the deprecated \"cloned-mac-address\".")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_GENERATE_MAC_ADDRESS_MASK N_("With \"cloned-mac-address\" setting \"random\" or \"stable\", by default all bits of the MAC address are scrambled and a locally-administered, unicast MAC address is created. This property allows to specify that certain bits are fixed. Note that the least significant bit of the first MAC address will always be unset to create a unicast MAC address. If the property is NULL, it is eligible to be overwritten by a default connection setting. If the value is still NULL or an empty string, the default is to create a locally-administered, unicast MAC address. If the value contains one MAC address, this address is used as mask. The set bits of the mask are to be filled with the current MAC address of the device, while the unset bits are subject to randomization. Setting \"FE:FF:FF:00:00:00\" means to preserve the OUI of the current MAC address and only randomize the lower 3 bytes using the \"random\" or \"stable\" algorithm. If the value contains one additional MAC address after the mask, this address is used instead of the current MAC address to fill the bits that shall not be randomized. For example, a value of \"FE:FF:FF:00:00:00 68:F7:28:00:00:00\" will set the OUI of the MAC address to 68:F7:28, while the lower bits are randomized. A value of \"02:00:00:00:00:00 00:00:00:00:00:00\" will create a fully scrambled globally-administered, burned-in MAC address. If the value contains more then one additional MAC addresses, one of them is chosen randomly. For example, \"02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00\" will create a fully scrambled MAC address, randomly locally or globally administered.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_HIDDEN N_("If TRUE, indicates this network is a non-broadcasting network that hides its SSID. In this case various workarounds may take place, such as probe-scanning the SSID for more reliable network discovery. However, these workarounds expose inherent insecurities with hidden SSID networks, and thus hidden SSID networks should be used with caution.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MAC_ADDRESS N_("If specified, this connection will only apply to the Wi-Fi device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing).")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST N_("A list of permanent MAC addresses of Wi-Fi devices to which this connection should never apply. Each MAC address should be given in the standard hex-digits-and-colons notation (eg \"00:11:22:33:44:55\").")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MAC_ADDRESS_RANDOMIZATION N_("One of NM_SETTING_MAC_RANDOMIZATION_DEFAULT (0) (never randomize unless the user has set a global default to randomize and the supplicant supports randomization), NM_SETTING_MAC_RANDOMIZATION_NEVER (1) (never randomize the MAC address), or NM_SETTING_MAC_RANDOMIZATION_ALWAYS (2) (always randomize the MAC address). This property is deprecated for 'cloned-mac-address'. Deprecated: 1")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MODE N_("Wi-Fi network mode; one of \"infrastructure\", \"adhoc\" or \"ap\". If blank, infrastructure is assumed.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple Ethernet frames.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_POWERSAVE N_("One of NM_SETTING_WIRELESS_POWERSAVE_DISABLE (2) (disable Wi-Fi power saving), NM_SETTING_WIRELESS_POWERSAVE_ENABLE (3) (enable Wi-Fi power saving), NM_SETTING_WIRELESS_POWERSAVE_IGNORE (1) (don't touch currently configure setting) or NM_SETTING_WIRELESS_POWERSAVE_DEFAULT (0) (use the globally configured value). All other values are reserved.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_RATE N_("If non-zero, directs the device to only use the specified bitrate for communication with the access point. Units are in Kb/s, ie 5500 = 5.5 Mbit/s. This property is highly driver dependent and not all devices support setting a static bitrate.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SEEN_BSSIDS N_("A list of BSSIDs (each BSSID formatted as a MAC address like \"00:11:22:33:44:55\") that have been detected as part of the Wi-Fi network. NetworkManager internally tracks previously seen BSSIDs. The property is only meant for reading and reflects the BSSID list of NetworkManager. The changes you make to this property will not be preserved.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SSID N_("SSID of the Wi-Fi network. Must be specified.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_TX_POWER N_("If non-zero, directs the device to use the specified transmit power. Units are dBm. This property is highly driver dependent and not all devices support setting a static transmit power.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_AUTH_ALG N_("When WEP is used (ie, key-mgmt = \"none\" or \"ieee8021x\") indicate the 802.11 authentication algorithm required by the AP here. One of \"open\" for Open System, \"shared\" for Shared Key, or \"leap\" for Cisco LEAP. When using Cisco LEAP (ie, key-mgmt = \"ieee8021x\" and auth-alg = \"leap\") the \"leap-username\" and \"leap-password\" properties must be specified.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_GROUP N_("A list of group/broadcast encryption algorithms which prevents connections to Wi-Fi networks that do not utilize one of the algorithms in the list. For maximum compatibility leave this property empty. Each list element may be one of \"wep40\", \"wep104\", \"tkip\", or \"ccmp\".")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_KEY_MGMT N_("Key management used for the connection. One of \"none\" (WEP), \"ieee8021x\" (Dynamic WEP), \"wpa-none\" (Ad-Hoc WPA-PSK), \"wpa-psk\" (infrastructure WPA-PSK), or \"wpa-eap\" (WPA-Enterprise). This property must be set for any Wi-Fi connection that uses security.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD N_("The login password for legacy LEAP connections (ie, key-mgmt = \"ieee8021x\" and auth-alg = \"leap\").")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS N_("Flags indicating how to handle the \"leap-password\" property.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME N_("The login username for legacy LEAP connections (ie, key-mgmt = \"ieee8021x\" and auth-alg = \"leap\").")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PAIRWISE N_("A list of pairwise encryption algorithms which prevents connections to Wi-Fi networks that do not utilize one of the algorithms in the list. For maximum compatibility leave this property empty. Each list element may be one of \"tkip\" or \"ccmp\".")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PMF N_("Indicates whether Protected Management Frames (802.11w) must be enabled for the connection. One of NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT (0) (use global default value), NM_SETTING_WIRELESS_SECURITY_PMF_DISABLE (1) (disable PMF), NM_SETTING_WIRELESS_SECURITY_PMF_OPTIONAL (2) (enable PMF if the supplicant and the access point support it) or NM_SETTING_WIRELESS_SECURITY_PMF_REQUIRED (3) (enable PMF and fail if not supported). When set to NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT (0) and no global default is set, PMF will be optionally enabled.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PROTO N_("List of strings specifying the allowed WPA protocol versions to use. Each element may be one \"wpa\" (allow WPA) or \"rsn\" (allow WPA2/RSN). If not specified, both WPA and RSN connections are allowed.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PSK N_("Pre-Shared-Key for WPA networks. If the key is 64-characters long, it must contain only hexadecimal characters and is interpreted as a hexadecimal WPA key. Otherwise, the key must be between 8 and 63 ASCII characters (as specified in the 802.11i standard) and is interpreted as a WPA passphrase, and is hashed to derive the actual WPA-PSK used when connecting to the Wi-Fi network.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS N_("Flags indicating how to handle the \"psk\" property.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS N_("Flags indicating how to handle the \"wep-key0\", \"wep-key1\", \"wep-key2\", and \"wep-key3\" properties.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE N_("Controls the interpretation of WEP keys. Allowed values are NM_WEP_KEY_TYPE_KEY (1), in which case the key is either a 10- or 26-character hexadecimal string, or a 5- or 13-character ASCII password; or NM_WEP_KEY_TYPE_PASSPHRASE (2), in which case the passphrase is provided as a string and will be hashed using the de-facto MD5 method to derive the actual WEP key.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY0 N_("Index 0 WEP key. This is the WEP key used in most networks. See the \"wep-key-type\" property for a description of how this key is interpreted.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY1 N_("Index 1 WEP key. This WEP index is not used by most networks. See the \"wep-key-type\" property for a description of how this key is interpreted.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY2 N_("Index 2 WEP key. This WEP index is not used by most networks. See the \"wep-key-type\" property for a description of how this key is interpreted.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY3 N_("Index 3 WEP key. This WEP index is not used by most networks. See the \"wep-key-type\" property for a description of how this key is interpreted.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX N_("When static WEP is used (ie, key-mgmt = \"none\") and a non-default WEP key index is used by the AP, put that WEP key index here. Valid values are 0 (default key) through 3. Note that some consumer access points (like the Linksys WRT54G) number the keys 1 - 4.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_ALTSUBJECT_MATCHES N_("List of strings to be matched against the altSubjectName of the certificate presented by the authentication server. If the list is empty, no verification of the server certificate's altSubjectName is performed.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_ANONYMOUS_IDENTITY N_("Anonymous identity string for EAP authentication methods. Used as the unencrypted identity with EAP types that support different tunneled identity like EAP-TTLS.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_AUTH_TIMEOUT N_("A timeout for the authentication. Zero means the global default; if the global default is not set, the authentication timeout is 25 seconds.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_CA_CERT N_("Contains the CA certificate if used by the EAP method specified in the \"eap\" property. Certificate data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme (which is backwards compatible with NM 0.7.x) this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string \"file://\" and ending with a terminating NUL byte. This property can be unset even if the EAP method supports CA certificates, but this allows man-in-the-middle attacks and is NOT recommended.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_CA_CERT_PASSWORD N_("The password used to access the CA certificate stored in \"ca-cert\" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_CA_CERT_PASSWORD_FLAGS N_("Flags indicating how to handle the \"ca-cert-password\" property.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_CA_PATH N_("UTF-8 encoded path to a directory containing PEM or DER formatted certificates to be added to the verification chain in addition to the certificate specified in the \"ca-cert\" property.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_CLIENT_CERT N_("Contains the client certificate if used by the EAP method specified in the \"eap\" property. Certificate data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme (which is backwards compatible with NM 0.7.x) this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string \"file://\" and ending with a terminating NUL byte.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_CLIENT_CERT_PASSWORD N_("The password used to access the client certificate stored in \"client-cert\" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_CLIENT_CERT_PASSWORD_FLAGS N_("Flags indicating how to handle the \"client-cert-password\" property.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH N_("Constraint for server domain name. If set, this FQDN is used as a suffix match requirement for dNSName element(s) of the certificate presented by the authentication server. If a matching dNSName is found, this constraint is met. If no dNSName values are present, this constraint is matched against SubjectName CN using same suffix match comparison.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_EAP N_("The allowed EAP method to be used when authenticating to the network with 802.1x. Valid methods are: \"leap\", \"md5\", \"tls\", \"peap\", \"ttls\", \"pwd\", and \"fast\". Each method requires different configuration using the properties of this setting; refer to wpa_supplicant documentation for the allowed combinations.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_IDENTITY N_("Identity string for EAP authentication methods. Often the user's user or login name.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PAC_FILE N_("UTF-8 encoded file path containing PAC for EAP-FAST.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PASSWORD N_("UTF-8 encoded password used for EAP authentication methods. If both the \"password\" property and the \"password-raw\" property are specified, \"password\" is preferred.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PASSWORD_RAW N_("Password used for EAP authentication methods, given as a byte array to allow passwords in other encodings than UTF-8 to be used. If both the \"password\" property and the \"password-raw\" property are specified, \"password\" is preferred.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PASSWORD_RAW_FLAGS N_("Flags indicating how to handle the \"password-raw\" property.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE1_AUTH_FLAGS N_("Specifies authentication flags to use in \"phase 1\" outer authentication using NMSetting8021xAuthFlags options. The invidual TLS versions can be explicitly disabled. If a certain TLS disable flag is not set, it is up to the supplicant to allow or forbid it. The TLS options map to tls_disable_tlsv1_x settings. See the wpa_supplicant documentation for more details.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING N_("Enables or disables in-line provisioning of EAP-FAST credentials when FAST is specified as the EAP method in the \"eap\" property. Recognized values are \"0\" (disabled), \"1\" (allow unauthenticated provisioning), \"2\" (allow authenticated provisioning), and \"3\" (allow both authenticated and unauthenticated provisioning). See the wpa_supplicant documentation for more details.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE1_PEAPLABEL N_("Forces use of the new PEAP label during key derivation. Some RADIUS servers may require forcing the new PEAP label to interoperate with PEAPv1. Set to \"1\" to force use of the new PEAP label. See the wpa_supplicant documentation for more details.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE1_PEAPVER N_("Forces which PEAP version is used when PEAP is set as the EAP method in the \"eap\" property. When unset, the version reported by the server will be used. Sometimes when using older RADIUS servers, it is necessary to force the client to use a particular PEAP version. To do so, this property may be set to \"0\" or \"1\" to force that specific PEAP version.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES N_("List of strings to be matched against the altSubjectName of the certificate presented by the authentication server during the inner \"phase 2\" authentication. If the list is empty, no verification of the server certificate's altSubjectName is performed.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_AUTH N_("Specifies the allowed \"phase 2\" inner non-EAP authentication methods when an EAP method that uses an inner TLS tunnel is specified in the \"eap\" property. Recognized non-EAP \"phase 2\" methods are \"pap\", \"chap\", \"mschap\", \"mschapv2\", \"gtc\", \"otp\", \"md5\", and \"tls\". Each \"phase 2\" inner method requires specific parameters for successful authentication; see the wpa_supplicant documentation for more details.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_AUTHEAP N_("Specifies the allowed \"phase 2\" inner EAP-based authentication methods when an EAP method that uses an inner TLS tunnel is specified in the \"eap\" property. Recognized EAP-based \"phase 2\" methods are \"md5\", \"mschapv2\", \"otp\", \"gtc\", and \"tls\". Each \"phase 2\" inner method requires specific parameters for successful authentication; see the wpa_supplicant documentation for more details.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CA_CERT N_("Contains the \"phase 2\" CA certificate if used by the EAP method specified in the \"phase2-auth\" or \"phase2-autheap\" properties. Certificate data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme (which is backwards compatible with NM 0.7.x) this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string \"file://\" and ending with a terminating NUL byte. This property can be unset even if the EAP method supports CA certificates, but this allows man-in-the-middle attacks and is NOT recommended.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CA_CERT_PASSWORD N_("The password used to access the \"phase2\" CA certificate stored in \"phase2-ca-cert\" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CA_CERT_PASSWORD_FLAGS N_("Flags indicating how to handle the \"phase2-ca-cert-password\" property.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CA_PATH N_("UTF-8 encoded path to a directory containing PEM or DER formatted certificates to be added to the verification chain in addition to the certificate specified in the \"phase2-ca-cert\" property.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CLIENT_CERT N_("Contains the \"phase 2\" client certificate if used by the EAP method specified in the \"phase2-auth\" or \"phase2-autheap\" properties. Certificate data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme (which is backwards compatible with NM 0.7.x) this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string \"file://\" and ending with a terminating NUL byte. This property can be unset even if the EAP method supports CA certificates, but this allows man-in-the-middle attacks and is NOT recommended.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CLIENT_CERT_PASSWORD N_("The password used to access the \"phase2\" client certificate stored in \"phase2-client-cert\" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CLIENT_CERT_PASSWORD_FLAGS N_("Flags indicating how to handle the \"phase2-client-cert-password\" property.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_DOMAIN_SUFFIX_MATCH N_("Constraint for server domain name. If set, this FQDN is used as a suffix match requirement for dNSName element(s) of the certificate presented by the authentication server during the inner \"phase 2\" authentication. If a matching dNSName is found, this constraint is met. If no dNSName values are present, this constraint is matched against SubjectName CN using same suffix match comparison.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_PRIVATE_KEY N_("Contains the \"phase 2\" inner private key when the \"phase2-auth\" or \"phase2-autheap\" property is set to \"tls\". Key data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme and private keys, this property should be set to the key's encrypted PEM encoded data. When using private keys with the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string \"file://\" and ending with a terminating NUL byte. When using PKCS#12 format private keys and the blob scheme, this property should be set to the PKCS#12 data and the \"phase2-private-key-password\" property must be set to password used to decrypt the PKCS#12 certificate and key. When using PKCS#12 files and the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string \"file://\" and ending with a terminating NUL byte, and as with the blob scheme the \"phase2-private-key-password\" property must be set to the password used to decode the PKCS#12 private key and certificate.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD N_("The password used to decrypt the \"phase 2\" private key specified in the \"phase2-private-key\" property when the private key either uses the path scheme, or is a PKCS#12 format key.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS N_("Flags indicating how to handle the \"phase2-private-key-password\" property.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH N_("Substring to be matched against the subject of the certificate presented by the authentication server during the inner \"phase 2\" authentication. When unset, no verification of the authentication server certificate's subject is performed. This property provides little security, if any, and its use is deprecated in favor of NMSetting8021x:phase2-domain-suffix-match.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PIN N_("PIN used for EAP authentication methods.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PIN_FLAGS N_("Flags indicating how to handle the \"pin\" property.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PRIVATE_KEY N_("Contains the private key when the \"eap\" property is set to \"tls\". Key data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme and private keys, this property should be set to the key's encrypted PEM encoded data. When using private keys with the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string \"file://\" and ending with a terminating NUL byte. When using PKCS#12 format private keys and the blob scheme, this property should be set to the PKCS#12 data and the \"private-key-password\" property must be set to password used to decrypt the PKCS#12 certificate and key. When using PKCS#12 files and the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string \"file://\" and ending with a terminating NUL byte, and as with the blob scheme the \"private-key-password\" property must be set to the password used to decode the PKCS#12 private key and certificate. WARNING: \"private-key\" is not a \"secret\" property, and thus unencrypted private key data using the BLOB scheme may be readable by unprivileged users. Private keys should always be encrypted with a private key password to prevent unauthorized access to unencrypted private key data.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD N_("The password used to decrypt the private key specified in the \"private-key\" property when the private key either uses the path scheme, or if the private key is a PKCS#12 format key.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD_FLAGS N_("Flags indicating how to handle the \"private-key-password\" property.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_SUBJECT_MATCH N_("Substring to be matched against the subject of the certificate presented by the authentication server. When unset, no verification of the authentication server certificate's subject is performed. This property provides little security, if any, and its use is deprecated in favor of NMSetting8021x:domain-suffix-match.")
#define DESCRIBE_DOC_NM_SETTING_802_1X_SYSTEM_CA_CERTS N_("When TRUE, overrides the \"ca-path\" and \"phase2-ca-path\" properties using the system CA directory specified at configure time with the --system-ca-path switch. The certificates in this directory are added to the verification chain in addition to any certificates specified by the \"ca-cert\" and \"phase2-ca-cert\" properties. If the path provided with --system-ca-path is rather a file name (bundle of trusted CA certificates), it overrides \"ca-cert\" and \"phase2-ca-cert\" properties instead (sets ca_cert/ca_cert2 options for wpa_supplicant).")
#define DESCRIBE_DOC_NM_SETTING_WIRED_AUTO_NEGOTIATE N_("If TRUE, enforce auto-negotiation of port speed and duplex mode. If FALSE, \"speed\" and \"duplex\" properties should be both set or link configuration will be skipped.")
#define DESCRIBE_DOC_NM_SETTING_WIRED_CLONED_MAC_ADDRESS N_("If specified, request that the device use this MAC address instead. This is known as MAC cloning or spoofing. Beside explicitly specifing a MAC address, the special values \"preserve\", \"permanent\", \"random\" and \"stable\" are supported. \"preserve\" means not to touch the MAC address on activation. \"permanent\" means to use the permanent hardware address of the device. \"random\" creates a random MAC address on each connect. \"stable\" creates a hashed MAC address based on connection.stable-id and a machine dependent key. If unspecified, the value can be overwritten via global defaults, see manual of NetworkManager.conf. If still unspecified, it defaults to \"preserve\" (older versions of NetworkManager may use a different default value). On D-Bus, this field is expressed as \"assigned-mac-address\" or the deprecated \"cloned-mac-address\".")
#define DESCRIBE_DOC_NM_SETTING_WIRED_DUPLEX N_("Can be specified only when \"auto-negotiate\" is \"off\". In that case, statically configures the device to use that specified duplex mode, either \"half\" or \"full\". Must be set together with the \"speed\" property if specified. Before specifying a duplex mode be sure your device supports it.")
#define DESCRIBE_DOC_NM_SETTING_WIRED_GENERATE_MAC_ADDRESS_MASK N_("With \"cloned-mac-address\" setting \"random\" or \"stable\", by default all bits of the MAC address are scrambled and a locally-administered, unicast MAC address is created. This property allows to specify that certain bits are fixed. Note that the least significant bit of the first MAC address will always be unset to create a unicast MAC address. If the property is NULL, it is eligible to be overwritten by a default connection setting. If the value is still NULL or an empty string, the default is to create a locally-administered, unicast MAC address. If the value contains one MAC address, this address is used as mask. The set bits of the mask are to be filled with the current MAC address of the device, while the unset bits are subject to randomization. Setting \"FE:FF:FF:00:00:00\" means to preserve the OUI of the current MAC address and only randomize the lower 3 bytes using the \"random\" or \"stable\" algorithm. If the value contains one additional MAC address after the mask, this address is used instead of the current MAC address to fill the bits that shall not be randomized. For example, a value of \"FE:FF:FF:00:00:00 68:F7:28:00:00:00\" will set the OUI of the MAC address to 68:F7:28, while the lower bits are randomized. A value of \"02:00:00:00:00:00 00:00:00:00:00:00\" will create a fully scrambled globally-administered, burned-in MAC address. If the value contains more then one additional MAC addresses, one of them is chosen randomly. For example, \"02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00\" will create a fully scrambled MAC address, randomly locally or globally administered.")
#define DESCRIBE_DOC_NM_SETTING_WIRED_MAC_ADDRESS N_("If specified, this connection will only apply to the Ethernet device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing).")
#define DESCRIBE_DOC_NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST N_("If specified, this connection will never apply to the Ethernet device whose permanent MAC address matches an address in the list. Each MAC address is in the standard hex-digits-and-colons notation (00:11:22:33:44:55).")
#define DESCRIBE_DOC_NM_SETTING_WIRED_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple Ethernet frames.")
#define DESCRIBE_DOC_NM_SETTING_WIRED_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_WIRED_PORT N_("Specific port type to use if multiple the device supports multiple attachment methods. One of \"tp\" (Twisted Pair), \"aui\" (Attachment Unit Interface), \"bnc\" (Thin Ethernet) or \"mii\" (Media Independent Interface. If the device supports only one port type, this setting is ignored.")
#define DESCRIBE_DOC_NM_SETTING_WIRED_S390_NETTYPE N_("s390 network device type; one of \"qeth\", \"lcs\", or \"ctc\", representing the different types of virtual network devices available on s390 systems.")
#define DESCRIBE_DOC_NM_SETTING_WIRED_S390_OPTIONS N_("Dictionary of key/value pairs of s390-specific device options. Both keys and values must be strings. Allowed keys include \"portno\", \"layer2\", \"portname\", \"protocol\", among others. Key names must contain only alphanumeric characters (ie, [a-zA-Z0-9]).")
#define DESCRIBE_DOC_NM_SETTING_WIRED_S390_SUBCHANNELS N_("Identifies specific subchannels that this network device uses for communication with z/VM or s390 host. Like the \"mac-address\" property for non-z/VM devices, this property can be used to ensure this connection only applies to the network device that uses these subchannels. The list should contain exactly 3 strings, and each string may only be composed of hexadecimal characters and the period (.) character.")
#define DESCRIBE_DOC_NM_SETTING_WIRED_SPEED N_("Can be set to a value grater than zero only when \"auto-negotiate\" is \"off\". In that case, statically configures the device to use that specified speed. In Mbit/s, ie 100 == 100Mbit/s. Must be set together with the \"duplex\" property when non-zero. Before specifying a speed value be sure your device supports it.")
#define DESCRIBE_DOC_NM_SETTING_WIRED_WAKE_ON_LAN N_("The NMSettingWiredWakeOnLan options to enable. Not all devices support all options. May be any combination of NM_SETTING_WIRED_WAKE_ON_LAN_PHY (0x2), NM_SETTING_WIRED_WAKE_ON_LAN_UNICAST (0x4), NM_SETTING_WIRED_WAKE_ON_LAN_MULTICAST (0x8), NM_SETTING_WIRED_WAKE_ON_LAN_BROADCAST (0x10), NM_SETTING_WIRED_WAKE_ON_LAN_ARP (0x20), NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC (0x40) or the special values NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT (0x1) (to use global settings) and NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE (0x8000) (to disable management of Wake-on-LAN in NetworkManager).")
#define DESCRIBE_DOC_NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD N_("If specified, the password used with magic-packet-based Wake-on-LAN, represented as an Ethernet MAC address. If NULL, no password will be required.")
#define DESCRIBE_DOC_NM_SETTING_ADSL_ENCAPSULATION N_("Encapsulation of ADSL connection. Can be \"vcmux\" or \"llc\".")
#define DESCRIBE_DOC_NM_SETTING_ADSL_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_ADSL_PASSWORD N_("Password used to authenticate with the ADSL service.")
#define DESCRIBE_DOC_NM_SETTING_ADSL_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.")
#define DESCRIBE_DOC_NM_SETTING_ADSL_PROTOCOL N_("ADSL connection protocol. Can be \"pppoa\", \"pppoe\" or \"ipoatm\".")
#define DESCRIBE_DOC_NM_SETTING_ADSL_USERNAME N_("Username used to authenticate with the ADSL service.")
#define DESCRIBE_DOC_NM_SETTING_ADSL_VCI N_("VCI of ADSL connection")
#define DESCRIBE_DOC_NM_SETTING_ADSL_VPI N_("VPI of ADSL connection")
#define DESCRIBE_DOC_NM_SETTING_BLUETOOTH_BDADDR N_("The Bluetooth address of the device.")
#define DESCRIBE_DOC_NM_SETTING_BLUETOOTH_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_BLUETOOTH_TYPE N_("Either \"dun\" for Dial-Up Networking connections or \"panu\" for Personal Area Networking connections to devices supporting the NAP profile.")
#define DESCRIBE_DOC_NM_SETTING_BOND_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_BOND_OPTIONS N_("Dictionary of key/value pairs of bonding options. Both keys and values must be strings. Option names must contain only alphanumeric characters (ie, [a-zA-Z0-9]).")
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_AGEING_TIME N_("The Ethernet MAC address aging time, in seconds.")
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_FORWARD_DELAY N_("The Spanning Tree Protocol (STP) forwarding delay, in seconds.")
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_HELLO_TIME N_("The Spanning Tree Protocol (STP) hello time, in seconds.")
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_MAC_ADDRESS N_("If specified, the MAC address of bridge. When creating a new bridge, this MAC address will be set. When matching an existing (outside NetworkManager created) bridge, this MAC address must match.")
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_MAX_AGE N_("The Spanning Tree Protocol (STP) maximum message age, in seconds.")
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_MULTICAST_SNOOPING N_("Controls whether IGMP snooping is enabled for this bridge. Note that if snooping was automatically disabled due to hash collisions, the system may refuse to enable the feature until the collisions are resolved.")
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PRIORITY N_("Sets the Spanning Tree Protocol (STP) priority for this bridge. Lower values are \"better\"; the lowest priority bridge will be elected the root bridge.")
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_STP N_("Controls whether Spanning Tree Protocol (STP) is enabled for this bridge.")
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE N_("Enables or disabled \"hairpin mode\" for the port, which allows frames to be sent back out through the port the frame was received on.")
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PORT_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PORT_PATH_COST N_("The Spanning Tree Protocol (STP) port cost for destinations via this port.")
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PORT_PRIORITY N_("The Spanning Tree Protocol (STP) priority of this bridge port.")
#define DESCRIBE_DOC_NM_SETTING_CDMA_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple frames.")
#define DESCRIBE_DOC_NM_SETTING_CDMA_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_CDMA_NUMBER N_("The number to dial to establish the connection to the CDMA-based mobile broadband network, if any. If not specified, the default number (#777) is used when required.")
#define DESCRIBE_DOC_NM_SETTING_CDMA_PASSWORD N_("The password used to authenticate with the network, if required. Many providers do not require a password, or accept any password. But if a password is required, it is specified here.")
#define DESCRIBE_DOC_NM_SETTING_CDMA_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.")
#define DESCRIBE_DOC_NM_SETTING_CDMA_USERNAME N_("The username used to authenticate with the network, if required. Many providers do not require a username, or accept any username. But if a username is required, it is specified here.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_AUTOCONNECT N_("Whether or not the connection should be automatically connected by NetworkManager when the resources for the connection are available. TRUE to automatically activate the connection, FALSE to require manual intervention to activate the connection.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY N_("The autoconnect priority. If the connection is set to autoconnect, connections with higher priority will be preferred. Defaults to 0. The higher number means higher priority.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES N_("The number of times a connection should be tried when autoctivating before giving up. Zero means forever, -1 means the global default (4 times if not overridden).")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES N_("Whether or not slaves of this connection should be automatically brought up when NetworkManager activates this connection. This only has a real effect for master connections. The permitted values are: 0: leave slave connections untouched, 1: activate all the slave connections with this connection, -1: default. If -1 (default) is set, global connection.autoconnect-slaves is read to determine the real value. If it is default as well, this fallbacks to 0.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT N_("If greater than zero, delay success of IP addressing until either the timeout is reached, or an IP gateway replies to a ping.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_ID N_("A human readable unique identifier for the connection, like \"Work Wi-Fi\" or \"T-Mobile 3G\".")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_INTERFACE_NAME N_("The name of the network interface this connection is bound to. If not set, then the connection can be attached to any interface of the appropriate type (subject to restrictions imposed by other settings). For software devices this specifies the name of the created device. For connection types where interface names cannot easily be made persistent (e.g. mobile broadband or USB Ethernet), this property should not be used. Setting this property restricts the interfaces a connection can be used with, and if interface names change or are reordered the connection may be applied to the wrong interface.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_LLDP N_("Whether LLDP is enabled for the connection.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_MASTER N_("Interface name of the master device or UUID of the master connection.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_METERED N_("Whether the connection is metered. When updating this property on a currently activated connection, the change takes effect immediately.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_PERMISSIONS N_("An array of strings defining what access a given user has to this connection. If this is NULL or empty, all users are allowed to access this connection. Otherwise a user is allowed to access this connection if and only if they are in this list. Each entry is of the form \"[type]:[id]:[reserved]\"; for example, \"user:dcbw:blah\". At this time only the \"user\" [type] is allowed. Any other values are ignored and reserved for future use. [id] is the username that this permission refers to, which may not contain the \":\" character. Any [reserved] information present must be ignored and is reserved for future use. All of [type], [id], and [reserved] must be valid UTF-8.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_READ_ONLY N_("FALSE if the connection can be modified using the provided settings service's D-Bus interface with the right privileges, or TRUE if the connection is read-only and cannot be modified.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_SECONDARIES N_("List of connection UUIDs that should be activated when the base connection itself is activated. Currently only VPN connections are supported.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_SLAVE_TYPE N_("Setting name of the device type of this slave's master connection (eg, \"bond\"), or NULL if this connection is not a slave.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_STABLE_ID N_("Token to generate stable IDs for the connection. The stable-id is used for generating IPv6 stable private addresses with ipv6.addr-gen-mode=stable-privacy. It is also used to seed the generated cloned MAC address for ethernet.cloned-mac-address=stable and wifi.cloned-mac-address=stable. Note that also the interface name of the activating connection and a per-host secret key is included into the address generation so that the same stable-id on different hosts/devices yields different addresses. If the value is unset, an ID unique for the connection is used. Specifing a stable-id allows multiple connections to generate the same addresses. Another use is to generate IDs at runtime via dynamic substitutions. The '$' character is treated special to perform dynamic substitutions at runtime. Currently supported are \"${CONNECTION}\", \"${BOOT}\", \"${RANDOM}\". These effectively create unique IDs per-connection, per-boot, or every time. Any unrecognized patterns following '$' are treated verbatim, however are reserved for future use. You are thus advised to avoid '$' or escape it as \"$$\". For example, set it to \"${CONNECTION}/${BOOT}\" to create a unique id for this connection that changes with every reboot. Note that two connections only use the same effective id if their stable-id is also identical before performing dynamic substitutions.")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_TIMESTAMP N_("The time, in seconds since the Unix Epoch, that the connection was last _successfully_ fully activated. NetworkManager updates the connection timestamp periodically when the connection is active to ensure that an active connection has the latest timestamp. The property is only meant for reading (changes to this property will not be preserved).")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_TYPE N_("Base type of the connection. For hardware-dependent connections, should contain the setting name of the hardware-type specific setting (ie, \"802-3-ethernet\" or \"802-11-wireless\" or \"bluetooth\", etc), and for non-hardware dependent connections like VPN or otherwise, should contain the setting name of that setting type (ie, \"vpn\" or \"bridge\", etc).")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_UUID N_("A universally unique identifier for the connection, for example generated with libuuid. It should be assigned when the connection is created, and never changed as long as the connection still applies to the same network. For example, it should not be changed when the \"id\" property or NMSettingIP4Config changes, but might need to be re-created when the Wi-Fi SSID, mobile broadband network provider, or \"type\" property changes. The UUID must be in the format \"2815492f-7e56-435e-b2e9-246bd7cdc664\" (ie, contains only hexadecimal characters and \"-\").")
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_ZONE N_("The trust level of a the connection. Free form case-insensitive string (for example \"Home\", \"Work\", \"Public\"). NULL or unspecified zone means the connection will be placed in the default zone as defined by the firewall. When updating this property on a currently activated connection, the change takes effect immediately.")
#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FCOE_FLAGS N_("Specifies the NMSettingDcbFlags for the DCB FCoE application. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).")
#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FCOE_MODE N_("The FCoE controller mode; either \"fabric\" (default) or \"vn2vn\".")
#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FCOE_PRIORITY N_("The highest User Priority (0 - 7) which FCoE frames should use, or -1 for default priority. Only used when the \"app-fcoe-flags\" property includes the NM_SETTING_DCB_FLAG_ENABLE (0x1) flag.")
#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FIP_FLAGS N_("Specifies the NMSettingDcbFlags for the DCB FIP application. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).")
#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FIP_PRIORITY N_("The highest User Priority (0 - 7) which FIP frames should use, or -1 for default priority. Only used when the \"app-fip-flags\" property includes the NM_SETTING_DCB_FLAG_ENABLE (0x1) flag.")
#define DESCRIBE_DOC_NM_SETTING_DCB_APP_ISCSI_FLAGS N_("Specifies the NMSettingDcbFlags for the DCB iSCSI application. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).")
#define DESCRIBE_DOC_NM_SETTING_DCB_APP_ISCSI_PRIORITY N_("The highest User Priority (0 - 7) which iSCSI frames should use, or -1 for default priority. Only used when the \"app-iscsi-flags\" property includes the NM_SETTING_DCB_FLAG_ENABLE (0x1) flag.")
#define DESCRIBE_DOC_NM_SETTING_DCB_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_BANDWIDTH N_("An array of 8 uint values, where the array index corresponds to the User Priority (0 - 7) and the value indicates the percentage of bandwidth of the priority's assigned group that the priority may use. The sum of all percentages for priorities which belong to the same group must total 100 percent.")
#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_FLOW_CONTROL N_("An array of 8 boolean values, where the array index corresponds to the User Priority (0 - 7) and the value indicates whether or not the corresponding priority should transmit priority pause.")
#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS N_("Specifies the NMSettingDcbFlags for DCB Priority Flow Control (PFC). Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).")
#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_GROUP_BANDWIDTH N_("An array of 8 uint values, where the array index corresponds to the Priority Group ID (0 - 7) and the value indicates the percentage of link bandwidth allocated to that group. Allowed values are 0 - 100, and the sum of all values must total 100 percent.")
#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_GROUP_FLAGS N_("Specifies the NMSettingDcbFlags for DCB Priority Groups. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).")
#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_GROUP_ID N_("An array of 8 uint values, where the array index corresponds to the User Priority (0 - 7) and the value indicates the Priority Group ID. Allowed Priority Group ID values are 0 - 7 or 15 for the unrestricted group.")
#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_STRICT_BANDWIDTH N_("An array of 8 boolean values, where the array index corresponds to the User Priority (0 - 7) and the value indicates whether or not the priority may use all of the bandwidth allocated to its assigned group.")
#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_TRAFFIC_CLASS N_("An array of 8 uint values, where the array index corresponds to the User Priority (0 - 7) and the value indicates the traffic class (0 - 7) to which the priority is mapped.")
#define DESCRIBE_DOC_NM_SETTING_DUMMY_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_GENERIC_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_GSM_APN N_("The GPRS Access Point Name specifying the APN used when establishing a data session with the GSM-based network. The APN often determines how the user will be billed for their network usage and whether the user has access to the Internet or just a provider-specific walled-garden, so it is important to use the correct APN for the user's mobile broadband plan. The APN may only be composed of the characters a-z, 0-9, ., and - per GSM 03.60 Section 14.9.")
#define DESCRIBE_DOC_NM_SETTING_GSM_DEVICE_ID N_("The device unique identifier (as given by the WWAN management service) which this connection applies to. If given, the connection will only apply to the specified device.")
#define DESCRIBE_DOC_NM_SETTING_GSM_HOME_ONLY N_("When TRUE, only connections to the home network will be allowed. Connections to roaming networks will not be made.")
#define DESCRIBE_DOC_NM_SETTING_GSM_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple frames.")
#define DESCRIBE_DOC_NM_SETTING_GSM_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_GSM_NETWORK_ID N_("The Network ID (GSM LAI format, ie MCC-MNC) to force specific network registration. If the Network ID is specified, NetworkManager will attempt to force the device to register only on the specified network. This can be used to ensure that the device does not roam when direct roaming control of the device is not otherwise possible.")
#define DESCRIBE_DOC_NM_SETTING_GSM_NUMBER N_("Number to dial when establishing a PPP data session with the GSM-based mobile broadband network. Many modems do not require PPP for connections to the mobile network and thus this property should be left blank, which allows NetworkManager to select the appropriate settings automatically.")
#define DESCRIBE_DOC_NM_SETTING_GSM_PASSWORD N_("The password used to authenticate with the network, if required. Many providers do not require a password, or accept any password. But if a password is required, it is specified here.")
#define DESCRIBE_DOC_NM_SETTING_GSM_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.")
#define DESCRIBE_DOC_NM_SETTING_GSM_PIN N_("If the SIM is locked with a PIN it must be unlocked before any other operations are requested. Specify the PIN here to allow operation of the device.")
#define DESCRIBE_DOC_NM_SETTING_GSM_PIN_FLAGS N_("Flags indicating how to handle the \"pin\" property.")
#define DESCRIBE_DOC_NM_SETTING_GSM_SIM_ID N_("The SIM card unique identifier (as given by the WWAN management service) which this connection applies to. If given, the connection will apply to any device also allowed by \"device-id\" which contains a SIM card matching the given identifier.")
#define DESCRIBE_DOC_NM_SETTING_GSM_SIM_OPERATOR_ID N_("A MCC/MNC string like \"310260\" or \"21601\" identifying the specific mobile network operator which this connection applies to. If given, the connection will apply to any device also allowed by \"device-id\" and \"sim-id\" which contains a SIM card provisioined by the given operator.")
#define DESCRIBE_DOC_NM_SETTING_GSM_USERNAME N_("The username used to authenticate with the network, if required. Many providers do not require a username, or accept any username. But if a username is required, it is specified here.")
#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_MAC_ADDRESS N_("If specified, this connection will only apply to the IPoIB device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing).")
#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple frames.")
#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_P_KEY N_("The InfiniBand P_Key to use for this device. A value of -1 means to use the default P_Key (aka \"the P_Key at index 0\"). Otherwise it is a 16-bit unsigned integer, whose high bit is set if it is a \"full membership\" P_Key.")
#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_PARENT N_("The interface name of the parent device of this device. Normally NULL, but if the \"p_key\" property is set, then you must specify the base device by setting either this property or \"mac-address\".")
#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_TRANSPORT_MODE N_("The IP-over-InfiniBand transport mode. Either \"datagram\" or \"connected\".")
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_ENCAPSULATION_LIMIT N_("How many additional levels of encapsulation are permitted to be prepended to packets. This property applies only to IPv6 tunnels.")
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_FLOW_LABEL N_("The flow label to assign to tunnel packets. This property applies only to IPv6 tunnels.")
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_INPUT_KEY N_("The key used for tunnel input packets; the property is valid only for certain tunnel modes (GRE, IP6GRE). If empty, no key is used.")
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_LOCAL N_("The local endpoint of the tunnel; the value can be empty, otherwise it must contain an IPv4 or IPv6 address.")
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_MODE N_("The tunneling mode, for example NM_IP_TUNNEL_MODE_IPIP (1) or NM_IP_TUNNEL_MODE_GRE (2).")
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_MTU N_("None")
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_OUTPUT_KEY N_("The key used for tunnel output packets; the property is valid only for certain tunnel modes (GRE, IP6GRE). If empty, no key is used.")
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_PARENT N_("If given, specifies the parent interface name or parent connection UUID the new device will be bound to so that tunneled packets will only be routed via that interface.")
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_PATH_MTU_DISCOVERY N_("Whether to enable Path MTU Discovery on this tunnel.")
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_REMOTE N_("The remote endpoint of the tunnel; the value must contain an IPv4 or IPv6 address.")
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_TOS N_("The type of service (IPv4) or traffic class (IPv6) field to be set on tunneled packets.")
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_TTL N_("The TTL to assign to tunneled packets. 0 is a special value meaning that packets inherit the TTL value.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ADDRESSES N_("Array of IP addresses.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DAD_TIMEOUT N_("Timeout in milliseconds used to check for the presence of duplicate IP addresses on the network. If an address conflict is detected, the activation will fail. A zero value means that no duplicate address detection is performed, -1 means the default value (either configuration ipvx.dad-timeout override or 3 seconds). A value greater than zero is a timeout in milliseconds.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID N_("A string sent to the DHCP server to identify the local machine which the DHCP server may use to customize the DHCP lease and options.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_FQDN N_("If the \"dhcp-send-hostname\" property is TRUE, then the specified FQDN will be sent to the DHCP server when acquiring a lease. This property and \"dhcp-hostname\" are mutually exclusive and cannot be set at the same time.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME N_("If the \"dhcp-send-hostname\" property is TRUE, then the specified name will be sent to the DHCP server when acquiring a lease. This property and \"dhcp-fqdn\" are mutually exclusive and cannot be set at the same time.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME N_("If TRUE, a hostname is sent to the DHCP server when acquiring a lease. Some DHCP servers use this hostname to update DNS databases, essentially providing a static hostname for the computer. If the \"dhcp-hostname\" property is NULL and this property is TRUE, the current persistent hostname of the computer is sent.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_TIMEOUT N_("A timeout for a DHCP transaction in seconds.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS N_("Array of IP addresses of DNS servers.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS_OPTIONS N_("Array of DNS options as described in man 5 resolv.conf. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS_PRIORITY N_("Intra-connection DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. Note that the priority is to order DNS settings for multiple active connections. It does not disambiguate multiple DNS servers within the same connection profile. For that, just specify the DNS servers in the desired order. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from connections with the lowest priority value will be used.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS_SEARCH N_("Array of DNS search domains.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_GATEWAY N_("The gateway associated with this configuration. This is only meaningful if \"addresses\" is also set.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS N_("When \"method\" is set to \"auto\" and this property to TRUE, automatically configured nameservers and search domains are ignored and only nameservers and search domains specified in the \"dns\" and \"dns-search\" properties, if any, are used.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES N_("When \"method\" is set to \"auto\" and this property to TRUE, automatically configured routes are ignored and only routes specified in the \"routes\" property, if any, are used.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_MAY_FAIL N_("If TRUE, allow overall network configuration to proceed even if the configuration specified by this property times out. Note that at least one IP configuration must succeed or overall network configuration will still fail. For example, in IPv6-only networks, setting this property to TRUE on the NMSettingIP4Config allows the overall network configuration to succeed if IPv4 configuration fails but IPv6 configuration completes successfully.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_METHOD N_("IP configuration method. NMSettingIP4Config and NMSettingIP6Config both support \"auto\", \"manual\", and \"link-local\". See the subclass-specific documentation for other values. In general, for the \"auto\" method, properties such as \"dns\" and \"routes\" specify information that is added on to the information returned from automatic configuration. The \"ignore-auto-routes\" and \"ignore-auto-dns\" properties modify this behavior. For methods that imply no upstream network, such as \"shared\" or \"link-local\", these properties must be empty. For IPv4 method \"shared\", the IP subnet can be configured by adding one manual IPv4 address or otherwise 10.42.x.0/24 is chosen.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_NEVER_DEFAULT N_("If TRUE, this connection will never be the default connection for this IP type, meaning it will never be assigned the default route by NetworkManager.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTE_METRIC N_("The default metric for routes that don't explicitly specify a metric. The default value -1 means that the metric is choosen automatically based on the device type. The metric applies to dynamic routes, manual (static) routes that don't have an explicit metric setting, address prefix routes, and the default route. Note that for IPv6, the kernel accepts zero (0) but coerces it to 1024 (user default). Hence, setting this property to zero effectively mean setting it to 1024. For IPv4, zero is a regular value for the metric.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTES N_("Array of IP routes.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE N_("Configure method for creating the address for use with RFC4862 IPv6 Stateless Address Autoconfiguration. The permitted values are: \"eui64\", or \"stable-privacy\". If the property is set to \"eui64\", the addresses will be generated using the interface tokens derived from hardware address. This makes the host part of the address to stay constant, making it possible to track host's presence when it changes networks. The address changes when the interface hardware is replaced. The value of \"stable-privacy\" enables use of cryptographically secure hash of a secret host-specific key along with the connection's stable-id and the network address as specified by RFC7217. This makes it impossible to use the address track host's presence, and makes the address stable when the network interface hardware is replaced. On D-Bus, the absence of an addr-gen-mode setting equals enabling \"stable-privacy\". For keyfile plugin, the absence of the setting on disk means \"eui64\" so that the property doesn't change on upgrade from older versions. Note that this setting is distinct from the Privacy Extensions as configured by \"ip6-privacy\" property and it does not affect the temporary addresses configured with this option.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ADDRESSES N_("Array of IP addresses.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DAD_TIMEOUT N_("Timeout in milliseconds used to check for the presence of duplicate IP addresses on the network. If an address conflict is detected, the activation will fail. A zero value means that no duplicate address detection is performed, -1 means the default value (either configuration ipvx.dad-timeout override or 3 seconds). A value greater than zero is a timeout in milliseconds.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME N_("If the \"dhcp-send-hostname\" property is TRUE, then the specified name will be sent to the DHCP server when acquiring a lease. This property and \"dhcp-fqdn\" are mutually exclusive and cannot be set at the same time.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_SEND_HOSTNAME N_("If TRUE, a hostname is sent to the DHCP server when acquiring a lease. Some DHCP servers use this hostname to update DNS databases, essentially providing a static hostname for the computer. If the \"dhcp-hostname\" property is NULL and this property is TRUE, the current persistent hostname of the computer is sent.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_TIMEOUT N_("A timeout for a DHCP transaction in seconds.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS N_("Array of IP addresses of DNS servers.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS_OPTIONS N_("Array of DNS options as described in man 5 resolv.conf. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS_PRIORITY N_("Intra-connection DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. Note that the priority is to order DNS settings for multiple active connections. It does not disambiguate multiple DNS servers within the same connection profile. For that, just specify the DNS servers in the desired order. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from connections with the lowest priority value will be used.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS_SEARCH N_("Array of DNS search domains.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_GATEWAY N_("The gateway associated with this configuration. This is only meaningful if \"addresses\" is also set.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS N_("When \"method\" is set to \"auto\" and this property to TRUE, automatically configured nameservers and search domains are ignored and only nameservers and search domains specified in the \"dns\" and \"dns-search\" properties, if any, are used.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES N_("When \"method\" is set to \"auto\" and this property to TRUE, automatically configured routes are ignored and only routes specified in the \"routes\" property, if any, are used.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_IP6_PRIVACY N_("Configure IPv6 Privacy Extensions for SLAAC, described in RFC4941. If enabled, it makes the kernel generate a temporary IPv6 address in addition to the public one generated from MAC address via modified EUI-64. This enhances privacy, but could cause problems in some applications, on the other hand. The permitted values are: -1: unknown, 0: disabled, 1: enabled (prefer public address), 2: enabled (prefer temporary addresses). Having a per-connection setting set to \"-1\" (unknown) means fallback to global configuration \"ipv6.ip6-privacy\". If also global configuration is unspecified or set to \"-1\", fallback to read \"/proc/sys/net/ipv6/conf/default/use_tempaddr\". Note that this setting is distinct from the Stable Privacy addresses that can be enabled with the \"addr-gen-mode\" property's \"stable-privacy\" setting as another way of avoiding host tracking with IPv6 addresses.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_MAY_FAIL N_("If TRUE, allow overall network configuration to proceed even if the configuration specified by this property times out. Note that at least one IP configuration must succeed or overall network configuration will still fail. For example, in IPv6-only networks, setting this property to TRUE on the NMSettingIP4Config allows the overall network configuration to succeed if IPv4 configuration fails but IPv6 configuration completes successfully.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_METHOD N_("IP configuration method. NMSettingIP4Config and NMSettingIP6Config both support \"auto\", \"manual\", and \"link-local\". See the subclass-specific documentation for other values. In general, for the \"auto\" method, properties such as \"dns\" and \"routes\" specify information that is added on to the information returned from automatic configuration. The \"ignore-auto-routes\" and \"ignore-auto-dns\" properties modify this behavior. For methods that imply no upstream network, such as \"shared\" or \"link-local\", these properties must be empty. For IPv4 method \"shared\", the IP subnet can be configured by adding one manual IPv4 address or otherwise 10.42.x.0/24 is chosen.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_NEVER_DEFAULT N_("If TRUE, this connection will never be the default connection for this IP type, meaning it will never be assigned the default route by NetworkManager.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTE_METRIC N_("The default metric for routes that don't explicitly specify a metric. The default value -1 means that the metric is choosen automatically based on the device type. The metric applies to dynamic routes, manual (static) routes that don't have an explicit metric setting, address prefix routes, and the default route. Note that for IPv6, the kernel accepts zero (0) but coerces it to 1024 (user default). Hence, setting this property to zero effectively mean setting it to 1024. For IPv4, zero is a regular value for the metric.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTES N_("Array of IP routes.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_TOKEN N_("Configure the token for draft-chown-6man-tokenised-ipv6-identifiers-02 IPv6 tokenized interface identifiers. Useful with eui64 addr-gen-mode.")
#define DESCRIBE_DOC_NM_SETTING_MACSEC_ENCRYPT N_("Whether the transmitted traffic must be encrypted.")
#define DESCRIBE_DOC_NM_SETTING_MACSEC_MKA_CAK N_("The pre-shared CAK (Connectivity Association Key) for MACsec Key Agreement.")
#define DESCRIBE_DOC_NM_SETTING_MACSEC_MKA_CAK_FLAGS N_("Flags indicating how to handle the \"mka-cak\" property.")
#define DESCRIBE_DOC_NM_SETTING_MACSEC_MKA_CKN N_("The pre-shared CKN (Connectivity-association Key Name) for MACsec Key Agreement.")
#define DESCRIBE_DOC_NM_SETTING_MACSEC_MODE N_("Specifies how the CAK (Connectivity Association Key) for MKA (MACsec Key Agreement) is obtained.")
#define DESCRIBE_DOC_NM_SETTING_MACSEC_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_MACSEC_PARENT N_("If given, specifies the parent interface name or parent connection UUID from which this MACSEC interface should be created. If this property is not specified, the connection must contain an \"802-3-ethernet\" setting with a \"mac-address\" property.")
#define DESCRIBE_DOC_NM_SETTING_MACSEC_PORT N_("The port component of the SCI (Secure Channel Identifier), between 1 and 65534.")
#define DESCRIBE_DOC_NM_SETTING_MACSEC_VALIDATION N_("Specifies the validation mode for incoming frames.")
#define DESCRIBE_DOC_NM_SETTING_MACVLAN_MODE N_("The macvlan mode, which specifies the communication mechanism between multiple macvlans on the same lower device.")
#define DESCRIBE_DOC_NM_SETTING_MACVLAN_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_MACVLAN_PARENT N_("If given, specifies the parent interface name or parent connection UUID from which this MAC-VLAN interface should be created. If this property is not specified, the connection must contain an \"802-3-ethernet\" setting with a \"mac-address\" property.")
#define DESCRIBE_DOC_NM_SETTING_MACVLAN_PROMISCUOUS N_("Whether the interface should be put in promiscuous mode.")
#define DESCRIBE_DOC_NM_SETTING_MACVLAN_TAP N_("Whether the interface should be a MACVTAP.")
#define DESCRIBE_DOC_NM_SETTING_PPP_BAUD N_("If non-zero, instruct pppd to set the serial port to the specified baudrate. This value should normally be left as 0 to automatically choose the speed.")
#define DESCRIBE_DOC_NM_SETTING_PPP_CRTSCTS N_("If TRUE, specify that pppd should set the serial port to use hardware flow control with RTS and CTS signals. This value should normally be set to FALSE.")
#define DESCRIBE_DOC_NM_SETTING_PPP_LCP_ECHO_FAILURE N_("If non-zero, instruct pppd to presume the connection to the peer has failed if the specified number of LCP echo-requests go unanswered by the peer. The \"lcp-echo-interval\" property must also be set to a non-zero value if this property is used.")
#define DESCRIBE_DOC_NM_SETTING_PPP_LCP_ECHO_INTERVAL N_("If non-zero, instruct pppd to send an LCP echo-request frame to the peer every n seconds (where n is the specified value). Note that some PPP peers will respond to echo requests and some will not, and it is not possible to autodetect this.")
#define DESCRIBE_DOC_NM_SETTING_PPP_MPPE_STATEFUL N_("If TRUE, stateful MPPE is used. See pppd documentation for more information on stateful MPPE.")
#define DESCRIBE_DOC_NM_SETTING_PPP_MRU N_("If non-zero, instruct pppd to request that the peer send packets no larger than the specified size. If non-zero, the MRU should be between 128 and 16384.")
#define DESCRIBE_DOC_NM_SETTING_PPP_MTU N_("If non-zero, instruct pppd to send packets no larger than the specified size.")
#define DESCRIBE_DOC_NM_SETTING_PPP_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_PPP_NO_VJ_COMP N_("If TRUE, Van Jacobsen TCP header compression will not be requested.")
#define DESCRIBE_DOC_NM_SETTING_PPP_NOAUTH N_("If TRUE, do not require the other side (usually the PPP server) to authenticate itself to the client. If FALSE, require authentication from the remote side. In almost all cases, this should be TRUE.")
#define DESCRIBE_DOC_NM_SETTING_PPP_NOBSDCOMP N_("If TRUE, BSD compression will not be requested.")
#define DESCRIBE_DOC_NM_SETTING_PPP_NODEFLATE N_("If TRUE, \"deflate\" compression will not be requested.")
#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_CHAP N_("If TRUE, the CHAP authentication method will not be used.")
#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_EAP N_("If TRUE, the EAP authentication method will not be used.")
#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_MSCHAP N_("If TRUE, the MSCHAP authentication method will not be used.")
#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_MSCHAPV2 N_("If TRUE, the MSCHAPv2 authentication method will not be used.")
#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_PAP N_("If TRUE, the PAP authentication method will not be used.")
#define DESCRIBE_DOC_NM_SETTING_PPP_REQUIRE_MPPE N_("If TRUE, MPPE (Microsoft Point-to-Point Encrpytion) will be required for the PPP session. If either 64-bit or 128-bit MPPE is not available the session will fail. Note that MPPE is not used on mobile broadband connections.")
#define DESCRIBE_DOC_NM_SETTING_PPP_REQUIRE_MPPE_128 N_("If TRUE, 128-bit MPPE (Microsoft Point-to-Point Encrpytion) will be required for the PPP session, and the \"require-mppe\" property must also be set to TRUE. If 128-bit MPPE is not available the session will fail.")
#define DESCRIBE_DOC_NM_SETTING_PPPOE_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_PPPOE_PASSWORD N_("Password used to authenticate with the PPPoE service.")
#define DESCRIBE_DOC_NM_SETTING_PPPOE_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.")
#define DESCRIBE_DOC_NM_SETTING_PPPOE_SERVICE N_("If specified, instruct PPPoE to only initiate sessions with access concentrators that provide the specified service. For most providers, this should be left blank. It is only required if there are multiple access concentrators or a specific service is known to be required.")
#define DESCRIBE_DOC_NM_SETTING_PPPOE_USERNAME N_("Username used to authenticate with the PPPoE service.")
#define DESCRIBE_DOC_NM_SETTING_PROXY_BROWSER_ONLY N_("Whether the proxy configuration is for browser only.")
#define DESCRIBE_DOC_NM_SETTING_PROXY_METHOD N_("Method for proxy configuration, Default is NM_SETTING_PROXY_METHOD_NONE (0)")
#define DESCRIBE_DOC_NM_SETTING_PROXY_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_PROXY_PAC_SCRIPT N_("PAC script for the connection.")
#define DESCRIBE_DOC_NM_SETTING_PROXY_PAC_URL N_("PAC URL for obtaining PAC file.")
#define DESCRIBE_DOC_NM_SETTING_SERIAL_BAUD N_("Speed to use for communication over the serial port. Note that this value usually has no effect for mobile broadband modems as they generally ignore speed settings and use the highest available speed.")
#define DESCRIBE_DOC_NM_SETTING_SERIAL_BITS N_("Byte-width of the serial communication. The 8 in \"8n1\" for example.")
#define DESCRIBE_DOC_NM_SETTING_SERIAL_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_SERIAL_PARITY N_("Parity setting of the serial port.")
#define DESCRIBE_DOC_NM_SETTING_SERIAL_SEND_DELAY N_("Time to delay between each byte sent to the modem, in microseconds.")
#define DESCRIBE_DOC_NM_SETTING_SERIAL_STOPBITS N_("Number of stop bits for communication on the serial port. Either 1 or 2. The 1 in \"8n1\" for example.")
#define DESCRIBE_DOC_NM_SETTING_TEAM_CONFIG N_("The JSON configuration for the team network interface. The property should contain raw JSON configuration data suitable for teamd, because the value is passed directly to teamd. If not specified, the default configuration is used. See man teamd.conf for the format details.")
#define DESCRIBE_DOC_NM_SETTING_TEAM_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_CONFIG N_("The JSON configuration for the team port. The property should contain raw JSON configuration data suitable for teamd, because the value is passed directly to teamd. If not specified, the default configuration is used. See man teamd.conf for the format details.")
#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_TUN_GROUP N_("The group ID which will own the device. If set to NULL everyone will be able to use the device.")
#define DESCRIBE_DOC_NM_SETTING_TUN_MODE N_("The operating mode of the virtual device. Allowed values are NM_SETTING_TUN_MODE_TUN (1) to create a layer 3 device and NM_SETTING_TUN_MODE_TAP (2) to create an Ethernet-like layer 2 one.")
#define DESCRIBE_DOC_NM_SETTING_TUN_MULTI_QUEUE N_("If the property is set to TRUE, the interface will support multiple file descriptors (queues) to parallelize packet sending or receiving. Otherwise, the interface will only support a single queue.")
#define DESCRIBE_DOC_NM_SETTING_TUN_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_TUN_OWNER N_("The user ID which will own the device. If set to NULL everyone will be able to use the device.")
#define DESCRIBE_DOC_NM_SETTING_TUN_PI N_("If TRUE the interface will prepend a 4 byte header describing the physical interface to the packets.")
#define DESCRIBE_DOC_NM_SETTING_TUN_VNET_HDR N_("If TRUE the IFF_VNET_HDR the tunnel packets will include a virtio network header.")
#define DESCRIBE_DOC_NM_SETTING_USER_DATA N_("A dictionary of key/value pairs with user data. This data is ignored by NetworkManager and can be used at the users discretion. The keys only support a strict ascii format, but the values can be arbitrary UTF8 strings up to a certain length.")
#define DESCRIBE_DOC_NM_SETTING_USER_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_VLAN_EGRESS_PRIORITY_MAP N_("For outgoing packets, a list of mappings from Linux SKB priorities to 802.1p priorities. The mapping is given in the format \"from:to\" where both \"from\" and \"to\" are unsigned integers, ie \"7:3\".")
#define DESCRIBE_DOC_NM_SETTING_VLAN_FLAGS N_("One or more flags which control the behavior and features of the VLAN interface. Flags include NM_VLAN_FLAG_REORDER_HEADERS (0x1) (reordering of output packet headers), NM_VLAN_FLAG_GVRP (0x2) (use of the GVRP protocol), and NM_VLAN_FLAG_LOOSE_BINDING (0x4) (loose binding of the interface to its master device's operating state). NM_VLAN_FLAG_MVRP (0x8) (use of the MVRP protocol). The default value of this property is NM_VLAN_FLAG_REORDER_HEADERS, but it used to be 0. To preserve backward compatibility, the default-value in the D-Bus API continues to be 0 and a missing property on D-Bus is still considered as 0.")
#define DESCRIBE_DOC_NM_SETTING_VLAN_ID N_("The VLAN identifier that the interface created by this connection should be assigned. The valid range is from 0 to 4094, without the reserved id 4095.")
#define DESCRIBE_DOC_NM_SETTING_VLAN_INGRESS_PRIORITY_MAP N_("For incoming packets, a list of mappings from 802.1p priorities to Linux SKB priorities. The mapping is given in the format \"from:to\" where both \"from\" and \"to\" are unsigned integers, ie \"7:3\".")
#define DESCRIBE_DOC_NM_SETTING_VLAN_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_VLAN_PARENT N_("If given, specifies the parent interface name or parent connection UUID from which this VLAN interface should be created. If this property is not specified, the connection must contain an \"802-3-ethernet\" setting with a \"mac-address\" property.")
#define DESCRIBE_DOC_NM_SETTING_VPN_DATA N_("Dictionary of key/value pairs of VPN plugin specific data. Both keys and values must be strings.")
#define DESCRIBE_DOC_NM_SETTING_VPN_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_VPN_PERSISTENT N_("If the VPN service supports persistence, and this property is TRUE, the VPN will attempt to stay connected across link changes and outages, until explicitly disconnected.")
#define DESCRIBE_DOC_NM_SETTING_VPN_SECRETS N_("Dictionary of key/value pairs of VPN plugin specific secrets like passwords or private keys. Both keys and values must be strings.")
#define DESCRIBE_DOC_NM_SETTING_VPN_SERVICE_TYPE N_("D-Bus service name of the VPN plugin that this setting uses to connect to its network. i.e. org.freedesktop.NetworkManager.vpnc for the vpnc plugin.")
#define DESCRIBE_DOC_NM_SETTING_VPN_TIMEOUT N_("Timeout for the VPN service to establish the connection. Some services may take quite a long time to connect. Value of 0 means a default timeout, which is 60 seconds (unless overriden by vpn.timeout in configuration file). Values greater than zero mean timeout in seconds.")
#define DESCRIBE_DOC_NM_SETTING_VPN_USER_NAME N_("If the VPN connection requires a user name for authentication, that name should be provided here. If the connection is available to more than one user, and the VPN requires each user to supply a different name, then leave this property empty. If this property is empty, NetworkManager will automatically supply the username of the user which requested the VPN connection.")
#define DESCRIBE_DOC_NM_SETTING_VXLAN_AGEING N_("Specifies the lifetime in seconds of FDB entries learnt by the kernel.")
#define DESCRIBE_DOC_NM_SETTING_VXLAN_DESTINATION_PORT N_("Specifies the UDP destination port to communicate to the remote VXLAN tunnel endpoint.")
#define DESCRIBE_DOC_NM_SETTING_VXLAN_ID N_("Specifies the VXLAN Network Identifer (or VXLAN Segment Identifier) to use.")
#define DESCRIBE_DOC_NM_SETTING_VXLAN_L2_MISS N_("Specifies whether netlink LL ADDR miss notifications are generated.")
#define DESCRIBE_DOC_NM_SETTING_VXLAN_L3_MISS N_("Specifies whether netlink IP ADDR miss notifications are generated.")
#define DESCRIBE_DOC_NM_SETTING_VXLAN_LEARNING N_("Specifies whether unknown source link layer addresses and IP addresses are entered into the VXLAN device forwarding database.")
#define DESCRIBE_DOC_NM_SETTING_VXLAN_LIMIT N_("Specifies the maximum number of FDB entries. A value of zero means that the kernel will store unlimited entries.")
#define DESCRIBE_DOC_NM_SETTING_VXLAN_LOCAL N_("If given, specifies the source IP address to use in outgoing packets.")
#define DESCRIBE_DOC_NM_SETTING_VXLAN_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_VXLAN_PARENT N_("If given, specifies the parent interface name or parent connection UUID.")
#define DESCRIBE_DOC_NM_SETTING_VXLAN_PROXY N_("Specifies whether ARP proxy is turned on.")
#define DESCRIBE_DOC_NM_SETTING_VXLAN_REMOTE N_("Specifies the unicast destination IP address to use in outgoing packets when the destination link layer address is not known in the VXLAN device forwarding database, or the multicast IP address to join.")
#define DESCRIBE_DOC_NM_SETTING_VXLAN_RSC N_("Specifies whether route short circuit is turned on.")
#define DESCRIBE_DOC_NM_SETTING_VXLAN_SOURCE_PORT_MAX N_("Specifies the maximum UDP source port to communicate to the remote VXLAN tunnel endpoint.")
#define DESCRIBE_DOC_NM_SETTING_VXLAN_SOURCE_PORT_MIN N_("Specifies the minimum UDP source port to communicate to the remote VXLAN tunnel endpoint.")
#define DESCRIBE_DOC_NM_SETTING_VXLAN_TOS N_("Specifies the TOS value to use in outgoing packets.")
#define DESCRIBE_DOC_NM_SETTING_VXLAN_TTL N_("Specifies the time-to-live value to use in outgoing packets.")
#define DESCRIBE_DOC_NM_SETTING_WIMAX_MAC_ADDRESS N_("If specified, this connection will only apply to the WiMAX device whose MAC address matches. This property does not change the MAC address of the device (known as MAC spoofing). Deprecated: 1")
#define DESCRIBE_DOC_NM_SETTING_WIMAX_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_WIMAX_NETWORK_NAME N_("Network Service Provider (NSP) name of the WiMAX network this connection should use. Deprecated: 1")

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output
method="text"
doctype-public="-//OASIS//DTD DocBook XML V4.3//EN"
doctype-system="http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
/>
<xsl:template match="nm-setting-docs">/* Generated file. Do not edit. */
<xsl:apply-templates select="setting" mode="properties"><xsl:sort select="@name"/></xsl:apply-templates>
</xsl:template>
<xsl:template match="setting" mode="properties">
<xsl:apply-templates select="property">
<xsl:sort select="@name"/>
<xsl:with-param name="setting_name_upper" select="@name_upper"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="property">
<xsl:param name="setting_name_upper" />
<xsl:variable name="docs">
<xsl:call-template name="escape_quotes">
<xsl:with-param name="string" select="@description"/>
</xsl:call-template>
</xsl:variable>#define DESCRIBE_DOC_NM_SETTING_<xsl:value-of select="$setting_name_upper"/>_<xsl:value-of select="@name_upper"/> N_("<xsl:value-of select="$docs"/>")
</xsl:template>
<xsl:template match="setting" mode="settings">
{ "<xsl:value-of select="@name"/>", setting_<xsl:value-of select="translate(@name,'-','_')"/>, <xsl:value-of select="count(./property)"/> },</xsl:template>
<xsl:template name="escape_quotes">
<xsl:param name="string" />
<xsl:choose>
<xsl:when test="contains($string, '&quot;')">
<xsl:value-of select="substring-before($string, '&quot;')" />\&quot;<xsl:call-template name="escape_quotes"><xsl:with-param name="string" select="substring-after($string, '&quot;')" /></xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View file

@ -0,0 +1,160 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
* 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, 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 2017 Red Hat, Inc.
*/
#include "nm-default.h"
#include "NetworkManager.h"
#include "nm-meta-setting-access.h"
#include "nm-utils/nm-test-utils.h"
/*****************************************************************************/
static void
test_client_meta_check (void)
{
const NMMetaSettingInfoEditor *const*infos_p;
NMMetaSettingType m;
guint p;
G_STATIC_ASSERT (G_STRUCT_OFFSET (NMMetaAbstractInfo, meta_type) == G_STRUCT_OFFSET (NMMetaSettingInfoEditor, meta_type));
G_STATIC_ASSERT (G_STRUCT_OFFSET (NMMetaAbstractInfo, meta_type) == G_STRUCT_OFFSET (NMMetaPropertyInfo, meta_type));
for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++) {
const NMMetaSettingInfo *info = &nm_meta_setting_infos[m];
GType gtype;
g_assert (info);
g_assert (info->meta_type == m);
g_assert (info->setting_name);
g_assert (info->get_setting_gtype);
gtype = info->get_setting_gtype ();
g_assert (gtype != NM_TYPE_SETTING);
{
nm_auto_unref_gtypeclass GTypeClass *gclass = g_type_class_ref (gtype);
g_assert (G_TYPE_CHECK_CLASS_TYPE (gclass, gtype));
}
{
gs_unref_object NMSetting *setting = g_object_new (gtype, NULL);
g_assert (NM_IS_SETTING (setting));
g_assert (G_TYPE_CHECK_INSTANCE_TYPE (setting, gtype));
g_assert_cmpstr (nm_setting_get_name (setting), ==, info->setting_name);
}
}
for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++) {
const NMMetaSettingInfoEditor *info = &nm_meta_setting_infos_editor[m];
g_assert (info);
g_assert (info->meta_type == &nm_meta_type_setting_info_editor);
g_assert (info->general);
g_assert (info->general == &nm_meta_setting_infos[m]);
g_assert_cmpstr (info->general->setting_name, ==, info->meta_type->get_name ((const NMMetaAbstractInfo *) info, FALSE));
g_assert_cmpstr ("name", ==, info->meta_type->get_name ((const NMMetaAbstractInfo *) info, TRUE));
g_assert (info->properties_num == NM_PTRARRAY_LEN (info->properties));
if (info->properties_num) {
gs_unref_hashtable GHashTable *property_names = g_hash_table_new (g_str_hash, g_str_equal);
g_assert (info->properties);
for (p = 0; p < info->properties_num; p++) {
const NMMetaPropertyInfo *pi = info->properties[p];
g_assert (pi);
g_assert (pi->meta_type == &nm_meta_type_property_info);
g_assert (pi->setting_info == info);
g_assert (pi->property_name);
g_assert (nm_g_hash_table_add (property_names, (gpointer) pi->property_name));
g_assert_cmpstr (pi->property_name, ==, pi->meta_type->get_name ((const NMMetaAbstractInfo *) pi, FALSE));
g_assert_cmpstr (pi->property_name, ==, pi->meta_type->get_name ((const NMMetaAbstractInfo *) pi, TRUE));
g_assert (pi->property_type);
g_assert (pi->property_type->get_fcn);
}
g_assert (!info->properties[info->properties_num]);
} else
g_assert (!info->properties);
if (info->valid_parts) {
gsize i, l;
gs_unref_hashtable GHashTable *dup = g_hash_table_new (NULL, NULL);
l = NM_PTRARRAY_LEN (info->valid_parts);
g_assert (l >= 2);
for (i = 0; info->valid_parts[i]; i++) {
g_assert (info->valid_parts[i]->setting_info);
g_assert (nm_g_hash_table_add (dup, (gpointer) info->valid_parts[i]->setting_info));
if (i == 0) {
g_assert (info->valid_parts[i]->setting_info == &nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_CONNECTION]);
g_assert (info->valid_parts[i]->mandatory);
}
if (i == 1) {
g_assert (info->valid_parts[i]->setting_info == &nm_meta_setting_infos_editor[m]);
g_assert (info->valid_parts[i]->mandatory);
}
}
g_assert (i == l);
}
}
for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++) {
const NMMetaSettingInfoEditor *info = &nm_meta_setting_infos_editor[m];
g_assert (nm_meta_setting_info_editor_find_by_name (info->general->setting_name, FALSE) == info);
g_assert (nm_meta_setting_info_editor_find_by_gtype (info->general->get_setting_gtype ()) == info);
for (p = 0; p < info->properties_num; p++) {
const NMMetaPropertyInfo *pi = info->properties[p];
g_assert (nm_meta_setting_info_editor_get_property_info (info, pi->property_name) == pi);
g_assert (nm_meta_property_info_find_by_name (info->general->setting_name, pi->property_name) == pi);
}
}
infos_p = nm_meta_setting_infos_editor_p ();
g_assert (infos_p);
for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++)
g_assert (infos_p[m] == &nm_meta_setting_infos_editor[m]);
g_assert (!infos_p[m]);
}
/*****************************************************************************/
NMTST_DEFINE ();
int
main (int argc, char **argv)
{
nmtst_init (&argc, &argv, TRUE);
g_test_add_func ("/client/meta/check", test_client_meta_check);
return g_test_run ();
}

File diff suppressed because it is too large Load diff

View file

@ -8,6 +8,10 @@ print_test_logs() {
echo ">>>> PRINT TEST LOGS $1 (done)"
}
# travis is known to generate the settings doc differently.
# Don't compare.
export NMTST_NO_CHECK_SETTINGS_DOCS=yes
if ! make check -j 4 -k ; then
print_test_logs "first-test"

View file

@ -175,11 +175,6 @@ gssize _nm_utils_ptrarray_find_first (gconstpointer *list, gssize len, gconstpoi
gssize _nm_utils_ptrarray_find_binary_search (gconstpointer *list, gsize len, gconstpointer needle, GCompareDataFunc cmpfcn, gpointer user_data);
gssize _nm_utils_array_find_binary_search (gconstpointer list, gsize elem_size, gsize len, gconstpointer needle, GCompareDataFunc cmpfcn, gpointer user_data);
char **_nm_utils_strv_cleanup (char **strv,
gboolean strip_whitespace,
gboolean skip_empty,
gboolean skip_repeated);
char ** _nm_utils_strsplit_set (const char *str,
const char *delimiters,
int max_tokens);
@ -204,8 +199,6 @@ gboolean _nm_utils_check_module_file (const char *name,
gpointer user_data,
GError **error);
char *_nm_utils_enum_to_str_full (GType type, int value, const char *sep);
#define NM_UTILS_UUID_TYPE_LEGACY 0
#define NM_UTILS_UUID_TYPE_VARIANT3 1

View file

@ -28,7 +28,7 @@
#include "nm-setting-8021x.h"
#include "nm-core-internal.h"
#include "nm-setting-metadata.h"
#include "nm-meta-setting.h"
/*****************************************************************************/

View file

@ -2778,7 +2778,7 @@ need_private_key_password (GBytes *blob,
{
NMCryptoFileFormat format = NM_CRYPTO_FILE_FORMAT_UNKNOWN;
if (flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)
if (flags == NM_SETTING_SECRET_FLAG_NONE || flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)
return FALSE;
/* Private key password is required */
@ -2822,13 +2822,15 @@ need_secrets_tls (NMSetting8021x *self,
scheme = nm_setting_802_1x_get_phase2_ca_cert_scheme (self);
if ( scheme == NM_SETTING_802_1X_CK_SCHEME_PKCS11
&& !(priv->phase2_ca_cert_password_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)
&& !( priv->phase2_ca_cert_password_flags == NM_SETTING_SECRET_FLAG_NONE
|| priv->phase2_ca_cert_password_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)
&& !priv->phase2_ca_cert_password)
g_ptr_array_add (secrets, NM_SETTING_802_1X_PHASE2_CA_CERT_PASSWORD);
scheme = nm_setting_802_1x_get_phase2_client_cert_scheme (self);
if ( scheme == NM_SETTING_802_1X_CK_SCHEME_PKCS11
&& !(priv->phase2_client_cert_password_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)
&& !( priv->phase2_client_cert_password_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED
|| priv->phase2_client_cert_password_flags == NM_SETTING_SECRET_FLAG_NONE)
&& !priv->phase2_client_cert_password)
g_ptr_array_add (secrets, NM_SETTING_802_1X_PHASE2_CLIENT_CERT_PASSWORD);
} else {
@ -2847,13 +2849,15 @@ need_secrets_tls (NMSetting8021x *self,
scheme = nm_setting_802_1x_get_ca_cert_scheme (self);
if ( scheme == NM_SETTING_802_1X_CK_SCHEME_PKCS11
&& !(priv->ca_cert_password_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)
&& !( priv->ca_cert_password_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED
|| priv->ca_cert_password_flags == NM_SETTING_SECRET_FLAG_NONE)
&& !priv->ca_cert_password)
g_ptr_array_add (secrets, NM_SETTING_802_1X_CA_CERT_PASSWORD);
scheme = nm_setting_802_1x_get_client_cert_scheme (self);
if ( scheme == NM_SETTING_802_1X_CK_SCHEME_PKCS11
&& !(priv->client_cert_password_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)
&& !( priv->client_cert_password_flags == NM_SETTING_SECRET_FLAG_NONE
|| priv->client_cert_password_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)
&& !priv->client_cert_password)
g_ptr_array_add (secrets, NM_SETTING_802_1X_CLIENT_CERT_PASSWORD);
}

View file

@ -224,7 +224,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("property is invalid"));
g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_METHOD);
g_prefix_error (error, "%s.%s: ", NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE);
return FALSE;
}

View file

@ -65,6 +65,7 @@ typedef struct {
GSList *proto; /* GSList of strings */
GSList *pairwise; /* GSList of strings */
GSList *group; /* GSList of strings */
NMSettingWirelessSecurityPmf pmf;
/* LEAP */
char *leap_username;
@ -93,6 +94,7 @@ enum {
PROP_PROTO,
PROP_PAIRWISE,
PROP_GROUP,
PROP_PMF,
PROP_LEAP_USERNAME,
PROP_WEP_KEY0,
PROP_WEP_KEY1,
@ -573,6 +575,22 @@ nm_setting_wireless_security_clear_groups (NMSettingWirelessSecurity *setting)
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_SECURITY_GROUP);
}
/*
* nm_setting_wireless_security_get_pmf:
* @setting: the #NMSettingWirelessSecurity
*
* Returns: the #NMSettingWirelessSecurity:pmf property of the setting
*
* Since: 1.10
**/
NMSettingWirelessSecurityPmf
nm_setting_wireless_security_get_pmf (NMSettingWirelessSecurity *setting)
{
g_return_val_if_fail (NM_IS_SETTING_WIRELESS_SECURITY (setting), 0);
return NM_SETTING_WIRELESS_SECURITY_GET_PRIVATE (setting)->pmf;
}
/**
* nm_setting_wireless_security_get_psk:
* @setting: the #NMSettingWirelessSecurity
@ -1013,6 +1031,31 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
}
}
G_STATIC_ASSERT_EXPR (((NMSettingWirelessSecurityPmf) -1) > 0);
if (priv->pmf > NM_SETTING_WIRELESS_SECURITY_PMF_REQUIRED) {
g_set_error_literal (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("property is invalid"));
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, NM_SETTING_WIRELESS_SECURITY_PMF);
return FALSE;
}
if ( NM_IN_SET (priv->pmf,
NM_SETTING_WIRELESS_SECURITY_PMF_OPTIONAL,
NM_SETTING_WIRELESS_SECURITY_PMF_REQUIRED)
&& !NM_IN_STRSET (priv->key_mgmt, "wpa-eap", "wpa-psk")) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("'%s' can only be used with '%s=%s or '%s=%s'"),
priv->pmf == NM_SETTING_WIRELESS_SECURITY_PMF_OPTIONAL ? "optional" : "required",
NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-eap",
NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk");
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, NM_SETTING_WIRELESS_SECURITY_PMF);
return FALSE;
}
return TRUE;
}
@ -1198,6 +1241,9 @@ set_property (GObject *object, guint prop_id,
g_slist_free_full (priv->group, g_free);
priv->group = _nm_utils_strv_to_slist (g_value_get_boxed (value), TRUE);
break;
case PROP_PMF:
priv->pmf = g_value_get_int (value);
break;
case PROP_LEAP_USERNAME:
g_free (priv->leap_username);
priv->leap_username = g_value_dup_string (value);
@ -1270,6 +1316,9 @@ get_property (GObject *object, guint prop_id,
case PROP_GROUP:
g_value_take_boxed (value, _nm_utils_slist_to_strv (priv->group, TRUE));
break;
case PROP_PMF:
g_value_set_int (value, nm_setting_wireless_security_get_pmf (setting));
break;
case PROP_LEAP_USERNAME:
g_value_set_string (value, priv->leap_username);
break;
@ -1467,6 +1516,37 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
* NMSettingWirelessSecurity:pmf:
*
* Indicates whether Protected Management Frames (802.11w) must be enabled
* for the connection. One of %NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT
* (use global default value), %NM_SETTING_WIRELESS_SECURITY_PMF_DISABLE
* (disable PMF), %NM_SETTING_WIRELESS_SECURITY_PMF_OPTIONAL (enable PMF if
* the supplicant and the access point support it) or
* %NM_SETTING_WIRELESS_SECURITY_PMF_REQUIRED (enable PMF and fail if not
* supported). When set to %NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT and no
* global default is set, PMF will be optionally enabled.
*
* Since: 1.10
**/
/* ---ifcfg-rh---
* property: pmf
* variable: PMF(+)
* values: default, disable, optional, required
* description: Enables or disables PMF (802.11w)
* example: PMF=required
* ---end---
*/
g_object_class_install_property
(object_class, PROP_PMF,
g_param_spec_int (NM_SETTING_WIRELESS_SECURITY_PMF, "", "",
G_MININT32, G_MAXINT32, 0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
NM_SETTING_PARAM_FUZZY_IGNORE |
G_PARAM_STATIC_STRINGS));
/**
* NMSettingWirelessSecurity:leap-username:
*

View file

@ -71,12 +71,31 @@ typedef enum {
NM_WEP_KEY_TYPE_LAST = NM_WEP_KEY_TYPE_PASSPHRASE
} NMWepKeyType;
/**
* NMSettingWirelessSecurityPmf:
* @NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT: use the default value
* @NM_SETTING_WIRELESS_SECURITY_PMF_DISABLE: disable PMF
* @NM_SETTING_WIRELESS_SECURITY_PMF_OPTIONAL: enable PMF if the supplicant and the AP support it
* @NM_SETTING_WIRELESS_SECURITY_PMF_REQUIRED: require PMF and fail if not available
*
* These flags indicate whether PMF must be enabled.
**/
typedef enum {
NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT = 0,
NM_SETTING_WIRELESS_SECURITY_PMF_DISABLE = 1,
NM_SETTING_WIRELESS_SECURITY_PMF_OPTIONAL = 2,
NM_SETTING_WIRELESS_SECURITY_PMF_REQUIRED = 3,
_NM_SETTING_WIRELESS_SECURITY_PMF_NUM, /*< skip >*/
NM_SETTING_WIRELESS_SECURITY_PMF_LAST = _NM_SETTING_WIRELESS_SECURITY_PMF_NUM - 1, /*< skip >*/
} NMSettingWirelessSecurityPmf;
#define NM_SETTING_WIRELESS_SECURITY_KEY_MGMT "key-mgmt"
#define NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX "wep-tx-keyidx"
#define NM_SETTING_WIRELESS_SECURITY_AUTH_ALG "auth-alg"
#define NM_SETTING_WIRELESS_SECURITY_PROTO "proto"
#define NM_SETTING_WIRELESS_SECURITY_PAIRWISE "pairwise"
#define NM_SETTING_WIRELESS_SECURITY_GROUP "group"
#define NM_SETTING_WIRELESS_SECURITY_PMF "pmf"
#define NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME "leap-username"
#define NM_SETTING_WIRELESS_SECURITY_WEP_KEY0 "wep-key0"
#define NM_SETTING_WIRELESS_SECURITY_WEP_KEY1 "wep-key1"
@ -132,6 +151,9 @@ void nm_setting_wireless_security_remove_group (NMSettingWireles
gboolean nm_setting_wireless_security_remove_group_by_value (NMSettingWirelessSecurity *setting, const char *group);
void nm_setting_wireless_security_clear_groups (NMSettingWirelessSecurity *setting);
NM_AVAILABLE_IN_1_10
NMSettingWirelessSecurityPmf nm_setting_wireless_security_get_pmf (NMSettingWirelessSecurity *setting);
const char *nm_setting_wireless_security_get_psk (NMSettingWirelessSecurity *setting);
NMSettingSecretFlags nm_setting_wireless_security_get_psk_flags (NMSettingWirelessSecurity *setting);

View file

@ -37,6 +37,7 @@
#include <jansson.h>
#endif
#include "nm-utils/nm-enum-utils.h"
#include "nm-common-macros.h"
#include "nm-utils-private.h"
#include "nm-setting-private.h"
@ -443,36 +444,6 @@ nm_utils_same_ssid (const guint8 *ssid1, gsize len1,
return memcmp (ssid1, ssid2, len1) == 0 ? TRUE : FALSE;
}
char **
_nm_utils_strv_cleanup (char **strv,
gboolean strip_whitespace,
gboolean skip_empty,
gboolean skip_repeated)
{
guint i, j;
if (!strv || !*strv)
return strv;
if (strip_whitespace) {
for (i = 0; strv[i]; i++)
g_strstrip (strv[i]);
}
if (!skip_empty && !skip_repeated)
return strv;
j = 0;
for (i = 0; strv[i]; i++) {
if ( (skip_empty && !*strv[i])
|| (skip_repeated && nm_utils_strv_find_first (strv, j, strv[i]) >= 0))
g_free (strv[i]);
else
strv[j++] = strv[i];
}
strv[j] = NULL;
return strv;
}
gboolean
_nm_utils_string_slist_validate (GSList *list, const char **valid_values)
{
@ -4249,82 +4220,7 @@ int _nm_utils_dns_option_find_idx (GPtrArray *array, const char *option)
return -1;
}
#define IS_FLAGS_SEPARATOR(ch) (NM_IN_SET ((ch), ' ', '\t', ',', '\n', '\r'))
static gboolean
_is_hex_string (const char *str)
{
return str[0] == '0'
&& str[1] == 'x'
&& str[2]
&& NM_STRCHAR_ALL (&str[2], ch, g_ascii_isxdigit (ch));
}
static gboolean
_enum_is_valid_enum_nick (const char *str)
{
return str[0]
&& !NM_STRCHAR_ANY (str, ch, g_ascii_isspace (ch))
&& !NM_STRCHAR_ALL (str, ch, g_ascii_isdigit (ch));
}
static gboolean
_enum_is_valid_flags_nick (const char *str)
{
return str[0]
&& !NM_STRCHAR_ANY (str, ch, IS_FLAGS_SEPARATOR (ch))
&& !_is_hex_string (str);
}
char *
_nm_utils_enum_to_str_full (GType type,
int value,
const char *flags_separator)
{
GTypeClass *class;
char *ret;
if ( flags_separator
&& ( !flags_separator[0]
|| NM_STRCHAR_ANY (flags_separator, ch, !IS_FLAGS_SEPARATOR (ch))))
g_return_val_if_reached (NULL);
class = g_type_class_ref (type);
if (G_IS_ENUM_CLASS (class)) {
GEnumValue *enum_value;
enum_value = g_enum_get_value (G_ENUM_CLASS (class), value);
if ( !enum_value
|| !_enum_is_valid_enum_nick (enum_value->value_nick))
ret = g_strdup_printf ("%d", value);
else
ret = strdup (enum_value->value_nick);
} else if (G_IS_FLAGS_CLASS (class)) {
GFlagsValue *flags_value;
GString *str = g_string_new ("");
flags_separator = flags_separator ?: " ";
while (value) {
flags_value = g_flags_get_first_value (G_FLAGS_CLASS (class), value);
if (str->len)
g_string_append (str, flags_separator);
if ( !flags_value
|| !_enum_is_valid_flags_nick (flags_value->value_nick)) {
g_string_append_printf (str, "0x%x", (unsigned) value);
break;
}
g_string_append (str, flags_value->value_nick);
value &= ~flags_value->value;
}
ret = g_string_free (str, FALSE);
} else
g_return_val_if_reached (NULL);
g_type_class_unref (class);
return ret;
}
/*****************************************************************************/
/**
* nm_utils_enum_to_str:
@ -4333,8 +4229,9 @@ _nm_utils_enum_to_str_full (GType type,
*
* Converts an enum value to its string representation. If the enum is a
* %G_TYPE_FLAGS the function returns a comma-separated list of matching values.
* If the enum is a %G_TYPE_ENUM and the given value is not valid the
* function returns %NULL.
* If the value has no corresponding string representation, it is converted
* to a number. For enums it is converted to a decimal number, for flags
* to an (unsigned) hex number.
*
* Returns: a newly allocated string or %NULL
*
@ -4368,81 +4265,7 @@ gboolean
nm_utils_enum_from_str (GType type, const char *str,
int *out_value, char **err_token)
{
GTypeClass *class;
gboolean ret = FALSE;
int value = 0;
gs_free char *str_clone = NULL;
char *s;
gint64 v64;
g_return_val_if_fail (str, FALSE);
str_clone = strdup (str);
s = nm_str_skip_leading_spaces (str_clone);
g_strchomp (s);
class = g_type_class_ref (type);
if (G_IS_ENUM_CLASS (class)) {
GEnumValue *enum_value;
if (s[0]) {
if (NM_STRCHAR_ALL (s, ch, g_ascii_isdigit (ch))) {
v64 = _nm_utils_ascii_str_to_int64 (s, 10, 0, G_MAXINT, -1);
if (v64 != -1) {
value = (int) v64;
ret = TRUE;
}
} else {
enum_value = g_enum_get_value_by_nick (G_ENUM_CLASS (class), s);
if (enum_value) {
value = enum_value->value;
ret = TRUE;
}
}
}
} else if (G_IS_FLAGS_CLASS (class)) {
GFlagsValue *flags_value;
ret = TRUE;
while (s[0]) {
char *s_end;
for (s_end = s; s_end[0]; s_end++) {
if (IS_FLAGS_SEPARATOR (s_end[0])) {
s_end[0] = '\0';
s_end++;
break;
}
}
if (s[0]) {
if (_is_hex_string (s)) {
v64 = _nm_utils_ascii_str_to_int64 (&s[2], 16, 0, G_MAXUINT, -1);
if (v64 == -1) {
ret = FALSE;
break;
}
value |= (int) v64;
} else {
flags_value = g_flags_get_value_by_nick (G_FLAGS_CLASS (class), s);
if (!flags_value) {
ret = FALSE;
break;
}
value |= flags_value->value;
}
}
s = s_end;
}
} else
g_return_val_if_reached (FALSE);
NM_SET_OUT (err_token, !ret && s[0] ? g_strdup (s) : NULL);
NM_SET_OUT (out_value, ret ? value : 0);
g_type_class_unref (class);
return ret;
return _nm_utils_enum_from_str_full (type, str, out_value, err_token, NULL);
}
/**
@ -4460,52 +4283,11 @@ nm_utils_enum_from_str (GType type, const char *str,
*/
const char **nm_utils_enum_get_values (GType type, gint from, gint to)
{
GTypeClass *class;
GPtrArray *array;
gint i;
char sbuf[64];
class = g_type_class_ref (type);
array = g_ptr_array_new ();
if (G_IS_ENUM_CLASS (class)) {
GEnumClass *enum_class = G_ENUM_CLASS (class);
GEnumValue *enum_value;
for (i = 0; i < enum_class->n_values; i++) {
enum_value = &enum_class->values[i];
if (enum_value->value >= from && enum_value->value <= to) {
if (_enum_is_valid_enum_nick (enum_value->value_nick))
g_ptr_array_add (array, (gpointer) enum_value->value_nick);
else
g_ptr_array_add (array, (gpointer) g_intern_string (nm_sprintf_buf (sbuf, "%d", enum_value->value)));
}
}
} else if (G_IS_FLAGS_CLASS (class)) {
GFlagsClass *flags_class = G_FLAGS_CLASS (class);
GFlagsValue *flags_value;
for (i = 0; i < flags_class->n_values; i++) {
flags_value = &flags_class->values[i];
if (flags_value->value >= from && flags_value->value <= to) {
if (_enum_is_valid_flags_nick (flags_value->value_nick))
g_ptr_array_add (array, (gpointer) flags_value->value_nick);
else
g_ptr_array_add (array, (gpointer) g_intern_string (nm_sprintf_buf (sbuf, "0x%x", (unsigned) flags_value->value)));
}
}
} else {
g_type_class_unref (class);
g_ptr_array_free (array, TRUE);
g_return_val_if_reached (NULL);
}
g_type_class_unref (class);
g_ptr_array_add (array, NULL);
return (const char **) g_ptr_array_free (array, FALSE);
return _nm_utils_enum_get_values (type, from, to);
}
/*****************************************************************************/
#if WITH_JANSSON
/**
* nm_utils_is_json_object:

View file

@ -132,4 +132,18 @@
# define NM_AVAILABLE_IN_1_8
#endif
#if NM_VERSION_MIN_REQUIRED >= NM_VERSION_1_10
# define NM_DEPRECATED_IN_1_10 G_DEPRECATED
# define NM_DEPRECATED_IN_1_10_FOR(f) G_DEPRECATED_FOR(f)
#else
# define NM_DEPRECATED_IN_1_10
# define NM_DEPRECATED_IN_1_10_FOR(f)
#endif
#if NM_VERSION_MAX_ALLOWED < NM_VERSION_1_10
# define NM_AVAILABLE_IN_1_10 G_UNAVAILABLE(1,10)
#else
# define NM_AVAILABLE_IN_1_10
#endif
#endif /* NM_VERSION_H */

View file

@ -4655,6 +4655,81 @@ test_nm_utils_strstrdictkey (void)
/*****************************************************************************/
static guint
_g_strv_length (gconstpointer arr)
{
return arr ? g_strv_length ((char **) arr) : 0;
}
static void
test_nm_ptrarray_len (void)
{
#define _PTRARRAY_cmp(len, arr) \
G_STMT_START { \
g_assert_cmpint (len, ==, NM_PTRARRAY_LEN (arr)); \
g_assert_cmpint (len, ==, _g_strv_length (arr)); \
} G_STMT_END
#define _PTRARRAY_LEN0(T) \
G_STMT_START { \
T **vnull = NULL; \
T *const*vnull1 = NULL; \
T *const*const vnull2 = NULL; \
T *v0[] = { NULL }; \
T *const*v01 = v0; \
T *const*const v02 = v0; \
T **const v03 = v0; \
\
_PTRARRAY_cmp (0, vnull); \
_PTRARRAY_cmp (0, vnull1); \
_PTRARRAY_cmp (0, vnull2); \
_PTRARRAY_cmp (0, v0); \
_PTRARRAY_cmp (0, v01); \
_PTRARRAY_cmp (0, v02); \
_PTRARRAY_cmp (0, v03); \
} G_STMT_END
_PTRARRAY_LEN0 (char);
_PTRARRAY_LEN0 (const char);
_PTRARRAY_LEN0 (int);
_PTRARRAY_LEN0 (const int);
_PTRARRAY_LEN0 (void *);
_PTRARRAY_LEN0 (void);
_PTRARRAY_LEN0 (const void);
#define _PTRARRAY_LENn(T) \
G_STMT_START { \
T x[5] = { 0 }; \
\
T *v1[] = { &x[0], NULL }; \
T *const*v11 = v1; \
T *const*const v12 = v1; \
T **const v13 = v1; \
\
T *v2[] = { &x[0], &x[1], NULL }; \
T *const*v21 = v2; \
T *const*const v22 = v2; \
T **const v23 = v2; \
\
_PTRARRAY_cmp (1, v1); \
_PTRARRAY_cmp (1, v11); \
_PTRARRAY_cmp (1, v12); \
_PTRARRAY_cmp (1, v13); \
\
_PTRARRAY_cmp (2, v2); \
_PTRARRAY_cmp (2, v21); \
_PTRARRAY_cmp (2, v22); \
_PTRARRAY_cmp (2, v23); \
} G_STMT_END
_PTRARRAY_LENn (char);
_PTRARRAY_LENn (const char);
_PTRARRAY_LENn (int);
_PTRARRAY_LENn (const int);
_PTRARRAY_LENn (void *);
}
/*****************************************************************************/
static void
test_nm_utils_dns_option_validate_do (char *option, gboolean ipv6, const NMUtilsDNSOptionDesc *descs,
gboolean exp_result, char *exp_name, gboolean exp_value)
@ -5200,7 +5275,7 @@ static void test_nm_utils_enum (void)
test_nm_utils_enum_to_str_do (bool_enum, NM_TEST_GENERAL_BOOL_ENUM_67, "67");
test_nm_utils_enum_to_str_do (bool_enum, NM_TEST_GENERAL_BOOL_ENUM_46, "64");
test_nm_utils_enum_to_str_do (meta_flags, NM_TEST_GENERAL_META_FLAGS_NONE, "");
test_nm_utils_enum_to_str_do (meta_flags, NM_TEST_GENERAL_META_FLAGS_NONE, "none");
test_nm_utils_enum_to_str_do (meta_flags, NM_TEST_GENERAL_META_FLAGS_BAZ, "baz");
test_nm_utils_enum_to_str_do (meta_flags, NM_TEST_GENERAL_META_FLAGS_FOO |
NM_TEST_GENERAL_META_FLAGS_BAR |
@ -5716,6 +5791,7 @@ int main (int argc, char **argv)
g_test_add_func ("/core/general/_glib_compat_g_hash_table_get_keys_as_array", test_g_hash_table_get_keys_as_array);
g_test_add_func ("/core/general/_nm_utils_ptrarray_find_binary_search", test_nm_utils_ptrarray_find_binary_search);
g_test_add_func ("/core/general/_nm_utils_strstrdictkey", test_nm_utils_strstrdictkey);
g_test_add_func ("/core/general/nm_ptrarray_len", test_nm_ptrarray_len);
g_test_add_func ("/core/general/_nm_utils_dns_option_validate", test_nm_utils_dns_option_validate);
g_test_add_func ("/core/general/_nm_utils_dns_option_find_idx", test_nm_utils_dns_option_find_idx);

View file

@ -121,6 +121,12 @@ make_tls_connection (const char *detail, NMSetting8021xCKScheme scheme)
&error);
nmtst_assert_success (success, error);
success = nm_setting_set_secret_flags (NM_SETTING (s_8021x),
NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD,
NM_SETTING_SECRET_FLAG_AGENT_OWNED,
&error);
nmtst_assert_success (success, error);
/* IP4 setting */
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
@ -247,6 +253,13 @@ make_tls_phase2_connection (const char *detail, NMSetting8021xCKScheme scheme)
&error);
nmtst_assert_success (success, error);
success = nm_setting_set_secret_flags (NM_SETTING (s_8021x),
NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD,
NM_SETTING_SECRET_FLAG_AGENT_OWNED,
&error);
nmtst_assert_success (success, error);
/* IP4 setting */
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));

View file

@ -132,4 +132,18 @@
# define NM_AVAILABLE_IN_1_8
#endif
#if NM_VERSION_MIN_REQUIRED >= NM_VERSION_1_10
# define NM_DEPRECATED_IN_1_10 G_DEPRECATED
# define NM_DEPRECATED_IN_1_10_FOR(f) G_DEPRECATED_FOR(f)
#else
# define NM_DEPRECATED_IN_1_10
# define NM_DEPRECATED_IN_1_10_FOR(f)
#endif
#if NM_VERSION_MAX_ALLOWED < NM_VERSION_1_10
# define NM_AVAILABLE_IN_1_10 G_UNAVAILABLE(1,10)
#else
# define NM_AVAILABLE_IN_1_10
#endif
#endif /* NM_VERSION_H */

View file

@ -76,6 +76,12 @@ constants = {
'NULL': 'NULL' }
setting_names = {}
def get_setting_name_define(setting):
n = setting.attrib[symbol_prefix_key]
if n and n.startswith("setting_"):
return n[8:].upper()
raise Exception("Unexpected symbol_prefix_key \"%s\"" % (n))
def init_constants(girxml, settings):
for const in girxml.findall('./gi:namespace/gi:constant', ns_map):
cname = const.attrib['{%s}type' % ns_map['c']]
@ -98,7 +104,7 @@ def init_constants(girxml, settings):
for setting in settings:
setting_type_name = 'NM' + setting.attrib['name'];
setting_name_symbol = 'NM_' + setting.attrib[symbol_prefix_key].upper() + '_SETTING_NAME'
setting_name_symbol = 'NM_SETTING_' + get_setting_name_define(setting) + '_SETTING_NAME'
if setting_name_symbol in constants:
setting_name = constants[setting_name_symbol]
setting_names[setting_type_name] = setting_name
@ -215,7 +221,7 @@ for settingxml in settings:
class_desc = get_docs(settingxml)
if class_desc is None:
raise Exception("%s needs a gtk-doc block with one-line description" % setting.props.name)
outfile.write(" <setting name=\"%s\" description=\"%s\">\n" % (setting.props.name, class_desc))
outfile.write(" <setting name=\"%s\" description=\"%s\" name_upper=\"%s\" >\n" % (setting.props.name, class_desc, get_setting_name_define (settingxml)))
setting_properties = { prop.name: prop for prop in GObject.list_properties(setting) }
if args.overrides is None:
@ -249,12 +255,14 @@ for settingxml in settings:
if override.attrib['description'] != '':
value_desc = override.attrib['description']
prop_upper = prop.upper().replace('-', '_')
if default_value is not None:
outfile.write(" <property name=\"%s\" type=\"%s\" default=\"%s\" description=\"%s\" />\n" %
(prop, value_type, escape(default_value), escape(value_desc)))
outfile.write(" <property name=\"%s\" name_upper=\"%s\" type=\"%s\" default=\"%s\" description=\"%s\" />\n" %
(prop, prop_upper, value_type, escape(default_value), escape(value_desc)))
else:
outfile.write(" <property name=\"%s\" type=\"%s\" description=\"%s\" />\n" %
(prop, value_type, escape(value_desc)))
outfile.write(" <property name=\"%s\" name_upper=\"%s\" type=\"%s\" description=\"%s\" />\n" %
(prop, prop_upper, value_type, escape(value_desc)))
outfile.write(" </setting>\n")

View file

@ -1177,3 +1177,9 @@ global:
nm_utils_format_variant_attributes;
nm_utils_parse_variant_attributes;
} libnm_1_6_0;
libnm_1_10_0 {
global:
nm_setting_wireless_security_get_pmf;
nm_setting_wireless_security_pmf_get_type;
} libnm_1_8_0;

View file

@ -313,9 +313,9 @@ demarshal_dns_configuration (NMObject *object, GParamSpec *pspec, GVariant *valu
vpn);
g_free (domains);
g_free (nameservers);
g_variant_unref (entry_var);
if (!entry) {
g_warning ("Ignoring invalid DNS entry");
g_variant_unref (entry_var);
continue;
}

View file

@ -701,6 +701,11 @@ ipv6.ip6-privacy=0
<listitem><para>If left unspecified, the default value
"<literal>ignore</literal>" will be used.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>wifi-sec.pmf</varname></term>
<listitem><para>If left unspecified, the default value
"<literal>optional</literal>" will be used.</para></listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>

View file

@ -10,9 +10,13 @@ clients/cli/nmcli.c
clients/cli/polkit-agent.c
clients/cli/settings.c
clients/cli/utils.c
clients/common/nm-client-utils.c
clients/common/nm-meta-setting-access.c
clients/common/nm-meta-setting-desc.c
clients/common/nm-polkit-listener.c
clients/common/nm-secret-agent-simple.c
clients/common/nm-vpn-helpers.c
clients/common/settings-docs.c.in
clients/nm-online.c
clients/tui/newt/nmt-newt-utils.c
clients/tui/nm-editor-utils.c

6562
po/ar.po

File diff suppressed because it is too large Load diff

7434
po/as.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

6826
po/bg.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

6491
po/bs.po

File diff suppressed because it is too large Load diff

7580
po/ca.po

File diff suppressed because it is too large Load diff

6952
po/cs.po

File diff suppressed because it is too large Load diff

6908
po/da.po

File diff suppressed because it is too large Load diff

7464
po/de.po

File diff suppressed because it is too large Load diff

6565
po/dz.po

File diff suppressed because it is too large Load diff

7452
po/el.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

6957
po/eo.po

File diff suppressed because it is too large Load diff

7611
po/es.po

File diff suppressed because it is too large Load diff

6420
po/et.po

File diff suppressed because it is too large Load diff

6658
po/eu.po

File diff suppressed because it is too large Load diff

6791
po/fi.po

File diff suppressed because it is too large Load diff

7462
po/fr.po

File diff suppressed because it is too large Load diff

6665
po/gd.po

File diff suppressed because it is too large Load diff

7327
po/gl.po

File diff suppressed because it is too large Load diff

7430
po/gu.po

File diff suppressed because it is too large Load diff

6405
po/he.po

File diff suppressed because it is too large Load diff

7433
po/hi.po

File diff suppressed because it is too large Load diff

6966
po/hr.po

File diff suppressed because it is too large Load diff

7118
po/hu.po

File diff suppressed because it is too large Load diff

7038
po/id.po

File diff suppressed because it is too large Load diff

7560
po/it.po

File diff suppressed because it is too large Load diff

7593
po/ja.po

File diff suppressed because it is too large Load diff

6649
po/ka.po

File diff suppressed because it is too large Load diff

7420
po/kn.po

File diff suppressed because it is too large Load diff

7377
po/ko.po

File diff suppressed because it is too large Load diff

6557
po/ku.po

File diff suppressed because it is too large Load diff

7264
po/lt.po

File diff suppressed because it is too large Load diff

6650
po/lv.po

File diff suppressed because it is too large Load diff

6405
po/mk.po

File diff suppressed because it is too large Load diff

7413
po/ml.po

File diff suppressed because it is too large Load diff

7398
po/mr.po

File diff suppressed because it is too large Load diff

6409
po/nb.po

File diff suppressed because it is too large Load diff

6546
po/ne.po

File diff suppressed because it is too large Load diff

6410
po/nl.po

File diff suppressed because it is too large Load diff

6936
po/oc.po

File diff suppressed because it is too large Load diff

7415
po/or.po

File diff suppressed because it is too large Load diff

7433
po/pa.po

File diff suppressed because it is too large Load diff

7446
po/pl.po

File diff suppressed because it is too large Load diff

6565
po/pt.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

7533
po/ru.po

File diff suppressed because it is too large Load diff

6551
po/rw.po

File diff suppressed because it is too large Load diff

6815
po/sk.po

File diff suppressed because it is too large Load diff

7030
po/sl.po

File diff suppressed because it is too large Load diff

6491
po/sq.po

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more