[Telepathy] Connectivity plugins - API sketch

Alberto Mardegan mardy at users.sourceforge.net
Thu Jan 31 04:55:08 PST 2008


Hi, since I've been mentioning connectivity plugins here and there, but 
never clearly explained what are my thoughts about them, I'll try to do 
it here.

Basically, MC needs to be aware of any changes in connectivity, be it IP 
connectivity, VPN, or any kind of connectivity that would allow an 
account to work.

One necessary premise is that I'm an egoist and I don't care of other 
users for this plugins: they are meant for being used by MC. If some 
better unified way of reporting this information comes up in the Linux 
world, I'll happily switch to that; but now I'd like to have something 
that covers all MC needs, and that's all.

I'm referring to it as "connectivity", but maybe we can come up with 
better names, such as "transport", "carrier", dunno (I'd like an English 
native speaker to come up with a name).

The Connectivity Plugin (CP) will be a DBus object that will consist of 
one signal, ConnectivityEvent, and one method, GetConnectivityStatus.

ConnectivityEvent (s: conn_ID, u: event_type, a{sv}: params):
this signal will be emitted when the status of the connection named 
"conn_ID" changes. "event_type" is an enum, whose values can be 
CONNECTED and DISCONNECTED (optionally plugins can report also 
CONNECTING and DISCONNECTING, if they apply). The "params" are a set of 
informations about the event, and I think they make sense only for 
CONNECTING and CONNECTED events. As an example, when we connect to a 
wireless network we could have a CONNECTED event on the conn_ID "wlan0" 
with "params" like:

{
   "type": CONN_TYPE_IP, #it could be an element of an enum, or maybe a 
well-known string
   "ip-address": "192.168.1.10",
   "gateway": "192.168.1.1",
   "netmask": "255.255.255.0",
   "essid": "Home",
   "...":...,
}


About the method, it could be something like this:

GetConnectivityStatus () -> a(sua{sv})

which returns an array of the connections (with the same information as 
in the ConnectivityEvent signal) managed by this plugin; connections in 
DISCONNECTED state might be missing from the list.

A plugin will have a configuration file like 
XDG_DATA_DIRS/telepthy/connectivity/_pluginname_.plugin which contains 
the DBus object path and bus name of the plugin.

The plugin doesn't need to be running all the time; for instance a 
plugin for IP connectivity could install a small script in 
/etc/network/if-{up,down}.d/ which emits the ConnectionEvent signal, and 
the service would be invoked by DBus when someone calls 
GetConnectivityStatus().

Comments welcome.

Ciao,
   Alberto


-- 
http://www.mardy.it <-- Geek in un lingua international!


More information about the Telepathy mailing list