diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 883757545..24a100efa 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -3728,6 +3728,16 @@ cache_lookup_link (NMPlatform *platform, int ifindex) return obj_cache; } +const NMPlatformObject *const* +nm_linux_platform_lookup (NMPlatform *platform, const NMPCacheId *cache_id, guint *out_len) +{ + g_return_val_if_fail (NM_IS_LINUX_PLATFORM (platform), NULL); + g_return_val_if_fail (cache_id, NULL); + + return nmp_cache_lookup_multi (NM_LINUX_PLATFORM_GET_PRIVATE (platform)->cache, + cache_id, out_len); +} + static GArray * link_get_all (NMPlatform *platform) { diff --git a/src/platform/nm-linux-platform.h b/src/platform/nm-linux-platform.h index 4ae2fd140..3b2a440e5 100644 --- a/src/platform/nm-linux-platform.h +++ b/src/platform/nm-linux-platform.h @@ -52,4 +52,10 @@ NMPlatform *nm_linux_platform_new (gboolean netns_support); void nm_linux_platform_setup (void); +struct _NMPCacheId; + +const NMPlatformObject *const *nm_linux_platform_lookup (NMPlatform *platform, + const struct _NMPCacheId *cache_id, + guint *out_len); + #endif /* __NETWORKMANAGER_LINUX_PLATFORM_H__ */ diff --git a/src/platform/nmp-object.h b/src/platform/nmp-object.h index c5241037d..062d01d29 100644 --- a/src/platform/nmp-object.h +++ b/src/platform/nmp-object.h @@ -95,8 +95,9 @@ typedef enum { /*< skip >*/ } NMPCacheIdType; typedef struct _NMPObject NMPObject; +typedef struct _NMPCacheId NMPCacheId; -typedef struct { +struct _NMPCacheId { union { NMMultiIndexId base; guint8 _id_type; /* NMPCacheIdType as guint8 */ @@ -136,7 +137,7 @@ typedef struct { struct in6_addr _misaligned_network; } routes_by_destination_ip6; }; -} NMPCacheId; +}; extern NMPCacheId _nmp_cache_id_static; #define NMP_CACHE_ID_STATIC (&_nmp_cache_id_static)