Commit ae8c7a89 authored by Beniamino Galvani's avatar Beniamino Galvani

libnm-core: add NMSettingIPTunnel

Add a generic NMSettingTunnel which describes properties of tunnels
over IPv4 and IPv6 (GRE, SIT, IPIP, IPIP6, IP6GRE, etc.). Since those
tunnel types all have similar properties it makes sense to have a
single setting type for them.
parent 13a981fc
......@@ -25,6 +25,7 @@ libnm_core_headers = \
$(core)/nm-setting-gsm.h \
$(core)/nm-setting-infiniband.h \
$(core)/nm-setting-ip-config.h \
$(core)/nm-setting-ip-tunnel.h \
$(core)/nm-setting-ip4-config.h \
$(core)/nm-setting-ip6-config.h \
$(core)/nm-setting-olpc-mesh.h \
......@@ -82,6 +83,7 @@ libnm_core_sources = \
$(core)/nm-setting-gsm.c \
$(core)/nm-setting-infiniband.c \
$(core)/nm-setting-ip-config.c \
$(core)/nm-setting-ip-tunnel.c \
$(core)/nm-setting-ip4-config.c \
$(core)/nm-setting-ip6-config.c \
$(core)/nm-setting-olpc-mesh.c \
......
......@@ -1865,6 +1865,24 @@ nm_connection_get_setting_ip4_config (NMConnection *connection)
return (NMSettingIPConfig *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
}
/**
* nm_connection_get_setting_ip_tunnel:
* @connection: the #NMConnection
*
* A shortcut to return any #NMSettingIPTunnel the connection might contain.
*
* Returns: (transfer none): an #NMSettingIPTunnel if the connection contains one, otherwise %NULL
*
* Since: 1.2
**/
NMSettingIPTunnel *
nm_connection_get_setting_ip_tunnel (NMConnection *connection)
{
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
return (NMSettingIPTunnel *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP_TUNNEL);
}
/**
* nm_connection_get_setting_ip6_config:
* @connection: the #NMConnection
......
......@@ -202,6 +202,8 @@ NMSettingDcb * nm_connection_get_setting_dcb (NMConnec
NMSettingGeneric * nm_connection_get_setting_generic (NMConnection *connection);
NMSettingGsm * nm_connection_get_setting_gsm (NMConnection *connection);
NMSettingInfiniband * nm_connection_get_setting_infiniband (NMConnection *connection);
NM_AVAILABLE_IN_1_2
NMSettingIPTunnel * nm_connection_get_setting_ip_tunnel (NMConnection *connection);
NMSettingIPConfig * nm_connection_get_setting_ip4_config (NMConnection *connection);
NMSettingIPConfig * nm_connection_get_setting_ip6_config (NMConnection *connection);
NMSettingOlpcMesh * nm_connection_get_setting_olpc_mesh (NMConnection *connection);
......
......@@ -49,6 +49,7 @@
#include "nm-setting-generic.h"
#include "nm-setting-gsm.h"
#include "nm-setting-infiniband.h"
#include "nm-setting-ip-tunnel.h"
#include "nm-setting-ip4-config.h"
#include "nm-setting-ip6-config.h"
#include "nm-setting-olpc-mesh.h"
......
......@@ -42,6 +42,7 @@ typedef struct _NMSettingGeneric NMSettingGeneric;
typedef struct _NMSettingGsm NMSettingGsm;
typedef struct _NMSettingInfiniband NMSettingInfiniband;
typedef struct _NMSettingIPConfig NMSettingIPConfig;
typedef struct _NMSettingIPTunnel NMSettingIPTunnel;
typedef struct _NMSettingIP4Config NMSettingIP4Config;
typedef struct _NMSettingIP6Config NMSettingIP6Config;
typedef struct _NMSettingOlpcMesh NMSettingOlpcMesh;
......
......@@ -67,7 +67,7 @@
#define NM_DBUS_INTERFACE_DEVICE_MACVLAN NM_DBUS_INTERFACE_DEVICE ".Macvlan"
#define NM_DBUS_INTERFACE_DEVICE_VXLAN NM_DBUS_INTERFACE_DEVICE ".Vxlan"
#define NM_DBUS_INTERFACE_DEVICE_GRE NM_DBUS_INTERFACE_DEVICE ".Gre"
#define NM_DBUS_INTERFACE_DEVICE_IP_TUNNEL NM_DBUS_INTERFACE_DEVICE ".IPTunnel"
#define NM_DBUS_INTERFACE_SETTINGS "org.freedesktop.NetworkManager.Settings"
#define NM_DBUS_PATH_SETTINGS "/org/freedesktop/NetworkManager/Settings"
......@@ -668,4 +668,34 @@ typedef enum /*< flags >*/ {
#define NM_LLDP_DEST_NEAREST_NON_TPMR_BRIDGE "nearest-non-tpmr-bridge"
#define NM_LLDP_DEST_NEAREST_CUSTOMER_BRIDGE "nearest-customer-bridge"
/**
* NMIPTunnelMode:
* @NM_IP_TUNNEL_MODE_UNKNOWN: Unknown/unset tunnel mode
* @NM_IP_TUNNEL_MODE_IPIP: IP in IP tunnel
* @NM_IP_TUNNEL_MODE_GRE: GRE tunnel
* @NM_IP_TUNNEL_MODE_SIT: SIT tunnel
* @NM_IP_TUNNEL_MODE_ISATAP: ISATAP tunnel
* @NM_IP_TUNNEL_MODE_VTI: VTI tunnel
* @NM_IP_TUNNEL_MODE_IP6IP6: IPv6 in IPv6 tunnel
* @NM_IP_TUNNEL_MODE_IPIP6: IPv4 in IPv6 tunnel
* @NM_IP_TUNNEL_MODE_IP6GRE: IPv6 GRE tunnel
* @NM_IP_TUNNEL_MODE_VTI6: IPv6 VTI tunnel
*
* The tunneling mode.
*
* Since: 1.2
*/
typedef enum {
NM_IP_TUNNEL_MODE_UKNOWN = 0,
NM_IP_TUNNEL_MODE_IPIP = 1,
NM_IP_TUNNEL_MODE_GRE = 2,
NM_IP_TUNNEL_MODE_SIT = 3,
NM_IP_TUNNEL_MODE_ISATAP = 4,
NM_IP_TUNNEL_MODE_VTI = 5,
NM_IP_TUNNEL_MODE_IP6IP6 = 6,
NM_IP_TUNNEL_MODE_IPIP6 = 7,
NM_IP_TUNNEL_MODE_IP6GRE = 8,
NM_IP_TUNNEL_MODE_VTI6 = 9,
} NMIPTunnelMode;
#endif /* __NM_DBUS_INTERFACE_H__ */
This diff is collapsed.
/* -*- 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.
*
* Copyright 2015 Red Hat, Inc.
*/
#ifndef __NM_SETTING_IP_TUNNEL_H__
#define __NM_SETTING_IP_TUNNEL_H__
#if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
#error "Only <NetworkManager.h> can be included directly."
#endif
#include <nm-setting.h>
G_BEGIN_DECLS
#define NM_TYPE_SETTING_IP_TUNNEL (nm_setting_ip_tunnel_get_type ())
#define NM_SETTING_IP_TUNNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_IP_TUNNEL, NMSettingIPTunnel))
#define NM_SETTING_IP_TUNNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_IP_TUNNEL, NMSettingIPTunnelClass))
#define NM_IS_SETTING_IP_TUNNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_IP_TUNNEL))
#define NM_IS_SETTING_IP_TUNNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_IP_TUNNEL))
#define NM_SETTING_IP_TUNNEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_IP_TUNNEL, NMSettingIPTunnelClass))
#define NM_SETTING_IP_TUNNEL_SETTING_NAME "ip-tunnel"
#define NM_SETTING_IP_TUNNEL_PARENT "parent"
#define NM_SETTING_IP_TUNNEL_MODE "mode"
#define NM_SETTING_IP_TUNNEL_LOCAL "local"
#define NM_SETTING_IP_TUNNEL_REMOTE "remote"
#define NM_SETTING_IP_TUNNEL_TTL "ttl"
#define NM_SETTING_IP_TUNNEL_TOS "tos"
#define NM_SETTING_IP_TUNNEL_PATH_MTU_DISCOVERY "path-mtu-discovery"
#define NM_SETTING_IP_TUNNEL_INPUT_KEY "input-key"
#define NM_SETTING_IP_TUNNEL_OUTPUT_KEY "output-key"
#define NM_SETTING_IP_TUNNEL_ENCAPSULATION_LIMIT "encapsulation-limit"
#define NM_SETTING_IP_TUNNEL_FLOW_LABEL "flow-label"
struct _NMSettingIPTunnel {
NMSetting parent;
};
typedef struct {
NMSettingClass parent;
/*< private >*/
gpointer padding[4];
} NMSettingIPTunnelClass;
NM_AVAILABLE_IN_1_2
GType nm_setting_ip_tunnel_get_type (void);
NM_AVAILABLE_IN_1_2
NMSetting * nm_setting_ip_tunnel_new (void);
NM_AVAILABLE_IN_1_2
const char *nm_setting_ip_tunnel_get_parent (NMSettingIPTunnel *setting);
NM_AVAILABLE_IN_1_2
NMIPTunnelMode nm_setting_ip_tunnel_get_mode (NMSettingIPTunnel *setting);
NM_AVAILABLE_IN_1_2
const char *nm_setting_ip_tunnel_get_local (NMSettingIPTunnel *setting);
NM_AVAILABLE_IN_1_2
const char *nm_setting_ip_tunnel_get_remote (NMSettingIPTunnel *setting);
NM_AVAILABLE_IN_1_2
guint nm_setting_ip_tunnel_get_ttl (NMSettingIPTunnel *setting);
NM_AVAILABLE_IN_1_2
guint nm_setting_ip_tunnel_get_tos (NMSettingIPTunnel *setting);
NM_AVAILABLE_IN_1_2
gboolean nm_setting_ip_tunnel_get_path_mtu_discovery (NMSettingIPTunnel *setting);
NM_AVAILABLE_IN_1_2
const char *nm_setting_ip_tunnel_get_input_key (NMSettingIPTunnel *setting);
NM_AVAILABLE_IN_1_2
const char *nm_setting_ip_tunnel_get_output_key (NMSettingIPTunnel *setting);
NM_AVAILABLE_IN_1_2
guint nm_setting_ip_tunnel_get_encapsulation_limit (NMSettingIPTunnel *setting);
NM_AVAILABLE_IN_1_2
guint nm_setting_ip_tunnel_get_flow_label (NMSettingIPTunnel *setting);
G_END_DECLS
#endif /* __NM_SETTING_IP_TUNNEL_H__ */
......@@ -61,6 +61,7 @@
#include <nm-setting-gsm.h>
#include <nm-setting-infiniband.h>
#include <nm-setting-ip-config.h>
#include <nm-setting-ip-tunnel.h>
#include <nm-setting-ip4-config.h>
#include <nm-setting-ip6-config.h>
#include <nm-setting-olpc-mesh.h>
......
......@@ -858,6 +858,7 @@ libnm_1_0_6 {
libnm_1_2_0 {
global:
nm_access_point_get_last_seen;
nm_connection_get_setting_ip_tunnel;
nm_connection_verify_secrets;
nm_device_ethernet_get_s390_subchannels;
nm_device_get_lldp_neighbors;
......@@ -874,6 +875,7 @@ global:
nm_device_tun_get_vnet_hdr;
nm_device_wifi_request_scan_options;
nm_device_wifi_request_scan_options_async;
nm_ip_tunnel_mode_get_type;
nm_lldp_neighbor_get_attr_names;
nm_lldp_neighbor_get_attr_string_value;
nm_lldp_neighbor_get_attr_type;
......@@ -904,6 +906,17 @@ global:
nm_setting_ip_config_has_dns_options;
nm_setting_ip_config_remove_dns_option;
nm_setting_ip_config_remove_dns_option_by_value;
nm_setting_ip_tunnel_get_input_key;
nm_setting_ip_tunnel_get_local;
nm_setting_ip_tunnel_get_mode;
nm_setting_ip_tunnel_get_output_key;
nm_setting_ip_tunnel_get_parent;
nm_setting_ip_tunnel_get_path_mtu_discovery;
nm_setting_ip_tunnel_get_remote;
nm_setting_ip_tunnel_get_tos;
nm_setting_ip_tunnel_get_type;
nm_setting_ip_tunnel_get_ttl;
nm_setting_ip_tunnel_new;
nm_setting_mac_randomization_get_type;
nm_setting_tun_get_group;
nm_setting_tun_get_mode;
......
......@@ -65,6 +65,7 @@ libnm-core/nm-setting-infiniband.c
libnm-core/nm-setting-ip-config.c
libnm-core/nm-setting-ip4-config.c
libnm-core/nm-setting-ip6-config.c
libnm-core/nm-setting-ip-tunnel.c
libnm-core/nm-setting-olpc-mesh.c
libnm-core/nm-setting-ppp.c
libnm-core/nm-setting-pppoe.c
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment