summary refs log tree commit diff
path: root/src/core/ndisc/nm-ndisc-private.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/ndisc/nm-ndisc-private.h')
-rw-r--r--src/core/ndisc/nm-ndisc-private.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/core/ndisc/nm-ndisc-private.h b/src/core/ndisc/nm-ndisc-private.h
new file mode 100644
index 00000000..04739124
--- /dev/null
+++ b/src/core/ndisc/nm-ndisc-private.h
@@ -0,0 +1,68 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2015 Red Hat, Inc.
+ */
+
+#ifndef __NETWORKMANAGER_NDISC_PRIVATE_H__
+#define __NETWORKMANAGER_NDISC_PRIVATE_H__
+
+#include "nm-ndisc.h"
+
+/* Functions only used by ndisc implementations */
+
+struct _NMNDiscDataInternal {
+    NMNDiscData public;
+    GArray *gateways;
+    GArray *addresses;
+    GArray *routes;
+    GArray *dns_servers;
+    GArray *dns_domains;
+};
+
+typedef struct _NMNDiscDataInternal NMNDiscDataInternal;
+
+void nm_ndisc_ra_received(NMNDisc *ndisc, gint64 now_msec, NMNDiscConfigMap changed);
+void nm_ndisc_rs_received(NMNDisc *ndisc);
+
+gboolean nm_ndisc_add_gateway(NMNDisc *ndisc, const NMNDiscGateway *new_item, gint64 now_msec);
+gboolean
+nm_ndisc_complete_and_add_address(NMNDisc *ndisc, const NMNDiscAddress *new_item, gint64 now_msec);
+gboolean nm_ndisc_add_route(NMNDisc *ndisc, const NMNDiscRoute *new_item, gint64 now_msec);
+gboolean nm_ndisc_add_dns_server(NMNDisc *ndisc, const NMNDiscDNSServer *new_item, gint64 now_msec);
+gboolean nm_ndisc_add_dns_domain(NMNDisc *ndisc, const NMNDiscDNSDomain *new_item, gint64 now_msec);
+
+/*****************************************************************************/
+
+#define _NMLOG_DOMAIN      LOGD_IP6
+#define _NMLOG(level, ...) _LOG(level, _NMLOG_DOMAIN, ndisc, __VA_ARGS__)
+
+#define _LOG(level, domain, self, ...)                                                \
+    G_STMT_START                                                                      \
+    {                                                                                 \
+        const NMLogLevel  __level  = (level);                                         \
+        const NMLogDomain __domain = (domain);                                        \
+                                                                                      \
+        if (nm_logging_enabled(__level, __domain)) {                                  \
+            NMNDisc *const __self = (self);                                           \
+            char           __prefix[64];                                              \
+            const char *   __ifname = __self ? nm_ndisc_get_ifname(__self) : NULL;    \
+                                                                                      \
+            _nm_log(__level,                                                          \
+                    __domain,                                                         \
+                    0,                                                                \
+                    __ifname,                                                         \
+                    NULL,                                                             \
+                    "%s: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__),                        \
+                    (__self ? nm_sprintf_buf(__prefix,                                \
+                                             "%s[%p,%s%s%s]",                         \
+                                             _NMLOG_PREFIX_NAME,                      \
+                                             __self,                                  \
+                                             NM_PRINT_FMT_QUOTE_STRING(__ifname))     \
+                            : _NMLOG_PREFIX_NAME) _NM_UTILS_MACRO_REST(__VA_ARGS__)); \
+        }                                                                             \
+    }                                                                                 \
+    G_STMT_END
+
+/*****************************************************************************/
+
+#endif /* __NETWORKMANAGER_NDISC_PRIVATE_H__ */