Skip to content

Commit ff0567f

Browse files
committed
Update enums using latest NetworkManager documentation
Add new `NetworkManagerVersionInfoCapability`, `ClientPermission` and `ClientPermissionResult` enums. Update `DeviceType`, `DeviceStateReason` and `DeviceMetered` with new values. Thank you @diggit for bringins this to my attention. Closes #74
1 parent 7fb2d18 commit ff0567f

File tree

3 files changed

+170
-1
lines changed

3 files changed

+170
-1
lines changed

sdbus_async/networkmanager/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
BluetoothCapabilitiesFlags,
2727
CheckpointCreateFlags,
2828
CheckpointRollbackResult,
29+
ClientPermission,
30+
ClientPermissionResult,
2931
ConnectionMultiConnect,
3032
ConnectionType,
3133
ConnectivityState,
@@ -42,6 +44,7 @@
4244
NetworkManagerCapabilitiesFlags,
4345
NetworkManagerReloadFlags,
4446
NetworkManagerState,
47+
NetworkManagerVersionInfoCapability,
4548
RadioFlags,
4649
SecretAgentCapabilitiesFlags,
4750
SecretAgentGetSecretsFlags,
@@ -237,6 +240,8 @@
237240
'BluetoothCapabilitiesFlags',
238241
'CheckpointCreateFlags',
239242
'CheckpointRollbackResult',
243+
'ClientPermission',
244+
'ClientPermissionResult',
240245
'ConnectionMultiConnect',
241246
'ConnectionType',
242247
'ConnectivityState',
@@ -253,6 +258,7 @@
253258
'NetworkManagerCapabilitiesFlags',
254259
'NetworkManagerReloadFlags',
255260
'NetworkManagerState',
261+
'NetworkManagerVersionInfoCapability',
256262
'RadioFlags',
257263
'SecretAgentCapabilitiesFlags',
258264
'SecretAgentGetSecretsFlags',

sdbus_async/networkmanager/enums.py

Lines changed: 158 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,31 @@
2727
from enum import Enum, IntEnum, IntFlag
2828

2929

30+
class NetworkManagerVersionInfoCapability(IntEnum):
31+
"""The numeric values represent the bit index of the capability.
32+
33+
These capabilities can be queried in the ``version_info`` D-Bus property.
34+
35+
Since NetworkManager 1.42.
36+
"""
37+
38+
SYNC_ROUTE_WITH_TABLE = 0
39+
"""Contains the fix to a bug that caused that routes in table other
40+
than main were not removed on reapply nor on connection down.
41+
"""
42+
IP4_FORWARDING = 1
43+
"""Indicates that NetworkManager supports configuring per-device IPv4
44+
sysctl forwarding setting.
45+
46+
Since NetworkManager 1.54.
47+
"""
48+
SRIOV_PRESERVE_ON_DOWN = 2
49+
"""NetworkManager supports the "sriov.preserve-on-down" property.
50+
51+
Since NetworkManager 1.54.
52+
"""
53+
54+
3055
class NetworkManagerCapabilitiesFlags(IntFlag):
3156
"""NetworkManager loaded plugins.
3257
@@ -197,7 +222,7 @@ class DeviceType(IntEnum):
197222
WPAN = 27
198223
"""A IEEE 802.15.4 (WPAN) MAC Layer Device."""
199224
SIXLOWPAN = 28
200-
"""6LoWPAN interfac.e"""
225+
"""6LoWPAN interface."""
201226
WIREGUARD = 29
202227
"""A WireGuard interface."""
203228
WIFI_P2P = 30
@@ -215,6 +240,16 @@ class DeviceType(IntEnum):
215240
216241
Since NetworkManager 1.42.
217242
"""
243+
HSR = 33
244+
"""A HSR/PRP device.
245+
246+
Since NetworkManager 1.46.
247+
"""
248+
IPVLAN = 34
249+
"""A IPVLAN device.
250+
251+
Since NetworkManager 1.52.
252+
"""
218253

219254

220255
class DeviceCapabilitiesFlags(IntFlag):
@@ -618,6 +653,58 @@ class DeviceStateReason(IntEnum):
618653
"""Configuration of SR-IOV parameters failed."""
619654
PEER_NOT_FOUND = 67
620655
"""The Wi-Fi P2P peer could not be found."""
656+
DEVICE_HANDLER_FAILED = 68
657+
"""The device handler dispatcher returned an error.
658+
659+
Since NetworkManager 1.46.
660+
"""
661+
UNMANAGED_BY_DEFAULT = 69
662+
"""The device is unmanaged because the device type is unmanaged by default.
663+
664+
Since NetworkManager 1.48.
665+
"""
666+
UNMANAGED_EXTERNAL_DOWN = 70
667+
"""The device is unmanaged because it is an external device and is
668+
unconfigured (down or without addresses).
669+
670+
Since NetworkManager 1.48.
671+
"""
672+
UNMANAGED_LINK_NOT_INIT = 71
673+
"""The device is unmanaged because the link is not initialized by udev.
674+
675+
Since NetworkManager 1.48.
676+
"""
677+
UNMANAGED_QUITTING = 72
678+
"""The device is unmanaged because NetworkManager is quitting.
679+
680+
Since NetworkManager 1.48.
681+
"""
682+
UNMANAGED_SLEEPING = 73
683+
"""The device is unmanaged because networking is disabled or the system
684+
is suspended.
685+
686+
Since NetworkManager 1.48.
687+
"""
688+
UNMANAGED_USER_CONF = 74
689+
"""The device is unmanaged by user decision in NetworkManager.conf.
690+
691+
Since NetworkManager 1.48.
692+
"""
693+
UNMANAGED_USER_EXPLICIT = 75
694+
"""The device is unmanaged by explicit user decision.
695+
696+
Since NetworkManager 1.48.
697+
"""
698+
UNMANAGED_USER_SETTINGS = 76
699+
"""The device is unmanaged by user decision via settings plugin.
700+
701+
Since NetworkManager 1.48.
702+
"""
703+
UNMANAGED_USER_UDEV = 77
704+
"""The device is unmanaged via udev rule.
705+
706+
Since NetworkManager 1.48.
707+
"""
621708

622709

623710
class DeviceMetered(IntEnum):
@@ -863,6 +950,14 @@ class CheckpointCreateFlags(IntFlag):
863950
864951
Since NetworkManager 1.38.
865952
"""
953+
TRACK_INTERNAL_GLOBAL_DNS = 0x20
954+
"""during rollback, by default changes to global DNS via D-BUS interface
955+
are preserved. With this flag, the rollback reverts the global DNS changes
956+
made via D-Bus interface. Global DNS defined in [global-dns] section of
957+
NetworkManager.conf is not impacted by this flag.
958+
959+
Since NetworkManager 1.48.
960+
"""
866961

867962

868963
class CheckpointRollbackResult(IntEnum):
@@ -1102,6 +1197,68 @@ class DeviceInterfaceFlags(IntFlag):
11021197
"""
11031198

11041199

1200+
class ClientPermission(IntEnum):
1201+
"""Permissions that NetworkManager clients can obtain."""
1202+
1203+
NONE = 0
1204+
"""Unknown or no permission."""
1205+
ENABLE_DISABLE_NETWORK = 1
1206+
"""Controls whether networking can be globally enabled or disabled."""
1207+
DISABLE_WIFI = 2
1208+
"""Controls whether Wi-Fi can be globally enabled or disabled."""
1209+
DISABLE_WWAN = 3
1210+
"""Controls whether WWAN (3G) can be globally enabled or disabled."""
1211+
DISABLE_WIMAX = 4
1212+
"""Controls whether WiMAX can be globally enabled or disabled."""
1213+
SLEEP_WAKE = 5
1214+
"""Controls whether the client can ask NetworkManager to sleep and wake."""
1215+
NETWORK_CONTROL = 6
1216+
"""Controls whether networking connections can be started, stopped, and
1217+
changed.
1218+
"""
1219+
WIFI_SHARE_PROTECTED = 7
1220+
"""Controls whether a password protected Wi-Fi hotspot can be created."""
1221+
WIFI_SHARE_OPEN = 8
1222+
"""Controls whether an open Wi-Fi hotspot can be created."""
1223+
SETTINGS_MODIFY_SYSTEM = 9
1224+
"""Controls whether connections that are available to all users
1225+
can be modified.
1226+
"""
1227+
MODIFY_OWN = 10
1228+
"""Controls whether connections owned by the current user
1229+
can be modified.
1230+
"""
1231+
MODIFY_HOSTNAME = 11
1232+
"""Controls whether the persistent hostname can be changed."""
1233+
MODIFY_GLOBAL_DNS = 12
1234+
"""Modify persistent global DNS configuration."""
1235+
RELOAD = 13
1236+
"""Controls access to reload."""
1237+
CHECKPOINT_ROLLBACK = 14
1238+
"""Permission to create checkpoints."""
1239+
ENABLE_DISABLE_STATISTICS = 15
1240+
"""Controls whether device statistics can be globally enabled
1241+
or disabled.
1242+
"""
1243+
ENABLE_DISABLE_CONNECTIVITY_CHECK = 16
1244+
"""Controls whether connectivity check can be enabled or disabled."""
1245+
WIFI_SCAN = 17
1246+
"""Controls whether wifi scans can be performed."""
1247+
1248+
1249+
class ClientPermissionResult(IntEnum):
1250+
"""Indicate what authorizations and permissions required for permission."""
1251+
1252+
UNKNOWN = 0
1253+
"""Unknown or no authorization."""
1254+
YES = 1
1255+
"""Permission is available."""
1256+
AUTH = 2
1257+
"""Authorization is necessary before the permission is available."""
1258+
NO = 3
1259+
"""Permission to perform the operation is denied by system policy."""
1260+
1261+
11051262
class RadioFlags(IntFlag):
11061263
"""Flags related to radio interfaces.
11071264

sdbus_block/networkmanager/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
BluetoothCapabilitiesFlags,
2727
CheckpointCreateFlags,
2828
CheckpointRollbackResult,
29+
ClientPermission,
30+
ClientPermissionResult,
2931
ConnectionMultiConnect,
3032
ConnectionType,
3133
ConnectivityState,
@@ -42,6 +44,7 @@
4244
NetworkManagerCapabilitiesFlags,
4345
NetworkManagerReloadFlags,
4446
NetworkManagerState,
47+
NetworkManagerVersionInfoCapability,
4548
RadioFlags,
4649
SecretAgentCapabilitiesFlags,
4750
SecretAgentGetSecretsFlags,
@@ -237,6 +240,8 @@
237240
'BluetoothCapabilitiesFlags',
238241
'CheckpointCreateFlags',
239242
'CheckpointRollbackResult',
243+
'ClientPermission',
244+
'ClientPermissionResult',
240245
'ConnectionMultiConnect',
241246
'ConnectionType',
242247
'ConnectivityState',
@@ -253,6 +258,7 @@
253258
'NetworkManagerCapabilitiesFlags',
254259
'NetworkManagerReloadFlags',
255260
'NetworkManagerState',
261+
'NetworkManagerVersionInfoCapability',
256262
'RadioFlags',
257263
'SecretAgentCapabilitiesFlags',
258264
'SecretAgentGetSecretsFlags',

0 commit comments

Comments
 (0)