mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-02 01:28:02 +02:00
libnm: refactor some NMSetting to use direct properties for enum/flags
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1033
This commit is contained in:
parent
25e705c361
commit
4010d75922
11 changed files with 139 additions and 253 deletions
|
|
@ -39,20 +39,20 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_AUTO_CONFIG,
|
|||
PROP_MTU, );
|
||||
|
||||
typedef struct {
|
||||
char *number; /* For dialing, duh */
|
||||
char *username;
|
||||
char *password;
|
||||
char *device_id;
|
||||
char *sim_id;
|
||||
char *sim_operator_id;
|
||||
char *apn; /* NULL for dynamic */
|
||||
char *network_id; /* for manual registration or NULL for automatic */
|
||||
char *pin;
|
||||
NMSettingSecretFlags password_flags;
|
||||
NMSettingSecretFlags pin_flags;
|
||||
guint32 mtu;
|
||||
bool auto_config;
|
||||
bool home_only;
|
||||
char *number; /* For dialing, duh */
|
||||
char *username;
|
||||
char *password;
|
||||
char *device_id;
|
||||
char *sim_id;
|
||||
char *sim_operator_id;
|
||||
char *apn; /* NULL for dynamic */
|
||||
char *network_id; /* for manual registration or NULL for automatic */
|
||||
char *pin;
|
||||
guint password_flags;
|
||||
guint pin_flags;
|
||||
guint32 mtu;
|
||||
bool auto_config;
|
||||
bool home_only;
|
||||
} NMSettingGsmPrivate;
|
||||
|
||||
/**
|
||||
|
|
@ -498,9 +498,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
|||
case PROP_PASSWORD:
|
||||
g_value_set_string(value, nm_setting_gsm_get_password(setting));
|
||||
break;
|
||||
case PROP_PASSWORD_FLAGS:
|
||||
g_value_set_flags(value, nm_setting_gsm_get_password_flags(setting));
|
||||
break;
|
||||
case PROP_APN:
|
||||
g_value_set_string(value, nm_setting_gsm_get_apn(setting));
|
||||
break;
|
||||
|
|
@ -510,9 +507,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
|||
case PROP_PIN:
|
||||
g_value_set_string(value, nm_setting_gsm_get_pin(setting));
|
||||
break;
|
||||
case PROP_PIN_FLAGS:
|
||||
g_value_set_flags(value, nm_setting_gsm_get_pin_flags(setting));
|
||||
break;
|
||||
case PROP_HOME_ONLY:
|
||||
g_value_set_boolean(value, nm_setting_gsm_get_home_only(setting));
|
||||
break;
|
||||
|
|
@ -529,7 +523,7 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
|||
g_value_set_uint(value, nm_setting_gsm_get_mtu(setting));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
_nm_setting_property_get_property_direct(object, prop_id, value, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -556,9 +550,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
|
|||
g_free(priv->password);
|
||||
priv->password = g_value_dup_string(value);
|
||||
break;
|
||||
case PROP_PASSWORD_FLAGS:
|
||||
priv->password_flags = g_value_get_flags(value);
|
||||
break;
|
||||
case PROP_APN:
|
||||
g_free(priv->apn);
|
||||
priv->apn = NULL;
|
||||
|
|
@ -577,9 +568,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
|
|||
g_free(priv->pin);
|
||||
priv->pin = g_value_dup_string(value);
|
||||
break;
|
||||
case PROP_PIN_FLAGS:
|
||||
priv->pin_flags = g_value_get_flags(value);
|
||||
break;
|
||||
case PROP_HOME_ONLY:
|
||||
priv->home_only = g_value_get_boolean(value);
|
||||
break;
|
||||
|
|
@ -599,7 +587,7 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
|
|||
priv->mtu = g_value_get_uint(value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
_nm_setting_property_set_property_direct(object, prop_id, value, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -722,14 +710,12 @@ nm_setting_gsm_class_init(NMSettingGsmClass *klass)
|
|||
*
|
||||
* Flags indicating how to handle the #NMSettingGsm:password property.
|
||||
**/
|
||||
obj_properties[PROP_PASSWORD_FLAGS] =
|
||||
g_param_spec_flags(NM_SETTING_GSM_PASSWORD_FLAGS,
|
||||
"",
|
||||
"",
|
||||
NM_TYPE_SETTING_SECRET_FLAGS,
|
||||
NM_SETTING_SECRET_FLAG_NONE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
_nm_setting_property_define_direct_secret_flags(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_GSM_PASSWORD_FLAGS,
|
||||
PROP_PASSWORD_FLAGS,
|
||||
NMSettingGsmPrivate,
|
||||
password_flags);
|
||||
/**
|
||||
* NMSettingGsm:apn:
|
||||
*
|
||||
|
|
@ -782,12 +768,12 @@ nm_setting_gsm_class_init(NMSettingGsmClass *klass)
|
|||
*
|
||||
* Flags indicating how to handle the #NMSettingGsm:pin property.
|
||||
**/
|
||||
obj_properties[PROP_PIN_FLAGS] = g_param_spec_flags(NM_SETTING_GSM_PIN_FLAGS,
|
||||
"",
|
||||
"",
|
||||
NM_TYPE_SETTING_SECRET_FLAGS,
|
||||
NM_SETTING_SECRET_FLAG_NONE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_setting_property_define_direct_secret_flags(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_GSM_PIN_FLAGS,
|
||||
PROP_PIN_FLAGS,
|
||||
NMSettingGsmPrivate,
|
||||
pin_flags);
|
||||
|
||||
/**
|
||||
* NMSettingGsm:home-only:
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ typedef struct {
|
|||
|
||||
char *token;
|
||||
char *dhcp_duid;
|
||||
NMSettingIP6ConfigPrivacy ip6_privacy;
|
||||
int ip6_privacy;
|
||||
NMSettingIP6ConfigAddrGenMode addr_gen_mode;
|
||||
gint32 ra_timeout;
|
||||
} NMSettingIP6ConfigPrivate;
|
||||
|
|
@ -507,9 +507,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
|||
NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE(object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_IP6_PRIVACY:
|
||||
g_value_set_enum(value, priv->ip6_privacy);
|
||||
break;
|
||||
case PROP_ADDR_GEN_MODE:
|
||||
g_value_set_int(value, priv->addr_gen_mode);
|
||||
break;
|
||||
|
|
@ -523,7 +520,7 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
|||
g_value_set_int(value, priv->ra_timeout);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
_nm_setting_property_get_property_direct(object, prop_id, value, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -534,9 +531,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
|
|||
NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE(object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_IP6_PRIVACY:
|
||||
priv->ip6_privacy = g_value_get_enum(value);
|
||||
break;
|
||||
case PROP_ADDR_GEN_MODE:
|
||||
priv->addr_gen_mode = g_value_get_int(value);
|
||||
break;
|
||||
|
|
@ -552,7 +546,7 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
|
|||
priv->ra_timeout = g_value_get_int(value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
_nm_setting_property_set_property_direct(object, prop_id, value, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -566,7 +560,6 @@ nm_setting_ip6_config_init(NMSettingIP6Config *setting)
|
|||
|
||||
_nm_setting_ip_config_private_init(setting, &priv->parent);
|
||||
|
||||
priv->ip6_privacy = NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN;
|
||||
priv->addr_gen_mode = NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY;
|
||||
}
|
||||
|
||||
|
|
@ -803,13 +796,15 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
|
|||
* example: IPV6_PRIVACY=rfc3041 IPV6_PRIVACY_PREFER_PUBLIC_IP=yes
|
||||
* ---end---
|
||||
*/
|
||||
obj_properties[PROP_IP6_PRIVACY] =
|
||||
g_param_spec_enum(NM_SETTING_IP6_CONFIG_IP6_PRIVACY,
|
||||
"",
|
||||
"",
|
||||
NM_TYPE_SETTING_IP6_CONFIG_PRIVACY,
|
||||
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_setting_property_define_direct_enum(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_IP6_CONFIG_IP6_PRIVACY,
|
||||
PROP_IP6_PRIVACY,
|
||||
NM_TYPE_SETTING_IP6_CONFIG_PRIVACY,
|
||||
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN,
|
||||
NM_SETTING_PARAM_NONE,
|
||||
NMSettingIP6ConfigPrivate,
|
||||
ip6_privacy);
|
||||
|
||||
/**
|
||||
* NMSettingIP6Config:addr-gen-mode:
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ typedef struct {
|
|||
char *mka_cak;
|
||||
char *mka_ckn;
|
||||
int port;
|
||||
guint mka_cak_flags;
|
||||
NMSettingMacsecMode mode;
|
||||
NMSettingSecretFlags mka_cak_flags;
|
||||
NMSettingMacsecValidation validation;
|
||||
bool encrypt;
|
||||
bool send_sci;
|
||||
|
|
@ -420,9 +420,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
|||
case PROP_MKA_CAK:
|
||||
g_value_set_string(value, priv->mka_cak);
|
||||
break;
|
||||
case PROP_MKA_CAK_FLAGS:
|
||||
g_value_set_flags(value, priv->mka_cak_flags);
|
||||
break;
|
||||
case PROP_MKA_CKN:
|
||||
g_value_set_string(value, priv->mka_ckn);
|
||||
break;
|
||||
|
|
@ -436,7 +433,7 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
|||
g_value_set_boolean(value, priv->send_sci);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
_nm_setting_property_get_property_direct(object, prop_id, value, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -462,9 +459,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
|
|||
nm_free_secret(priv->mka_cak);
|
||||
priv->mka_cak = g_value_dup_string(value);
|
||||
break;
|
||||
case PROP_MKA_CAK_FLAGS:
|
||||
priv->mka_cak_flags = g_value_get_flags(value);
|
||||
break;
|
||||
case PROP_MKA_CKN:
|
||||
g_free(priv->mka_ckn);
|
||||
priv->mka_ckn = g_value_dup_string(value);
|
||||
|
|
@ -479,7 +473,7 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
|
|||
priv->send_sci = g_value_get_boolean(value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
_nm_setting_property_set_property_direct(object, prop_id, value, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -613,13 +607,12 @@ nm_setting_macsec_class_init(NMSettingMacsecClass *klass)
|
|||
*
|
||||
* Since: 1.6
|
||||
**/
|
||||
obj_properties[PROP_MKA_CAK_FLAGS] =
|
||||
g_param_spec_flags(NM_SETTING_MACSEC_MKA_CAK_FLAGS,
|
||||
"",
|
||||
"",
|
||||
NM_TYPE_SETTING_SECRET_FLAGS,
|
||||
NM_SETTING_SECRET_FLAG_NONE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_setting_property_define_direct_secret_flags(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_MACSEC_MKA_CAK_FLAGS,
|
||||
PROP_MKA_CAK_FLAGS,
|
||||
NMSettingMacsecPrivate,
|
||||
mka_cak_flags);
|
||||
|
||||
/**
|
||||
* NMSettingMacsec:mka-ckn:
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ struct _NMSettingSriov {
|
|||
NMSetting parent;
|
||||
GPtrArray *vfs;
|
||||
guint total_vfs;
|
||||
NMTernary autoprobe_drivers;
|
||||
int autoprobe_drivers;
|
||||
};
|
||||
|
||||
struct _NMSettingSriovClass {
|
||||
|
|
@ -1147,11 +1147,8 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
|||
(NMUtilsCopyFunc) nm_sriov_vf_dup,
|
||||
(GDestroyNotify) nm_sriov_vf_unref));
|
||||
break;
|
||||
case PROP_AUTOPROBE_DRIVERS:
|
||||
g_value_set_enum(value, self->autoprobe_drivers);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
_nm_setting_property_get_property_direct(object, prop_id, value, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1171,11 +1168,8 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
|
|||
(NMUtilsCopyFunc) nm_sriov_vf_dup,
|
||||
(GDestroyNotify) nm_sriov_vf_unref);
|
||||
break;
|
||||
case PROP_AUTOPROBE_DRIVERS:
|
||||
self->autoprobe_drivers = g_value_get_enum(value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
_nm_setting_property_set_property_direct(object, prop_id, value, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1186,8 +1180,6 @@ static void
|
|||
nm_setting_sriov_init(NMSettingSriov *setting)
|
||||
{
|
||||
setting->vfs = g_ptr_array_new_with_free_func((GDestroyNotify) nm_sriov_vf_unref);
|
||||
|
||||
setting->autoprobe_drivers = NM_TERNARY_DEFAULT;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1335,13 +1327,13 @@ nm_setting_sriov_class_init(NMSettingSriovClass *klass)
|
|||
* example: SRIOV_AUTOPROBE_DRIVERS=0,1
|
||||
* ---end---
|
||||
*/
|
||||
obj_properties[PROP_AUTOPROBE_DRIVERS] = g_param_spec_enum(
|
||||
NM_SETTING_SRIOV_AUTOPROBE_DRIVERS,
|
||||
"",
|
||||
"",
|
||||
NM_TYPE_TERNARY,
|
||||
NM_TERNARY_DEFAULT,
|
||||
NM_SETTING_PARAM_FUZZY_IGNORE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_setting_property_define_direct_ternary_enum(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_SRIOV_AUTOPROBE_DRIVERS,
|
||||
PROP_AUTOPROBE_DRIVERS,
|
||||
NM_SETTING_PARAM_FUZZY_IGNORE,
|
||||
NMSettingSriov,
|
||||
autoprobe_drivers);
|
||||
|
||||
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ typedef struct {
|
|||
char *generate_mac_address_mask;
|
||||
char *s390_nettype;
|
||||
char *wol_password;
|
||||
int accept_all_mac_addresses;
|
||||
NMSettingWiredWakeOnLan wol;
|
||||
NMTernary accept_all_mac_addresses;
|
||||
guint32 speed;
|
||||
guint32 mtu;
|
||||
bool auto_negotiate;
|
||||
|
|
@ -1050,11 +1050,8 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
|||
case PROP_WAKE_ON_LAN_PASSWORD:
|
||||
g_value_set_string(value, priv->wol_password);
|
||||
break;
|
||||
case PROP_ACCEPT_ALL_MAC_ADDRESSES:
|
||||
g_value_set_enum(value, priv->accept_all_mac_addresses);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
_nm_setting_property_get_property_direct(object, prop_id, value, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1188,11 +1185,8 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
|
|||
g_free(priv->wol_password);
|
||||
priv->wol_password = g_value_dup_string(value);
|
||||
break;
|
||||
case PROP_ACCEPT_ALL_MAC_ADDRESSES:
|
||||
priv->accept_all_mac_addresses = g_value_get_enum(value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
_nm_setting_property_set_property_direct(object, prop_id, value, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1208,8 +1202,7 @@ nm_setting_wired_init(NMSettingWired *setting)
|
|||
priv->mac_address_blacklist = g_array_new(TRUE, FALSE, sizeof(char *));
|
||||
g_array_set_clear_func(priv->mac_address_blacklist, (GDestroyNotify) clear_blacklist_item);
|
||||
|
||||
priv->wol = NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT;
|
||||
priv->accept_all_mac_addresses = NM_TERNARY_DEFAULT;
|
||||
priv->wol = NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1724,13 +1717,13 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass)
|
|||
* description: Enforce the interface to accept all the packets.
|
||||
* ---end---
|
||||
*/
|
||||
obj_properties[PROP_ACCEPT_ALL_MAC_ADDRESSES] =
|
||||
g_param_spec_enum(NM_SETTING_WIRED_ACCEPT_ALL_MAC_ADDRESSES,
|
||||
"",
|
||||
"",
|
||||
NM_TYPE_TERNARY,
|
||||
NM_TERNARY_DEFAULT,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_setting_property_define_direct_ternary_enum(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_WIRED_ACCEPT_ALL_MAC_ADDRESSES,
|
||||
PROP_ACCEPT_ALL_MAC_ADDRESSES,
|
||||
NM_SETTING_PARAM_NONE,
|
||||
NMSettingWiredPrivate,
|
||||
accept_all_mac_addresses);
|
||||
|
||||
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
|
|
|
|||
|
|
@ -893,17 +893,17 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_FWMARK,
|
|||
PROP_PRIVATE_KEY_FLAGS, );
|
||||
|
||||
typedef struct {
|
||||
char *private_key;
|
||||
GPtrArray *peers_arr;
|
||||
GHashTable *peers_hash;
|
||||
NMSettingSecretFlags private_key_flags;
|
||||
NMTernary ip4_auto_default_route;
|
||||
NMTernary ip6_auto_default_route;
|
||||
guint32 fwmark;
|
||||
guint32 mtu;
|
||||
guint16 listen_port;
|
||||
bool peer_routes;
|
||||
bool private_key_valid : 1;
|
||||
char *private_key;
|
||||
GPtrArray *peers_arr;
|
||||
GHashTable *peers_hash;
|
||||
guint private_key_flags;
|
||||
int ip4_auto_default_route;
|
||||
int ip6_auto_default_route;
|
||||
guint32 fwmark;
|
||||
guint32 mtu;
|
||||
guint16 listen_port;
|
||||
bool peer_routes;
|
||||
bool private_key_valid : 1;
|
||||
} NMSettingWireGuardPrivate;
|
||||
|
||||
/**
|
||||
|
|
@ -2268,12 +2268,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
|||
case PROP_FWMARK:
|
||||
g_value_set_uint(value, priv->fwmark);
|
||||
break;
|
||||
case PROP_IP4_AUTO_DEFAULT_ROUTE:
|
||||
g_value_set_enum(value, priv->ip4_auto_default_route);
|
||||
break;
|
||||
case PROP_IP6_AUTO_DEFAULT_ROUTE:
|
||||
g_value_set_enum(value, priv->ip6_auto_default_route);
|
||||
break;
|
||||
case PROP_LISTEN_PORT:
|
||||
g_value_set_uint(value, priv->listen_port);
|
||||
break;
|
||||
|
|
@ -2286,11 +2280,8 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
|||
case PROP_PRIVATE_KEY:
|
||||
g_value_set_string(value, priv->private_key);
|
||||
break;
|
||||
case PROP_PRIVATE_KEY_FLAGS:
|
||||
g_value_set_flags(value, priv->private_key_flags);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
_nm_setting_property_get_property_direct(object, prop_id, value, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -2305,12 +2296,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
|
|||
case PROP_FWMARK:
|
||||
priv->fwmark = g_value_get_uint(value);
|
||||
break;
|
||||
case PROP_IP4_AUTO_DEFAULT_ROUTE:
|
||||
priv->ip4_auto_default_route = g_value_get_enum(value);
|
||||
break;
|
||||
case PROP_IP6_AUTO_DEFAULT_ROUTE:
|
||||
priv->ip6_auto_default_route = g_value_get_enum(value);
|
||||
break;
|
||||
case PROP_LISTEN_PORT:
|
||||
priv->listen_port = g_value_get_uint(value);
|
||||
break;
|
||||
|
|
@ -2334,11 +2319,8 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
|
|||
}
|
||||
}
|
||||
break;
|
||||
case PROP_PRIVATE_KEY_FLAGS:
|
||||
priv->private_key_flags = g_value_get_flags(value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
_nm_setting_property_set_property_direct(object, prop_id, value, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -2350,10 +2332,8 @@ nm_setting_wireguard_init(NMSettingWireGuard *setting)
|
|||
{
|
||||
NMSettingWireGuardPrivate *priv = NM_SETTING_WIREGUARD_GET_PRIVATE(setting);
|
||||
|
||||
priv->peers_arr = g_ptr_array_new();
|
||||
priv->peers_hash = g_hash_table_new(nm_pstr_hash, nm_pstr_equal);
|
||||
priv->ip4_auto_default_route = NM_TERNARY_DEFAULT;
|
||||
priv->ip6_auto_default_route = NM_TERNARY_DEFAULT;
|
||||
priv->peers_arr = g_ptr_array_new();
|
||||
priv->peers_hash = g_hash_table_new(nm_pstr_hash, nm_pstr_equal);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2430,13 +2410,12 @@ nm_setting_wireguard_class_init(NMSettingWireGuardClass *klass)
|
|||
*
|
||||
* Since: 1.16
|
||||
**/
|
||||
obj_properties[PROP_PRIVATE_KEY_FLAGS] =
|
||||
g_param_spec_flags(NM_SETTING_WIREGUARD_PRIVATE_KEY_FLAGS,
|
||||
"",
|
||||
"",
|
||||
NM_TYPE_SETTING_SECRET_FLAGS,
|
||||
NM_SETTING_SECRET_FLAG_NONE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_setting_property_define_direct_secret_flags(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_WIREGUARD_PRIVATE_KEY_FLAGS,
|
||||
PROP_PRIVATE_KEY_FLAGS,
|
||||
NMSettingWireGuardPrivate,
|
||||
private_key_flags);
|
||||
|
||||
/**
|
||||
* NMSettingWireGuard:fwmark:
|
||||
|
|
@ -2542,13 +2521,13 @@ nm_setting_wireguard_class_init(NMSettingWireGuardClass *klass)
|
|||
*
|
||||
* Since: 1.20
|
||||
**/
|
||||
obj_properties[PROP_IP4_AUTO_DEFAULT_ROUTE] = g_param_spec_enum(
|
||||
NM_SETTING_WIREGUARD_IP4_AUTO_DEFAULT_ROUTE,
|
||||
"",
|
||||
"",
|
||||
NM_TYPE_TERNARY,
|
||||
NM_TERNARY_DEFAULT,
|
||||
NM_SETTING_PARAM_FUZZY_IGNORE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_setting_property_define_direct_ternary_enum(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_WIREGUARD_IP4_AUTO_DEFAULT_ROUTE,
|
||||
PROP_IP4_AUTO_DEFAULT_ROUTE,
|
||||
NM_SETTING_PARAM_FUZZY_IGNORE,
|
||||
NMSettingWireGuardPrivate,
|
||||
ip4_auto_default_route);
|
||||
|
||||
/**
|
||||
* NMSettingWireGuard:ip6-auto-default-route:
|
||||
|
|
@ -2557,13 +2536,13 @@ nm_setting_wireguard_class_init(NMSettingWireGuardClass *klass)
|
|||
*
|
||||
* Since: 1.20
|
||||
**/
|
||||
obj_properties[PROP_IP6_AUTO_DEFAULT_ROUTE] = g_param_spec_enum(
|
||||
NM_SETTING_WIREGUARD_IP6_AUTO_DEFAULT_ROUTE,
|
||||
"",
|
||||
"",
|
||||
NM_TYPE_TERNARY,
|
||||
NM_TERNARY_DEFAULT,
|
||||
NM_SETTING_PARAM_FUZZY_IGNORE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_setting_property_define_direct_ternary_enum(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_WIREGUARD_IP6_AUTO_DEFAULT_ROUTE,
|
||||
PROP_IP6_AUTO_DEFAULT_ROUTE,
|
||||
NM_SETTING_PARAM_FUZZY_IGNORE,
|
||||
NMSettingWireGuardPrivate,
|
||||
ip6_auto_default_route);
|
||||
|
||||
/* ---dbus---
|
||||
* property: peers
|
||||
|
|
|
|||
|
|
@ -74,9 +74,9 @@ typedef struct {
|
|||
char *wep_key2;
|
||||
char *wep_key3;
|
||||
char *psk;
|
||||
NMSettingSecretFlags leap_password_flags;
|
||||
NMSettingSecretFlags wep_key_flags;
|
||||
NMSettingSecretFlags psk_flags;
|
||||
guint leap_password_flags;
|
||||
guint wep_key_flags;
|
||||
guint psk_flags;
|
||||
NMSettingWirelessSecurityPmf pmf;
|
||||
NMWepKeyType wep_key_type;
|
||||
NMSettingWirelessSecurityWpsMethod wps_method;
|
||||
|
|
@ -1350,21 +1350,12 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
|||
case PROP_WEP_KEY3:
|
||||
g_value_set_string(value, priv->wep_key3);
|
||||
break;
|
||||
case PROP_WEP_KEY_FLAGS:
|
||||
g_value_set_flags(value, priv->wep_key_flags);
|
||||
break;
|
||||
case PROP_PSK:
|
||||
g_value_set_string(value, priv->psk);
|
||||
break;
|
||||
case PROP_PSK_FLAGS:
|
||||
g_value_set_flags(value, priv->psk_flags);
|
||||
break;
|
||||
case PROP_LEAP_PASSWORD:
|
||||
g_value_set_string(value, priv->leap_password);
|
||||
break;
|
||||
case PROP_LEAP_PASSWORD_FLAGS:
|
||||
g_value_set_flags(value, priv->leap_password_flags);
|
||||
break;
|
||||
case PROP_WEP_KEY_TYPE:
|
||||
g_value_set_enum(value, priv->wep_key_type);
|
||||
break;
|
||||
|
|
@ -1375,7 +1366,7 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
|||
g_value_set_int(value, nm_setting_wireless_security_get_fils(setting));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
_nm_setting_property_get_property_direct(object, prop_id, value, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1436,23 +1427,14 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
|
|||
nm_free_secret(priv->wep_key3);
|
||||
priv->wep_key3 = g_value_dup_string(value);
|
||||
break;
|
||||
case PROP_WEP_KEY_FLAGS:
|
||||
priv->wep_key_flags = g_value_get_flags(value);
|
||||
break;
|
||||
case PROP_PSK:
|
||||
nm_free_secret(priv->psk);
|
||||
priv->psk = g_value_dup_string(value);
|
||||
break;
|
||||
case PROP_PSK_FLAGS:
|
||||
priv->psk_flags = g_value_get_flags(value);
|
||||
break;
|
||||
case PROP_LEAP_PASSWORD:
|
||||
nm_free_secret(priv->leap_password);
|
||||
priv->leap_password = g_value_dup_string(value);
|
||||
break;
|
||||
case PROP_LEAP_PASSWORD_FLAGS:
|
||||
priv->leap_password_flags = g_value_get_flags(value);
|
||||
break;
|
||||
case PROP_WEP_KEY_TYPE:
|
||||
priv->wep_key_type = g_value_get_enum(value);
|
||||
break;
|
||||
|
|
@ -1463,7 +1445,7 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
|
|||
priv->fils = g_value_get_int(value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
_nm_setting_property_set_property_direct(object, prop_id, value, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1811,13 +1793,12 @@ nm_setting_wireless_security_class_init(NMSettingWirelessSecurityClass *klass)
|
|||
* description: Password flags for KEY<i>, KEY_PASSPHRASE<i> password.
|
||||
* ---end---
|
||||
*/
|
||||
obj_properties[PROP_WEP_KEY_FLAGS] =
|
||||
g_param_spec_flags(NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS,
|
||||
"",
|
||||
"",
|
||||
NM_TYPE_SETTING_SECRET_FLAGS,
|
||||
NM_SETTING_SECRET_FLAG_NONE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_setting_property_define_direct_secret_flags(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS,
|
||||
PROP_WEP_KEY_FLAGS,
|
||||
NMSettingWirelessSecurityPrivate,
|
||||
wep_key_flags);
|
||||
|
||||
/**
|
||||
* NMSettingWirelessSecurity:psk:
|
||||
|
|
@ -1855,12 +1836,12 @@ nm_setting_wireless_security_class_init(NMSettingWirelessSecurityClass *klass)
|
|||
* example: WPA_PSK_FLAGS=user
|
||||
* ---end---
|
||||
*/
|
||||
obj_properties[PROP_PSK_FLAGS] = g_param_spec_flags(NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS,
|
||||
"",
|
||||
"",
|
||||
NM_TYPE_SETTING_SECRET_FLAGS,
|
||||
NM_SETTING_SECRET_FLAG_NONE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_setting_property_define_direct_secret_flags(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS,
|
||||
PROP_PSK_FLAGS,
|
||||
NMSettingWirelessSecurityPrivate,
|
||||
psk_flags);
|
||||
|
||||
/**
|
||||
* NMSettingWirelessSecurity:leap-password:
|
||||
|
|
@ -1895,13 +1876,13 @@ nm_setting_wireless_security_class_init(NMSettingWirelessSecurityClass *klass)
|
|||
* description: Password flags for IEEE_8021X_PASSWORD_FLAGS.
|
||||
* ---end---
|
||||
*/
|
||||
obj_properties[PROP_LEAP_PASSWORD_FLAGS] =
|
||||
g_param_spec_flags(NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS,
|
||||
"",
|
||||
"",
|
||||
NM_TYPE_SETTING_SECRET_FLAGS,
|
||||
NM_SETTING_SECRET_FLAG_NONE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_setting_property_define_direct_secret_flags(
|
||||
properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS,
|
||||
PROP_LEAP_PASSWORD_FLAGS,
|
||||
NMSettingWirelessSecurityPrivate,
|
||||
leap_password_flags);
|
||||
|
||||
/**
|
||||
* NMSettingWirelessSecurity:wep-key-type:
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ typedef struct {
|
|||
char *device_mac_address;
|
||||
char *cloned_mac_address;
|
||||
char *generate_mac_address_mask;
|
||||
int ap_isolation;
|
||||
NMSettingMacRandomization mac_address_randomization;
|
||||
NMTernary ap_isolation;
|
||||
guint32 channel;
|
||||
guint32 rate;
|
||||
guint32 tx_power;
|
||||
|
|
@ -1199,9 +1199,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
|||
case PROP_WAKE_ON_WLAN:
|
||||
g_value_set_uint(value, nm_setting_wireless_get_wake_on_wlan(setting));
|
||||
break;
|
||||
case PROP_AP_ISOLATION:
|
||||
g_value_set_enum(value, priv->ap_isolation);
|
||||
break;
|
||||
default:
|
||||
_nm_setting_property_get_property_direct(object, prop_id, value, pspec);
|
||||
break;
|
||||
|
|
@ -1294,9 +1291,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
|
|||
case PROP_WAKE_ON_WLAN:
|
||||
priv->wowl = g_value_get_uint(value);
|
||||
break;
|
||||
case PROP_AP_ISOLATION:
|
||||
priv->ap_isolation = g_value_get_enum(value);
|
||||
break;
|
||||
default:
|
||||
_nm_setting_property_set_property_direct(object, prop_id, value, pspec);
|
||||
break;
|
||||
|
|
@ -1314,8 +1308,7 @@ nm_setting_wireless_init(NMSettingWireless *setting)
|
|||
priv->mac_address_blacklist = g_array_new(TRUE, FALSE, sizeof(char *));
|
||||
g_array_set_clear_func(priv->mac_address_blacklist, (GDestroyNotify) clear_blacklist_item);
|
||||
|
||||
priv->wowl = NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT;
|
||||
priv->ap_isolation = NM_TERNARY_DEFAULT;
|
||||
priv->wowl = NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1924,13 +1917,13 @@ nm_setting_wireless_class_init(NMSettingWirelessClass *klass)
|
|||
* description: Whether AP isolation is enabled
|
||||
* ---end---
|
||||
*/
|
||||
obj_properties[PROP_AP_ISOLATION] = g_param_spec_enum(
|
||||
NM_SETTING_WIRELESS_AP_ISOLATION,
|
||||
"",
|
||||
"",
|
||||
NM_TYPE_TERNARY,
|
||||
NM_TERNARY_DEFAULT,
|
||||
NM_SETTING_PARAM_FUZZY_IGNORE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_setting_property_define_direct_ternary_enum(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_WIRELESS_AP_ISOLATION,
|
||||
PROP_AP_ISOLATION,
|
||||
NM_SETTING_PARAM_FUZZY_IGNORE,
|
||||
NMSettingWirelessPrivate,
|
||||
ap_isolation);
|
||||
|
||||
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
|
|
|
|||
|
|
@ -409,21 +409,7 @@ _nm_setting_class_commit(NMSettingClass *setting_class,
|
|||
.compare_fcn = _nm_setting_property_compare_fcn_default,
|
||||
.from_dbus_fcn = _nm_setting_property_from_dbus_fcn_gprop,
|
||||
.from_dbus_is_full = TRUE);
|
||||
else if (g_type_is_a(vtype, G_TYPE_ENUM)) {
|
||||
p->property_type = NM_SETT_INFO_PROPERT_TYPE_GPROP(
|
||||
G_VARIANT_TYPE_INT32,
|
||||
.typdata_to_dbus.gprop_type = NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_ENUM,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default,
|
||||
.from_dbus_fcn = _nm_setting_property_from_dbus_fcn_gprop,
|
||||
.from_dbus_is_full = TRUE);
|
||||
} else if (g_type_is_a(vtype, G_TYPE_FLAGS)) {
|
||||
p->property_type = NM_SETT_INFO_PROPERT_TYPE_GPROP(
|
||||
G_VARIANT_TYPE_UINT32,
|
||||
.typdata_to_dbus.gprop_type = NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_FLAGS,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default,
|
||||
.from_dbus_fcn = _nm_setting_property_from_dbus_fcn_gprop,
|
||||
.from_dbus_is_full = TRUE);
|
||||
} else
|
||||
else
|
||||
nm_assert_not_reached();
|
||||
|
||||
has_property_type:
|
||||
|
|
@ -1209,10 +1195,6 @@ _nm_setting_property_to_dbus_fcn_gprop(_NM_SETT_INFO_PROP_TO_DBUS_FCN_ARGS _nm_n
|
|||
switch (property_info->property_type->typdata_to_dbus.gprop_type) {
|
||||
case NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_DEFAULT:
|
||||
return g_dbus_gvalue_to_gvariant(&prop_value, property_info->property_type->dbus_type);
|
||||
case NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_ENUM:
|
||||
return nm_g_variant_maybe_singleton_i(g_value_get_enum(&prop_value));
|
||||
case NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_FLAGS:
|
||||
return g_variant_new_uint32(g_value_get_flags(&prop_value));
|
||||
case NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_GARRAY_UINT:
|
||||
G_STATIC_ASSERT_EXPR(sizeof(guint) == sizeof(guint32));
|
||||
nm_assert(G_VALUE_HOLDS(&prop_value, G_TYPE_ARRAY));
|
||||
|
|
|
|||
|
|
@ -4589,12 +4589,6 @@ test_setting_metadata(void)
|
|||
} else if (sip->property_type->to_dbus_fcn == _nm_setting_property_to_dbus_fcn_gprop) {
|
||||
g_assert(sip->param_spec);
|
||||
switch (sip->property_type->typdata_to_dbus.gprop_type) {
|
||||
case NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_ENUM:
|
||||
g_assert(g_type_is_a(sip->param_spec->value_type, G_TYPE_ENUM));
|
||||
goto check_done;
|
||||
case NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_FLAGS:
|
||||
g_assert(g_type_is_a(sip->param_spec->value_type, G_TYPE_FLAGS));
|
||||
goto check_done;
|
||||
case NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_GARRAY_UINT:
|
||||
g_assert(sip->param_spec->value_type == G_TYPE_ARRAY);
|
||||
goto check_done;
|
||||
|
|
|
|||
|
|
@ -660,8 +660,6 @@ const NMSettInfoSetting *nmtst_sett_info_settings(void);
|
|||
|
||||
typedef enum _nm_packed {
|
||||
NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_DEFAULT = 0,
|
||||
NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_ENUM,
|
||||
NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_FLAGS,
|
||||
NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_GARRAY_UINT,
|
||||
NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_STRDICT,
|
||||
} NMSettingPropertyToDBusFcnGPropType;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue