NetworkManager/src/settings/plugins/example
Dan Winship 1f81851017 core: add monitor-connection-files=false and ReloadConnections
Add a "monitor-connection-files" config option, which can be set to
"false" to disable automatic reloading of connections on file change.

To go with this, add a new ReloadConnections method on
o.fd.NM.Settings that can be used to manually reload connections, and
add an nm-cli command to call it.
2013-06-14 12:57:47 -03:00
..
common.h build: unify NetworkManager path handling (some paths are changed) 2012-11-05 14:01:47 +01:00
errors.c examples: add an example system settings plugin 2012-05-07 15:19:09 -05:00
Makefile.am settings: don't pass config_path to NMSettings and settings plugins 2013-04-03 10:23:48 -04:00
nm-example-connection.c settings: track whether connection is saved to disk or not 2013-05-28 12:26:55 -05:00
nm-example-connection.h core: fix NM_IS_*_CLASS(klass) macros 2012-07-27 13:15:54 +02:00
plugin.c core: add monitor-connection-files=false and ReloadConnections 2013-06-14 12:57:47 -03:00
plugin.h core: fix NM_IS_*_CLASS(klass) macros 2012-07-27 13:15:54 +02:00
reader.c examples: add an example system settings plugin 2012-05-07 15:19:09 -05:00
README examples: add an example system settings plugin 2012-05-07 15:19:09 -05:00
writer.c examples: add an example system settings plugin 2012-05-07 15:19:09 -05:00

Plugins generally have three components:

1) plugin object: manages the individual "connections", which are
  just objects wrapped around on-disk config data.  The plugin handles requests
  to add new connections via the NM D-Bus API, and also watches config
  directories for changes to configuration data.  It also handles reading and
  writing the persistent hostname, if the plugin supports hostnames.  Plugins
  implement the NMSystemConfigInterface interface.  See plugin.c.

2) "connections": subclasses of NMSettingsConnection.  They handle updates to
  configuration data, deletion, etc.  See NMExampleConnection.c.

3) reader/writer code: typically a separate static library that gets linked
  into the main plugin shared object, so they can be unit tested separately
  from the plugin.  This code should read config data from disk and create
  an NMConnection from it, and be capable of taking an NMConnection and writing
  out appropriate configuration data to disk.

NM will first call the "factory" function that every module must provide, which
is nm_system_config_factory().  That function creates and returns a singleton
instance of the plugin's main object, which implements NMSystemConfigInterface.
That interface is implemented via the object definition in G_DEFINE_TYPE_EXTENDED
in plugin.c, which registers the interface setup function
system_config_interface_init(), which when called actually sets up the vtables
for the functions defined by NMSystemConfigInterface.  Thus there are two
entry points into the plugin:  nm_system_config_factory() and
the NMSystemConfigInterface methods.

The plugin also emits various signals (defined by NMSystemConfigInterface)
which NetworkManager listens for.  These include persistent hostname changes
(if something modified the file in which the persistent hostname is stored)
and notifications of new connections if they were created via changes to
the on-disk files.  The "connection" objects can also emit signals
(defined by the NMSettingsConnection and NMConnection superclasses) when the
connections' backing storage gets changed or deleted.