NetworkManager/src/rdisc
Thomas Haller 3a30ccacc7 platform: add self argument to platform functions
Most nm_platform_*() functions operate on the platform
singleton nm_platform_get(). That made sense because the
NMPlatform instance was mainly to hook fake platform for
testing.

While the implicit argument saved some typing, I think explicit is
better. Especially, because NMPlatform could become a more usable
object then just a hook for testing.

With this change, NMPlatform instances can be used individually, not
only as a singleton instance.

Before this change, the constructor of NMLinuxPlatform could not
call any nm_platform_*() functions because the singleton was not
yet initialized. We could only instantiate an incomplete instance,
register it via nm_platform_setup(), and then complete initialization
via singleton->setup().
With this change, we can create and fully initialize NMPlatform instances
before/without setting them up them as singleton.

Also, currently there is no clear distinction between functions
that operate on the NMPlatform instance, and functions that can
be used stand-alone (e.g. nm_platform_ip4_address_to_string()).
The latter can not be mocked for testing. With this change, the
distinction becomes obvious. That is also useful because it becomes
clearer which functions make use of the platform cache and which not.

Inside nm-linux-platform.c, continue the pattern that the
self instance is named @platform. That makes sense because
its type is NMPlatform, and not NMLinuxPlatform what we
would expect from a paramter named @self.

This is a major diff that causes some pain when rebasing. Try
to rebase to the parent commit of this commit as a first step.
Then rebase on top of this commit using merge-strategy "ours".

(cherry picked from commit c6529a9d74)
2015-06-17 14:32:30 +02:00
..
tests platform: add self argument to platform functions 2015-06-17 14:32:30 +02:00
Makefile.am trivial: allow building tests from rdisc directory 2013-07-30 11:40:18 +02:00
nm-fake-rdisc.c rdisc: prevent solicitation loop for expiring DNS information (rh #1207730) (rh #1151665) 2015-05-01 16:01:16 -05:00
nm-fake-rdisc.h rdisc: prevent solicitation loop for expiring DNS information (rh #1207730) (rh #1151665) 2015-05-01 16:01:16 -05:00
nm-lndp-rdisc.c platform: add self argument to platform functions 2015-06-17 14:32:30 +02:00
nm-lndp-rdisc.h all: fix up multiple-include-guard defines 2014-08-16 10:17:14 -04:00
nm-rdisc-private.h rdisc: move most RA processing logic into base class 2015-05-01 15:59:01 -05:00
nm-rdisc.c core: Use tokenized identifiers when constructing an address 2015-06-17 13:19:16 +02:00
nm-rdisc.h core: Use tokenized identifiers when constructing an address 2015-06-17 13:19:16 +02:00