2019-09-10 09:19:01 +00:00
|
|
|
// SPDX-License-Identifier: LGPL-2.1+
|
2014-07-24 12:53:33 +00:00
|
|
|
/*
|
2019-10-01 07:20:35 +00:00
|
|
|
* Copyright (C) 2005 - 2017 Red Hat, Inc.
|
2014-07-24 12:53:33 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __NM_UTILS_PRIVATE_H__
|
|
|
|
#define __NM_UTILS_PRIVATE_H__
|
|
|
|
|
2018-01-02 12:37:06 +00:00
|
|
|
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_PRIVATE)
|
|
|
|
#error Cannot use this header.
|
2015-05-20 10:23:03 +00:00
|
|
|
#endif
|
|
|
|
|
2014-07-24 12:53:33 +00:00
|
|
|
#include "nm-setting-private.h"
|
2015-03-26 07:57:02 +00:00
|
|
|
#include "nm-setting-ip-config.h"
|
2014-07-24 12:53:33 +00:00
|
|
|
|
2017-03-02 10:08:34 +00:00
|
|
|
struct _NMVariantAttributeSpec {
|
|
|
|
char *name;
|
|
|
|
const GVariantType *type;
|
2017-02-15 14:06:24 +00:00
|
|
|
bool v4:1;
|
|
|
|
bool v6:1;
|
libnm-core/utils: add some special properties for the attributes
"no_value" indicates that the the attribute is a single word, not a
key=value pair. If the type is BOOLEAN then the attribute is considered
true, if it's a STRING then the key is used instead of a value.
"consumes_rest" indicates that the particular key takes the unparseable
tail of the string for a value.
This allows parsing tc-style strings. Consider this filter:
,------ regular key/value pair
,-----'----.
root handle 1234: matchall action simple foo bar baz
| | `-----------.-----------'
| | `- "", STRING, consumes_rest
| `------------------- "kind", STRING, no_value
`-------------------------------------- "root', BOOLEAN, no_value
2017-12-04 10:40:32 +00:00
|
|
|
bool no_value:1;
|
|
|
|
bool consumes_rest:1;
|
2017-02-15 14:06:24 +00:00
|
|
|
char str_type;
|
2017-03-02 10:08:34 +00:00
|
|
|
};
|
|
|
|
|
2019-05-01 09:56:29 +00:00
|
|
|
#define NM_VARIANT_ATTRIBUTE_SPEC_DEFINE(_name, _type, ...) \
|
|
|
|
(&((const NMVariantAttributeSpec) { \
|
|
|
|
.name = _name, \
|
|
|
|
.type = _type, \
|
|
|
|
__VA_ARGS__ \
|
|
|
|
}))
|
|
|
|
|
2014-07-24 12:53:33 +00:00
|
|
|
gboolean _nm_utils_string_slist_validate (GSList *list,
|
|
|
|
const char **valid_values);
|
|
|
|
|
2019-02-09 10:14:51 +00:00
|
|
|
gboolean _nm_utils_secret_flags_validate (NMSettingSecretFlags secret_flags,
|
|
|
|
const char *setting_name,
|
|
|
|
const char *property_name,
|
|
|
|
NMSettingSecretFlags disallowed_flags,
|
|
|
|
GError **error);
|
|
|
|
|
2019-01-27 23:36:08 +00:00
|
|
|
gboolean _nm_utils_wps_method_validate (NMSettingWirelessSecurityWpsMethod wps_method,
|
|
|
|
const char *setting_name,
|
|
|
|
const char *property_name,
|
|
|
|
gboolean wps_required,
|
|
|
|
GError **error);
|
|
|
|
|
2014-08-16 14:09:48 +00:00
|
|
|
/* D-Bus transform funcs */
|
2014-07-24 12:53:33 +00:00
|
|
|
|
2019-09-22 08:57:57 +00:00
|
|
|
extern const NMSettInfoPropertType nm_sett_info_propert_type_strdict;
|
|
|
|
|
|
|
|
extern const NMSettInfoPropertType nm_sett_info_propert_type_mac_addrees;
|
|
|
|
|
|
|
|
extern const NMSettInfoPropertType nm_sett_info_propert_type_cloned_mac_address;
|
|
|
|
|
|
|
|
extern const NMSettInfoPropertType nm_sett_info_propert_type_assigned_mac_address;
|
|
|
|
|
|
|
|
extern const NMSettInfoPropertType nm_sett_info_propert_type_bridge_vlans;
|
|
|
|
|
2014-08-16 14:09:48 +00:00
|
|
|
void _nm_utils_strdict_from_dbus (GVariant *dbus_value,
|
2014-06-24 21:40:08 +00:00
|
|
|
GValue *prop_value);
|
|
|
|
|
2014-08-16 14:09:48 +00:00
|
|
|
void _nm_utils_bytes_from_dbus (GVariant *dbus_value,
|
2014-06-26 14:42:11 +00:00
|
|
|
GValue *prop_value);
|
|
|
|
|
2014-10-28 12:56:07 +00:00
|
|
|
char * _nm_utils_hwaddr_canonical_or_invalid (const char *mac, gssize length);
|
|
|
|
|
2018-06-18 16:46:52 +00:00
|
|
|
void _nm_utils_format_variant_attributes_full (GString *str,
|
|
|
|
const NMUtilsNamedValue *values,
|
|
|
|
guint num_values,
|
|
|
|
char attr_separator,
|
|
|
|
char key_value_separator);
|
2018-05-25 10:05:24 +00:00
|
|
|
gboolean _nm_sriov_vf_parse_vlans (NMSriovVF *vf, const char *str, GError **error);
|
2018-06-18 16:46:52 +00:00
|
|
|
|
2019-03-16 16:21:35 +00:00
|
|
|
gboolean _nm_utils_bridge_vlan_verify_list (GPtrArray *vlans,
|
|
|
|
gboolean check_normalizable,
|
|
|
|
GError **error,
|
|
|
|
const char *setting,
|
|
|
|
const char *property);
|
|
|
|
|
2014-07-24 12:53:33 +00:00
|
|
|
#endif
|