core: refactor private data for NMExportedObject and others
This commit is contained in:
@@ -66,6 +66,12 @@ typedef struct {
|
||||
};
|
||||
} LldpAttrData;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
NM_GOBJECT_PROPERTIES_DEFINE (NMLldpListener,
|
||||
PROP_NEIGHBORS,
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
char *iface;
|
||||
int ifindex;
|
||||
@@ -79,13 +85,20 @@ typedef struct {
|
||||
GVariant *variant;
|
||||
} NMLldpListenerPrivate;
|
||||
|
||||
NM_GOBJECT_PROPERTIES_DEFINE (NMLldpListener,
|
||||
PROP_NEIGHBORS,
|
||||
);
|
||||
struct _NMLldpListener {
|
||||
GObject parent;
|
||||
NMLldpListenerPrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMLldpListenerClass {
|
||||
GObjectClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMLldpListener, nm_lldp_listener, G_TYPE_OBJECT)
|
||||
|
||||
#define NM_LLDP_LISTENER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_LLDP_LISTENER, NMLldpListenerPrivate))
|
||||
#define NM_LLDP_LISTENER_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMLldpListener, NM_IS_LLDP_LISTENER)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
guint8 chassis_id_type;
|
||||
@@ -903,8 +916,6 @@ nm_lldp_listener_class_init (NMLldpListenerClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (NMLldpListenerPrivate));
|
||||
|
||||
object_class->dispose = dispose;
|
||||
object_class->finalize = finalize;
|
||||
object_class->get_property = get_property;
|
||||
|
@@ -30,13 +30,7 @@
|
||||
|
||||
#define NM_LLDP_LISTENER_NEIGHBORS "neighbors"
|
||||
|
||||
struct _NMLldpListener {
|
||||
GObject parent;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
GObjectClass parent;
|
||||
} NMLldpListenerClass;
|
||||
typedef struct _NMLldpListenerClass NMLldpListenerClass;
|
||||
|
||||
GType nm_lldp_listener_get_type (void);
|
||||
NMLldpListener *nm_lldp_listener_new (void);
|
||||
|
@@ -37,30 +37,7 @@
|
||||
|
||||
#include "nm-dhcp-client-logging.h"
|
||||
|
||||
typedef struct {
|
||||
char * iface;
|
||||
int ifindex;
|
||||
GByteArray * hwaddr;
|
||||
gboolean ipv6;
|
||||
char * uuid;
|
||||
guint32 priority;
|
||||
guint32 timeout;
|
||||
GByteArray * duid;
|
||||
GBytes * client_id;
|
||||
char * hostname;
|
||||
char * fqdn;
|
||||
|
||||
NMDhcpState state;
|
||||
pid_t pid;
|
||||
guint timeout_id;
|
||||
guint watch_id;
|
||||
gboolean info_only;
|
||||
|
||||
} NMDhcpClientPrivate;
|
||||
|
||||
#define NM_DHCP_CLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP_CLIENT, NMDhcpClientPrivate))
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (NMDhcpClient, nm_dhcp_client, G_TYPE_OBJECT, G_TYPE_FLAG_ABSTRACT, {})
|
||||
/*****************************************************************************/
|
||||
|
||||
enum {
|
||||
SIGNAL_STATE_CHANGED,
|
||||
@@ -81,6 +58,30 @@ enum {
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
typedef struct _NMDhcpClientPrivate {
|
||||
char * iface;
|
||||
int ifindex;
|
||||
GByteArray * hwaddr;
|
||||
gboolean ipv6;
|
||||
char * uuid;
|
||||
guint32 priority;
|
||||
guint32 timeout;
|
||||
GByteArray * duid;
|
||||
GBytes * client_id;
|
||||
char * hostname;
|
||||
char * fqdn;
|
||||
|
||||
NMDhcpState state;
|
||||
pid_t pid;
|
||||
guint timeout_id;
|
||||
guint watch_id;
|
||||
gboolean info_only;
|
||||
} NMDhcpClientPrivate;
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (NMDhcpClient, nm_dhcp_client, G_TYPE_OBJECT, G_TYPE_FLAG_ABSTRACT, {})
|
||||
|
||||
#define NM_DHCP_CLIENT_GET_PRIVATE(self) _NM_GET_PRIVATE_PTR (self, NMDhcpClient, NM_IS_DHCP_CLIENT)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
pid_t
|
||||
@@ -781,14 +782,19 @@ nm_dhcp_client_handle_event (gpointer unused,
|
||||
static void
|
||||
nm_dhcp_client_init (NMDhcpClient *self)
|
||||
{
|
||||
NM_DHCP_CLIENT_GET_PRIVATE (self)->pid = -1;
|
||||
NMDhcpClientPrivate *priv;
|
||||
|
||||
priv = G_TYPE_INSTANCE_GET_PRIVATE (self, NM_TYPE_DHCP_CLIENT, NMDhcpClientPrivate);
|
||||
self->_priv = priv;
|
||||
|
||||
priv->pid = -1;
|
||||
}
|
||||
|
||||
static void
|
||||
get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE (object);
|
||||
NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE ((NMDhcpClient *) object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_IFACE:
|
||||
@@ -822,7 +828,7 @@ static void
|
||||
set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE (object);
|
||||
NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE ((NMDhcpClient *) object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_IFACE:
|
||||
|
@@ -52,8 +52,11 @@ typedef enum {
|
||||
NM_DHCP_STATE_MAX = __NM_DHCP_STATE_MAX - 1,
|
||||
} NMDhcpState;
|
||||
|
||||
struct _NMDhcpClientPrivate;
|
||||
|
||||
typedef struct {
|
||||
GObject parent;
|
||||
struct _NMDhcpClientPrivate *_priv;
|
||||
} NMDhcpClient;
|
||||
|
||||
typedef struct {
|
||||
@@ -171,4 +174,3 @@ gboolean nm_dhcp_client_handle_event (gpointer unused,
|
||||
void nm_dhcp_client_set_client_id (NMDhcpClient *self, GBytes *client_id);
|
||||
|
||||
#endif /* __NETWORKMANAGER_DHCP_CLIENT_H__ */
|
||||
|
||||
|
@@ -27,6 +27,8 @@
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-dhcp-dhclient.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
@@ -36,7 +38,6 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "nm-dhcp-dhclient.h"
|
||||
#include "nm-utils.h"
|
||||
#include "nm-dhcp-dhclient-utils.h"
|
||||
#include "nm-dhcp-manager.h"
|
||||
@@ -44,9 +45,7 @@
|
||||
#include "nm-dhcp-listener.h"
|
||||
#include "nm-dhcp-client-logging.h"
|
||||
|
||||
G_DEFINE_TYPE (NMDhcpDhclient, nm_dhcp_dhclient, NM_TYPE_DHCP_CLIENT)
|
||||
|
||||
#define NM_DHCP_DHCLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP_DHCLIENT, NMDhcpDhclientPrivate))
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
char *conf_file;
|
||||
@@ -56,6 +55,21 @@ typedef struct {
|
||||
NMDhcpListener *dhcp_listener;
|
||||
} NMDhcpDhclientPrivate;
|
||||
|
||||
struct _NMDhcpDhclient {
|
||||
NMDhcpClient parent;
|
||||
NMDhcpDhclientPrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMDhcpDhclientClass {
|
||||
NMDhcpClientClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMDhcpDhclient, nm_dhcp_dhclient, NM_TYPE_DHCP_CLIENT)
|
||||
|
||||
#define NM_DHCP_DHCLIENT_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMDhcpDhclient, NM_IS_DHCP_DHCLIENT)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static const char *
|
||||
nm_dhcp_dhclient_get_path (void)
|
||||
{
|
||||
@@ -546,7 +560,7 @@ state_changed (NMDhcpClient *client,
|
||||
GObject *ip_config,
|
||||
GHashTable *options)
|
||||
{
|
||||
NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (client);
|
||||
NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE ((NMDhcpDhclient *) client);
|
||||
gs_unref_bytes GBytes *client_id = NULL;
|
||||
|
||||
if (nm_dhcp_client_get_client_id (client))
|
||||
@@ -637,7 +651,7 @@ nm_dhcp_dhclient_init (NMDhcpDhclient *self)
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (object);
|
||||
NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE ((NMDhcpDhclient *) object);
|
||||
|
||||
if (priv->dhcp_listener) {
|
||||
g_signal_handlers_disconnect_by_func (priv->dhcp_listener,
|
||||
@@ -659,9 +673,6 @@ nm_dhcp_dhclient_class_init (NMDhcpDhclientClass *dhclient_class)
|
||||
NMDhcpClientClass *client_class = NM_DHCP_CLIENT_CLASS (dhclient_class);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (dhclient_class);
|
||||
|
||||
g_type_class_add_private (dhclient_class, sizeof (NMDhcpDhclientPrivate));
|
||||
|
||||
/* virtual methods */
|
||||
object_class->dispose = dispose;
|
||||
|
||||
client_class->ip4_start = ip4_start;
|
||||
|
@@ -16,8 +16,8 @@
|
||||
* Copyright (C) 2005 - 2010 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NETWORKMANAGER_DHCP_DHCLIENT_H__
|
||||
#define __NETWORKMANAGER_DHCP_DHCLIENT_H__
|
||||
#ifndef __NM_DHCP_DHCLIENT_H__
|
||||
#define __NM_DHCP_DHCLIENT_H__
|
||||
|
||||
#include "nm-dhcp-client.h"
|
||||
|
||||
@@ -28,15 +28,9 @@
|
||||
#define NM_IS_DHCP_DHCLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DHCP_DHCLIENT))
|
||||
#define NM_DHCP_DHCLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DHCP_DHCLIENT, NMDhcpDhclientClass))
|
||||
|
||||
typedef struct {
|
||||
NMDhcpClient parent;
|
||||
} NMDhcpDhclient;
|
||||
|
||||
typedef struct {
|
||||
NMDhcpClientClass parent;
|
||||
} NMDhcpDhclientClass;
|
||||
typedef struct _NMDhcpDhclient NMDhcpDhclient;
|
||||
typedef struct _NMDhcpDhclientClass NMDhcpDhclientClass;
|
||||
|
||||
GType nm_dhcp_dhclient_get_type (void);
|
||||
|
||||
#endif /* __NETWORKMANAGER_DHCP_DHCLIENT_H__ */
|
||||
|
||||
#endif /* __NM_DHCP_DHCLIENT_H__ */
|
||||
|
@@ -20,9 +20,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-dhcp-dhcpcd.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
@@ -31,22 +32,34 @@
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "nm-dhcp-dhcpcd.h"
|
||||
#include "nm-dhcp-manager.h"
|
||||
#include "nm-utils.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-dhcp-listener.h"
|
||||
#include "nm-dhcp-client-logging.h"
|
||||
|
||||
G_DEFINE_TYPE (NMDhcpDhcpcd, nm_dhcp_dhcpcd, NM_TYPE_DHCP_CLIENT)
|
||||
|
||||
#define NM_DHCP_DHCPCD_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP_DHCPCD, NMDhcpDhcpcdPrivate))
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
char *pid_file;
|
||||
NMDhcpListener *dhcp_listener;
|
||||
} NMDhcpDhcpcdPrivate;
|
||||
|
||||
struct _NMDhcpDhcpcd {
|
||||
NMDhcpClient parent;
|
||||
NMDhcpDhcpcdPrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMDhcpDhcpcdClass {
|
||||
NMDhcpClientClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMDhcpDhcpcd, nm_dhcp_dhcpcd, NM_TYPE_DHCP_CLIENT)
|
||||
|
||||
#define NM_DHCP_DHCPCD_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMDhcpDhcpcd, NM_IS_DHCP_DHCPCD)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static const char *
|
||||
nm_dhcp_dhcpcd_get_path (void)
|
||||
{
|
||||
@@ -204,7 +217,7 @@ nm_dhcp_dhcpcd_init (NMDhcpDhcpcd *self)
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
NMDhcpDhcpcdPrivate *priv = NM_DHCP_DHCPCD_GET_PRIVATE (object);
|
||||
NMDhcpDhcpcdPrivate *priv = NM_DHCP_DHCPCD_GET_PRIVATE ((NMDhcpDhcpcd *) object);
|
||||
|
||||
if (priv->dhcp_listener) {
|
||||
g_signal_handlers_disconnect_by_func (priv->dhcp_listener,
|
||||
@@ -224,9 +237,6 @@ nm_dhcp_dhcpcd_class_init (NMDhcpDhcpcdClass *dhcpcd_class)
|
||||
NMDhcpClientClass *client_class = NM_DHCP_CLIENT_CLASS (dhcpcd_class);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (dhcpcd_class);
|
||||
|
||||
g_type_class_add_private (dhcpcd_class, sizeof (NMDhcpDhcpcdPrivate));
|
||||
|
||||
/* virtual methods */
|
||||
object_class->dispose = dispose;
|
||||
|
||||
client_class->ip4_start = ip4_start;
|
||||
|
@@ -28,13 +28,8 @@
|
||||
#define NM_IS_DHCP_DHCPCD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DHCP_DHCPCD))
|
||||
#define NM_DHCP_DHCPCD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DHCP_DHCPCD, NMDhcpDhcpcdClass))
|
||||
|
||||
typedef struct {
|
||||
NMDhcpClient parent;
|
||||
} NMDhcpDhcpcd;
|
||||
|
||||
typedef struct {
|
||||
NMDhcpClientClass parent;
|
||||
} NMDhcpDhcpcdClass;
|
||||
typedef struct _NMDhcpDhcpcd NMDhcpDhcpcd;
|
||||
typedef struct _NMDhcpDhcpcdClass NMDhcpDhcpcdClass;
|
||||
|
||||
GType nm_dhcp_dhcpcd_get_type (void);
|
||||
|
||||
|
@@ -22,6 +22,8 @@
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-dhcp-manager.h"
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
@@ -32,7 +34,6 @@
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "nm-dhcp-manager.h"
|
||||
#include "nm-dhcp-dhclient.h"
|
||||
#include "nm-dhcp-dhcpcd.h"
|
||||
#include "nm-dhcp-systemd.h"
|
||||
@@ -41,10 +42,7 @@
|
||||
|
||||
#define DHCP_TIMEOUT 45 /* default DHCP timeout, in seconds */
|
||||
|
||||
/* default to installed helper, but can be modified for testing */
|
||||
const char *nm_dhcp_helper_path = LIBEXECDIR "/nm-dhcp-helper";
|
||||
|
||||
typedef GSList * (*GetLeaseConfigFunc) (const char *iface, const char *uuid, gboolean ipv6);
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
GType client_type;
|
||||
@@ -52,10 +50,24 @@ typedef struct {
|
||||
char * default_hostname;
|
||||
} NMDhcpManagerPrivate;
|
||||
|
||||
#define NM_DHCP_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP_MANAGER, NMDhcpManagerPrivate))
|
||||
struct _NMDhcpManager {
|
||||
GObject parent;
|
||||
NMDhcpManagerPrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMDhcpManagerClass {
|
||||
GObjectClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMDhcpManager, nm_dhcp_manager, G_TYPE_OBJECT)
|
||||
|
||||
#define NM_DHCP_MANAGER_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMDhcpManager, NM_IS_DHCP_MANAGER)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* default to installed helper, but can be modified for testing */
|
||||
const char *nm_dhcp_helper_path = LIBEXECDIR "/nm-dhcp-helper";
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
@@ -412,7 +424,7 @@ nm_dhcp_manager_init (NMDhcpManager *self)
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
NMDhcpManagerPrivate *priv = NM_DHCP_MANAGER_GET_PRIVATE (object);
|
||||
NMDhcpManagerPrivate *priv = NM_DHCP_MANAGER_GET_PRIVATE ((NMDhcpManager *) object);
|
||||
GList *values, *iter;
|
||||
|
||||
if (priv->clients) {
|
||||
@@ -428,7 +440,7 @@ dispose (GObject *object)
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
NMDhcpManagerPrivate *priv = NM_DHCP_MANAGER_GET_PRIVATE (object);
|
||||
NMDhcpManagerPrivate *priv = NM_DHCP_MANAGER_GET_PRIVATE ((NMDhcpManager *) object);
|
||||
|
||||
g_free (priv->default_hostname);
|
||||
|
||||
@@ -443,9 +455,6 @@ nm_dhcp_manager_class_init (NMDhcpManagerClass *manager_class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (manager_class);
|
||||
|
||||
g_type_class_add_private (manager_class, sizeof (NMDhcpManagerPrivate));
|
||||
|
||||
/* virtual methods */
|
||||
object_class->finalize = finalize;
|
||||
object_class->dispose = dispose;
|
||||
}
|
||||
|
@@ -33,13 +33,8 @@
|
||||
#define NM_IS_DHCP_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DHCP_MANAGER))
|
||||
#define NM_DHCP_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DHCP_MANAGER, NMDhcpManagerClass))
|
||||
|
||||
typedef struct {
|
||||
GObject parent;
|
||||
} NMDhcpManager;
|
||||
|
||||
typedef struct {
|
||||
GObjectClass parent;
|
||||
} NMDhcpManagerClass;
|
||||
typedef struct _NMDhcpManager NMDhcpManager;
|
||||
typedef struct _NMDhcpManagerClass NMDhcpManagerClass;
|
||||
|
||||
GType nm_dhcp_manager_get_type (void);
|
||||
|
||||
|
@@ -18,6 +18,8 @@
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-dhcp-systemd.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
@@ -28,7 +30,6 @@
|
||||
#include <ctype.h>
|
||||
#include <net/if_arp.h>
|
||||
|
||||
#include "nm-dhcp-systemd.h"
|
||||
#include "nm-utils.h"
|
||||
#include "nm-dhcp-utils.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
@@ -36,10 +37,6 @@
|
||||
#include "nm-dhcp-client-logging.h"
|
||||
#include "systemd/nm-sd.h"
|
||||
|
||||
G_DEFINE_TYPE (NMDhcpSystemd, nm_dhcp_systemd, NM_TYPE_DHCP_CLIENT)
|
||||
|
||||
#define NM_DHCP_SYSTEMD_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP_SYSTEMD, NMDhcpSystemdPrivate))
|
||||
|
||||
typedef struct {
|
||||
sd_dhcp_client *client4;
|
||||
sd_dhcp6_client *client6;
|
||||
@@ -51,6 +48,19 @@ typedef struct {
|
||||
gboolean info_only;
|
||||
} NMDhcpSystemdPrivate;
|
||||
|
||||
struct _NMDhcpSystemd {
|
||||
NMDhcpClient parent;
|
||||
NMDhcpSystemdPrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMDhcpSystemdClass {
|
||||
NMDhcpClientClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMDhcpSystemd, nm_dhcp_systemd, NM_TYPE_DHCP_CLIENT)
|
||||
|
||||
#define NM_DHCP_SYSTEMD_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMDhcpSystemd, NM_IS_DHCP_SYSTEMD)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define DHCP_OPTION_NIS_DOMAIN 40
|
||||
@@ -1000,7 +1010,7 @@ nm_dhcp_systemd_init (NMDhcpSystemd *self)
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE (object);
|
||||
NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE ((NMDhcpSystemd *) object);
|
||||
|
||||
g_clear_pointer (&priv->lease_file, g_free);
|
||||
|
||||
@@ -1025,9 +1035,6 @@ nm_dhcp_systemd_class_init (NMDhcpSystemdClass *sdhcp_class)
|
||||
NMDhcpClientClass *client_class = NM_DHCP_CLIENT_CLASS (sdhcp_class);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (sdhcp_class);
|
||||
|
||||
g_type_class_add_private (sdhcp_class, sizeof (NMDhcpSystemdPrivate));
|
||||
|
||||
/* virtual methods */
|
||||
object_class->dispose = dispose;
|
||||
|
||||
client_class->ip4_start = ip4_start;
|
||||
|
@@ -16,8 +16,8 @@
|
||||
* Copyright (C) 2014 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NM_DHCP_SYSTEMD_H
|
||||
#define NM_DHCP_SYSTEMD_H
|
||||
#ifndef __NM_DHCP_SYSTEMD_H__
|
||||
#define __NM_DHCP_SYSTEMD_H__
|
||||
|
||||
#include "nm-dhcp-client.h"
|
||||
|
||||
@@ -28,15 +28,10 @@
|
||||
#define NM_IS_DHCP_SYSTEMD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DHCP_SYSTEMD))
|
||||
#define NM_DHCP_SYSTEMD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DHCP_SYSTEMD, NMDhcpSystemdClass))
|
||||
|
||||
typedef struct {
|
||||
NMDhcpClient parent;
|
||||
} NMDhcpSystemd;
|
||||
|
||||
typedef struct {
|
||||
NMDhcpClientClass parent;
|
||||
} NMDhcpSystemdClass;
|
||||
typedef struct _NMDhcpSystemd NMDhcpSystemd;
|
||||
typedef struct _NMDhcpSystemdClass NMDhcpSystemdClass;
|
||||
|
||||
GType nm_dhcp_systemd_get_type (void);
|
||||
|
||||
#endif /* NM_DHCP_SYSTEMD_H */
|
||||
#endif /* __NM_DHCP_SYSTEMD_H__ */
|
||||
|
||||
|
@@ -21,12 +21,13 @@
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-activation-request.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "nm-activation-request.h"
|
||||
#include "nm-setting-wireless-security.h"
|
||||
#include "nm-setting-8021x.h"
|
||||
#include "nm-device.h"
|
||||
@@ -34,12 +35,6 @@
|
||||
#include "nm-settings-connection.h"
|
||||
#include "nm-auth-subject.h"
|
||||
|
||||
G_DEFINE_TYPE (NMActRequest, nm_act_request, NM_TYPE_ACTIVE_CONNECTION)
|
||||
|
||||
#define NM_ACT_REQUEST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
|
||||
NM_TYPE_ACT_REQUEST, \
|
||||
NMActRequestPrivate))
|
||||
|
||||
typedef struct {
|
||||
char *table;
|
||||
char *rule;
|
||||
@@ -51,6 +46,15 @@ typedef struct {
|
||||
GSList *share_rules;
|
||||
} NMActRequestPrivate;
|
||||
|
||||
struct _NMActRequest {
|
||||
NMActiveConnection parent;
|
||||
NMActRequestPrivate _priv;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
NMActiveConnectionClass parent;
|
||||
} NMActRequestClass;
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_IP4_CONFIG,
|
||||
@@ -61,6 +65,10 @@ enum {
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMActRequest, nm_act_request, NM_TYPE_ACTIVE_CONNECTION)
|
||||
|
||||
#define NM_ACT_REQUEST_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMActRequest, NM_IS_ACT_REQUEST)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
NMSettingsConnection *
|
||||
@@ -554,8 +562,6 @@ nm_act_request_class_init (NMActRequestClass *req_class)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (req_class);
|
||||
NMActiveConnectionClass *active_class = NM_ACTIVE_CONNECTION_CLASS (req_class);
|
||||
|
||||
g_type_class_add_private (req_class, sizeof (NMActRequestPrivate));
|
||||
|
||||
/* virtual methods */
|
||||
object_class->dispose = dispose;
|
||||
object_class->get_property = get_property;
|
||||
|
@@ -34,15 +34,6 @@
|
||||
struct _NMActRequestGetSecretsCallId;
|
||||
typedef struct _NMActRequestGetSecretsCallId *NMActRequestGetSecretsCallId;
|
||||
|
||||
struct _NMActRequest {
|
||||
NMActiveConnection parent;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
NMActiveConnectionClass parent;
|
||||
|
||||
} NMActRequestClass;
|
||||
|
||||
GType nm_act_request_get_type (void);
|
||||
|
||||
NMActRequest *nm_act_request_new (NMSettingsConnection *settings_connection,
|
||||
|
@@ -34,14 +34,7 @@
|
||||
|
||||
#include "nmdbus-active-connection.h"
|
||||
|
||||
/* Base class for anything implementing the Connection.Active D-Bus interface */
|
||||
G_DEFINE_ABSTRACT_TYPE (NMActiveConnection, nm_active_connection, NM_TYPE_EXPORTED_OBJECT)
|
||||
|
||||
#define NM_ACTIVE_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
|
||||
NM_TYPE_ACTIVE_CONNECTION, \
|
||||
NMActiveConnectionPrivate))
|
||||
|
||||
typedef struct {
|
||||
typedef struct _NMActiveConnectionPrivate {
|
||||
NMSettingsConnection *settings_connection;
|
||||
NMConnection *applied_connection;
|
||||
char *specific_object;
|
||||
@@ -105,6 +98,10 @@ enum {
|
||||
};
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (NMActiveConnection, nm_active_connection, NM_TYPE_EXPORTED_OBJECT)
|
||||
|
||||
#define NM_ACTIVE_CONNECTION_GET_PRIVATE(self) _NM_GET_PRIVATE_PTR(self, NMActiveConnection, NM_IS_ACTIVE_CONNECTION)
|
||||
|
||||
static void check_master_ready (NMActiveConnection *self);
|
||||
static void _device_cleanup (NMActiveConnection *self);
|
||||
|
||||
@@ -937,7 +934,10 @@ nm_active_connection_version_id_bump (NMActiveConnection *self)
|
||||
static void
|
||||
nm_active_connection_init (NMActiveConnection *self)
|
||||
{
|
||||
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self);
|
||||
NMActiveConnectionPrivate *priv;
|
||||
|
||||
priv = G_TYPE_INSTANCE_GET_PRIVATE (self, NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionPrivate);
|
||||
self->_priv = priv;
|
||||
|
||||
_LOGT ("creating");
|
||||
|
||||
@@ -1025,7 +1025,7 @@ static void
|
||||
get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object);
|
||||
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE ((NMActiveConnection *) object);
|
||||
GPtrArray *devices;
|
||||
NMDevice *master_device = NULL;
|
||||
|
||||
|
@@ -61,8 +61,11 @@
|
||||
#define NM_ACTIVE_CONNECTION_DEVICE_METERED_CHANGED "device-metered-changed"
|
||||
#define NM_ACTIVE_CONNECTION_PARENT_ACTIVE "parent-active"
|
||||
|
||||
struct _NMActiveConnectionPrivate;
|
||||
|
||||
struct _NMActiveConnection {
|
||||
NMExportedObject parent;
|
||||
struct _NMActiveConnectionPrivate *_priv;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
@@ -37,15 +37,13 @@
|
||||
|
||||
static gboolean quitting = FALSE;
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (NMExportedObject, nm_exported_object, G_TYPE_DBUS_OBJECT_SKELETON);
|
||||
|
||||
typedef struct {
|
||||
GDBusInterfaceSkeleton *interface;
|
||||
guint property_changed_signal_id;
|
||||
GHashTable *pending_notifies;
|
||||
} InterfaceData;
|
||||
|
||||
typedef struct {
|
||||
typedef struct _NMExportedObjectPrivate {
|
||||
NMBusManager *bus_mgr;
|
||||
char *path;
|
||||
|
||||
@@ -59,7 +57,11 @@ typedef struct {
|
||||
#endif
|
||||
} NMExportedObjectPrivate;
|
||||
|
||||
#define NM_EXPORTED_OBJECT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_EXPORTED_OBJECT, NMExportedObjectPrivate))
|
||||
G_DEFINE_ABSTRACT_TYPE (NMExportedObject, nm_exported_object, G_TYPE_DBUS_OBJECT_SKELETON);
|
||||
|
||||
#define NM_EXPORTED_OBJECT_GET_PRIVATE(self) _NM_GET_PRIVATE_PTR (self, NMExportedObject, NM_IS_EXPORTED_OBJECT)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
GHashTable *properties;
|
||||
@@ -800,7 +802,7 @@ _sort_pending_notifies (gconstpointer a, gconstpointer b, gpointer user_da
|
||||
static gboolean
|
||||
idle_emit_properties_changed (gpointer self)
|
||||
{
|
||||
NMExportedObjectPrivate *priv = NM_EXPORTED_OBJECT_GET_PRIVATE (self);
|
||||
NMExportedObjectPrivate *priv = NM_EXPORTED_OBJECT_GET_PRIVATE (NM_EXPORTED_OBJECT (self));
|
||||
guint k;
|
||||
|
||||
priv->notify_idle_id = 0;
|
||||
@@ -969,6 +971,10 @@ vtype_found:
|
||||
static void
|
||||
nm_exported_object_init (NMExportedObject *self)
|
||||
{
|
||||
NMExportedObjectPrivate *priv;
|
||||
|
||||
priv = G_TYPE_INSTANCE_GET_PRIVATE (self, NM_TYPE_EXPORTED_OBJECT, NMExportedObjectPrivate);
|
||||
self->_priv = priv;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -979,7 +985,7 @@ constructed (GObject *object)
|
||||
G_OBJECT_CLASS (nm_exported_object_parent_class)->constructed (object);
|
||||
|
||||
#ifdef _ASSERT_NO_EARLY_EXPORT
|
||||
NM_EXPORTED_OBJECT_GET_PRIVATE (object)->_constructed = TRUE;
|
||||
NM_EXPORTED_OBJECT_GET_PRIVATE (NM_EXPORTED_OBJECT (object))->_constructed = TRUE;
|
||||
#endif
|
||||
|
||||
klass = NM_EXPORTED_OBJECT_GET_CLASS (object);
|
||||
@@ -991,7 +997,7 @@ constructed (GObject *object)
|
||||
static void
|
||||
nm_exported_object_dispose (GObject *object)
|
||||
{
|
||||
NMExportedObjectPrivate *priv = NM_EXPORTED_OBJECT_GET_PRIVATE (object);
|
||||
NMExportedObjectPrivate *priv = NM_EXPORTED_OBJECT_GET_PRIVATE (NM_EXPORTED_OBJECT (object));
|
||||
|
||||
/* Objects should have already been unexported by their owner, unless
|
||||
* we are quitting, where many objects stick around until exit.
|
||||
|
@@ -47,8 +47,11 @@ void nm_exported_object_skeleton_release (GDBusInterfaceSkeleton *interface);
|
||||
#define NM_IS_EXPORTED_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_EXPORTED_OBJECT))
|
||||
#define NM_EXPORTED_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_EXPORTED_OBJECT, NMExportedObjectClass))
|
||||
|
||||
struct _NMExportedObjectPrivate;
|
||||
|
||||
struct _NMExportedObject {
|
||||
GDBusObjectSkeleton parent;
|
||||
struct _NMExportedObjectPrivate *_priv;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
@@ -80,10 +80,6 @@ G_STATIC_ASSERT (G_STRUCT_OFFSET (NMPlatformIPRoute, network_ptr) == G_STRUCT_OF
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define NM_PLATFORM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_PLATFORM, NMPlatformPrivate))
|
||||
|
||||
G_DEFINE_TYPE (NMPlatform, nm_platform, G_TYPE_OBJECT)
|
||||
|
||||
static guint signals[_NM_PLATFORM_SIGNAL_ID_LAST] = { 0 };
|
||||
|
||||
enum {
|
||||
@@ -93,10 +89,14 @@ enum {
|
||||
LAST_PROP,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
gboolean register_singleton;
|
||||
typedef struct _NMPlatformPrivate {
|
||||
bool register_singleton:1;
|
||||
} NMPlatformPrivate;
|
||||
|
||||
G_DEFINE_TYPE (NMPlatform, nm_platform, G_TYPE_OBJECT)
|
||||
|
||||
#define NM_PLATFORM_GET_PRIVATE(self) _NM_GET_PRIVATE_PTR (self, NMPlatform, NM_IS_PLATFORM)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
guint
|
||||
@@ -4246,8 +4246,9 @@ constructed (GObject *object)
|
||||
}
|
||||
|
||||
static void
|
||||
nm_platform_init (NMPlatform *object)
|
||||
nm_platform_init (NMPlatform *self)
|
||||
{
|
||||
self->_priv = G_TYPE_INSTANCE_GET_PRIVATE (self, NM_TYPE_PLATFORM, NMPlatformPrivate);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -483,10 +483,12 @@ typedef struct {
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
struct _NMPlatformPrivate;
|
||||
|
||||
struct _NMPlatform {
|
||||
GObject parent;
|
||||
|
||||
NMPNetns *_netns;
|
||||
struct _NMPlatformPrivate *_priv;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
@@ -90,13 +90,26 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE (
|
||||
PROP_FD_MNT,
|
||||
);
|
||||
|
||||
typedef struct _NMPNetnsPrivate NMPNetnsPrivate;
|
||||
|
||||
struct _NMPNetnsPrivate {
|
||||
typedef struct {
|
||||
int fd_net;
|
||||
int fd_mnt;
|
||||
} NMPNetnsPrivate;
|
||||
|
||||
struct _NMPNetns {
|
||||
GObject parent;
|
||||
NMPNetnsPrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMPNetnsClass {
|
||||
GObjectClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMPNetns, nmp_netns, G_TYPE_OBJECT);
|
||||
|
||||
#define NMP_NETNS_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMPNetns, NMP_IS_NETNS)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
NMPNetns *netns;
|
||||
int count;
|
||||
@@ -264,12 +277,6 @@ _stack_size (void)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
G_DEFINE_TYPE (NMPNetns, nmp_netns, G_TYPE_OBJECT);
|
||||
|
||||
#define NMP_NETNS_GET_PRIVATE(o) ((o)->priv)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static NMPNetns *
|
||||
_netns_new (GError **error)
|
||||
{
|
||||
@@ -311,10 +318,11 @@ _setns (NMPNetns *self, int type)
|
||||
{
|
||||
char buf[100];
|
||||
int fd;
|
||||
NMPNetnsPrivate *priv = NMP_NETNS_GET_PRIVATE (self);
|
||||
|
||||
nm_assert (NM_IN_SET (type, _CLONE_NS_ALL_V));
|
||||
|
||||
fd = (type == CLONE_NEWNET) ? self->priv->fd_net : self->priv->fd_mnt;
|
||||
fd = (type == CLONE_NEWNET) ? priv->fd_net : priv->fd_mnt;
|
||||
|
||||
_LOGt (self, "set netns(%s, %d)", _ns_types_to_str (type, 0, buf), fd);
|
||||
|
||||
@@ -397,7 +405,7 @@ nmp_netns_get_fd_net (NMPNetns *self)
|
||||
{
|
||||
g_return_val_if_fail (NMP_IS_NETNS (self), 0);
|
||||
|
||||
return self->priv->fd_net;
|
||||
return NMP_NETNS_GET_PRIVATE (self)->fd_net;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -405,7 +413,7 @@ nmp_netns_get_fd_mnt (NMPNetns *self)
|
||||
{
|
||||
g_return_val_if_fail (NMP_IS_NETNS (self), 0);
|
||||
|
||||
return self->priv->fd_mnt;
|
||||
return NMP_NETNS_GET_PRIVATE (self)->fd_mnt;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -664,17 +672,18 @@ set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
NMPNetns *self = NMP_NETNS (object);
|
||||
NMPNetnsPrivate *priv = NMP_NETNS_GET_PRIVATE (self);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_FD_NET:
|
||||
/* construct only */
|
||||
self->priv->fd_net = g_value_get_int (value);
|
||||
g_return_if_fail (self->priv->fd_net > 0);
|
||||
priv->fd_net = g_value_get_int (value);
|
||||
g_return_if_fail (priv->fd_net > 0);
|
||||
break;
|
||||
case PROP_FD_MNT:
|
||||
/* construct only */
|
||||
self->priv->fd_mnt = g_value_get_int (value);
|
||||
g_return_if_fail (self->priv->fd_mnt > 0);
|
||||
priv->fd_mnt = g_value_get_int (value);
|
||||
g_return_if_fail (priv->fd_mnt > 0);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@@ -685,22 +694,22 @@ set_property (GObject *object, guint prop_id,
|
||||
static void
|
||||
nmp_netns_init (NMPNetns *self)
|
||||
{
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, NMP_TYPE_NETNS, NMPNetnsPrivate);
|
||||
}
|
||||
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
NMPNetns *self = NMP_NETNS (object);
|
||||
NMPNetnsPrivate *priv = NMP_NETNS_GET_PRIVATE (self);
|
||||
|
||||
if (self->priv->fd_net > 0) {
|
||||
close (self->priv->fd_net);
|
||||
self->priv->fd_net = 0;
|
||||
if (priv->fd_net > 0) {
|
||||
close (priv->fd_net);
|
||||
priv->fd_net = 0;
|
||||
}
|
||||
|
||||
if (self->priv->fd_mnt > 0) {
|
||||
close (self->priv->fd_mnt);
|
||||
self->priv->fd_mnt = 0;
|
||||
if (priv->fd_mnt > 0) {
|
||||
close (priv->fd_mnt);
|
||||
priv->fd_mnt = 0;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (nmp_netns_parent_class)->dispose (object);
|
||||
@@ -711,8 +720,6 @@ nmp_netns_class_init (NMPNetnsClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (NMPNetnsPrivate));
|
||||
|
||||
object_class->set_property = set_property;
|
||||
object_class->dispose = dispose;
|
||||
|
||||
|
@@ -33,16 +33,7 @@
|
||||
#define NMP_NETNS_FD_NET "fd-net"
|
||||
#define NMP_NETNS_FD_MNT "fd-mnt"
|
||||
|
||||
struct _NMPNetnsPrivate;
|
||||
|
||||
struct _NMPNetns {
|
||||
GObject parent;
|
||||
struct _NMPNetnsPrivate *priv;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
GObjectClass parent;
|
||||
} NMPNetnsClass;
|
||||
typedef struct _NMPNetnsClass NMPNetnsClass;
|
||||
|
||||
GType nmp_netns_get_type (void);
|
||||
|
||||
|
@@ -20,11 +20,12 @@
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-secret-agent.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
|
||||
#include "nm-dbus-interface.h"
|
||||
#include "nm-secret-agent.h"
|
||||
#include "nm-bus-manager.h"
|
||||
#include "nm-auth-subject.h"
|
||||
#include "nm-simple-connection.h"
|
||||
@@ -32,31 +33,14 @@
|
||||
|
||||
#include "nmdbus-secret-agent.h"
|
||||
|
||||
#define _NMLOG_PREFIX_NAME "secret-agent"
|
||||
#define _NMLOG_DOMAIN LOGD_AGENTS
|
||||
#define _NMLOG(level, ...) \
|
||||
G_STMT_START { \
|
||||
if (nm_logging_enabled ((level), (_NMLOG_DOMAIN))) { \
|
||||
char __prefix[32]; \
|
||||
\
|
||||
if ((self)) \
|
||||
g_snprintf (__prefix, sizeof (__prefix), "%s[%p]", ""_NMLOG_PREFIX_NAME"", (self)); \
|
||||
else \
|
||||
g_strlcpy (__prefix, _NMLOG_PREFIX_NAME, sizeof (__prefix)); \
|
||||
_nm_log ((level), (_NMLOG_DOMAIN), 0, \
|
||||
"%s: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
|
||||
__prefix _NM_UTILS_MACRO_REST(__VA_ARGS__)); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
/*****************************************************************************/
|
||||
|
||||
#define LOG_REQ_FMT "req[%p,%s,%s%s%s%s]"
|
||||
#define LOG_REQ_ARG(req) (req), (req)->dbus_command, NM_PRINT_FMT_QUOTE_STRING ((req)->path), ((req)->cancellable ? "" : " (cancelled)")
|
||||
enum {
|
||||
DISCONNECTED,
|
||||
|
||||
G_DEFINE_TYPE (NMSecretAgent, nm_secret_agent, G_TYPE_OBJECT)
|
||||
|
||||
#define NM_SECRET_AGENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
|
||||
NM_TYPE_SECRET_AGENT, \
|
||||
NMSecretAgentPrivate))
|
||||
LAST_SIGNAL
|
||||
};
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
typedef struct {
|
||||
char *description;
|
||||
@@ -77,12 +61,40 @@ typedef struct {
|
||||
GHashTable *requests;
|
||||
} NMSecretAgentPrivate;
|
||||
|
||||
enum {
|
||||
DISCONNECTED,
|
||||
|
||||
LAST_SIGNAL
|
||||
struct _NMSecretAgent {
|
||||
GObject parent;
|
||||
NMSecretAgentPrivate _priv;
|
||||
};
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
struct _NMSecretAgentClass {
|
||||
GObjectClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMSecretAgent, nm_secret_agent, G_TYPE_OBJECT)
|
||||
|
||||
#define NM_SECRET_AGENT_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMSecretAgent, NM_IS_SECRET_AGENT)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define _NMLOG_PREFIX_NAME "secret-agent"
|
||||
#define _NMLOG_DOMAIN LOGD_AGENTS
|
||||
#define _NMLOG(level, ...) \
|
||||
G_STMT_START { \
|
||||
if (nm_logging_enabled ((level), (_NMLOG_DOMAIN))) { \
|
||||
char __prefix[32]; \
|
||||
\
|
||||
if ((self)) \
|
||||
g_snprintf (__prefix, sizeof (__prefix), "%s[%p]", ""_NMLOG_PREFIX_NAME"", (self)); \
|
||||
else \
|
||||
g_strlcpy (__prefix, _NMLOG_PREFIX_NAME, sizeof (__prefix)); \
|
||||
_nm_log ((level), (_NMLOG_DOMAIN), 0, \
|
||||
"%s: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
|
||||
__prefix _NM_UTILS_MACRO_REST(__VA_ARGS__)); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
#define LOG_REQ_FMT "req[%p,%s,%s%s%s%s]"
|
||||
#define LOG_REQ_ARG(req) (req), (req)->dbus_command, NM_PRINT_FMT_QUOTE_STRING ((req)->path), ((req)->cancellable ? "" : " (cancelled)")
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -783,18 +795,14 @@ nm_secret_agent_class_init (NMSecretAgentClass *config_class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (config_class);
|
||||
|
||||
g_type_class_add_private (config_class, sizeof (NMSecretAgentPrivate));
|
||||
|
||||
/* virtual methods */
|
||||
object_class->dispose = dispose;
|
||||
object_class->finalize = finalize;
|
||||
|
||||
/* signals */
|
||||
signals[DISCONNECTED] =
|
||||
g_signal_new (NM_SECRET_AGENT_DISCONNECTED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (NMSecretAgentClass, disconnected),
|
||||
0,
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
@@ -32,15 +32,7 @@
|
||||
|
||||
#define NM_SECRET_AGENT_DISCONNECTED "disconnected"
|
||||
|
||||
struct _NMSecretAgent {
|
||||
GObject parent;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
GObjectClass parent;
|
||||
|
||||
void (*disconnected) (NMSecretAgent *self);
|
||||
} NMSecretAgentClass;
|
||||
typedef struct _NMSecretAgentClass NMSecretAgentClass;
|
||||
|
||||
typedef struct _NMSecretAgentCallId *NMSecretAgentCallId;
|
||||
|
||||
|
@@ -40,38 +40,10 @@
|
||||
#define SETTINGS_TIMESTAMPS_FILE NMSTATEDIR "/timestamps"
|
||||
#define SETTINGS_SEEN_BSSIDS_FILE NMSTATEDIR "/seen-bssids"
|
||||
|
||||
#define _NMLOG_DOMAIN LOGD_SETTINGS
|
||||
#define _NMLOG_PREFIX_NAME "settings-connection"
|
||||
#define _NMLOG(level, ...) \
|
||||
G_STMT_START { \
|
||||
const NMLogLevel __level = (level); \
|
||||
\
|
||||
if (nm_logging_enabled (__level, _NMLOG_DOMAIN)) { \
|
||||
char __prefix[128]; \
|
||||
const char *__p_prefix = _NMLOG_PREFIX_NAME; \
|
||||
\
|
||||
if (self) { \
|
||||
const char *__uuid = nm_settings_connection_get_uuid (self); \
|
||||
\
|
||||
g_snprintf (__prefix, sizeof (__prefix), "%s[%p%s%s]", _NMLOG_PREFIX_NAME, self, __uuid ? "," : "", __uuid ? __uuid : ""); \
|
||||
__p_prefix = __prefix; \
|
||||
} \
|
||||
_nm_log (__level, _NMLOG_DOMAIN, 0, \
|
||||
"%s: " _NM_UTILS_MACRO_FIRST (__VA_ARGS__), \
|
||||
__p_prefix _NM_UTILS_MACRO_REST (__VA_ARGS__)); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
/*****************************************************************************/
|
||||
|
||||
static void nm_settings_connection_connection_interface_init (NMConnectionInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (NMSettingsConnection, nm_settings_connection, NM_TYPE_EXPORTED_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (NM_TYPE_CONNECTION, nm_settings_connection_connection_interface_init)
|
||||
)
|
||||
|
||||
#define NM_SETTINGS_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
|
||||
NM_TYPE_SETTINGS_CONNECTION, \
|
||||
NMSettingsConnectionPrivate))
|
||||
|
||||
NM_GOBJECT_PROPERTIES_DEFINE (NMSettingsConnection,
|
||||
PROP_VISIBLE,
|
||||
PROP_UNSAVED,
|
||||
@@ -86,9 +58,10 @@ enum {
|
||||
UPDATED_INTERNAL,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
typedef struct {
|
||||
typedef struct _NMSettingsConnectionPrivate {
|
||||
gboolean removed;
|
||||
|
||||
NMAgentManager *agent_mgr;
|
||||
@@ -127,9 +100,38 @@ typedef struct {
|
||||
NMDeviceStateReason autoconnect_blocked_reason;
|
||||
|
||||
char *filename;
|
||||
|
||||
} NMSettingsConnectionPrivate;
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (NMSettingsConnection, nm_settings_connection, NM_TYPE_EXPORTED_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (NM_TYPE_CONNECTION, nm_settings_connection_connection_interface_init)
|
||||
)
|
||||
|
||||
#define NM_SETTINGS_CONNECTION_GET_PRIVATE(self) _NM_GET_PRIVATE_PTR (self, NMSettingsConnection, NM_IS_SETTINGS_CONNECTION)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define _NMLOG_DOMAIN LOGD_SETTINGS
|
||||
#define _NMLOG_PREFIX_NAME "settings-connection"
|
||||
#define _NMLOG(level, ...) \
|
||||
G_STMT_START { \
|
||||
const NMLogLevel __level = (level); \
|
||||
\
|
||||
if (nm_logging_enabled (__level, _NMLOG_DOMAIN)) { \
|
||||
char __prefix[128]; \
|
||||
const char *__p_prefix = _NMLOG_PREFIX_NAME; \
|
||||
\
|
||||
if (self) { \
|
||||
const char *__uuid = nm_settings_connection_get_uuid (self); \
|
||||
\
|
||||
g_snprintf (__prefix, sizeof (__prefix), "%s[%p%s%s]", _NMLOG_PREFIX_NAME, self, __uuid ? "," : "", __uuid ? __uuid : ""); \
|
||||
__p_prefix = __prefix; \
|
||||
} \
|
||||
_nm_log (__level, _NMLOG_DOMAIN, 0, \
|
||||
"%s: " _NM_UTILS_MACRO_FIRST (__VA_ARGS__), \
|
||||
__p_prefix _NM_UTILS_MACRO_REST (__VA_ARGS__)); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
@@ -2609,7 +2611,10 @@ nm_settings_connection_get_uuid (NMSettingsConnection *self)
|
||||
static void
|
||||
nm_settings_connection_init (NMSettingsConnection *self)
|
||||
{
|
||||
NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
|
||||
NMSettingsConnectionPrivate *priv;
|
||||
|
||||
priv = G_TYPE_INSTANCE_GET_PRIVATE (self, NM_TYPE_SETTINGS_CONNECTION, NMSettingsConnectionPrivate);
|
||||
self->_priv = priv;
|
||||
|
||||
priv->visible = FALSE;
|
||||
priv->ready = TRUE;
|
||||
@@ -2748,7 +2753,6 @@ nm_settings_connection_class_init (NMSettingsConnectionClass *class)
|
||||
|
||||
exported_object_class->export_path = NM_DBUS_PATH_SETTINGS "/%u";
|
||||
|
||||
/* Virtual methods */
|
||||
object_class->constructed = constructed;
|
||||
object_class->dispose = dispose;
|
||||
object_class->get_property = get_property;
|
||||
@@ -2759,7 +2763,6 @@ nm_settings_connection_class_init (NMSettingsConnectionClass *class)
|
||||
class->delete = do_delete;
|
||||
class->supports_secrets = supports_secrets;
|
||||
|
||||
/* Properties */
|
||||
obj_properties[PROP_VISIBLE] =
|
||||
g_param_spec_boolean (NM_SETTINGS_CONNECTION_VISIBLE, "", "",
|
||||
FALSE,
|
||||
@@ -2794,7 +2797,6 @@ nm_settings_connection_class_init (NMSettingsConnectionClass *class)
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
/* Signals */
|
||||
|
||||
signals[UPDATED] =
|
||||
g_signal_new (NM_SETTINGS_CONNECTION_UPDATED,
|
||||
|
@@ -95,8 +95,11 @@ typedef void (*NMSettingsConnectionDeleteFunc) (NMSettingsConnection *self,
|
||||
GError *error,
|
||||
gpointer user_data);
|
||||
|
||||
struct _NMSettingsConnectionPrivate;
|
||||
|
||||
struct _NMSettingsConnection {
|
||||
NMExportedObject parent;
|
||||
struct _NMSettingsConnectionPrivate *_priv;
|
||||
};
|
||||
|
||||
struct _NMSettingsConnectionClass {
|
||||
|
@@ -21,29 +21,25 @@
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-supplicant-config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "nm-supplicant-config.h"
|
||||
#include "nm-supplicant-settings-verify.h"
|
||||
#include "nm-setting.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-utils.h"
|
||||
|
||||
#define NM_SUPPLICANT_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
|
||||
NM_TYPE_SUPPLICANT_CONFIG, \
|
||||
NMSupplicantConfigPrivate))
|
||||
|
||||
G_DEFINE_TYPE (NMSupplicantConfig, nm_supplicant_config, G_TYPE_OBJECT)
|
||||
|
||||
typedef struct {
|
||||
char *value;
|
||||
guint32 len;
|
||||
OptType type;
|
||||
} ConfigOption;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
GHashTable *config;
|
||||
GHashTable *blobs;
|
||||
guint32 ap_scan;
|
||||
@@ -51,6 +47,21 @@ typedef struct
|
||||
gboolean dispose_has_run;
|
||||
} NMSupplicantConfigPrivate;
|
||||
|
||||
struct _NMSupplicantConfig {
|
||||
GObject parent;
|
||||
NMSupplicantConfigPrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMSupplicantConfigClass {
|
||||
GObjectClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMSupplicantConfig, nm_supplicant_config, G_TYPE_OBJECT)
|
||||
|
||||
#define NM_SUPPLICANT_CONFIG_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMSupplicantConfig, NM_IS_SUPPLICANT_CONFIG)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
NMSupplicantConfig *
|
||||
nm_supplicant_config_new (void)
|
||||
{
|
||||
@@ -243,11 +254,11 @@ nm_supplicant_config_add_blob_for_connection (NMSupplicantConfig *self,
|
||||
static void
|
||||
nm_supplicant_config_finalize (GObject *object)
|
||||
{
|
||||
/* Complete object destruction */
|
||||
g_hash_table_destroy (NM_SUPPLICANT_CONFIG_GET_PRIVATE (object)->config);
|
||||
g_hash_table_destroy (NM_SUPPLICANT_CONFIG_GET_PRIVATE (object)->blobs);
|
||||
NMSupplicantConfigPrivate *priv = NM_SUPPLICANT_CONFIG_GET_PRIVATE ((NMSupplicantConfig *) object);
|
||||
|
||||
g_hash_table_destroy (priv->config);
|
||||
g_hash_table_destroy (priv->blobs);
|
||||
|
||||
/* Chain up to the parent class */
|
||||
G_OBJECT_CLASS (nm_supplicant_config_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@@ -258,8 +269,6 @@ nm_supplicant_config_class_init (NMSupplicantConfigClass *klass)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = nm_supplicant_config_finalize;
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (NMSupplicantConfigPrivate));
|
||||
}
|
||||
|
||||
guint32
|
||||
|
@@ -35,16 +35,7 @@
|
||||
#define NM_IS_SUPPLICANT_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SUPPLICANT_CONFIG))
|
||||
#define NM_SUPPLICANT_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SUPPLICANT_CONFIG, NMSupplicantConfigClass))
|
||||
|
||||
struct _NMSupplicantConfig
|
||||
{
|
||||
GObject parent;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GObjectClass parent;
|
||||
} NMSupplicantConfigClass;
|
||||
|
||||
typedef struct _NMSupplicantConfigClass NMSupplicantConfigClass;
|
||||
|
||||
GType nm_supplicant_config_get_type (void);
|
||||
|
||||
|
@@ -21,11 +21,12 @@
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-supplicant-interface.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-supplicant-interface.h"
|
||||
#include "nm-supplicant-config.h"
|
||||
#include "nm-core-internal.h"
|
||||
#include "nm-dbus-compat.h"
|
||||
@@ -36,13 +37,8 @@
|
||||
#define WPAS_ERROR_INVALID_IFACE WPAS_DBUS_INTERFACE ".InvalidInterface"
|
||||
#define WPAS_ERROR_EXISTS_ERROR WPAS_DBUS_INTERFACE ".InterfaceExists"
|
||||
|
||||
G_DEFINE_TYPE (NMSupplicantInterface, nm_supplicant_interface, G_TYPE_OBJECT)
|
||||
/*****************************************************************************/
|
||||
|
||||
#define NM_SUPPLICANT_INTERFACE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
|
||||
NM_TYPE_SUPPLICANT_INTERFACE, \
|
||||
NMSupplicantInterfacePrivate))
|
||||
|
||||
/* Signals */
|
||||
enum {
|
||||
STATE, /* change in the interface's state */
|
||||
REMOVED, /* interface was removed by the supplicant */
|
||||
@@ -56,8 +52,6 @@ enum {
|
||||
};
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
||||
/* Properties */
|
||||
NM_GOBJECT_PROPERTIES_DEFINE (NMSupplicantInterface,
|
||||
PROP_IFACE,
|
||||
PROP_SCANNING,
|
||||
@@ -98,6 +92,19 @@ typedef struct {
|
||||
NMSupplicantConfig *cfg;
|
||||
} NMSupplicantInterfacePrivate;
|
||||
|
||||
struct _NMSupplicantInterface {
|
||||
GObject parent;
|
||||
NMSupplicantInterfacePrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMSupplicantInterfaceClass {
|
||||
GObjectClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMSupplicantInterface, nm_supplicant_interface, G_TYPE_OBJECT)
|
||||
|
||||
#define NM_SUPPLICANT_INTERFACE_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMSupplicantInterface, NM_IS_SUPPLICANT_INTERFACE)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define _NMLOG_DOMAIN LOGD_SUPPLICANT
|
||||
@@ -1469,7 +1476,7 @@ set_property (GObject *object,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (object);
|
||||
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE ((NMSupplicantInterface *) object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_IFACE:
|
||||
@@ -1501,7 +1508,7 @@ get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (object);
|
||||
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE ((NMSupplicantInterface *) object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_SCANNING:
|
||||
@@ -1519,10 +1526,10 @@ get_property (GObject *object,
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (object);
|
||||
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE ((NMSupplicantInterface *) object);
|
||||
|
||||
if (priv->iface_proxy)
|
||||
g_signal_handlers_disconnect_by_data (priv->iface_proxy, NM_SUPPLICANT_INTERFACE (object));
|
||||
g_signal_handlers_disconnect_by_data (priv->iface_proxy, object);
|
||||
g_clear_object (&priv->iface_proxy);
|
||||
|
||||
if (priv->init_cancellable)
|
||||
@@ -1552,13 +1559,10 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (NMSupplicantInterfacePrivate));
|
||||
|
||||
object_class->dispose = dispose;
|
||||
object_class->set_property = set_property;
|
||||
object_class->get_property = get_property;
|
||||
|
||||
/* Properties */
|
||||
obj_properties[PROP_SCANNING] =
|
||||
g_param_spec_boolean (NM_SUPPLICANT_INTERFACE_SCANNING, "", "",
|
||||
FALSE,
|
||||
@@ -1598,12 +1602,11 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass)
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
/* Signals */
|
||||
signals[STATE] =
|
||||
g_signal_new (NM_SUPPLICANT_INTERFACE_STATE,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (NMSupplicantInterfaceClass, state),
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INT);
|
||||
|
||||
@@ -1611,7 +1614,7 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass)
|
||||
g_signal_new (NM_SUPPLICANT_INTERFACE_REMOVED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (NMSupplicantInterfaceClass, removed),
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
@@ -1619,7 +1622,7 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass)
|
||||
g_signal_new (NM_SUPPLICANT_INTERFACE_NEW_BSS,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (NMSupplicantInterfaceClass, new_bss),
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VARIANT);
|
||||
|
||||
@@ -1627,7 +1630,7 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass)
|
||||
g_signal_new (NM_SUPPLICANT_INTERFACE_BSS_UPDATED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (NMSupplicantInterfaceClass, bss_updated),
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VARIANT);
|
||||
|
||||
@@ -1635,7 +1638,7 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass)
|
||||
g_signal_new (NM_SUPPLICANT_INTERFACE_BSS_REMOVED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (NMSupplicantInterfaceClass, bss_removed),
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_STRING);
|
||||
|
||||
@@ -1643,7 +1646,7 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass)
|
||||
g_signal_new (NM_SUPPLICANT_INTERFACE_SCAN_DONE,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (NMSupplicantInterfaceClass, scan_done),
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
|
||||
|
||||
@@ -1651,7 +1654,7 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass)
|
||||
g_signal_new (NM_SUPPLICANT_INTERFACE_CONNECTION_ERROR,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (NMSupplicantInterfaceClass, connection_error),
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
|
||||
|
||||
@@ -1659,7 +1662,7 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass)
|
||||
g_signal_new (NM_SUPPLICANT_INTERFACE_CREDENTIALS_REQUEST,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (NMSupplicantInterfaceClass, credentials_request),
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
|
||||
}
|
||||
|
@@ -71,52 +71,7 @@ enum {
|
||||
#define NM_SUPPLICANT_INTERFACE_CONNECTION_ERROR "connection-error"
|
||||
#define NM_SUPPLICANT_INTERFACE_CREDENTIALS_REQUEST "credentials-request"
|
||||
|
||||
struct _NMSupplicantInterface {
|
||||
GObject parent;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
GObjectClass parent;
|
||||
|
||||
/* Signals */
|
||||
|
||||
/* change in the interface's state */
|
||||
void (*state) (NMSupplicantInterface * iface,
|
||||
guint32 new_state,
|
||||
guint32 old_state,
|
||||
int disconnect_reason);
|
||||
|
||||
/* interface was removed by the supplicant */
|
||||
void (*removed) (NMSupplicantInterface * iface);
|
||||
|
||||
/* interface saw a new BSS */
|
||||
void (*new_bss) (NMSupplicantInterface *iface,
|
||||
const char *object_path,
|
||||
GVariant *props);
|
||||
|
||||
/* a BSS property changed */
|
||||
void (*bss_updated) (NMSupplicantInterface *iface,
|
||||
const char *object_path,
|
||||
GVariant *props);
|
||||
|
||||
/* supplicant removed a BSS from its scan list */
|
||||
void (*bss_removed) (NMSupplicantInterface *iface,
|
||||
const char *object_path);
|
||||
|
||||
/* wireless scan is done */
|
||||
void (*scan_done) (NMSupplicantInterface *iface,
|
||||
gboolean success);
|
||||
|
||||
/* an error occurred during a connection request */
|
||||
void (*connection_error) (NMSupplicantInterface * iface,
|
||||
const char * name,
|
||||
const char * message);
|
||||
|
||||
/* 802.1x credentials requested */
|
||||
void (*credentials_request) (NMSupplicantInterface *iface,
|
||||
const char *field,
|
||||
const char *message);
|
||||
} NMSupplicantInterfaceClass;
|
||||
typedef struct _NMSupplicantInterfaceClass NMSupplicantInterfaceClass;
|
||||
|
||||
GType nm_supplicant_interface_get_type (void);
|
||||
|
||||
|
@@ -21,28 +21,15 @@
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-supplicant-manager.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "nm-supplicant-manager.h"
|
||||
#include "nm-supplicant-interface.h"
|
||||
#include "nm-supplicant-types.h"
|
||||
#include "nm-core-internal.h"
|
||||
|
||||
#define NM_SUPPLICANT_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
|
||||
NM_TYPE_SUPPLICANT_MANAGER, \
|
||||
NMSupplicantManagerPrivate))
|
||||
|
||||
G_DEFINE_TYPE (NMSupplicantManager, nm_supplicant_manager, G_TYPE_OBJECT)
|
||||
|
||||
#define _NMLOG_DOMAIN LOGD_SUPPLICANT
|
||||
#define _NMLOG_PREFIX_NAME "supplicant"
|
||||
#define _NMLOG(level, ...) \
|
||||
G_STMT_START { \
|
||||
nm_log ((level), _NMLOG_DOMAIN, \
|
||||
"%s" _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
|
||||
_NMLOG_PREFIX_NAME": " \
|
||||
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
|
||||
} G_STMT_END
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
GDBusProxy * proxy;
|
||||
@@ -56,6 +43,31 @@ typedef struct {
|
||||
guint die_count;
|
||||
} NMSupplicantManagerPrivate;
|
||||
|
||||
struct _NMSupplicantManager {
|
||||
GObject parent;
|
||||
NMSupplicantManagerPrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMSupplicantManagerClass {
|
||||
GObjectClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMSupplicantManager, nm_supplicant_manager, G_TYPE_OBJECT)
|
||||
|
||||
#define NM_SUPPLICANT_MANAGER_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMSupplicantManager, NM_IS_SUPPLICANT_MANAGER)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define _NMLOG_DOMAIN LOGD_SUPPLICANT
|
||||
#define _NMLOG_PREFIX_NAME "supplicant"
|
||||
#define _NMLOG(level, ...) \
|
||||
G_STMT_START { \
|
||||
nm_log ((level), _NMLOG_DOMAIN, \
|
||||
"%s" _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
|
||||
_NMLOG_PREFIX_NAME": " \
|
||||
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
|
||||
} G_STMT_END
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
G_DEFINE_QUARK (nm-supplicant-error-quark, nm_supplicant_error);
|
||||
@@ -403,8 +415,6 @@ nm_supplicant_manager_class_init (NMSupplicantManagerClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (NMSupplicantManagerPrivate));
|
||||
|
||||
object_class->dispose = dispose;
|
||||
}
|
||||
|
||||
|
@@ -32,15 +32,7 @@
|
||||
#define NM_IS_SUPPLICANT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SUPPLICANT_MANAGER))
|
||||
#define NM_SUPPLICANT_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SUPPLICANT_MANAGER, NMSupplicantManagerClass))
|
||||
|
||||
struct _NMSupplicantManager
|
||||
{
|
||||
GObject parent;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GObjectClass parent;
|
||||
} NMSupplicantManagerClass;
|
||||
typedef struct _NMSupplicantManagerClass NMSupplicantManagerClass;
|
||||
|
||||
GType nm_supplicant_manager_get_type (void);
|
||||
|
||||
|
@@ -20,13 +20,13 @@
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-supplicant-settings-verify.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "nm-supplicant-settings-verify.h"
|
||||
|
||||
struct Opt {
|
||||
const char * key;
|
||||
const OptType type;
|
||||
|
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-vpn-connection.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
@@ -30,7 +32,6 @@
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include "nm-vpn-connection.h"
|
||||
#include "nm-ip4-config.h"
|
||||
#include "nm-ip6-config.h"
|
||||
#include "nm-platform.h"
|
||||
|
@@ -19,8 +19,8 @@
|
||||
* Copyright (C) 2006 - 2008 Novell, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NETWORKMANAGER_VPN_CONNECTION_H__
|
||||
#define __NETWORKMANAGER_VPN_CONNECTION_H__
|
||||
#ifndef __NM_VPN_CONNECTION_H__
|
||||
#define __NM_VPN_CONNECTION_H__
|
||||
|
||||
#include "nm-vpn-dbus-interface.h"
|
||||
#include "nm-device.h"
|
||||
@@ -28,6 +28,8 @@
|
||||
#include "nm-active-connection.h"
|
||||
#include "nm-vpn-plugin-info.h"
|
||||
|
||||
#define NM_VPN_ROUTE_METRIC_DEFAULT 50
|
||||
|
||||
#define NM_TYPE_VPN_CONNECTION (nm_vpn_connection_get_type ())
|
||||
#define NM_VPN_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_VPN_CONNECTION, NMVpnConnection))
|
||||
#define NM_VPN_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_VPN_CONNECTION, NMVpnConnectionClass))
|
||||
@@ -44,9 +46,6 @@
|
||||
#define NM_VPN_CONNECTION_INTERNAL_STATE_CHANGED "internal-state-changed"
|
||||
#define NM_VPN_CONNECTION_INTERNAL_RETRY_AFTER_FAILURE "internal-retry-after-failure"
|
||||
|
||||
|
||||
#define NM_VPN_ROUTE_METRIC_DEFAULT 50
|
||||
|
||||
typedef struct _NMVpnConnectionClass NMVpnConnectionClass;
|
||||
|
||||
GType nm_vpn_connection_get_type (void);
|
||||
@@ -79,4 +78,4 @@ struct in6_addr * nm_vpn_connection_get_ip6_internal_gateway (NMVpnConnection
|
||||
guint32 nm_vpn_connection_get_ip4_route_metric (NMVpnConnection *self);
|
||||
guint32 nm_vpn_connection_get_ip6_route_metric (NMVpnConnection *self);
|
||||
|
||||
#endif /* __NETWORKMANAGER_VPN_CONNECTION_H__ */
|
||||
#endif /* __NM_VPN_CONNECTION_H__ */
|
||||
|
@@ -21,9 +21,10 @@
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-vpn-manager.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "nm-vpn-manager.h"
|
||||
#include "nm-vpn-plugin-info.h"
|
||||
#include "nm-vpn-connection.h"
|
||||
#include "nm-setting-vpn.h"
|
||||
@@ -31,10 +32,6 @@
|
||||
#include "nm-core-internal.h"
|
||||
#include "nm-enum-types.h"
|
||||
|
||||
G_DEFINE_TYPE (NMVpnManager, nm_vpn_manager, G_TYPE_OBJECT)
|
||||
|
||||
#define NM_VPN_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_VPN_MANAGER, NMVpnManagerPrivate))
|
||||
|
||||
typedef struct {
|
||||
GSList *plugins;
|
||||
GFileMonitor *monitor_etc;
|
||||
@@ -47,6 +44,19 @@ typedef struct {
|
||||
GHashTable *active_services;
|
||||
} NMVpnManagerPrivate;
|
||||
|
||||
struct _NMVpnManager {
|
||||
GObject parent;
|
||||
NMVpnManagerPrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMVpnManagerClass {
|
||||
GObjectClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMVpnManager, nm_vpn_manager, G_TYPE_OBJECT)
|
||||
|
||||
#define NM_VPN_MANAGER_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMVpnManager, NM_IS_VPN_MANAGER)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
@@ -252,7 +262,7 @@ nm_vpn_manager_init (NMVpnManager *self)
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
NMVpnManagerPrivate *priv = NM_VPN_MANAGER_GET_PRIVATE (object);
|
||||
NMVpnManagerPrivate *priv = NM_VPN_MANAGER_GET_PRIVATE ((NMVpnManager *) object);
|
||||
|
||||
if (priv->monitor_etc) {
|
||||
if (priv->monitor_id_etc)
|
||||
@@ -281,9 +291,6 @@ nm_vpn_manager_class_init (NMVpnManagerClass *manager_class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (manager_class);
|
||||
|
||||
g_type_class_add_private (manager_class, sizeof (NMVpnManagerPrivate));
|
||||
|
||||
/* virtual methods */
|
||||
object_class->dispose = dispose;
|
||||
}
|
||||
|
||||
|
@@ -19,8 +19,8 @@
|
||||
* Copyright (C) 2006 - 2008 Novell, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NETWORKMANAGER_VPN_MANAGER_H__
|
||||
#define __NETWORKMANAGER_VPN_MANAGER_H__
|
||||
#ifndef __NM_VPN_MANAGER_H__
|
||||
#define __NM_VPN_MANAGER_H__
|
||||
|
||||
#include "nm-vpn-connection.h"
|
||||
|
||||
@@ -31,13 +31,8 @@
|
||||
#define NM_IS_VPN_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_VPN_MANAGER))
|
||||
#define NM_VPN_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_VPN_MANAGER, NMVpnManagerClass))
|
||||
|
||||
typedef struct {
|
||||
GObject parent;
|
||||
} NMVpnManager;
|
||||
|
||||
typedef struct {
|
||||
GObjectClass parent;
|
||||
} NMVpnManagerClass;
|
||||
typedef struct _NMVpnManager NMVpnManager;
|
||||
typedef struct _NMVpnManagerClass NMVpnManagerClass;
|
||||
|
||||
GType nm_vpn_manager_get_type (void);
|
||||
|
||||
@@ -47,4 +42,4 @@ gboolean nm_vpn_manager_activate_connection (NMVpnManager *manager,
|
||||
NMVpnConnection *vpn,
|
||||
GError **error);
|
||||
|
||||
#endif /* __NETWORKMANAGER_VPN_MANAGER_H__ */
|
||||
#endif /* __NM_VPN_MANAGER_H__ */
|
||||
|
Reference in New Issue
Block a user