libnm: add nm-types.h, to avoid include loops

Add nm-types.h defining all the type structs, to avoid future include
loops. Clean up the includes in all of the installed headers.
This commit is contained in:
Dan Winship
2014-10-09 09:12:42 -04:00
parent dccaffe143
commit 8c3d6f734b
36 changed files with 150 additions and 133 deletions

View File

@@ -51,6 +51,7 @@ libnminclude_HEADERS = \
nm-object.h \
nm-remote-connection.h \
nm-secret-agent.h \
nm-types.h \
nm-vpn-connection.h \
nm-vpn-plugin.h \
nm-vpn-plugin-ui-interface.h \

View File

@@ -26,11 +26,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include <glib.h>
#include <glib-object.h>
#include <nm-dbus-interface.h>
#include <nm-connection.h>
#include "nm-object.h"
#include <nm-object.h>
G_BEGIN_DECLS
@@ -55,9 +51,9 @@ G_BEGIN_DECLS
#define NM_ACCESS_POINT_HW_ADDRESS "hw-address"
typedef struct {
struct _NMAccessPoint {
NMObject parent;
} NMAccessPoint;
};
typedef struct {
NMObjectClass parent;

View File

@@ -31,6 +31,10 @@
#include "nm-vpn-connection.h"
#include "nm-glib-compat.h"
#include "nm-dbus-helpers.h"
#include "nm-dhcp4-config.h"
#include "nm-dhcp6-config.h"
#include "nm-ip4-config.h"
#include "nm-ip6-config.h"
static GType _nm_active_connection_decide_type (GVariant *value);

View File

@@ -26,15 +26,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include <glib.h>
#include <glib-object.h>
#include "nm-object.h"
#include <nm-connection.h>
#include <nm-dbus-interface.h>
#include "nm-ip4-config.h"
#include "nm-dhcp4-config.h"
#include "nm-ip6-config.h"
#include "nm-dhcp6-config.h"
#include <nm-object.h>
G_BEGIN_DECLS
@@ -61,9 +53,9 @@ G_BEGIN_DECLS
#define NM_ACTIVE_CONNECTION_VPN "vpn"
#define NM_ACTIVE_CONNECTION_MASTER "master"
typedef struct {
struct _NMActiveConnection {
NMObject parent;
} NMActiveConnection;
};
typedef struct {
NMObjectClass parent;

View File

@@ -31,6 +31,7 @@
#include "nm-core-internal.h"
#include "nm-active-connection.h"
#include "nm-vpn-connection.h"
#include "nm-remote-connection.h"
#include "nm-object-cache.h"
#include "nm-glib-compat.h"
#include "nm-dbus-helpers.h"

View File

@@ -26,15 +26,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <nm-dbus-interface.h>
#include "nm-device.h"
#include "nm-active-connection.h"
#include "nm-remote-connection.h"
#include "nm-vpn-connection.h"
#include <nm-types.h>
G_BEGIN_DECLS
@@ -159,9 +151,9 @@ typedef enum {
#define NM_CLIENT_ERROR nm_client_error_quark ()
GQuark nm_client_error_quark (void);
typedef struct {
struct _NMClient {
GObject parent;
} NMClient;
};
typedef struct {
GObjectClass parent;

View File

@@ -25,7 +25,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include "nm-device.h"
#include <nm-device.h>
G_BEGIN_DECLS
@@ -53,9 +53,9 @@ GQuark nm_device_adsl_error_quark (void);
#define NM_DEVICE_ADSL_CARRIER "carrier"
typedef struct {
struct _NMDeviceAdsl {
NMDevice parent;
} NMDeviceAdsl;
};
typedef struct {
NMDeviceClass parent;

View File

@@ -25,7 +25,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include "nm-device.h"
#include <nm-device.h>
G_BEGIN_DECLS
@@ -57,9 +57,9 @@ GQuark nm_device_bond_error_quark (void);
#define NM_DEVICE_BOND_CARRIER "carrier"
#define NM_DEVICE_BOND_SLAVES "slaves"
typedef struct {
struct _NMDeviceBond {
NMDevice parent;
} NMDeviceBond;
};
typedef struct {
NMDeviceClass parent;

View File

@@ -25,7 +25,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include "nm-device.h"
#include <nm-device.h>
G_BEGIN_DECLS
@@ -57,9 +57,9 @@ GQuark nm_device_bridge_error_quark (void);
#define NM_DEVICE_BRIDGE_CARRIER "carrier"
#define NM_DEVICE_BRIDGE_SLAVES "slaves"
typedef struct {
struct _NMDeviceBridge {
NMDevice parent;
} NMDeviceBridge;
};
typedef struct {
NMDeviceClass parent;

View File

@@ -26,8 +26,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include "nm-dbus-interface.h"
#include "nm-device.h"
#include <nm-device.h>
G_BEGIN_DECLS
@@ -63,9 +62,9 @@ GQuark nm_device_bt_error_quark (void);
#define NM_DEVICE_BT_NAME "name"
#define NM_DEVICE_BT_CAPABILITIES "bt-capabilities"
typedef struct {
struct _NMDeviceBt {
NMDevice parent;
} NMDeviceBt;
};
typedef struct {
NMDeviceClass parent;

View File

@@ -26,7 +26,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include "nm-device.h"
#include <nm-device.h>
G_BEGIN_DECLS
@@ -61,9 +61,9 @@ GQuark nm_device_ethernet_error_quark (void);
#define NM_DEVICE_ETHERNET_SPEED "speed"
#define NM_DEVICE_ETHERNET_CARRIER "carrier"
typedef struct {
struct _NMDeviceEthernet {
NMDevice parent;
} NMDeviceEthernet;
};
typedef struct {
NMDeviceClass parent;

View File

@@ -25,7 +25,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include "nm-device.h"
#include <nm-device.h>
G_BEGIN_DECLS
@@ -54,9 +54,9 @@ GQuark nm_device_generic_error_quark (void);
#define NM_DEVICE_GENERIC_HW_ADDRESS "hw-address"
#define NM_DEVICE_GENERIC_TYPE_DESCRIPTION "type-description"
typedef struct {
struct _NMDeviceGeneric {
NMDevice parent;
} NMDeviceGeneric;
};
typedef struct {
NMDeviceClass parent;

View File

@@ -25,7 +25,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include "nm-device.h"
#include <nm-device.h>
G_BEGIN_DECLS
@@ -58,9 +58,9 @@ GQuark nm_device_infiniband_error_quark (void);
#define NM_DEVICE_INFINIBAND_HW_ADDRESS "hw-address"
#define NM_DEVICE_INFINIBAND_CARRIER "carrier"
typedef struct {
struct _NMDeviceInfiniband {
NMDevice parent;
} NMDeviceInfiniband;
};
typedef struct {
NMDeviceClass parent;

View File

@@ -26,7 +26,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include "nm-device.h"
#include <nm-device.h>
G_BEGIN_DECLS
@@ -57,9 +57,9 @@ GQuark nm_device_modem_error_quark (void);
#define NM_DEVICE_MODEM_MODEM_CAPABILITIES "modem-capabilities"
#define NM_DEVICE_MODEM_CURRENT_CAPABILITIES "current-capabilities"
typedef struct {
struct _NMDeviceModem {
NMDevice parent;
} NMDeviceModem;
};
typedef struct {
NMDeviceClass parent;

View File

@@ -25,8 +25,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include "nm-device.h"
#include "nm-device-wifi.h"
#include <nm-device.h>
G_BEGIN_DECLS
@@ -56,9 +55,9 @@ GQuark nm_device_olpc_mesh_error_quark (void);
#define NM_DEVICE_OLPC_MESH_COMPANION "companion"
#define NM_DEVICE_OLPC_MESH_ACTIVE_CHANNEL "active-channel"
typedef struct {
struct _NMDeviceOlpcMesh {
NMDevice parent;
} NMDeviceOlpcMesh;
};
typedef struct {
NMDeviceClass parent;

View File

@@ -25,7 +25,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include "nm-device.h"
#include <nm-device.h>
G_BEGIN_DECLS
@@ -57,9 +57,9 @@ GQuark nm_device_team_error_quark (void);
#define NM_DEVICE_TEAM_CARRIER "carrier"
#define NM_DEVICE_TEAM_SLAVES "slaves"
typedef struct {
struct _NMDeviceTeam {
NMDevice parent;
} NMDeviceTeam;
};
typedef struct {
NMDeviceClass parent;

View File

@@ -25,7 +25,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include "nm-device.h"
#include <nm-device.h>
G_BEGIN_DECLS
@@ -61,9 +61,9 @@ GQuark nm_device_vlan_error_quark (void);
#define NM_DEVICE_VLAN_CARRIER "carrier"
#define NM_DEVICE_VLAN_VLAN_ID "vlan-id"
typedef struct {
struct _NMDeviceVlan {
NMDevice parent;
} NMDeviceVlan;
};
typedef struct {
NMDeviceClass parent;

View File

@@ -30,6 +30,7 @@
#include <nm-utils.h>
#include "nm-device-wifi.h"
#include "nm-access-point.h"
#include "nm-device-private.h"
#include "nm-object-private.h"
#include "nm-object-cache.h"

View File

@@ -26,8 +26,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include "nm-device.h"
#include "nm-access-point.h"
#include <nm-device.h>
G_BEGIN_DECLS
@@ -71,9 +70,9 @@ GQuark nm_device_wifi_error_quark (void);
#define NM_DEVICE_WIFI_CAPABILITIES "wireless-capabilities"
#define NM_DEVICE_WIFI_ACCESS_POINTS "access-points"
typedef struct {
struct _NMDeviceWifi {
NMDevice parent;
} NMDeviceWifi;
};
typedef struct {
NMDeviceClass parent;

View File

@@ -29,6 +29,7 @@
#include <nm-utils.h>
#include "nm-device-wimax.h"
#include "nm-wimax-nsp.h"
#include "nm-object-private.h"
#include "nm-object-cache.h"
#include "nm-core-internal.h"

View File

@@ -26,8 +26,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include "nm-device.h"
#include "nm-wimax-nsp.h"
#include <nm-device.h>
G_BEGIN_DECLS
@@ -66,9 +65,9 @@ GQuark nm_device_wimax_error_quark (void);
#define NM_DEVICE_WIMAX_BSID "bsid"
#define NM_DEVICE_WIMAX_NSPS "nsps"
typedef struct {
struct _NMDeviceWimax {
NMDevice parent;
} NMDeviceWimax;
};
typedef struct {
NMDeviceClass parent;

View File

@@ -25,6 +25,7 @@
#include <gudev/gudev.h>
#include "nm-dbus-interface.h"
#include "nm-active-connection.h"
#include "nm-device-ethernet.h"
#include "nm-device-adsl.h"
#include "nm-device-wifi.h"
@@ -40,6 +41,10 @@
#include "nm-device-generic.h"
#include "nm-device.h"
#include "nm-device-private.h"
#include "nm-dhcp4-config.h"
#include "nm-dhcp6-config.h"
#include "nm-ip4-config.h"
#include "nm-ip6-config.h"
#include "nm-object-private.h"
#include "nm-object-cache.h"
#include "nm-remote-connection.h"

View File

@@ -26,16 +26,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include <glib.h>
#include <glib-object.h>
#include "nm-object.h"
#include "nm-dbus-interface.h"
#include "nm-ip4-config.h"
#include "nm-dhcp4-config.h"
#include "nm-ip6-config.h"
#include "nm-dhcp6-config.h"
#include "nm-connection.h"
#include "nm-active-connection.h"
#include <nm-object.h>
G_BEGIN_DECLS
@@ -84,9 +75,9 @@ GQuark nm_device_error_quark (void);
#define NM_DEVICE_PHYSICAL_PORT_ID "physical-port-id"
#define NM_DEVICE_MTU "mtu"
typedef struct {
struct _NMDevice {
NMObject parent;
} NMDevice;
};
typedef struct {
NMObjectClass parent;

View File

@@ -26,9 +26,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include <glib.h>
#include <glib-object.h>
#include "nm-object.h"
#include <nm-object.h>
G_BEGIN_DECLS
@@ -38,9 +36,9 @@ G_BEGIN_DECLS
#define NM_IS_DHCP4_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DHCP4_CONFIG))
#define NM_IS_DHCP4_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DHCP4_CONFIG))
typedef struct {
struct _NMDhcp4Config {
NMObject parent;
} NMDhcp4Config;
};
typedef struct {
NMObjectClass parent;

View File

@@ -26,9 +26,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include <glib.h>
#include <glib-object.h>
#include "nm-object.h"
#include <nm-object.h>
G_BEGIN_DECLS
@@ -38,9 +36,9 @@ G_BEGIN_DECLS
#define NM_IS_DHCP6_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DHCP6_CONFIG))
#define NM_IS_DHCP6_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DHCP6_CONFIG))
typedef struct {
struct _NMDhcp6Config {
NMObject parent;
} NMDhcp6Config;
};
typedef struct {
NMObjectClass parent;

View File

@@ -26,9 +26,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include <glib.h>
#include <glib-object.h>
#include "nm-object.h"
#include <nm-object.h>
G_BEGIN_DECLS
@@ -39,9 +37,9 @@ G_BEGIN_DECLS
#define NM_IS_IP4_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_IP4_CONFIG))
#define NM_IP4_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_IP4_CONFIG, NMIP4ConfigClass))
typedef struct {
struct _NMIP4Config {
NMObject parent;
} NMIP4Config;
};
typedef struct {
NMObjectClass parent;

View File

@@ -26,9 +26,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include <glib.h>
#include <glib-object.h>
#include "nm-object.h"
#include <nm-object.h>
G_BEGIN_DECLS
@@ -39,9 +37,9 @@ G_BEGIN_DECLS
#define NM_IS_IP6_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_IP6_CONFIG))
#define NM_IP6_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_IP6_CONFIG, NMIP6ConfigClass))
typedef struct {
struct _NMIP6Config {
NMObject parent;
} NMIP6Config;
};
typedef struct {
NMObjectClass parent;

View File

@@ -22,8 +22,8 @@
#ifndef __NM_MANAGER_H__
#define __NM_MANAGER_H__
#include "nm-client.h"
#include "nm-object.h"
#include <nm-object.h>
#include <nm-client.h>
G_BEGIN_DECLS

View File

@@ -26,9 +26,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include <gio/gio.h>
#include <nm-version.h>
#include <nm-types.h>
G_BEGIN_DECLS
@@ -58,9 +56,9 @@ GQuark nm_object_error_quark (void);
#define NM_OBJECT_PATH "path"
#define NM_OBJECT_DBUS_CONNECTION "dbus-connection"
typedef struct {
struct _NMObject {
GObject parent;
} NMObject;
};
typedef struct {
GObjectClass parent;

View File

@@ -26,7 +26,6 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include <nm-connection.h>
#include <nm-object.h>
G_BEGIN_DECLS
@@ -58,9 +57,9 @@ GQuark nm_remote_connection_error_quark (void);
#define NM_REMOTE_CONNECTION_UNSAVED "unsaved"
#define NM_REMOTE_CONNECTION_VISIBLE "visible"
typedef struct {
struct _NMRemoteConnection {
NMObject parent;
} NMRemoteConnection;
};
typedef struct {
NMObjectClass parent_class;

View File

@@ -25,6 +25,7 @@
#include "nm-remote-settings.h"
#include "nm-client.h"
#include "nm-remote-connection.h"
#include "nm-remote-connection-private.h"
#include "nm-object-private.h"
#include "nm-dbus-helpers.h"

View File

@@ -22,10 +22,7 @@
#ifndef __NM_REMOTE_SETTINGS_H__
#define __NM_REMOTE_SETTINGS_H__
#include <gio/gio.h>
#include <nm-object.h>
#include <nm-connection.h>
#include <nm-remote-connection.h>
G_BEGIN_DECLS

View File

@@ -25,8 +25,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include <gio/gio.h>
#include <nm-connection.h>
#include <nm-types.h>
G_BEGIN_DECLS
@@ -72,9 +71,9 @@ typedef enum {
#define NM_SECRET_AGENT_REGISTERED "registered"
#define NM_SECRET_AGENT_CAPABILITIES "capabilities"
typedef struct {
struct _NMSecretAgent {
GObject parent;
} NMSecretAgent;
};
/**
* NMSecretAgentGetSecretsFunc:

56
libnm/nm-types.h Normal file
View File

@@ -0,0 +1,56 @@
/* -*- 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_TYPES_H__
#define __NM_TYPES_H__
#include <gio/gio.h>
#include <nm-dbus-interface.h>
#include <nm-connection.h>
typedef struct _NMAccessPoint NMAccessPoint;
typedef struct _NMActiveConnection NMActiveConnection;
typedef struct _NMClient NMClient;
typedef struct _NMDevice NMDevice;
typedef struct _NMDeviceAdsl NMDeviceAdsl;
typedef struct _NMDeviceBond NMDeviceBond;
typedef struct _NMDeviceBridge NMDeviceBridge;
typedef struct _NMDeviceBt NMDeviceBt;
typedef struct _NMDeviceEthernet NMDeviceEthernet;
typedef struct _NMDeviceGeneric NMDeviceGeneric;
typedef struct _NMDeviceInfiniband NMDeviceInfiniband;
typedef struct _NMDeviceModem NMDeviceModem;
typedef struct _NMDeviceOlpcMesh NMDeviceOlpcMesh;
typedef struct _NMDeviceTeam NMDeviceTeam;
typedef struct _NMDeviceVlan NMDeviceVlan;
typedef struct _NMDeviceWifi NMDeviceWifi;
typedef struct _NMDeviceWimax NMDeviceWimax;
typedef struct _NMDhcp4Config NMDhcp4Config;
typedef struct _NMDhcp6Config NMDhcp6Config;
typedef struct _NMIP4Config NMIP4Config;
typedef struct _NMIP6Config NMIP6Config;
typedef struct _NMObject NMObject;
typedef struct _NMRemoteConnection NMRemoteConnection;
typedef struct _NMSecretAgent NMSecretAgent;
typedef struct _NMVpnConnection NMVpnConnection;
typedef struct _NMWimaxNsp NMWimaxNsp;
#endif /* NM_TYPES_H */

View File

@@ -26,10 +26,8 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include <glib.h>
#include <glib-object.h>
#include "nm-active-connection.h"
#include "nm-vpn-dbus-interface.h"
#include <nm-active-connection.h>
#include <nm-vpn-dbus-interface.h>
G_BEGIN_DECLS
@@ -43,9 +41,9 @@ G_BEGIN_DECLS
#define NM_VPN_CONNECTION_VPN_STATE "vpn-state"
#define NM_VPN_CONNECTION_BANNER "banner"
typedef struct {
struct _NMVpnConnection {
NMActiveConnection parent;
} NMVpnConnection;
};
typedef struct {
NMActiveConnectionClass parent;

View File

@@ -26,10 +26,7 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include <glib.h>
#include <glib-object.h>
#include <nm-dbus-interface.h>
#include "nm-object.h"
#include <nm-object.h>
G_BEGIN_DECLS
@@ -51,9 +48,9 @@ typedef enum {
NM_WIMAX_NSP_NETWORK_TYPE_ROAMING_PARTNER = 3
} NMWimaxNspNetworkType;
typedef struct {
struct _NMWimaxNsp {
NMObject parent;
} NMWimaxNsp;
};
typedef struct {
NMObjectClass parent;