summaryrefslogtreecommitdiff
path: root/libnm-core/nm-core-internal.h
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-12-29 13:01:28 +0100
committerThomas Haller <thaller@redhat.com>2019-02-14 08:00:29 +0100
commit713e879d769f4aa95d1b15f5a584cc9cf4e9bd13 (patch)
tree7c7a94d5311b78bf6d8b3dd5b642dd67072c110d /libnm-core/nm-core-internal.h
parentd93845e2c2c67349abcfc1f5377d820f02247b8b (diff)
downloadNetworkManager-713e879d769f4aa95d1b15f5a584cc9cf4e9bd13.tar.gz
libnm: add NMSockAddrEndpoint API
NMSockAddrEndpoint is an immutable structure that contains the endpoint string of a service. It also includes the (naive) parsing of the host and port/service parts. This will be used for the endpoint of WireGuard's peers. But since endpoints are not something specific to WireGuard, give it a general name (and purpose) independent from WireGuard. Essentially, this structure takes a string in a manner that libnm understands, and uses it for node and service arguments for getaddrinfo(). NMSockAddrEndpoint allows to have endpoints that are not parsable into a host and port part. That is useful because our settings need to be able to hold invalid values. That is for forward compatibility (server sends a new endpoint format) and for better error handling (have invalid settings that can be constructed without loss, but fail later during the NMSetting:verify() step).
Diffstat (limited to 'libnm-core/nm-core-internal.h')
-rw-r--r--libnm-core/nm-core-internal.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h
index 891ec0a7aa..19a914956e 100644
--- a/libnm-core/nm-core-internal.h
+++ b/libnm-core/nm-core-internal.h
@@ -614,6 +614,25 @@ gboolean _nm_setting_sriov_sort_vfs (NMSettingSriov *setting);
/*****************************************************************************/
+typedef struct _NMSockAddrEndpoint NMSockAddrEndpoint;
+
+NMSockAddrEndpoint *nm_sock_addr_endpoint_new (const char *endpoint);
+
+NMSockAddrEndpoint *nm_sock_addr_endpoint_ref (NMSockAddrEndpoint *self);
+void nm_sock_addr_endpoint_unref (NMSockAddrEndpoint *self);
+
+const char *nm_sock_addr_endpoint_get_endpoint (NMSockAddrEndpoint *self);
+const char *nm_sock_addr_endpoint_get_host (NMSockAddrEndpoint *self);
+gint32 nm_sock_addr_endpoint_get_port (NMSockAddrEndpoint *self);
+
+gboolean nm_sock_addr_endpoint_get_fixed_sockaddr (NMSockAddrEndpoint *self,
+ gpointer sockaddr);
+
+#define nm_auto_unref_sockaddrendpoint nm_auto(_nm_auto_unref_sockaddrendpoint)
+NM_AUTO_DEFINE_FCN_VOID0 (NMSockAddrEndpoint *, _nm_auto_unref_sockaddrendpoint, nm_sock_addr_endpoint_unref)
+
+/*****************************************************************************/
+
typedef struct _NMSettInfoSetting NMSettInfoSetting;
typedef struct _NMSettInfoProperty NMSettInfoProperty;