#include "nm-dbus-glib-types.h"
#include "nm-dispatcher-api.h"
#include "nm-utils.h"
-#include "nm-utils-private.h"
/*******************************************/
#include <glib/gi18n-lib.h>
#include <dbus/dbus-glib.h>
#include <NetworkManager.h>
-#include <nm-utils-private.h>
#include "nmt-route-table.h"
#include "nmt-route-entry.h"
IGNORE_HFILES= \
crypto.h \
nm-dbus-helpers-private.h \
+ nm-core-internal.h \
nm-device-private.h \
nm-object-cache.h \
nm-object-private.h \
libnm_core_private_headers = \
$(core)/crypto.h \
+ $(core)/nm-core-internal.h \
$(core)/nm-param-spec-specialized.h \
$(core)/nm-setting-private.h \
$(core)/nm-utils-private.h
--- /dev/null
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * (C) Copyright 2014 Red Hat, Inc.
+ */
+
+#ifndef NM_CORE_NM_INTERNAL_H
+#define NM_CORE_NM_INTERNAL_H
+
+/* This header file contain functions that are provided as private API
+ * by libnm-core. It will contain functions to give privileged access to
+ * libnm-core. This can be useful for NetworkManager and libnm.so
+ * which both are special users of libnm-core.
+ * It also exposes some utility functions for reuse.
+ *
+ * These functions are not exported and are only available to components that link
+ * statically against libnm-core. This basically means libnm-core, libnm, NetworkManager
+ * and some test programs.
+ **/
+
+#include <glib.h>
+
+#include "nm-utils.h"
+
+#include "nm-setting-ip4-config.h"
+
+const char *_nm_setting_ip4_config_get_address_label (NMSettingIP4Config *setting,
+ guint32 i);
+gboolean _nm_setting_ip4_config_add_address_with_label (NMSettingIP4Config *setting,
+ NMIP4Address *address,
+ const char *label);
+
+
+#endif
#include "nm-dbus-glib-types.h"
#include "nm-glib-compat.h"
#include "nm-setting-private.h"
+#include "nm-core-internal.h"
/**
}
const char *
-nm_setting_ip4_config_get_address_label (NMSettingIP4Config *setting, guint32 i)
+_nm_setting_ip4_config_get_address_label (NMSettingIP4Config *setting, guint32 i)
{
NMSettingIP4ConfigPrivate *priv;
nm_setting_ip4_config_add_address (NMSettingIP4Config *setting,
NMIP4Address *address)
{
- return nm_setting_ip4_config_add_address_with_label (setting, address, NULL);
+ return _nm_setting_ip4_config_add_address_with_label (setting, address, NULL);
}
gboolean
-nm_setting_ip4_config_add_address_with_label (NMSettingIP4Config *setting,
- NMIP4Address *address,
- const char *label)
+_nm_setting_ip4_config_add_address_with_label (NMSettingIP4Config *setting,
+ NMIP4Address *address,
+ const char *label)
{
NMSettingIP4ConfigPrivate *priv;
NMIP4Address *copy;
NMSetting *nm_setting_find_in_list (GSList *settings_list, const char *setting_name);
-/* Private NMSettingIP4Config methods */
-#include "nm-setting-ip4-config.h"
-const char *nm_setting_ip4_config_get_address_label (NMSettingIP4Config *setting, guint32 i);
-gboolean nm_setting_ip4_config_add_address_with_label (NMSettingIP4Config *setting, NMIP4Address *address, const char *label);
-
NMSettingVerifyResult _nm_setting_verify_deprecated_virtual_iface_name (const char *interface_name,
gboolean allow_missing,
const char *setting_name,
void _nm_value_transforms_register (void);
-/***********************************************************/
-
-typedef struct NMUtilsPrivateData {
- const char * (*nm_setting_ip4_config_get_address_label) (NMSettingIP4Config *setting,
- guint32 i);
- gboolean (*nm_setting_ip4_config_add_address_with_label) (NMSettingIP4Config *setting,
- NMIP4Address *address,
- const char *label);
-} NMUtilsPrivateData;
-
-const NMUtilsPrivateData *nm_utils_get_private (void);
-
-/**
- * NM_UTILS_PRIVATE_CALL:
- * @call: a call to a private libnm function
- *
- * Used to call private libnm functions. Eg, if there was a
- * private function called nm_foo_get_bar(), you could call it like:
- *
- * bar = NM_UTILS_PRIVATE_CALL (nm_foo_get_bar (foo, x, y, z));
- *
- * This macro only exists inside the NetworkManager source tree and
- * is not part of the public API.
- */
-#define NM_UTILS_PRIVATE_CALL(call) (nm_utils_get_private ()->call)
-
#endif
}
}
-/***********************************************************/
-static const NMUtilsPrivateData data = {
- .nm_setting_ip4_config_get_address_label = nm_setting_ip4_config_get_address_label,
- .nm_setting_ip4_config_add_address_with_label = nm_setting_ip4_config_add_address_with_label,
-};
-
-/**
- * nm_utils_get_private:
- *
- * Entry point for NetworkManager-internal API. You should not use this
- * function for any reason.
- *
- * Returns: Who knows? It's a mystery.
- */
-const NMUtilsPrivateData *
-nm_utils_get_private (void)
-{
- return &data;
-}
#include "nm-setting-vlan.h"
#include "nm-setting-bond.h"
#include "nm-utils.h"
-#include "nm-utils-private.h"
+#include "nm-core-internal.h"
#include "nm-dbus-glib-types.h"
#include "nm-test-utils.h"
nm_setting_verify (NM_SETTING (s_ip4), NULL, &error);
g_assert_no_error (error);
- label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, 0));
+ label = _nm_setting_ip4_config_get_address_label (s_ip4, 0);
g_assert_cmpstr (label, ==, NULL);
/* addr 2 */
nm_ip4_address_set_address (addr, 0x02020202);
nm_ip4_address_set_prefix (addr, 24);
- NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_add_address_with_label (s_ip4, addr, "eth0:1"));
+ _nm_setting_ip4_config_add_address_with_label (s_ip4, addr, "eth0:1");
nm_ip4_address_unref (addr);
nm_setting_verify (NM_SETTING (s_ip4), NULL, &error);
g_assert_no_error (error);
- label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, 1));
+ label = _nm_setting_ip4_config_get_address_label (s_ip4, 1);
g_assert_cmpstr (label, ==, "eth0:1");
/* addr 3 */
nm_ip4_address_set_address (addr, 0x03030303);
nm_ip4_address_set_prefix (addr, 24);
- NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_add_address_with_label (s_ip4, addr, NULL));
+ _nm_setting_ip4_config_add_address_with_label (s_ip4, addr, NULL);
nm_ip4_address_unref (addr);
nm_setting_verify (NM_SETTING (s_ip4), NULL, &error);
g_assert_no_error (error);
- label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, 2));
+ label = _nm_setting_ip4_config_get_address_label (s_ip4, 2);
g_assert_cmpstr (label, ==, NULL);
/* Remove addr 1 and re-verify remaining addresses */
addr = nm_setting_ip4_config_get_address (s_ip4, 0);
g_assert_cmpint (nm_ip4_address_get_address (addr), ==, 0x02020202);
- label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, 0));
+ label = _nm_setting_ip4_config_get_address_label (s_ip4, 0);
g_assert_cmpstr (label, ==, "eth0:1");
addr = nm_setting_ip4_config_get_address (s_ip4, 1);
g_assert_cmpint (nm_ip4_address_get_address (addr), ==, 0x03030303);
- label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, 1));
+ label = _nm_setting_ip4_config_get_address_label (s_ip4, 1);
g_assert_cmpstr (label, ==, NULL);
addr = nm_setting_ip4_config_get_address (s_ip4, 0);
g_assert_cmpint (nm_ip4_address_get_address (addr), ==, 0x02020202);
- label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, 0));
+ label = _nm_setting_ip4_config_get_address_label (s_ip4, 0);
g_assert_cmpstr (label, ==, NULL);
addr = nm_setting_ip4_config_get_address (s_ip4, 1);
g_assert_cmpint (nm_ip4_address_get_address (addr), ==, 0x03030303);
- label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, 1));
+ label = _nm_setting_ip4_config_get_address_label (s_ip4, 1);
g_assert_cmpstr (label, ==, NULL);
/* Setting labels now will leave addresses untouched */
addr = nm_setting_ip4_config_get_address (s_ip4, 0);
g_assert_cmpint (nm_ip4_address_get_address (addr), ==, 0x02020202);
- label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, 0));
+ label = _nm_setting_ip4_config_get_address_label (s_ip4, 0);
g_assert_cmpstr (label, ==, "eth0:1");
addr = nm_setting_ip4_config_get_address (s_ip4, 1);
g_assert_cmpint (nm_ip4_address_get_address (addr), ==, 0x03030303);
- label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, 1));
+ label = _nm_setting_ip4_config_get_address_label (s_ip4, 1);
g_assert_cmpstr (label, ==, NULL);
/* Setting labels to a value that's too short or too long will result in
nm_utils_deinit;
nm_utils_escape_ssid;
nm_utils_file_is_pkcs12;
- nm_utils_get_private;
nm_utils_gvalue_hash_dup;
nm_utils_hex2byte;
nm_utils_hexstr2bin;
#include "nm-dbus-glib-types.h"
#include "nm-ip4-config-glue.h"
#include "NetworkManagerUtils.h"
-#include "nm-utils-private.h"
+#include "nm-core-internal.h"
G_DEFINE_TYPE (NMIP4Config, nm_ip4_config, G_TYPE_OBJECT)
/* Addresses */
for (i = 0; i < naddresses; i++) {
NMIP4Address *s_addr = nm_setting_ip4_config_get_address (setting, i);
- const char *label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (setting, i));
+ const char *label = _nm_setting_ip4_config_get_address_label (setting, i);
NMPlatformIP4Address address;
memset (&address, 0, sizeof (address));
nm_ip4_address_set_gateway (s_addr, gateway);
if (*address->label)
- NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_add_address_with_label (s_ip4, s_addr, address->label));
+ _nm_setting_ip4_config_add_address_with_label (s_ip4, s_addr, address->label);
else
nm_setting_ip4_config_add_address (s_ip4, s_addr);
nm_ip4_address_unref (s_addr);
#include <nm-setting-bridge-port.h>
#include <nm-setting-dcb.h>
#include <nm-setting-generic.h>
-#include <nm-utils-private.h>
+#include "nm-core-internal.h"
#include <nm-utils.h>
#include "nm-platform.h"
ok = read_full_ip4_address (parsed, network_file, -1, addr, &err);
svCloseFile (parsed);
if (ok) {
- if (!NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_add_address_with_label (s_ip4, addr, device)))
+ if (!_nm_setting_ip4_config_add_address_with_label (s_ip4, addr, device))
PARSE_WARNING ("duplicate IP4 address in alias file %s", item);
} else {
PARSE_WARNING ("error reading IP4 address from alias file '%s': %s",
#include <nm-setting-serial.h>
#include <nm-setting-vlan.h>
#include <nm-setting-dcb.h>
-#include <nm-utils-private.h>
+#include "nm-core-internal.h"
#include "NetworkManagerUtils.h"
TEST_IFCFG_ALIASES_GOOD,
i);
- ASSERT (g_strcmp0 (NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, i)), expected_label[j]) == 0,
+ ASSERT (g_strcmp0 (_nm_setting_ip4_config_get_address_label (s_ip4, i), expected_label[j]) == 0,
"aliases-good-verify-ip4", "failed to verify %s: unexpected IP4 address label #%d",
TEST_IFCFG_ALIASES_GOOD,
i);
"aliases-bad-verify-ip4", "failed to verify %s: unexpected IP4 address gateway",
base);
- ASSERT (g_strcmp0 (NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, 0)), expected_label) == 0,
+ ASSERT (g_strcmp0 (_nm_setting_ip4_config_get_address_label (s_ip4, 0), expected_label) == 0,
"aliases-bad-verify-ip4", "failed to verify %s: unexpected IP4 address label",
base);
nm_ip4_address_set_address (addr, ip[i]);
nm_ip4_address_set_prefix (addr, prefix);
nm_ip4_address_set_gateway (addr, gw);
- NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_add_address_with_label (s_ip4, addr, label[i]));
+ _nm_setting_ip4_config_add_address_with_label (s_ip4, addr, label[i]);
nm_ip4_address_unref (addr);
}
testfile,
i);
- ASSERT (g_strcmp0 (NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, i)), label[j]) == 0,
+ ASSERT (g_strcmp0 (_nm_setting_ip4_config_get_address_label (s_ip4, i), label[j]) == 0,
"wired-aliases-write-verify-ip4", "failed to verify %s: unexpected IP4 address label #%d",
testfile,
i);
#include <nm-setting-vlan.h>
#include <nm-setting-team.h>
#include <nm-setting-team-port.h>
-#include <nm-utils-private.h>
+#include "nm-core-internal.h"
#include <nm-utils.h>
#include "nm-logging.h"
NMIP4Address *addr;
guint32 ip;
- if (i > 0 && NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, i)))
+ if (i > 0 && _nm_setting_ip4_config_get_address_label (s_ip4, i))
continue;
if (n == 0) {
guint32 ip;
shvarFile *ifcfg;
- label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, i));
+ label = _nm_setting_ip4_config_get_address_label (s_ip4, i);
if (!label)
continue;
if ( strncmp (label, base_name, base_name_len) != 0