1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// This file is part of linux-support. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-support/master/COPYRIGHT. No part of linux-support, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
// Copyright © 2020 The developers of linux-support. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-support/master/COPYRIGHT.
bitflags!
{
/// Wake-On-Lan options.
///
/// Strings are in the `ethtool_stringset::ETH_SS_WOL_MODES` string set.
pub(crate) struct WAKE: u32
{
/// Wake on PHY activity.
///
/// String set value is `phy`.
///
/// Ethtool setting is `p`.
const WAKE_PHY = WakeOnLanWhen::PHY.to_bitflag();
/// Wake on unicast messages.
///
/// String set value is `ucast`.
///
/// Ethtool setting is `u`.
const WAKE_UCAST = WakeOnLanWhen::UnicastMessages.to_bitflag();
/// Wake on multicast messages.
///
/// String set value is `mcast`.
///
/// Ethtool setting is `m`.
const WAKE_MCAST = WakeOnLanWhen::MulticastMessages.to_bitflag();
/// Wake on broadcast messages.
///
/// String set value is `bcast`.
///
/// Ethtool setting is `b`.
const WAKE_BCAST = WakeOnLanWhen::BroadcastMessages.to_bitflag();
/// Wake on ARP.
///
/// String set value is `arp`.
///
/// Ethtool setting is `a`.
const WAKE_ARP = WakeOnLanWhen::AddressResolutionProtocolPackets.to_bitflag();
/// Wake on MagicPacket™.
///
/// String set value is `magic`.
///
/// Ethtool setting is `g`.
const WAKE_MAGIC = WakeOnLanWhen::MagicPacket.to_bitflag();
/// Enable SecureOn™ password for MagicPacket™.
///
/// Only meaningful if `WAKE_MAGIC` is specified; the value of `ethtool_wolinfo.sopass` is valid.
///
/// String set value is `magicsecure`.
///
/// Ethtool setting is `s`.
const WAKE_MAGICSECURE = 1 << 6;
/// Wake on filter(s).
///
/// String set value is `filter`.
///
/// Ethtool setting is `f`.
const WAKE_FILTER = WakeOnLanWhen::Filters.to_bitflag();
}
}
impl WAKE
{
pub(crate) const WOL_MODE_COUNT: usize = 8;
#[inline(always)]
pub(crate) fn secure_on_magic_password_is_valid(self) -> bool
{
self.contains(WAKE::WAKE_MAGIC | WAKE::WAKE_MAGICSECURE)
}
}