diff options
-rw-r--r-- | src/nm-ip4-config.h | 33 | ||||
-rw-r--r-- | src/nm-types.h | 1 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/nm-ip4-config.h b/src/nm-ip4-config.h index 978471df29..a698857cfd 100644 --- a/src/nm-ip4-config.h +++ b/src/nm-ip4-config.h @@ -267,4 +267,37 @@ gboolean nm_ip4_config_nmpobj_remove (NMIP4Config *self, void nm_ip4_config_hash (const NMIP4Config *self, GChecksum *sum, gboolean dns_only); gboolean nm_ip4_config_equal (const NMIP4Config *a, const NMIP4Config *b); +/*****************************************************************************/ + +#include "nm-ip6-config.h" + +#if _NM_CC_SUPPORT_GENERIC +#define NM_IP_CONFIG_CAST(config) \ + ({ \ + const void *const _config = (config); \ + \ + nm_assert (_Generic ((config), \ + const void *: (NM_IS_IP4_CONFIG (_config) || NM_IS_IP6_CONFIG (_config)), \ + void *: (NM_IS_IP4_CONFIG (_config) || NM_IS_IP6_CONFIG (_config)), \ + const NMIPConfig *: (NM_IS_IP4_CONFIG (_config) || NM_IS_IP6_CONFIG (_config)), \ + NMIPConfig *: (NM_IS_IP4_CONFIG (_config) || NM_IS_IP6_CONFIG (_config)), \ + const NMIP4Config *: (NM_IS_IP4_CONFIG (_config)), \ + NMIP4Config *: (NM_IS_IP4_CONFIG (_config)), \ + const NMIP6Config *: (NM_IS_IP6_CONFIG (_config)), \ + NMIP6Config *: (NM_IS_IP6_CONFIG (_config)))); \ + \ + _Generic ((config), \ + const void *: ((const NMIPConfig *) _config), \ + void *: (( NMIPConfig *) _config), \ + const NMIPConfig *: ((const NMIPConfig *) _config), \ + NMIPConfig *: (( NMIPConfig *) _config), \ + const NMIP4Config *: ((const NMIPConfig *) _config), \ + NMIP4Config *: (( NMIPConfig *) _config), \ + const NMIP6Config *: ((const NMIPConfig *) _config), \ + NMIP6Config *: (( NMIPConfig *) _config)); \ + }) +#else +#define NM_IP_CONFIG_CAST(config) ((NMIPConfig *) (config)) +#endif + #endif /* __NETWORKMANAGER_IP4_CONFIG_H__ */ diff --git a/src/nm-types.h b/src/nm-types.h index e01c48b0a5..cad3c0315a 100644 --- a/src/nm-types.h +++ b/src/nm-types.h @@ -42,6 +42,7 @@ typedef struct _NMDevice NMDevice; typedef struct _NMDhcp4Config NMDhcp4Config; typedef struct _NMDhcp6Config NMDhcp6Config; typedef struct _NMProxyConfig NMProxyConfig; +typedef struct _NMIPConfig NMIPConfig; typedef struct _NMIP4Config NMIP4Config; typedef struct _NMIP6Config NMIP6Config; typedef struct _NMManager NMManager; |