Merge branch 'develop'

This commit is contained in:
Christian Müller 2020-03-06 11:56:59 +01:00
commit 7809e29c58
4 changed files with 33 additions and 8 deletions

View file

@ -21,6 +21,8 @@ type DeviceStatistics interface {
// Refresh rate of the rest of properties of this interface. The properties are guaranteed to be refreshed each RefreshRateMs milliseconds in case the underlying counter has changed too. If zero, there is no guaranteed refresh rate of the properties. // Refresh rate of the rest of properties of this interface. The properties are guaranteed to be refreshed each RefreshRateMs milliseconds in case the underlying counter has changed too. If zero, there is no guaranteed refresh rate of the properties.
GetPropertyRefreshRateMs() (uint32, error) GetPropertyRefreshRateMs() (uint32, error)
SetPropertyRefreshRateMs(uint32) (error)
// Number of transmitted bytes // Number of transmitted bytes
GetPropertyTxBytes() (uint64, error) GetPropertyTxBytes() (uint64, error)
@ -45,6 +47,10 @@ func (d *deviceStatistics) GetPropertyRefreshRateMs() (uint32, error) {
return d.getUint32Property(DeviceStatisticsPropertyRefreshRateMs) return d.getUint32Property(DeviceStatisticsPropertyRefreshRateMs)
} }
func (d *deviceStatistics) SetPropertyRefreshRateMs(rate uint32) (error) {
return d.setProperty(DeviceStatisticsPropertyRefreshRateMs, rate)
}
func (d *deviceStatistics) GetPropertyTxBytes() (uint64, error) { func (d *deviceStatistics) GetPropertyTxBytes() (uint64, error) {
return d.getUint64Property(DeviceStatisticsPropertyTxBytes) return d.getUint64Property(DeviceStatisticsPropertyTxBytes)
} }

View file

@ -63,7 +63,7 @@ type IP6Config interface {
GetPropertyRouteData() ([]IP6RouteData, error) GetPropertyRouteData() ([]IP6RouteData, error)
// GetNameservers gets the nameservers in use. // GetNameservers gets the nameservers in use.
GetPropertyNameservers() ([]string, error) GetPropertyNameservers() ([][]byte, error)
// A list of domains this address belongs to. // A list of domains this address belongs to.
GetPropertyDomains() ([]string, error) GetPropertyDomains() ([]string, error)
@ -169,16 +169,16 @@ func (c *ip6Config) GetPropertyRouteData() ([]IP6RouteData, error) {
return routes, nil return routes, nil
} }
func (c *ip6Config) GetPropertyNameservers() ([]string, error) { func (c *ip6Config) GetPropertyNameservers() ([][]byte, error) {
nameservers, err := c.getSliceSliceByteProperty(IP6ConfigPropertyNameservers) nameservers, err := c.getSliceSliceByteProperty(IP6ConfigPropertyNameservers)
ret := make([]string, len(nameservers)) ret := make([][]byte, len(nameservers))
if err != nil { if err != nil {
return ret, err return ret, err
} }
for i, nameserver := range nameservers { for i, nameserver := range nameservers {
ret[i] = string(nameserver) ret[i] = nameserver
} }
return ret, nil return ret, nil

View file

@ -367,12 +367,26 @@ func (nm *networkManager) State() (state NmState, err error) {
} }
func (nm *networkManager) CheckpointCreate(devices []Device, rollbackTimeout uint32, flags []NmCheckpointCreateFlags) (cp Checkpoint, err error) { func (nm *networkManager) CheckpointCreate(devices []Device, rollbackTimeout uint32, flags []NmCheckpointCreateFlags) (cp Checkpoint, err error) {
intFlags := 0 var intFlags uint32 = 0
for _, flag := range flags { for _, flag := range flags {
intFlags |= int(flag) intFlags |= uint32(flag)
} }
err = nm.callWithReturn(&cp, NetworkManagerCheckpointCreate, rollbackTimeout, intFlags) var devicePaths []dbus.ObjectPath
if len(devices) > 0 {
devicePaths := []dbus.ObjectPath{}
for _, device := range devices {
devicePaths = append(devicePaths, device.GetPath())
}
}
var checkpointPath dbus.ObjectPath
err = nm.callWithReturn(&checkpointPath, NetworkManagerCheckpointCreate, devicePaths, rollbackTimeout, intFlags)
if err != nil {
return
}
cp, err = NewCheckpoint(checkpointPath)
return return
} }
@ -425,7 +439,7 @@ func (nm *networkManager) GetPropertyAllDevices() ([]Device, error) {
} }
func (nm *networkManager) GetPropertyCheckpoints() ([]Checkpoint, error) { func (nm *networkManager) GetPropertyCheckpoints() ([]Checkpoint, error) {
checkpointsPaths, err := nm.getSliceObjectProperty(NetworkManagerPropertyAllDevices) checkpointsPaths, err := nm.getSliceObjectProperty(NetworkManagerPropertyCheckpoints)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View file

@ -58,6 +58,11 @@ func (d *dbusBase) getProperty(iface string) (interface{}, error) {
return variant.Value(), err return variant.Value(), err
} }
func (d *dbusBase) setProperty(iface string, value interface{}) (error) {
err := d.obj.SetProperty(iface, dbus.MakeVariant(value))
return err
}
func (d *dbusBase) getObjectProperty(iface string) (value dbus.ObjectPath, err error) { func (d *dbusBase) getObjectProperty(iface string) (value dbus.ObjectPath, err error) {
prop, err := d.getProperty(iface) prop, err := d.getProperty(iface)
if err != nil { if err != nil {