On Tue, 2020-11-24 at 09:30 +0000, Graham White via networkmanager-list wrote: > From the point of view of a VPN plugin, what's the best way to > communicate status/log information with the user on their desktop? > > My scenario is for the NetworkManager-anyconnect VPN plugin, should > the connection fail for some reason, it would be nice to give the > user a bit more information as to why the connection attempt didn't > work. I'm thinking that integrating with the desktop notification > system is possibly the right way to go here but wanted to check if > there's a best practise or any advice you can give?
Hi, The plugin can only use the D-Bus VPN Plugin API ([1]) to notify NetworkManager about events. And NetworkManager can only use NetworkManager's D-Bus API ([3]) to notify clients about events. In particular, NetworkManager's D-Bus API does not have an event like: "StatusMessageSignal" where it would just broadcast some messages. It commonly works by exposing the current state in form of D-Bus objects, and emitting PropertiesChanged signals when something changes. Such "one-shot-notification" API does currently not exist. Maybe it could be added, but it's not entirely clear how that would be useful. That's why the device has a "State" and a "StateReason" property. You might say, that the "StateReason" is more an ad-hoc information associated with the last state change. So, even the "StateReason" is expressed in form of a property, and not via a "StateChanged(reason)" signal -- although, such a redundant signal exists as well. [1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/e7d828f6a0b63f83e8888578c393434311240aea/introspection/org.freedesktop.NetworkManager.VPN.Plugin.xml [2] https://networkmanager.pages.freedesktop.org/NetworkManager/NetworkManager/spec.html If the current API does not allow what you want, it should be added. But note NetworkManager's model of having (potentially) unlimited D-Bus clients may not work so well with a one-shot-notification API. So, maybe such status information should also become a property (like "StateReason"). As it makes sense... best, Thomas
signature.asc
Description: This is a digitally signed message part
_______________________________________________ networkmanager-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/networkmanager-list
