Commit Graph

8 Commits

Author SHA1 Message Date
Lubomir Rintel
14bfd55361 platform: g_hash_table_add doesn't return a value before 2.40 2015-06-22 17:04:22 +02:00
Lubomir Rintel
a1868dcfc3 platform: fix build on 32-bit systems
The decimal literals are signed by default and these are too large to fit in a
signed 32-bit int.
2015-06-22 13:13:05 +02:00
Thomas Haller
ae824f582b nmp-object: check for non-empty ifname in _vt_cmd_obj_is_visible_link() 2015-06-20 18:50:27 +02:00
Thomas Haller
518cf76de7 platform/trivial: rename ObjectType to NMPObjectType
After doing all the refactoring, rename the ObjectType enum to NMPObjectType.
I didn't do this earlier to avoid problems with rebasing. But since I will
backport the platform changes to nm-1-0, this is the right time to get
the name right.
2015-06-19 16:24:20 +02:00
Thomas Haller
8f9dac01ac platform: fix lookup addresses and routes for any ifindex and refactor NMPCacheIdType
After refactoring platform, nm_platform_ipx_route_get_all() and
nm_platform_ipx_address_get_all() was broken for calling with a
non-posititive ifindex (which has the meaning: ignore ifindex).

While fixing that, also refactor the NMPCacheIdType so that it matches
better the supported id-types.

Fixes: 470bcefa5f
2015-06-18 17:19:00 +02:00
Thomas Haller
1b2b988ea9 platform: no longer expose udi field in NMPlatformLink
The @udi field is not a static string, so any user of a NMPlatformLink
instance must make sure not to use the field beyond the lifetime of the
NMPlatformLink instance.
As we pass on the platform link instance during platform changed events,
this is hard to ensure for the subscriber of the signal -- because a
call back into platform could invalidate/modify the object.

Just not expose this field as part of the link instance. The few callers
who actually needed it should instead call nm_platform_get_uid(). With
that, the lifetime of the returned 'const char *' pointer is clearly
defined.
2015-06-17 11:41:43 +02:00
Thomas Haller
53f98e7f9e platform: implement NMPObject and NMPCache
NMPObject is a simple "object" implemenation around NMPlatformObject.
They are ref-counted and have a class-pointer. Several basic functions
like equality, hash, to-string are implemented.

NMPCache is can be used to store the NMPObject. Objects are indexed
via their primary id, but there is also multi-lookup via NMCacheId
and NMMultiIndex.

Part of the implementation is inside "nm-linux-platform.c",
because it depends on utility functions from there.
2015-06-17 11:23:51 +02:00
Thomas Haller
359fe9f8c1 platform: add nmp-object.h file 2015-06-17 11:23:51 +02:00