NetworkManager/src/settings/plugins
Thomas Haller 25ade39752 tests: use NMTST_EXPECT*() macros
Tests are commonly created via copy&paste. Hence, it's
better to express a certain concept explicitly via a function
or macro. This way, the implementation of the concept can be
adjusted at one place, without requiring to change all the callers.

Also, the macro is shorter, and brevity is better for tests
so it's easier to understand what the test does. Without being
bothered by noise from the redundant information.

Also, the macro knows better which message to expect. For example,
messages inside "src" are prepended by nm-logging.c with a level
and a timestamp. The expect macro is aware of that and tests for it

  #define NMTST_EXPECT_NM_ERROR(msg)      NMTST_EXPECT_NM (G_LOG_LEVEL_MESSAGE, "*<error> [*] "msg)

This again allows the caller to ignore this prefix, but still assert
more strictly.
2018-01-08 12:38:54 +01:00
..
ibft tests: use NMTST_EXPECT*() macros 2018-01-08 12:38:54 +01:00
ifcfg-rh tests: use NMTST_EXPECT*() macros 2018-01-08 12:38:54 +01:00
ifupdown build: add initial support for meson build system 2017-12-13 15:48:50 +01:00
keyfile tests: use NMTST_EXPECT*() macros 2018-01-08 12:38:54 +01:00
meson.build settings: drop unmaintained ifnet settings plugin of Gentoo 2017-12-21 10:50:33 +01:00
README core: fix interface type names 2015-09-10 13:43:47 -04: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.  Plugins implement the
  NMSettingsPlugin interface.  See plugin.c.

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

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_settings_plugin_factory().  That function creates and returns a singleton
instance of the plugin's main object, which implements NMSettingsPlugin.
That interface is implemented via the object definition in G_DEFINE_TYPE_EXTENDED
in plugin.c, which registers the interface setup function
settings_plugin_interface_init(), which when called actually sets up the vtables
for the functions defined by NMSettingsPluginInterface.  Thus there are two
entry points into the plugin:  nm_settings_plugin_factory() and
the NMSettingsPluginInterface methods.

The plugin also emits various signals (defined by NMSettingsPluginInterface)
which NetworkManager listens for.  These include 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.