Add 1.16 Methods and Properties path definitions

This commit is contained in:
Christian Müller 2019-05-16 17:10:52 +02:00
parent 5c25f8b28d
commit 3eddf987a8
7 changed files with 162 additions and 60 deletions

View file

@ -9,15 +9,17 @@ import (
const ( const (
AccessPointInterface = NetworkManagerInterface + ".AccessPoint" AccessPointInterface = NetworkManagerInterface + ".AccessPoint"
AccessPointPropertyFlags = AccessPointInterface + ".Flags" /* Property */
AccessPointPropertyWPAFlags = AccessPointInterface + ".WpaFlags" AccessPointPropertyFlags = AccessPointInterface + ".Flags" // readable u
AccessPointPropertyRSNFlags = AccessPointInterface + ".RsnFlags" AccessPointPropertyWpaFlags = AccessPointInterface + ".WpaFlags" // readable u
AccessPointPropertySSID = AccessPointInterface + ".Ssid" AccessPointPropertyRsnFlags = AccessPointInterface + ".RsnFlags" // readable u
AccessPointPropertyFrequency = AccessPointInterface + ".Frequency" AccessPointPropertySsid = AccessPointInterface + ".Ssid" // readable ay
AccessPointPropertyHWAddress = AccessPointInterface + ".HwAddress" AccessPointPropertyFrequency = AccessPointInterface + ".Frequency" // readable u
AccessPointPropertyMode = AccessPointInterface + ".Mode" AccessPointPropertyHwAddress = AccessPointInterface + ".HwAddress" // readable s
AccessPointPropertyMaxBitrate = AccessPointInterface + ".MaxBitrate" AccessPointPropertyMode = AccessPointInterface + ".Mode" // readable u
AccessPointPropertyStrength = AccessPointInterface + ".Strength" AccessPointPropertyMaxBitrate = AccessPointInterface + ".MaxBitrate" // readable u
AccessPointPropertyStrength = AccessPointInterface + ".Strength" // readable y
AccessPointPropertyLastSeen = AccessPointInterface + ".LastSeen" // readable i
) )
type AccessPoint interface { type AccessPoint interface {
@ -76,15 +78,15 @@ func (a *accessPoint) GetFlags() uint32 {
} }
func (a *accessPoint) GetWPAFlags() uint32 { func (a *accessPoint) GetWPAFlags() uint32 {
return a.getUint32Property(AccessPointPropertyWPAFlags) return a.getUint32Property(AccessPointPropertyWpaFlags)
} }
func (a *accessPoint) GetRSNFlags() uint32 { func (a *accessPoint) GetRSNFlags() uint32 {
return a.getUint32Property(AccessPointPropertyRSNFlags) return a.getUint32Property(AccessPointPropertyRsnFlags)
} }
func (a *accessPoint) GetSSID() string { func (a *accessPoint) GetSSID() string {
return string(a.getSliceByteProperty(AccessPointPropertySSID)) return string(a.getSliceByteProperty(AccessPointPropertySsid))
} }
func (a *accessPoint) GetFrequency() uint32 { func (a *accessPoint) GetFrequency() uint32 {
@ -92,7 +94,7 @@ func (a *accessPoint) GetFrequency() uint32 {
} }
func (a *accessPoint) GetHWAddress() string { func (a *accessPoint) GetHWAddress() string {
return a.getStringProperty(AccessPointPropertyHWAddress) return a.getStringProperty(AccessPointPropertyHwAddress)
} }
func (a *accessPoint) GetMode() Nm80211Mode { func (a *accessPoint) GetMode() Nm80211Mode {

View file

@ -6,20 +6,24 @@ import (
const ( const (
ActiveConnectionInterface = NetworkManagerInterface + ".Connection.Active" ActiveConnectionInterface = NetworkManagerInterface + ".Connection.Active"
ActiveConnectionProperyConnection = ActiveConnectionInterface + ".Connection"
ActiveConnectionProperySpecificObject = ActiveConnectionInterface + ".SpecificObject" /* Property */
ActiveConnectionProperyID = ActiveConnectionInterface + ".Id" ActiveConnectionProperyConnection = ActiveConnectionInterface + ".Connection" // readable o
ActiveConnectionProperyUUID = ActiveConnectionInterface + ".Uuid" ActiveConnectionProperySpecificObject = ActiveConnectionInterface + ".SpecificObject" // readable o
ActiveConnectionProperyType = ActiveConnectionInterface + ".Type" ActiveConnectionProperyId = ActiveConnectionInterface + ".Id" // readable s
ActiveConnectionProperyDevices = ActiveConnectionInterface + ".Devices" ActiveConnectionProperyUuid = ActiveConnectionInterface + ".Uuid" // readable s
ActiveConnectionProperyState = ActiveConnectionInterface + ".State" ActiveConnectionProperyType = ActiveConnectionInterface + ".Type" // readable s
ActiveConnectionProperyStateFlags = ActiveConnectionInterface + ".StateFlags" ActiveConnectionProperyDevices = ActiveConnectionInterface + ".Devices" // readable ao
ActiveConnectionProperyDefault = ActiveConnectionInterface + ".Default" ActiveConnectionProperyState = ActiveConnectionInterface + ".State" // readable u
ActiveConnectionProperyIP4Config = ActiveConnectionInterface + ".Ip4Config" ActiveConnectionProperyStateFlags = ActiveConnectionInterface + ".StateFlags" // readable u
ActiveConnectionProperyDHCP4Config = ActiveConnectionInterface + ".Dhcp4Config" ActiveConnectionProperyDefault = ActiveConnectionInterface + ".Default" // readable b
ActiveConnectionProperyDefault6 = ActiveConnectionInterface + ".Default6" ActiveConnectionProperyIp4Config = ActiveConnectionInterface + ".Ip4Config" // readable o
ActiveConnectionProperyVPN = ActiveConnectionInterface + ".Vpn" ActiveConnectionProperyDhcp4Config = ActiveConnectionInterface + ".Dhcp4Config" // readable o
ActiveConnectionProperyMaster = ActiveConnectionInterface + ".Master" ActiveConnectionProperyDefault6 = ActiveConnectionInterface + ".Default6" // readable b
ActiveConnectionProperyIp6Config = ActiveConnectionInterface + ".Ip6Config" // readable o
ActiveConnectionProperyDhcp6Config = ActiveConnectionInterface + ".Dhcp6Config" // readable o
ActiveConnectionProperyVpn = ActiveConnectionInterface + ".Vpn" // readable b
ActiveConnectionProperyMaster = ActiveConnectionInterface + ".Master" // readable o
) )
type ActiveConnection interface { type ActiveConnection interface {
@ -91,11 +95,11 @@ func (a *activeConnection) GetSpecificObject() AccessPoint {
} }
func (a *activeConnection) GetID() string { func (a *activeConnection) GetID() string {
return a.getStringProperty(ActiveConnectionProperyID) return a.getStringProperty(ActiveConnectionProperyId)
} }
func (a *activeConnection) GetUUID() string { func (a *activeConnection) GetUUID() string {
return a.getStringProperty(ActiveConnectionProperyUUID) return a.getStringProperty(ActiveConnectionProperyUuid)
} }
func (a *activeConnection) GetType() string { func (a *activeConnection) GetType() string {
@ -129,7 +133,7 @@ func (a *activeConnection) GetDefault() bool {
} }
func (a *activeConnection) GetIP4Config() IP4Config { func (a *activeConnection) GetIP4Config() IP4Config {
path := a.getObjectProperty(ActiveConnectionProperyIP4Config) path := a.getObjectProperty(ActiveConnectionProperyIp4Config)
r, err := NewIP4Config(path) r, err := NewIP4Config(path)
if err != nil { if err != nil {
panic(err) panic(err)
@ -138,7 +142,7 @@ func (a *activeConnection) GetIP4Config() IP4Config {
} }
func (a *activeConnection) GetDHCP4Config() DHCP4Config { func (a *activeConnection) GetDHCP4Config() DHCP4Config {
path := a.getObjectProperty(ActiveConnectionProperyDHCP4Config) path := a.getObjectProperty(ActiveConnectionProperyDhcp4Config)
r, err := NewDHCP4Config(path) r, err := NewDHCP4Config(path)
if err != nil { if err != nil {
panic(err) panic(err)
@ -147,7 +151,7 @@ func (a *activeConnection) GetDHCP4Config() DHCP4Config {
} }
func (a *activeConnection) GetVPN() bool { func (a *activeConnection) GetVPN() bool {
ret := a.getProperty(ActiveConnectionProperyVPN) ret := a.getProperty(ActiveConnectionProperyVpn)
return ret.(bool) return ret.(bool)
} }

View file

@ -9,7 +9,20 @@ import (
const ( const (
ConnectionInterface = SettingsInterface + ".Connection" ConnectionInterface = SettingsInterface + ".Connection"
/* Methods */
ConnectionUpdate = ConnectionInterface + ".Update"
ConnectionUpdateUnsaved = ConnectionInterface + ".UpdateUnsaved"
ConnectionDelete = ConnectionInterface + ".Delete"
ConnectionGetSettings = ConnectionInterface + ".GetSettings" ConnectionGetSettings = ConnectionInterface + ".GetSettings"
ConnectionGetSecrets = ConnectionInterface + ".GetSecrets"
ConnectionClearSecrets = ConnectionInterface + ".ClearSecrets"
ConnectionSave = ConnectionInterface + ".Save"
ConnectionUpdate2 = ConnectionInterface + ".Update2"
/* Properties */
ConnectionPropertyUnsaved = ConnectionInterface + ".Unsaved" // readable b
ConnectionPropertyFlags = ConnectionInterface + ".Flags" // readable u
ConnectionPropertyFilename = ConnectionInterface + ".Filename" // readable s
) )
//type ConnectionSettings map[string]map[string]interface{} //type ConnectionSettings map[string]map[string]interface{}

View file

@ -9,15 +9,34 @@ import (
const ( const (
DeviceInterface = NetworkManagerInterface + ".Device" DeviceInterface = NetworkManagerInterface + ".Device"
DevicePropertyUdi = DeviceInterface + ".Udi" /* Properties */
DevicePropertyInterface = DeviceInterface + ".Interface" DevicePropertyUdi = DeviceInterface + ".Udi" // readable s
DevicePropertyIpInterface = DeviceInterface + ".IpInterface" DevicePropertyInterface = DeviceInterface + ".Interface" // readable s
DevicePropertyState = DeviceInterface + ".State" DevicePropertyIpInterface = DeviceInterface + ".IpInterface" // readable s
DevicePropertyManaged = DeviceInterface + ".Managed" DevicePropertyDriver = DeviceInterface + ".Driver" // readable s
DevicePropertyIP4Config = DeviceInterface + ".Ip4Config" DevicePropertyDriverVersion = DeviceInterface + ".DriverVersion" // readable s
DevicePropertyDeviceType = DeviceInterface + ".DeviceType" DevicePropertyFirmwareVersion = DeviceInterface + ".FirmwareVersion" // readable s
DevicePropertyAvailableConnections = DeviceInterface + ".AvailableConnections" DevicePropertyCapabilities = DeviceInterface + ".Capabilities" // readable u
DevicePropertyDhcp4Config = DeviceInterface + ".Dhcp4Config" DevicePropertyIp4Address = DeviceInterface + ".Ip4Address" // readable u
DevicePropertyState = DeviceInterface + ".State" // readable u
DevicePropertyStateReason = DeviceInterface + ".StateReason" // readable (uu)
DevicePropertyActiveConnection = DeviceInterface + ".ActiveConnection" // readable o
DevicePropertyIp4Config = DeviceInterface + ".Ip4Config" // readable o
DevicePropertyDhcp4Config = DeviceInterface + ".Dhcp4Config" // readable o
DevicePropertyIp6Config = DeviceInterface + ".Ip6Config" // readable o
DevicePropertyDhcp6Config = DeviceInterface + ".Dhcp6Config" // readable o
DevicePropertyManaged = DeviceInterface + ".Managed" // readwrite b
DevicePropertyAutoconnect = DeviceInterface + ".Autoconnect" // readwrite b
DevicePropertyFirmwareMissing = DeviceInterface + ".FirmwareMissing" // readable b
DevicePropertyNmPluginMissing = DeviceInterface + ".NmPluginMissing" // readable b
DevicePropertyDeviceType = DeviceInterface + ".DeviceType" // readable u
DevicePropertyAvailableConnections = DeviceInterface + ".AvailableConnections" // readable ao
DevicePropertyPhysicalPortId = DeviceInterface + ".PhysicalPortId" // readable s
DevicePropertyMtu = DeviceInterface + ".Mtu" // readable u
DevicePropertyMetered = DeviceInterface + ".Metered" // readable u
DevicePropertyLldpNeighbors = DeviceInterface + ".LldpNeighbors" // readable aa{sv}
DevicePropertyReal = DeviceInterface + ".Real" // readable b
DevicePropertyIp4Connectivity = DeviceInterface + ".Ip4Connectivity" // readable u
) )
func DeviceFactory(objectPath dbus.ObjectPath) (Device, error) { func DeviceFactory(objectPath dbus.ObjectPath) (Device, error) {
@ -84,6 +103,9 @@ type Device interface {
// are not persistent and lost after NetworkManager restart. // are not persistent and lost after NetworkManager restart.
GetManaged() bool GetManaged() bool
// If TRUE, indicates the device is allowed to autoconnect. If FALSE, manual intervention is required before the device will automatically connect to a known network, such as activating a connection using the device, or setting this property to TRUE. This property cannot be set to TRUE for default-unmanaged devices, since they never autoconnect.
GetAutoConnect() bool
MarshalJSON() ([]byte, error) MarshalJSON() ([]byte, error)
} }
@ -117,7 +139,7 @@ func (d *device) GetState() NmDeviceState {
} }
func (d *device) GetIP4Config() IP4Config { func (d *device) GetIP4Config() IP4Config {
path := d.getObjectProperty(DevicePropertyIP4Config) path := d.getObjectProperty(DevicePropertyIp4Address)
if path == "/" { if path == "/" {
return nil return nil
} }
@ -167,6 +189,10 @@ func (d *device) GetManaged() bool {
return d.getBoolProperty(DevicePropertyManaged) return d.getBoolProperty(DevicePropertyManaged)
} }
func (d *device) GetAutoConnect() bool {
return d.getBoolProperty(DevicePropertyAutoconnect)
}
func (d *device) marshalMap() map[string]interface{} { func (d *device) marshalMap() map[string]interface{} {
return map[string]interface{}{ return map[string]interface{}{
"Interface": d.GetInterface(), "Interface": d.GetInterface(),

View file

@ -9,10 +9,20 @@ import (
const ( const (
IP4ConfigInterface = NetworkManagerInterface + ".IP4Config" IP4ConfigInterface = NetworkManagerInterface + ".IP4Config"
IP4ConfigPropertyAddresses = IP4ConfigInterface + ".Addresses" /* Properties */
IP4ConfigPropertyRoutes = IP4ConfigInterface + ".Routes" IP4ConfigPropertyAddresses = IP4ConfigInterface + ".Addresses" // readable aau
IP4ConfigPropertyNameservers = IP4ConfigInterface + ".Nameservers" IP4ConfigPropertyAddressData = IP4ConfigInterface + ".AddressData" // readable aa{sv}
IP4ConfigPropertyDomains = IP4ConfigInterface + ".Domains" IP4ConfigPropertyGateway = IP4ConfigInterface + ".Gateway" // readable s
IP4ConfigPropertyRoutes = IP4ConfigInterface + ".Routes" // readable aau
IP4ConfigPropertyRouteData = IP4ConfigInterface + ".RouteData" // readable aa{sv}
IP4ConfigPropertyNameservers = IP4ConfigInterface + ".Nameservers" // readable au
IP4ConfigPropertyNameserverData = IP4ConfigInterface + ".NameserverData" // readable aa{sv}
IP4ConfigPropertyDomains = IP4ConfigInterface + ".Domains" // readable as
IP4ConfigPropertySearches = IP4ConfigInterface + ".Searches" // readable as
IP4ConfigPropertyDnsOptions = IP4ConfigInterface + ".DnsOptions" // readable as
IP4ConfigPropertyDnsPriority = IP4ConfigInterface + ".DnsPriority" // readable i
IP4ConfigPropertyWinsServers = IP4ConfigInterface + ".WinsServers" // readable au
IP4ConfigPropertyWinsServerData = IP4ConfigInterface + ".WinsServerData" // readable as
) )
type IP4Address struct { type IP4Address struct {

View file

@ -10,12 +10,51 @@ const (
NetworkManagerInterface = "org.freedesktop.NetworkManager" NetworkManagerInterface = "org.freedesktop.NetworkManager"
NetworkManagerObjectPath = "/org/freedesktop/NetworkManager" NetworkManagerObjectPath = "/org/freedesktop/NetworkManager"
/* Methods */
NetworkManagerReload = NetworkManagerInterface + ".Reload"
NetworkManagerGetDevices = NetworkManagerInterface + ".GetDevices" NetworkManagerGetDevices = NetworkManagerInterface + ".GetDevices"
NetworkManagerGetAllDevices = NetworkManagerInterface + ".GetAllDevices" NetworkManagerGetAllDevices = NetworkManagerInterface + ".GetAllDevices"
NetworkManagerGetDeviceByIpIface = NetworkManagerInterface + ".GetDeviceByIpIface"
NetworkManagerActivateConnection = NetworkManagerInterface + ".ActivateConnection" NetworkManagerActivateConnection = NetworkManagerInterface + ".ActivateConnection"
NetworkManagerAddAndActivateConnection = NetworkManagerInterface + ".AddAndActivateConnection" NetworkManagerAddAndActivateConnection = NetworkManagerInterface + ".AddAndActivateConnection"
NetworkManagerPropertyState = NetworkManagerInterface + ".State" NetworkManagerAddAndActivateConnection2 = NetworkManagerInterface + ".AddAndActivateConnection2"
NetworkManagerPropertyActiveConnection = NetworkManagerInterface + ".ActiveConnections" NetworkManagerDeactivateConnection = NetworkManagerInterface + ".DeactivateConnection"
NetworkManagerSleep = NetworkManagerInterface + ".Sleep"
NetworkManagerEnable = NetworkManagerInterface + ".Enable"
NetworkManagerGetPermissions = NetworkManagerInterface + ".GetPermissions"
NetworkManagerSetLogging = NetworkManagerInterface + ".SetLogging"
NetworkManagerGetLogging = NetworkManagerInterface + ".GetLogging"
NetworkManagerCheckConnectivity = NetworkManagerInterface + ".CheckConnectivity"
NetworkManagerstate = NetworkManagerInterface + ".state"
NetworkManagerCheckpointCreate = NetworkManagerInterface + ".CheckpointCreate"
NetworkManagerCheckpointDestroy = NetworkManagerInterface + ".CheckpointDestroy"
NetworkManagerCheckpointRollback = NetworkManagerInterface + ".CheckpointRollback"
NetworkManagerCheckpointAdjustRollbackTimeout = NetworkManagerInterface + ".CheckpointAdjustRollbackTimeout"
/* Property */
NetworkManagerPropertyDevices = NetworkManagerInterface + ".Devices" // readable ao
NetworkManagerPropertyAllDevices = NetworkManagerInterface + ".AllDevices" // readable ao
NetworkManagerPropertyCheckpoints = NetworkManagerInterface + ".Checkpoints" // readable ao
NetworkManagerPropertyNetworkingEnabled = NetworkManagerInterface + ".NetworkingEnabled" // readable b
NetworkManagerPropertyWirelessEnabled = NetworkManagerInterface + ".WirelessEnabled" // readwrite b
NetworkManagerPropertyWirelessHardwareEnabled = NetworkManagerInterface + ".WirelessHardwareEnabled" // readable b
NetworkManagerPropertyWwanEnabled = NetworkManagerInterface + ".WwanEnabled" // readwrite b
NetworkManagerPropertyWwanHardwareEnabled = NetworkManagerInterface + ".WwanHardwareEnabled" // readable b
NetworkManagerPropertyWimaxEnabled = NetworkManagerInterface + ".WimaxEnabled" // readwrite b
NetworkManagerPropertyWimaxHardwareEnabled = NetworkManagerInterface + ".WimaxHardwareEnabled" // readable b
NetworkManagerPropertyActiveConnections = NetworkManagerInterface + ".ActiveConnections" // readable ao
NetworkManagerPropertyPrimaryConnection = NetworkManagerInterface + ".PrimaryConnection" // readable o
NetworkManagerPropertyPrimaryConnectionType = NetworkManagerInterface + ".PrimaryConnectionType" // readable s
NetworkManagerPropertyMetered = NetworkManagerInterface + ".Metered" // readable u
NetworkManagerPropertyActivatingConnection = NetworkManagerInterface + ".ActivatingConnection" // readable o
NetworkManagerPropertyStartup = NetworkManagerInterface + ".Startup" // readable b
NetworkManagerPropertyVersion = NetworkManagerInterface + ".Version" // readable s
NetworkManagerPropertyCapabilities = NetworkManagerInterface + ".Capabilities" // readable au
NetworkManagerPropertyState = NetworkManagerInterface + ".State" // readable u
NetworkManagerPropertyConnectivity = NetworkManagerInterface + ".Connectivity" // readable u
NetworkManagerPropertyConnectivityCheckAvailable = NetworkManagerInterface + ".ConnectivityCheckAvailable" // readable b
NetworkManagerPropertyConnectivityCheckEnabled = NetworkManagerInterface + ".ConnectivityCheckEnabled" // readwrite b
NetworkManagerPropertyGlobalDnsConfiguration = NetworkManagerInterface + ".GlobalDnsConfiguration" // readwrite a{sv}
) )
type NetworkManager interface { type NetworkManager interface {
@ -104,7 +143,7 @@ func (n *networkManager) GetState() NmState {
} }
func (n *networkManager) GetActiveConnections() []ActiveConnection { func (n *networkManager) GetActiveConnections() []ActiveConnection {
acPaths := n.getSliceObjectProperty(NetworkManagerPropertyActiveConnection) acPaths := n.getSliceObjectProperty(NetworkManagerPropertyActiveConnections)
ac := make([]ActiveConnection, len(acPaths)) ac := make([]ActiveConnection, len(acPaths))
var err error var err error

View file

@ -8,11 +8,19 @@ const (
SettingsInterface = NetworkManagerInterface + ".Settings" SettingsInterface = NetworkManagerInterface + ".Settings"
SettingsObjectPath = NetworkManagerObjectPath + "/Settings" SettingsObjectPath = NetworkManagerObjectPath + "/Settings"
/* Methods */
SettingsListConnections = SettingsInterface + ".ListConnections" SettingsListConnections = SettingsInterface + ".ListConnections"
SettingsGetConnectionByUuid = SettingsInterface + ".GetConnectionByUuid"
SettingsAddConnection = SettingsInterface + ".AddConnection" SettingsAddConnection = SettingsInterface + ".AddConnection"
SettingsAddConnectionUnsaved = SettingsInterface + ".AddConnectionUnsaved"
SettingsLoadConnections = SettingsInterface + ".LoadConnections"
SettingsReloadConnections = SettingsInterface + ".ReloadConnections"
SettingsSaveHostname = SettingsInterface + ".SaveHostname" SettingsSaveHostname = SettingsInterface + ".SaveHostname"
SettingsHostnameProperty = SettingsInterface + ".Hostname" /* Properties */
SettingsPropertyConnections = SettingsInterface + "Connections" // readable ao
SettingsPropertyHostname = SettingsInterface + "Hostname" // readable s
SettingsPropertyCanModify = SettingsInterface + "CanModify" // readable b
) )
type Settings interface { type Settings interface {
@ -73,7 +81,7 @@ func (s *settings) SaveHostname(hostname string) {
} }
func (s *settings) Hostname() string { func (s *settings) Hostname() string {
hostname := s.getStringProperty(SettingsHostnameProperty) hostname := s.getStringProperty(SettingsPropertyHostname)
return hostname return hostname
} }