2008-11-03 04:13:42 +00:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
2004-06-24 14:18:37 +00:00
|
|
|
/* NetworkManager -- Network link manager
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
|
*
|
2008-06-26 18:31:52 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2004-06-24 14:18:37 +00:00
|
|
|
*
|
2011-07-12 09:08:04 +02:00
|
|
|
* Copyright (C) 2004 - 2011 Red Hat, Inc.
|
2008-11-03 04:13:42 +00:00
|
|
|
* Copyright (C) 2005 - 2008 Novell, Inc.
|
2004-06-24 14:18:37 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef NETWORK_MANAGER_UTILS_H
|
|
|
|
|
#define NETWORK_MANAGER_UTILS_H
|
|
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
#include <stdio.h>
|
2004-07-06 01:34:10 +00:00
|
|
|
#include <net/ethernet.h>
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2008-04-21 03:02:32 +00:00
|
|
|
#include "nm-ip4-config.h"
|
|
|
|
|
#include "nm-setting-ip4-config.h"
|
2009-07-29 12:12:41 -04:00
|
|
|
#include "nm-ip6-config.h"
|
|
|
|
|
#include "nm-setting-ip6-config.h"
|
2008-04-27 14:30:06 +00:00
|
|
|
#include "nm-connection.h"
|
2013-11-15 13:09:12 -06:00
|
|
|
#include "nm-setting-private.h"
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2008-04-27 12:23:17 +00:00
|
|
|
gboolean nm_ethernet_address_is_valid (const struct ether_addr *test_addr);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2014-02-13 18:12:41 +01:00
|
|
|
in_addr_t nm_utils_ip4_address_clear_host_address (in_addr_t addr, guint8 plen);
|
|
|
|
|
void nm_utils_ip6_address_clear_host_address (struct in6_addr *dst, const struct in6_addr *src, guint8 plen);
|
|
|
|
|
|
2008-04-27 12:23:17 +00:00
|
|
|
int nm_spawn_process (const char *args);
|
2004-06-24 14:18:37 +00:00
|
|
|
|
2014-03-14 14:26:12 +01:00
|
|
|
/* macro to return strlen() of a compile time string. */
|
|
|
|
|
#define STRLEN(str) ( sizeof ("" str) - 1 )
|
|
|
|
|
|
2013-03-20 09:48:24 -04:00
|
|
|
gboolean nm_match_spec_string (const GSList *specs, const char *string);
|
2009-06-11 00:39:12 -04:00
|
|
|
gboolean nm_match_spec_hwaddr (const GSList *specs, const char *hwaddr);
|
2010-06-17 21:24:14 -07:00
|
|
|
gboolean nm_match_spec_s390_subchannels (const GSList *specs, const char *subchannels);
|
2013-02-12 18:00:48 -05:00
|
|
|
gboolean nm_match_spec_interface_name (const GSList *specs, const char *interface_name);
|
2009-06-11 00:39:12 -04:00
|
|
|
|
2011-07-01 14:56:07 -05:00
|
|
|
const char *nm_utils_get_shared_wifi_permission (NMConnection *connection);
|
2007-08-15 01:59:19 +00:00
|
|
|
|
2009-01-22 12:35:04 +02:00
|
|
|
GHashTable *value_hash_create (void);
|
|
|
|
|
void value_hash_add (GHashTable *hash,
|
|
|
|
|
const char *key,
|
|
|
|
|
GValue *value);
|
|
|
|
|
|
|
|
|
|
void value_hash_add_str (GHashTable *hash,
|
|
|
|
|
const char *key,
|
|
|
|
|
const char *str);
|
|
|
|
|
|
|
|
|
|
void value_hash_add_object_path (GHashTable *hash,
|
|
|
|
|
const char *key,
|
|
|
|
|
const char *op);
|
|
|
|
|
|
|
|
|
|
void value_hash_add_uint (GHashTable *hash,
|
|
|
|
|
const char *key,
|
|
|
|
|
guint32 val);
|
|
|
|
|
|
2010-03-16 23:51:55 -07:00
|
|
|
void value_hash_add_bool (GHashTable *hash,
|
|
|
|
|
const char *key,
|
|
|
|
|
gboolean val);
|
|
|
|
|
|
2011-05-02 22:38:51 -05:00
|
|
|
void value_hash_add_object_property (GHashTable *hash,
|
|
|
|
|
const char *key,
|
|
|
|
|
GObject *object,
|
|
|
|
|
const char *prop,
|
|
|
|
|
GType val_type);
|
|
|
|
|
|
2013-09-26 17:34:23 -04:00
|
|
|
void nm_utils_normalize_connection (NMConnection *connection,
|
|
|
|
|
gboolean default_enable_ipv6);
|
core: don't have IP4 and IP6 configs on slaves
Although it's convenient in some places to have IP configs on all
connections, it makes more sense in other places to not have IP
configs on slaves. (eg, it's confusing for nmcli, etc, to report a
full NMSettingIP4Config on a slave device). So revert parts of the
earlier patch. However, it's still safe to assume that s_ip4 != NULL
if method != DISABLED, so some of the earlier simplifications can
stay.
Also, add nm_utils_get_ip_config_method(), which returns the correct
IP config method for a connection, whether the connection has IP4 and
IP6 settings objects or not, and use that to keep some more of the
simplifications from the earlier patch.
2013-10-14 10:38:56 -04:00
|
|
|
const char *nm_utils_get_ip_config_method (NMConnection *connection,
|
|
|
|
|
GType ip_setting_type);
|
2013-09-26 17:34:23 -04:00
|
|
|
|
2011-01-13 13:28:52 -06:00
|
|
|
void nm_utils_complete_generic (NMConnection *connection,
|
|
|
|
|
const char *ctype,
|
|
|
|
|
const GSList *existing,
|
|
|
|
|
const char *format,
|
2011-02-25 11:58:16 -06:00
|
|
|
const char *preferred,
|
|
|
|
|
gboolean default_enable_ipv6);
|
2011-01-13 13:28:52 -06:00
|
|
|
|
2012-02-22 23:40:18 -06:00
|
|
|
char *nm_utils_new_vlan_name (const char *parent_iface, guint32 vlan_id);
|
2012-02-12 14:48:44 -06:00
|
|
|
|
2013-11-19 22:28:36 -06:00
|
|
|
GPtrArray *nm_utils_read_resolv_conf_nameservers (const char *rc_contents);
|
|
|
|
|
|
2013-11-15 13:09:12 -06:00
|
|
|
typedef gboolean (NMUtilsMatchFilterFunc) (NMConnection *connection, gpointer user_data);
|
|
|
|
|
|
|
|
|
|
NMConnection *nm_utils_match_connection (GSList *connections,
|
|
|
|
|
NMConnection *original,
|
2014-02-25 17:56:06 -06:00
|
|
|
gboolean device_has_carrier,
|
2013-11-15 13:09:12 -06:00
|
|
|
NMUtilsMatchFilterFunc match_filter_func,
|
|
|
|
|
gpointer match_filter_data);
|
|
|
|
|
|
2014-01-21 13:07:06 +01:00
|
|
|
gint64 nm_utils_ascii_str_to_int64 (const char *str, guint base, gint64 min, gint64 max, gint64 fallback);
|
|
|
|
|
|
2013-12-10 13:16:08 +01:00
|
|
|
#define NM_UTILS_NS_PER_SECOND ((gint64) 1000000000)
|
2014-02-11 11:17:40 +01:00
|
|
|
gint64 nm_utils_get_monotonic_timestamp_us (void);
|
2013-12-10 13:16:08 +01:00
|
|
|
gint64 nm_utils_get_monotonic_timestamp_ms (void);
|
|
|
|
|
gint32 nm_utils_get_monotonic_timestamp_s (void);
|
|
|
|
|
|
2014-03-04 17:01:10 -05:00
|
|
|
const char *nm_utils_ip6_property_path (const char *ifname, const char *property);
|
|
|
|
|
|
2009-01-22 12:35:04 +02:00
|
|
|
#endif /* NETWORK_MANAGER_UTILS_H */
|