core: add nm_ip_config_iter_ip_address_for_each() macro
This commit is contained in:
@@ -101,6 +101,8 @@ ForEachMacros: ['c_list_for_each',
|
|||||||
'nm_ip_config_iter_ip4_route_for_each',
|
'nm_ip_config_iter_ip4_route_for_each',
|
||||||
'nm_ip_config_iter_ip6_address_for_each',
|
'nm_ip_config_iter_ip6_address_for_each',
|
||||||
'nm_ip_config_iter_ip6_route_for_each',
|
'nm_ip_config_iter_ip6_route_for_each',
|
||||||
|
'nm_ip_config_iter_ip_address_for_each',
|
||||||
|
'nm_ip_config_iter_ip_route_for_each',
|
||||||
'nm_json_array_foreach',
|
'nm_json_array_foreach',
|
||||||
'nm_json_object_foreach',
|
'nm_json_object_foreach',
|
||||||
'nm_l3_config_data_iter_ip4_address_for_each',
|
'nm_l3_config_data_iter_ip4_address_for_each',
|
||||||
|
@@ -375,6 +375,36 @@ nm_ip_config_get_first_address(NMIPConfig *self)
|
|||||||
_NM_IP_CONFIG_DISPATCH(self, nm_ip4_config_get_first_address, nm_ip6_config_get_first_address);
|
_NM_IP_CONFIG_DISPATCH(self, nm_ip4_config_get_first_address, nm_ip6_config_get_first_address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
nm_ip_config_iter_ip_address_init(NMDedupMultiIter *iter, const NMIPConfig *self)
|
||||||
|
{
|
||||||
|
if (NM_IS_IP4_CONFIG(self))
|
||||||
|
nm_ip_config_iter_ip4_address_init(iter, (const NMIP4Config *) self);
|
||||||
|
else {
|
||||||
|
nm_assert(NM_IS_IP6_CONFIG(self));
|
||||||
|
nm_ip_config_iter_ip6_address_init(iter, (const NMIP6Config *) self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define nm_ip_config_iter_ip_address_for_each(iter, self, address) \
|
||||||
|
for (nm_ip_config_iter_ip_address_init((iter), (self)); \
|
||||||
|
nm_platform_dedup_multi_iter_next_ip_address((iter), (address));)
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
nm_ip_config_iter_ip_route_init(NMDedupMultiIter *iter, const NMIPConfig *self)
|
||||||
|
{
|
||||||
|
if (NM_IS_IP4_CONFIG(self))
|
||||||
|
nm_ip_config_iter_ip4_route_init(iter, (const NMIP4Config *) self);
|
||||||
|
else {
|
||||||
|
nm_assert(NM_IS_IP6_CONFIG(self));
|
||||||
|
nm_ip_config_iter_ip6_route_init(iter, (const NMIP6Config *) self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define nm_ip_config_iter_ip_route_for_each(iter, self, route) \
|
||||||
|
for (nm_ip_config_iter_ip_route_init((iter), (self)); \
|
||||||
|
nm_platform_dedup_multi_iter_next_ip_route((iter), (route));)
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
nm_ip_config_add_address(NMIPConfig *self, const NMPlatformIPAddress *address)
|
nm_ip_config_add_address(NMIPConfig *self, const NMPlatformIPAddress *address)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user