Commit b1087908 authored by Dan Winship's avatar Dan Winship

libnm-core: add nm-core-types.h, remove cross-includes

Add nm-core-types.h, typedefing all of the GObject types in
libnm-core; this is needed so that nm-setting.h can reference
NMConnection in addition to nm-connection.h referencing NMSetting.

Removing the cross-includes from the various headers causes lots of
fallout elsewhere. (In particular, nm-utils.h used to include
nm-connection.h, which included every setting header, so any file that
included nm-utils.h automatically got most of the rest of libnm-core
without needing to pay attention to specifics.) Fix this up by
including nm-core-internal.h from those files that are now missing
includes.
parent 6eba3aa1
......@@ -25,11 +25,9 @@
#include <glib.h>
#include <glib-object.h>
#include "nm-connection.h"
#include "nm-setting-connection.h"
#include "nm-core-internal.h"
#include "nm-dispatcher-utils.h"
#include "nm-dispatcher-api.h"
#include "nm-utils.h"
/*******************************************/
......
......@@ -9,6 +9,7 @@ libnm_core_headers = \
$(core_build)/nm-core-enum-types.h \
$(core_build)/nm-version.h \
$(core)/nm-connection.h \
$(core)/nm-core-types.h \
$(core)/nm-dbus-interface.h \
$(core)/nm-errors.h \
$(core)/nm-setting-8021x.h \
......
......@@ -26,32 +26,7 @@
#include "nm-connection.h"
#include "nm-utils.h"
#include "nm-setting-private.h"
#include "nm-setting-8021x.h"
#include "nm-setting-bluetooth.h"
#include "nm-setting-connection.h"
#include "nm-setting-infiniband.h"
#include "nm-setting-ip4-config.h"
#include "nm-setting-ip6-config.h"
#include "nm-setting-ppp.h"
#include "nm-setting-pppoe.h"
#include "nm-setting-wimax.h"
#include "nm-setting-wired.h"
#include "nm-setting-adsl.h"
#include "nm-setting-wireless.h"
#include "nm-setting-wireless-security.h"
#include "nm-setting-serial.h"
#include "nm-setting-vpn.h"
#include "nm-setting-olpc-mesh.h"
#include "nm-setting-bond.h"
#include "nm-setting-team.h"
#include "nm-setting-team-port.h"
#include "nm-setting-bridge.h"
#include "nm-setting-bridge-port.h"
#include "nm-setting-vlan.h"
#include "nm-setting-serial.h"
#include "nm-setting-gsm.h"
#include "nm-setting-cdma.h"
#include "nm-core-internal.h"
/**
* SECTION:nm-connection
......
......@@ -27,38 +27,10 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include <glib.h>
#include <glib-object.h>
#include <nm-core-types.h>
#include <nm-setting.h>
#include <nm-errors.h>
#include <nm-setting-8021x.h>
#include <nm-setting-bluetooth.h>
#include <nm-setting-bond.h>
#include <nm-setting-team.h>
#include <nm-setting-team-port.h>
#include <nm-setting-bridge.h>
#include <nm-setting-bridge-port.h>
#include <nm-setting-cdma.h>
#include <nm-setting-connection.h>
#include <nm-setting-dcb.h>
#include <nm-setting-generic.h>
#include <nm-setting-gsm.h>
#include <nm-setting-infiniband.h>
#include <nm-setting-ip4-config.h>
#include <nm-setting-ip6-config.h>
#include <nm-setting-olpc-mesh.h>
#include <nm-setting-ppp.h>
#include <nm-setting-pppoe.h>
#include <nm-setting-serial.h>
#include <nm-setting-vpn.h>
#include <nm-setting-wimax.h>
#include <nm-setting-wired.h>
#include <nm-setting-adsl.h>
#include <nm-setting-wireless.h>
#include <nm-setting-wireless-security.h>
#include <nm-setting-vlan.h>
G_BEGIN_DECLS
#define NM_TYPE_CONNECTION (nm_connection_get_type ())
......@@ -84,7 +56,6 @@ G_BEGIN_DECLS
* NMConnection is the interface implemented by #NMRemoteConnection on the
* client side, and #NMSettingsConnection on the daemon side.
*/
typedef struct _NMConnection NMConnection;
typedef struct {
GTypeInterface parent;
......
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* 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.
*
* 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.
*
* Copyright 2014 Red Hat, Inc.
*/
#ifndef __NM_CORE_TYPES_H__
#define __NM_CORE_TYPES_H__
#include <glib-object.h>
#include <nm-dbus-interface.h>
#include <nm-core-enum-types.h>
typedef struct _NMConnection NMConnection;
typedef struct _NMSetting NMSetting;
typedef struct _NMSetting8021x NMSetting8021x;
typedef struct _NMSettingAdsl NMSettingAdsl;
typedef struct _NMSettingBluetooth NMSettingBluetooth;
typedef struct _NMSettingBond NMSettingBond;
typedef struct _NMSettingBridge NMSettingBridge;
typedef struct _NMSettingBridgePort NMSettingBridgePort;
typedef struct _NMSettingCdma NMSettingCdma;
typedef struct _NMSettingConnection NMSettingConnection;
typedef struct _NMSettingDcb NMSettingDcb;
typedef struct _NMSettingGeneric NMSettingGeneric;
typedef struct _NMSettingGsm NMSettingGsm;
typedef struct _NMSettingInfiniband NMSettingInfiniband;
typedef struct _NMSettingIP4Config NMSettingIP4Config;
typedef struct _NMSettingIP6Config NMSettingIP6Config;
typedef struct _NMSettingOlpcMesh NMSettingOlpcMesh;
typedef struct _NMSettingPpp NMSettingPpp;
typedef struct _NMSettingPppoe NMSettingPppoe;
typedef struct _NMSettingSerial NMSettingSerial;
typedef struct _NMSettingTeam NMSettingTeam;
typedef struct _NMSettingTeamPort NMSettingTeamPort;
typedef struct _NMSettingVlan NMSettingVlan;
typedef struct _NMSettingVpn NMSettingVpn;
typedef struct _NMSettingWimax NMSettingWimax;
typedef struct _NMSettingWired NMSettingWired;
typedef struct _NMSettingWireless NMSettingWireless;
typedef struct _NMSettingWirelessSecurity NMSettingWirelessSecurity;
typedef struct _NMSimpleConnection NMSimpleConnection;
#endif /* __NM_CORE_TYPES_H__ */
......@@ -132,9 +132,9 @@ typedef enum { /*< underscore_name=nm_setting_802_1x_ck_scheme >*/
* properties to the paths to their respective objects.
*/
typedef struct {
struct _NMSetting8021x {
NMSetting parent;
} NMSetting8021x;
};
typedef struct {
NMSettingClass parent;
......
......@@ -54,9 +54,9 @@ G_BEGIN_DECLS
#define NM_SETTING_ADSL_ENCAPSULATION_VCMUX "vcmux"
#define NM_SETTING_ADSL_ENCAPSULATION_LLC "llc"
typedef struct {
struct _NMSettingAdsl {
NMSetting parent;
} NMSettingAdsl;
};
typedef struct {
NMSettingClass parent;
......
......@@ -59,9 +59,9 @@ G_BEGIN_DECLS
*/
#define NM_SETTING_BLUETOOTH_TYPE_PANU "panu"
typedef struct {
struct _NMSettingBluetooth {
NMSetting parent;
} NMSettingBluetooth;
};
typedef struct {
NMSettingClass parent;
......
......@@ -30,6 +30,7 @@
#include "nm-utils.h"
#include "nm-utils-private.h"
#include "nm-setting-private.h"
#include "nm-setting-infiniband.h"
/**
* SECTION:nm-setting-bond
......
......@@ -58,9 +58,9 @@ G_BEGIN_DECLS
#define NM_SETTING_BOND_OPTION_RESEND_IGMP "resend_igmp"
#define NM_SETTING_BOND_OPTION_LACP_RATE "lacp_rate"
typedef struct {
struct _NMSettingBond {
NMSetting parent;
} NMSettingBond;
};
typedef struct {
NMSettingClass parent;
......
......@@ -28,6 +28,8 @@
#include "nm-utils.h"
#include "nm-utils-private.h"
#include "nm-setting-private.h"
#include "nm-setting-connection.h"
#include "nm-setting-bridge.h"
/**
* SECTION:nm-setting-bridge-port
......
......@@ -43,9 +43,9 @@ G_BEGIN_DECLS
#define NM_SETTING_BRIDGE_PORT_PATH_COST "path-cost"
#define NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE "hairpin-mode"
typedef struct {
struct _NMSettingBridgePort {
NMSetting parent;
} NMSettingBridgePort;
};
typedef struct {
NMSettingClass parent;
......
......@@ -47,9 +47,9 @@ G_BEGIN_DECLS
#define NM_SETTING_BRIDGE_MAX_AGE "max-age"
#define NM_SETTING_BRIDGE_AGEING_TIME "ageing-time"
typedef struct {
struct _NMSettingBridge {
NMSetting parent;
} NMSettingBridge;
};
typedef struct {
NMSettingClass parent;
......
......@@ -45,9 +45,9 @@ G_BEGIN_DECLS
#define NM_SETTING_CDMA_PASSWORD "password"
#define NM_SETTING_CDMA_PASSWORD_FLAGS "password-flags"
typedef struct {
struct _NMSettingCdma {
NMSetting parent;
} NMSettingCdma;
};
typedef struct {
NMSettingClass parent;
......
......@@ -27,6 +27,10 @@
#include "nm-utils-private.h"
#include "nm-setting-connection.h"
#include "nm-setting-private.h"
#include "nm-setting-bond.h"
#include "nm-setting-bridge.h"
#include "nm-setting-team.h"
#include "nm-setting-vlan.h"
/**
* SECTION:nm-setting-connection
......
......@@ -65,9 +65,9 @@ G_BEGIN_DECLS
* The NMSettingConnection struct contains only private data.
* It should only be accessed through the functions described below.
*/
typedef struct {
struct _NMSettingConnection {
NMSetting parent;
} NMSettingConnection;
};
typedef struct {
NMSettingClass parent;
......
......@@ -93,9 +93,9 @@ typedef enum { /*< flags >*/
#define NM_SETTING_DCB_PRIORITY_TRAFFIC_CLASS "priority-traffic-class"
typedef struct {
struct _NMSettingDcb {
NMSetting parent;
} NMSettingDcb;
};
typedef struct {
NMSettingClass parent;
......
......@@ -39,9 +39,9 @@ G_BEGIN_DECLS
#define NM_SETTING_GENERIC_SETTING_NAME "generic"
typedef struct {
struct _NMSettingGeneric {
NMSetting parent;
} NMSettingGeneric;
};
typedef struct {
NMSettingClass parent;
......
......@@ -50,9 +50,9 @@ G_BEGIN_DECLS
#define NM_SETTING_GSM_PIN_FLAGS "pin-flags"
#define NM_SETTING_GSM_HOME_ONLY "home-only"
typedef struct {
struct _NMSettingGsm {
NMSetting parent;
} NMSettingGsm;
};
typedef struct {
NMSettingClass parent;
......
......@@ -45,9 +45,9 @@ G_BEGIN_DECLS
#define NM_SETTING_INFINIBAND_P_KEY "p-key"
#define NM_SETTING_INFINIBAND_PARENT "parent"
typedef struct {
struct _NMSettingInfiniband {
NMSetting parent;
} NMSettingInfiniband;
};
typedef struct {
NMSettingClass parent;
......
......@@ -22,6 +22,7 @@
#include <string.h>
#include <glib/gi18n.h>
#include <arpa/inet.h>
#include "nm-setting-ip4-config.h"
#include "nm-utils.h"
......
......@@ -148,9 +148,9 @@ void nm_ip4_route_set_metric (NMIP4Route *route,
guint32 metric);
typedef struct {
struct _NMSettingIP4Config {
NMSetting parent;
} NMSettingIP4Config;
};
typedef struct {
NMSettingClass parent;
......
......@@ -178,9 +178,9 @@ guint32 nm_ip6_route_get_metric (NMIP6Route *route);
void nm_ip6_route_set_metric (NMIP6Route *route,
guint32 metric);
typedef struct {
struct _NMSettingIP6Config {
NMSetting parent;
} NMSettingIP6Config;
};
typedef struct {
NMSettingClass parent;
......
......@@ -44,9 +44,9 @@ G_BEGIN_DECLS
#define NM_SETTING_OLPC_MESH_CHANNEL "channel"
#define NM_SETTING_OLPC_MESH_DHCP_ANYCAST_ADDRESS "dhcp-anycast-address"
typedef struct {
struct _NMSettingOlpcMesh {
NMSetting parent;
} NMSettingOlpcMesh;
};
typedef struct {
NMSettingClass parent;
......
......@@ -59,9 +59,9 @@ G_BEGIN_DECLS
#define NM_SETTING_PPP_LCP_ECHO_FAILURE "lcp-echo-failure"
#define NM_SETTING_PPP_LCP_ECHO_INTERVAL "lcp-echo-interval"
typedef struct {
struct _NMSettingPpp {
NMSetting parent;
} NMSettingPpp;
};
typedef struct {
NMSettingClass parent;
......
......@@ -45,9 +45,9 @@ G_BEGIN_DECLS
#define NM_SETTING_PPPOE_PASSWORD "password"
#define NM_SETTING_PPPOE_PASSWORD_FLAGS "password-flags"
typedef struct {
struct _NMSettingPppoe {
NMSetting parent;
} NMSettingPppoe;
};
typedef struct {
NMSettingClass parent;
......
......@@ -60,9 +60,9 @@ typedef enum {
#define NM_SETTING_SERIAL_STOPBITS "stopbits"
#define NM_SETTING_SERIAL_SEND_DELAY "send-delay"
typedef struct {
struct _NMSettingSerial {
NMSetting parent;
} NMSettingSerial;
};
typedef struct {
NMSettingClass parent;
......
......@@ -27,6 +27,8 @@
#include "nm-utils.h"
#include "nm-utils-private.h"
#include "nm-setting-private.h"
#include "nm-setting-connection.h"
#include "nm-setting-team.h"
/**
* SECTION:nm-setting-team-port
......
......@@ -40,9 +40,9 @@ G_BEGIN_DECLS
#define NM_SETTING_TEAM_PORT_CONFIG "config"
typedef struct {
struct _NMSettingTeamPort {
NMSetting parent;
} NMSettingTeamPort;
};
typedef struct {
NMSettingClass parent;
......
......@@ -40,9 +40,9 @@ G_BEGIN_DECLS
#define NM_SETTING_TEAM_CONFIG "config"
typedef struct {
struct _NMSettingTeam {
NMSetting parent;
} NMSettingTeam;
};
typedef struct {
NMSettingClass parent;
......
......@@ -27,7 +27,7 @@
#include "nm-utils.h"
#include "nm-setting-connection.h"
#include "nm-setting-private.h"
#include "nm-core-enum-types.h"
#include "nm-setting-wired.h"
/**
* SECTION:nm-setting-vlan
......
......@@ -46,9 +46,9 @@ G_BEGIN_DECLS
#define NM_SETTING_VLAN_INGRESS_PRIORITY_MAP "ingress-priority-map"
#define NM_SETTING_VLAN_EGRESS_PRIORITY_MAP "egress-priority-map"
typedef struct {
struct _NMSettingVlan {
NMSetting parent;
} NMSettingVlan;
};
typedef struct {
NMSettingClass parent;
......
......@@ -45,9 +45,9 @@ G_BEGIN_DECLS
#define NM_SETTING_VPN_DATA "data"
#define NM_SETTING_VPN_SECRETS "secrets"
typedef struct {
struct _NMSettingVpn {
NMSetting parent;
} NMSettingVpn;
};
typedef struct {
NMSettingClass parent;
......
......@@ -42,9 +42,9 @@ G_BEGIN_DECLS
#define NM_SETTING_WIMAX_NETWORK_NAME "network-name"
#define NM_SETTING_WIMAX_MAC_ADDRESS "mac-address"
typedef struct {
struct _NMSettingWimax {
NMSetting parent;
} NMSettingWimax;
};
typedef struct {
NMSettingClass parent;
......
......@@ -52,9 +52,9 @@ G_BEGIN_DECLS
#define NM_SETTING_WIRED_S390_NETTYPE "s390-nettype"
#define NM_SETTING_WIRED_S390_OPTIONS "s390-options"
typedef struct {
struct _NMSettingWired {
NMSetting parent;
} NMSettingWired;
};
typedef struct {
NMSettingClass parent;
......
......@@ -29,7 +29,7 @@
#include "nm-utils.h"
#include "nm-utils-private.h"
#include "nm-setting-private.h"
#include "nm-core-enum-types.h"
#include "nm-setting-wireless.h"
/**
* SECTION:nm-setting-wireless-security
......
......@@ -89,9 +89,9 @@ typedef enum {
#define NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD "leap-password"
#define NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS "leap-password-flags"
typedef struct {
struct _NMSettingWirelessSecurity {
NMSetting parent;
} NMSettingWirelessSecurity;
};
typedef struct {
NMSettingClass parent;
......
......@@ -79,9 +79,9 @@ G_BEGIN_DECLS
*/
#define NM_SETTING_WIRELESS_MODE_INFRA "infrastructure"
typedef struct {
struct _NMSettingWireless {
NMSetting parent;
} NMSettingWireless;
};
typedef struct {
NMSettingClass parent;
......
......@@ -26,12 +26,20 @@
#include "nm-setting.h"
#include "nm-setting-private.h"
#include "nm-setting-connection.h"
#include "nm-utils.h"
#include "nm-core-internal.h"
#include "nm-utils-private.h"
#include "nm-property-compare.h"
#include "nm-setting-connection.h"
#include "nm-setting-bond.h"
#include "nm-setting-bridge.h"
#include "nm-setting-bridge-port.h"
#include "nm-setting-pppoe.h"
#include "nm-setting-team.h"
#include "nm-setting-team-port.h"
#include "nm-setting-vpn.h"
/**
* SECTION:nm-setting
* @short_description: Describes related configuration information
......
......@@ -27,10 +27,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include <glib.h>
#include <glib-object.h>
#include <nm-version.h>
#include <nm-core-types.h>
G_BEGIN_DECLS
......@@ -138,9 +135,9 @@ typedef enum {
* The NMSetting struct contains only private data.
* It should only be accessed through the functions described below.
*/
typedef struct {
struct _NMSetting {
GObject parent;
} NMSetting;
};
/**
......
......@@ -36,9 +36,9 @@ G_BEGIN_DECLS
#define NM_IS_SIMPLE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SIMPLE_CONNECTION))
#define NM_SIMPLE_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SIMPLE_CONNECTION, NMSimpleConnectionClass))
typedef struct {
struct _NMSimpleConnection {
GObject parent;
} NMSimpleConnection;
};
typedef struct {
GObjectClass parent_class;
......
......@@ -33,6 +33,15 @@
#include "nm-setting-private.h"
#include "crypto.h"
#include "nm-setting-bond.h"
#include "nm-setting-bridge.h"
#include "nm-setting-infiniband.h"
#include "nm-setting-ip6-config.h"
#include "nm-setting-team.h"
#include "nm-setting-vlan.h"
#include "nm-setting-wired.h"
#include "nm-setting-wireless.h"
/**
* SECTION:nm-utils
* @short_description: Utility functions
......
......@@ -27,13 +27,15 @@
#include <glib.h>
#include <netinet/in.h>
/* For ETH_ALEN and INFINIBAND_ALEN */
#include <linux/if_ether.h>
#include <linux/if_infiniband.h>
#include "nm-connection.h"
#include "nm-simple-connection.h"
#include "nm-dbus-interface.h"
#include "nm-core-enum-types.h"
#include "nm-setting-wireless-security.h"
G_BEGIN_DECLS
......
......@@ -25,20 +25,35 @@
#include <nm-utils.h>
#include "nm-setting-private.h"
#include "nm-utils.h"
#include "nm-core-internal.h"
#include "nm-setting-8021x.h"
#include "nm-setting-adsl.h"
#include "nm-setting-bluetooth.h"
#include "nm-setting-bond.h"
#include "nm-setting-bridge.h"
#include "nm-setting-bridge-port.h"
#include "nm-setting-cdma.h"
#include "nm-setting-connection.h"
#include "nm-setting-vpn.h"
#include "nm-setting-generic.h"
#include "nm-setting-gsm.h"
#include "nm-setting-cdma.h"
#include "nm-setting-wired.h"
#include "nm-setting-wireless-security.h"
#include "nm-setting-ip6-config.h"
#include "nm-setting-infiniband.h"
#include "nm-setting-ip4-config.h"
#include "nm-setting-ip6-config.h"
#include "nm-setting-olpc-mesh.h"
#include "nm-setting-ppp.h"
#include "nm-setting-pppoe.h"
#include "nm-setting-serial.h"
#include "nm-setting-team.h"
#include "nm-setting-team-port.h"
#include "nm-setting-vlan.h"
#include "nm-setting-bond.h"
#include "nm-utils.h"
#include "nm-core-internal.h"
#include "nm-setting-vpn.h"
#include "nm-setting-wimax.h"
#include "nm-setting-wired.h"
#include "nm-setting-wireless.h"
#include "nm-setting-wireless-security.h"
#include "nm-simple-connection.h"
#include "nm-test-utils.h"
......
......@@ -22,17 +22,18 @@
#include <glib.h>
#include <string.h>
#include "nm-setting-connection.h"
#include "nm-setting-wired.h"
#include "nm-setting-8021x.h"
#include "nm-setting-ip4-config.h"
#include "nm-setting-wireless.h"
#include "nm-setting-wireless-security.h"
#include "nm-setting-cdma.h"
#include "nm-setting-connection.h"
#include "nm-setting-gsm.h"
#include "nm-setting-ip4-config.h"
#include "nm-setting-ppp.h"
#include "nm-setting-pppoe.h"
#include "nm-setting-vpn.h"
#include "nm-setting-wired.h"
#include "nm-setting-wireless-security.h"
#include "nm-setting-wireless.h"
#include "nm-simple-connection.h"
#include "nm-utils.h"
#include "nm-test-utils.h"
......