mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-02 03:00:37 +01:00
merge: branch 'lr/wpan-channel'
https://github.com/NetworkManager/NetworkManager/pull/209
This commit is contained in:
commit
fb2ae67da6
12 changed files with 249 additions and 27 deletions
|
|
@ -992,8 +992,10 @@ usage_connection_add (void)
|
|||
" [source-port-min <0-65535>]\n"
|
||||
" [source-port-max <0-65535>]\n"
|
||||
" [destination-port <0-65535>]\n\n"
|
||||
" wpan: [short-addr <0x0000-0xffff>]\n\n"
|
||||
" [pan-id <0x0000-0xffff>]\n\n"
|
||||
" wpan: [short-addr <0x0000-0xffff>]\n"
|
||||
" [pan-id <0x0000-0xffff>]\n"
|
||||
" [page <default|0-31>]\n"
|
||||
" [channel <default|0-26>]\n"
|
||||
" [mac <MAC address>]\n\n"
|
||||
" 6lowpan: dev <parent device (connection UUID, ifname, or MAC)>\n"
|
||||
" dummy:\n\n"
|
||||
|
|
|
|||
|
|
@ -7827,6 +7827,34 @@ static const NMMetaPropertyInfo *const property_infos_WPAN[] = {
|
|||
),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_WPAN_PAGE,
|
||||
.is_cli_option = TRUE,
|
||||
.property_alias = "page",
|
||||
.prompt = N_("Page (<default|0-31>)"),
|
||||
.property_type = &_pt_gobject_int,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, \
|
||||
.value_infos = INT_VALUE_INFOS (
|
||||
{
|
||||
.value = NM_SETTING_WPAN_PAGE_DEFAULT,
|
||||
.nick = "default",
|
||||
}
|
||||
),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_WPAN_CHANNEL,
|
||||
.is_cli_option = TRUE,
|
||||
.property_alias = "channel",
|
||||
.prompt = N_("Channel (<default|0-26>)"),
|
||||
.property_type = &_pt_gobject_int,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, \
|
||||
.value_infos = INT_VALUE_INFOS (
|
||||
{
|
||||
.value = NM_SETTING_WPAN_CHANNEL_DEFAULT,
|
||||
.nick = "default",
|
||||
}
|
||||
),
|
||||
),
|
||||
),
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -359,6 +359,8 @@
|
|||
#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_NETWORK_NAME N_("Network Service Provider (NSP) name of the WiMAX network this connection should use. Deprecated: 1")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WPAN_CHANNEL N_("IEEE 802.15.4 channel. A positive integer or -1, meaning \"do not set, use whatever the device is already set to\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WPAN_MAC_ADDRESS N_("If specified, this connection will only apply to the IEEE 802.15.4 (WPAN) MAC layer device whose permanent MAC address matches.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WPAN_PAGE N_("IEEE 802.15.4 channel page. A positive integer or -1, meaning \"do not set, use whatever the device is already set to\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WPAN_PAN_ID N_("IEEE 802.15.4 Personal Area Network (PAN) identifier.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WPAN_SHORT_ADDRESS N_("Short IEEE 802.15.4 address to be used within a restricted environment.")
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ our $indent;
|
|||
sub new_hunk
|
||||
{
|
||||
$type = undef;
|
||||
$indent = "";
|
||||
$indent = undef;
|
||||
}
|
||||
|
||||
sub new_file
|
||||
|
|
@ -93,7 +93,7 @@ if ($is_patch) {
|
|||
new_file ($2);
|
||||
next;
|
||||
}
|
||||
/^([ \+])(.*)/ or next;
|
||||
s/^([ \+])(.*)/$2/ or next;
|
||||
$line_no++;
|
||||
$check_line = $1 eq '+';
|
||||
$line = $2;
|
||||
|
|
@ -133,17 +133,25 @@ complain ("Don't use \"unsigned int\" but just use \"unsigned\"") if $line =~ /\
|
|||
complain ("Please use LGPL2+ for new files") if $is_patch and $line =~ /under the terms of the GNU General Public License/;
|
||||
complain ("Don't use space inside elvis operator ?:") if $line =~ /\?[\t ]+:/;
|
||||
|
||||
new_hunk if $_ eq '';
|
||||
my ($this_indent) = /^(\s*)/;
|
||||
if (defined $indent) {
|
||||
my $this_tabs_before_spaces = length $1 if $this_indent =~ /^(\t*) +/;
|
||||
my $tabs_before_spaces = length $1 if $indent =~ /^(\t*) +/;
|
||||
|
||||
complain ("Bad indentation")
|
||||
if $this_indent =~ /^$indent\t+ +/
|
||||
or (defined $tabs_before_spaces and defined $this_tabs_before_spaces
|
||||
and $this_tabs_before_spaces < $tabs_before_spaces);
|
||||
}
|
||||
$indent = $this_indent;
|
||||
|
||||
# Further on we process stuff without comments.
|
||||
$_ = $line;
|
||||
s/\s*\/\*.*\*\///;
|
||||
s/\s*\/\*.*//;
|
||||
s/\s*\/\/.*//;
|
||||
/^\s* \* / and next;
|
||||
new_hunk if $_ eq '';
|
||||
|
||||
my ($this_indent) = /^(\s*)/;
|
||||
complain ('Bad indentation') if $this_indent =~ /^$indent\t+ +/;
|
||||
$indent = $this_indent;
|
||||
|
||||
if (/^typedef*/) {
|
||||
# We expect the { on the same line as the typedef. Otherwise it
|
||||
|
|
|
|||
|
|
@ -26,22 +26,34 @@
|
|||
#include "nm-setting-private.h"
|
||||
#include "nm-utils-private.h"
|
||||
|
||||
/* Ideally we'll be able to get this from a public header. */
|
||||
/* Ideally we'll be able to get these from a public header. */
|
||||
#ifndef IEEE802154_ADDR_LEN
|
||||
#define IEEE802154_ADDR_LEN 8
|
||||
#endif
|
||||
|
||||
#ifndef IEEE802154_MAX_PAGE
|
||||
#define IEEE802154_MAX_PAGE 31
|
||||
#endif
|
||||
|
||||
#ifndef IEEE802154_MAX_CHANNEL
|
||||
#define IEEE802154_MAX_CHANNEL 26
|
||||
#endif
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_MAC_ADDRESS,
|
||||
PROP_PAN_ID,
|
||||
PROP_SHORT_ADDRESS,
|
||||
PROP_PAGE,
|
||||
PROP_CHANNEL,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char *mac_address;
|
||||
guint16 pan_id;
|
||||
guint16 short_address;
|
||||
gint16 page;
|
||||
gint16 channel;
|
||||
} NMSettingWpanPrivate;
|
||||
|
||||
/**
|
||||
|
|
@ -117,6 +129,38 @@ nm_setting_wpan_get_short_address (NMSettingWpan *setting)
|
|||
return NM_SETTING_WPAN_GET_PRIVATE (setting)->short_address;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_wpan_get_page:
|
||||
* @setting: the #NMSettingWpan
|
||||
*
|
||||
* Returns: the #NMSettingWpan:page property of the setting
|
||||
*
|
||||
* Since: 1.16
|
||||
**/
|
||||
gint16
|
||||
nm_setting_wpan_get_page (NMSettingWpan *setting)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_WPAN (setting), NM_SETTING_WPAN_PAGE_DEFAULT);
|
||||
|
||||
return NM_SETTING_WPAN_GET_PRIVATE (setting)->page;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_wpan_get_channel:
|
||||
* @setting: the #NMSettingWpan
|
||||
*
|
||||
* Returns: the #NMSettingWpan:channel property of the setting
|
||||
*
|
||||
* Since: 1.16
|
||||
**/
|
||||
gint16
|
||||
nm_setting_wpan_get_channel (NMSettingWpan *setting)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_WPAN (setting), NM_SETTING_WPAN_CHANNEL_DEFAULT);
|
||||
|
||||
return NM_SETTING_WPAN_GET_PRIVATE (setting)->channel;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
verify (NMSetting *setting, NMConnection *connection, GError **error)
|
||||
{
|
||||
|
|
@ -131,6 +175,37 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if ((priv->page == NM_SETTING_WPAN_PAGE_DEFAULT) != (priv->channel == NM_SETTING_WPAN_CHANNEL_DEFAULT)) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("page must be defined along with a channel"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WPAN_SETTING_NAME, NM_SETTING_WPAN_PAGE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (priv->page < NM_SETTING_WPAN_PAGE_DEFAULT || priv->page > IEEE802154_MAX_PAGE) {
|
||||
g_set_error (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("page must be between %d and %d"),
|
||||
NM_SETTING_WPAN_PAGE_DEFAULT,
|
||||
IEEE802154_MAX_PAGE);
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WPAN_SETTING_NAME, NM_SETTING_WPAN_PAGE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (priv->channel < NM_SETTING_WPAN_CHANNEL_DEFAULT || priv->channel > IEEE802154_MAX_CHANNEL) {
|
||||
g_set_error (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("channel must not be between %d and %d"),
|
||||
NM_SETTING_WPAN_CHANNEL_DEFAULT,
|
||||
IEEE802154_MAX_CHANNEL);
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WPAN_SETTING_NAME, NM_SETTING_WPAN_CHANNEL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -149,6 +224,12 @@ get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
|||
case PROP_SHORT_ADDRESS:
|
||||
g_value_set_uint (value, nm_setting_wpan_get_short_address (setting));
|
||||
break;
|
||||
case PROP_PAGE:
|
||||
g_value_set_int (value, nm_setting_wpan_get_page (setting));
|
||||
break;
|
||||
case PROP_CHANNEL:
|
||||
g_value_set_int (value, nm_setting_wpan_get_channel (setting));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
|
@ -172,6 +253,12 @@ set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *p
|
|||
case PROP_SHORT_ADDRESS:
|
||||
priv->short_address = g_value_get_uint (value);
|
||||
break;
|
||||
case PROP_PAGE:
|
||||
priv->page = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_CHANNEL:
|
||||
priv->channel = g_value_get_int (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
|
@ -183,8 +270,10 @@ nm_setting_wpan_init (NMSettingWpan *setting)
|
|||
{
|
||||
NMSettingWpanPrivate *priv = NM_SETTING_WPAN_GET_PRIVATE (setting);
|
||||
|
||||
priv->short_address = G_MAXUINT16;
|
||||
priv->pan_id = G_MAXUINT16;
|
||||
priv->short_address = G_MAXUINT16;
|
||||
priv->page = NM_SETTING_WPAN_PAGE_DEFAULT;
|
||||
priv->channel = NM_SETTING_WPAN_CHANNEL_DEFAULT;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -240,11 +329,11 @@ nm_setting_wpan_class_init (NMSettingWpanClass *klass)
|
|||
* ---end---
|
||||
*/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_MAC_ADDRESS,
|
||||
g_param_spec_string (NM_SETTING_WPAN_MAC_ADDRESS, "", "",
|
||||
NULL,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
(object_class, PROP_MAC_ADDRESS,
|
||||
g_param_spec_string (NM_SETTING_WPAN_MAC_ADDRESS, "", "",
|
||||
NULL,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMSettingWpan:pan-id:
|
||||
|
|
@ -252,11 +341,11 @@ nm_setting_wpan_class_init (NMSettingWpanClass *klass)
|
|||
* IEEE 802.15.4 Personal Area Network (PAN) identifier.
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_PAN_ID,
|
||||
g_param_spec_uint (NM_SETTING_WPAN_PAN_ID, "", "",
|
||||
0, G_MAXUINT16, G_MAXUINT16,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
(object_class, PROP_PAN_ID,
|
||||
g_param_spec_uint (NM_SETTING_WPAN_PAN_ID, "", "",
|
||||
0, G_MAXUINT16, G_MAXUINT16,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMSettingWpan:short-address:
|
||||
|
|
@ -264,11 +353,45 @@ nm_setting_wpan_class_init (NMSettingWpanClass *klass)
|
|||
* Short IEEE 802.15.4 address to be used within a restricted environment.
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_SHORT_ADDRESS,
|
||||
g_param_spec_uint (NM_SETTING_WPAN_SHORT_ADDRESS, "", "",
|
||||
0, G_MAXUINT16, G_MAXUINT16,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
(object_class, PROP_SHORT_ADDRESS,
|
||||
g_param_spec_uint (NM_SETTING_WPAN_SHORT_ADDRESS, "", "",
|
||||
0, G_MAXUINT16, G_MAXUINT16,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMSettingWpan:page:
|
||||
*
|
||||
* IEEE 802.15.4 channel page. A positive integer or -1, meaning "do not
|
||||
* set, use whatever the device is already set to".
|
||||
*
|
||||
* Since: 1.16
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_PAGE,
|
||||
g_param_spec_int (NM_SETTING_WPAN_PAGE, "", "",
|
||||
G_MININT16,
|
||||
G_MAXINT16,
|
||||
NM_SETTING_WPAN_PAGE_DEFAULT,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMSettingWpan:channel:
|
||||
*
|
||||
* IEEE 802.15.4 channel. A positive integer or -1, meaning "do not
|
||||
* set, use whatever the device is already set to".
|
||||
*
|
||||
* Since: 1.16
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_CHANNEL,
|
||||
g_param_spec_int (NM_SETTING_WPAN_CHANNEL, "", "",
|
||||
G_MININT16,
|
||||
G_MAXINT16,
|
||||
NM_SETTING_WPAN_CHANNEL_DEFAULT,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
_nm_setting_class_commit (setting_class, NM_META_SETTING_TYPE_WPAN);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,11 @@ G_BEGIN_DECLS
|
|||
#define NM_SETTING_WPAN_MAC_ADDRESS "mac-address"
|
||||
#define NM_SETTING_WPAN_PAN_ID "pan-id"
|
||||
#define NM_SETTING_WPAN_SHORT_ADDRESS "short-address"
|
||||
#define NM_SETTING_WPAN_PAGE "page"
|
||||
#define NM_SETTING_WPAN_CHANNEL "channel"
|
||||
|
||||
#define NM_SETTING_WPAN_PAGE_DEFAULT -1
|
||||
#define NM_SETTING_WPAN_CHANNEL_DEFAULT -1
|
||||
|
||||
typedef struct _NMSettingWpanClass NMSettingWpanClass;
|
||||
|
||||
|
|
@ -53,6 +58,10 @@ NM_AVAILABLE_IN_1_14
|
|||
guint16 nm_setting_wpan_get_pan_id (NMSettingWpan *setting);
|
||||
NM_AVAILABLE_IN_1_14
|
||||
guint16 nm_setting_wpan_get_short_address (NMSettingWpan *setting);
|
||||
NM_AVAILABLE_IN_1_16
|
||||
gint16 nm_setting_wpan_get_page (NMSettingWpan *setting);
|
||||
NM_AVAILABLE_IN_1_16
|
||||
gint16 nm_setting_wpan_get_channel (NMSettingWpan *setting);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
|||
NMPlatform *platform;
|
||||
guint16 pan_id;
|
||||
guint16 short_address;
|
||||
gint16 page, channel;
|
||||
int ifindex;
|
||||
const guint8 *hwaddr;
|
||||
gsize hwaddr_len = 0;
|
||||
|
|
@ -182,9 +183,18 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
|||
}
|
||||
}
|
||||
|
||||
channel = nm_setting_wpan_get_channel (s_wpan);
|
||||
if (channel != NM_SETTING_WPAN_CHANNEL_DEFAULT) {
|
||||
page = nm_setting_wpan_get_page (s_wpan);
|
||||
if (!nm_platform_wpan_set_channel (platform, ifindex, page, channel)) {
|
||||
_LOGW (LOGD_DEVICE, "unable to set the channel");
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
out:
|
||||
nm_device_bring_up (device, TRUE, NULL);
|
||||
nm_device_bring_up (device, TRUE, NULL);
|
||||
|
||||
if (lowpan_device)
|
||||
nm_device_bring_up (lowpan_device, TRUE, NULL);
|
||||
|
|
|
|||
|
|
@ -6947,6 +6947,13 @@ wpan_set_short_addr (NMPlatform *platform, int ifindex, guint16 short_addr)
|
|||
return nm_wpan_utils_set_short_addr (wpan_data, short_addr);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
wpan_set_channel (NMPlatform *platform, int ifindex, guint8 page, guint8 channel)
|
||||
{
|
||||
WPAN_GET_WPAN_DATA (wpan_data, platform, ifindex, FALSE);
|
||||
return nm_wpan_utils_set_channel (wpan_data, page, channel);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
|
|
@ -8067,6 +8074,7 @@ nm_linux_platform_class_init (NMLinuxPlatformClass *klass)
|
|||
platform_class->wpan_set_pan_id = wpan_set_pan_id;
|
||||
platform_class->wpan_get_short_addr = wpan_get_short_addr;
|
||||
platform_class->wpan_set_short_addr = wpan_set_short_addr;
|
||||
platform_class->wpan_set_channel = wpan_set_channel;
|
||||
|
||||
platform_class->link_gre_add = link_gre_add;
|
||||
platform_class->link_ip6tnl_add = link_ip6tnl_add;
|
||||
|
|
|
|||
|
|
@ -3128,6 +3128,16 @@ nm_platform_wpan_set_short_addr (NMPlatform *self, int ifindex, guint16 short_ad
|
|||
return klass->wpan_set_short_addr (self, ifindex, short_addr);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_platform_wpan_set_channel (NMPlatform *self, int ifindex, guint8 page, guint8 channel)
|
||||
{
|
||||
_CHECK_SELF (self, klass, FALSE);
|
||||
|
||||
g_return_val_if_fail (ifindex > 0, FALSE);
|
||||
|
||||
return klass->wpan_set_channel (self, ifindex, page, channel);
|
||||
}
|
||||
|
||||
#define TO_STRING_DEV_BUF_SIZE (5+15+1)
|
||||
static const char *
|
||||
_to_string_dev (NMPlatform *self, int ifindex, char *buf, size_t size)
|
||||
|
|
|
|||
|
|
@ -927,6 +927,7 @@ typedef struct {
|
|||
gboolean (*wpan_set_pan_id) (NMPlatform *, int ifindex, guint16 pan_id);
|
||||
guint16 (*wpan_get_short_addr) (NMPlatform *, int ifindex);
|
||||
gboolean (*wpan_set_short_addr) (NMPlatform *, int ifindex, guint16 short_addr);
|
||||
gboolean (*wpan_set_channel) (NMPlatform *, int ifindex, guint8 page, guint8 channel);
|
||||
|
||||
gboolean (*object_delete) (NMPlatform *, const NMPObject *obj);
|
||||
|
||||
|
|
@ -1317,6 +1318,7 @@ guint16 nm_platform_wpan_get_pan_id (NMPlatform *platform, int ifindex
|
|||
gboolean nm_platform_wpan_set_pan_id (NMPlatform *platform, int ifindex, guint16 pan_id);
|
||||
guint16 nm_platform_wpan_get_short_addr (NMPlatform *platform, int ifindex);
|
||||
gboolean nm_platform_wpan_set_short_addr (NMPlatform *platform, int ifindex, guint16 short_addr);
|
||||
gboolean nm_platform_wpan_set_channel (NMPlatform *platform, int ifindex, guint8 page, guint8 channel);
|
||||
|
||||
void nm_platform_ip4_address_set_addr (NMPlatformIP4Address *addr, in_addr_t address, guint8 plen);
|
||||
const struct in6_addr *nm_platform_ip6_address_get_peer (const NMPlatformIP6Address *addr);
|
||||
|
|
|
|||
|
|
@ -243,6 +243,24 @@ nla_put_failure:
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_wpan_utils_set_channel (NMWpanUtils *self, guint8 page, guint8 channel)
|
||||
{
|
||||
nm_auto_nlmsg struct nl_msg *msg = NULL;
|
||||
int err;
|
||||
|
||||
g_return_val_if_fail (self != NULL, FALSE);
|
||||
|
||||
msg = nl802154_alloc_msg (self, NL802154_CMD_SET_CHANNEL, 0);
|
||||
NLA_PUT_U8 (msg, NL802154_ATTR_PAGE, page);
|
||||
NLA_PUT_U8 (msg, NL802154_ATTR_CHANNEL, channel);
|
||||
err = nl802154_send_and_recv (self, msg, NULL, NULL);
|
||||
return err >= 0;
|
||||
|
||||
nla_put_failure:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -44,4 +44,6 @@ gboolean nm_wpan_utils_set_pan_id (NMWpanUtils *self, guint16 pan_id);
|
|||
guint16 nm_wpan_utils_get_short_addr (NMWpanUtils *self);
|
||||
gboolean nm_wpan_utils_set_short_addr (NMWpanUtils *self, guint16 short_addr);
|
||||
|
||||
gboolean nm_wpan_utils_set_channel (NMWpanUtils *self, guint8 page, guint8 channel);
|
||||
|
||||
#endif /* __WPAN_UTILS_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue