ICD Policy Plugins
Information on the Internet Connectivity Daemon Policy Plugins
An Internet Connectivity Daemon policy plugin is a plugin used by the Internet Connectivity Daemon to decide different things about an internet connection such as whether to connect or disconnect it.
By writing a new ICD policy plugin, it should be possible to do things like making one WiFi network take priority over another WiFi network (e.g. your home network taking priority over everything else)
The plugins included with Fremantle are (in priority order): (this information comes through gconf and can be changed via the normal gconf configuration-changing tools or tricks)
- libicd_policy_merge.so (Merge a new request with an already existing one)
- libicd_policy_ask.so (Request 'Select connection' dialog from UI)
- libicd_policy_any.so (Any connection)
- libicd_policy_change.so (Change to another connection)
- libicd_policy_add.so (New IAP creation)
- libicd_policy_always_online.so (Always online policy)
- libicd_policy_one.so (One connection only)
- libicd_policy_restart.so (IAP restart policy)
- libicd_policy_nw_disconnect.so (Network disconnect reference count)
ICD policy plugins all #include policy_api.h (the base API file for ICD policy plugins) and may optionally #include icd_dbus.h (header file for working with dbus) and/or icd_log.h (logging code for ICD2 policy plugins).
All ICD policy plugins export a function called icd_policy_init. This function takes a variable of type icd_policy_api * plus a number of callbacks that can be saved for later use. Your plugin does whatever initialization it wishes to do (registering dbus handlers for example), saves any private data in the "private" field of the icd_policy_api structure (which may be a pointer to a data structure containing a bunch of data) and then fills in any appropriate function members of the icd_policy_api that this plugin wishes to listen for.
Different callbacks have different prototypes but all of them get passed the private data stored earlier.
The policy API header files plus reverse engineered code (that may not be 100% correct) for libicd_policy_one.so and libicd_policy_add.so can be found here: http://code.google.com/p/icd-policy/source/browse/#svn%2Ftrunk
Documentation for all this stuff can be found here: http://maemo.org/api_refs/5.0/5.0-final/icd2/index.html
I am hoping that this information will be usefull to someone and that someone will take it and build a new policy plugins with it.