libnm: split "NMManager" out of NMClient
Clone NMClient as NMManager, and make NMClient just be a wrapper around that new class.
This commit is contained in:
@@ -61,6 +61,7 @@ libnminclude_HEADERS = \
|
|||||||
libnm_la_private_headers = \
|
libnm_la_private_headers = \
|
||||||
nm-dbus-helpers.h \
|
nm-dbus-helpers.h \
|
||||||
nm-device-private.h \
|
nm-device-private.h \
|
||||||
|
nm-manager.h \
|
||||||
nm-object-cache.h \
|
nm-object-cache.h \
|
||||||
nm-object-private.h \
|
nm-object-private.h \
|
||||||
nm-remote-connection-private.h
|
nm-remote-connection-private.h
|
||||||
@@ -89,6 +90,7 @@ libnm_la_csources = \
|
|||||||
nm-enum-types.c \
|
nm-enum-types.c \
|
||||||
nm-ip4-config.c \
|
nm-ip4-config.c \
|
||||||
nm-ip6-config.c \
|
nm-ip6-config.c \
|
||||||
|
nm-manager.c \
|
||||||
nm-object-cache.c \
|
nm-object-cache.c \
|
||||||
nm-object.c \
|
nm-object.c \
|
||||||
nm-remote-connection.c \
|
nm-remote-connection.c \
|
||||||
|
1003
libnm/nm-client.c
1003
libnm/nm-client.c
File diff suppressed because it is too large
Load Diff
@@ -30,7 +30,6 @@
|
|||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
#include <nm-dbus-interface.h>
|
#include <nm-dbus-interface.h>
|
||||||
#include "nm-object.h"
|
|
||||||
#include "nm-device.h"
|
#include "nm-device.h"
|
||||||
#include "nm-active-connection.h"
|
#include "nm-active-connection.h"
|
||||||
#include "nm-vpn-connection.h"
|
#include "nm-vpn-connection.h"
|
||||||
@@ -144,11 +143,11 @@ typedef enum {
|
|||||||
GQuark nm_client_error_quark (void);
|
GQuark nm_client_error_quark (void);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NMObject parent;
|
GObject parent;
|
||||||
} NMClient;
|
} NMClient;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NMObjectClass parent;
|
GObjectClass parent;
|
||||||
|
|
||||||
/* Signals */
|
/* Signals */
|
||||||
void (*device_added) (NMClient *client, NMDevice *device);
|
void (*device_added) (NMClient *client, NMDevice *device);
|
||||||
|
1600
libnm/nm-manager.c
Normal file
1600
libnm/nm-manager.c
Normal file
File diff suppressed because it is too large
Load Diff
168
libnm/nm-manager.h
Normal file
168
libnm/nm-manager.h
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||||
|
/*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Copyright 2007 - 2008 Novell, Inc.
|
||||||
|
* Copyright 2007 - 2014 Red Hat, Inc.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __NM_MANAGER_H__
|
||||||
|
#define __NM_MANAGER_H__
|
||||||
|
|
||||||
|
#include "nm-client.h"
|
||||||
|
#include "nm-object.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define NM_TYPE_MANAGER (nm_manager_get_type ())
|
||||||
|
#define NM_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_MANAGER, NMManager))
|
||||||
|
#define NM_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_MANAGER, NMManagerClass))
|
||||||
|
#define NM_IS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_MANAGER))
|
||||||
|
#define NM_IS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_MANAGER))
|
||||||
|
#define NM_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_MANAGER, NMManagerClass))
|
||||||
|
|
||||||
|
#define NM_MANAGER_VERSION "version"
|
||||||
|
#define NM_MANAGER_STATE "state"
|
||||||
|
#define NM_MANAGER_STARTUP "startup"
|
||||||
|
#define NM_MANAGER_NM_RUNNING "nm-running"
|
||||||
|
#define NM_MANAGER_NETWORKING_ENABLED "networking-enabled"
|
||||||
|
#define NM_MANAGER_WIRELESS_ENABLED "wireless-enabled"
|
||||||
|
#define NM_MANAGER_WIRELESS_HARDWARE_ENABLED "wireless-hardware-enabled"
|
||||||
|
#define NM_MANAGER_WWAN_ENABLED "wwan-enabled"
|
||||||
|
#define NM_MANAGER_WWAN_HARDWARE_ENABLED "wwan-hardware-enabled"
|
||||||
|
#define NM_MANAGER_WIMAX_ENABLED "wimax-enabled"
|
||||||
|
#define NM_MANAGER_WIMAX_HARDWARE_ENABLED "wimax-hardware-enabled"
|
||||||
|
#define NM_MANAGER_ACTIVE_CONNECTIONS "active-connections"
|
||||||
|
#define NM_MANAGER_CONNECTIVITY "connectivity"
|
||||||
|
#define NM_MANAGER_PRIMARY_CONNECTION "primary-connection"
|
||||||
|
#define NM_MANAGER_ACTIVATING_CONNECTION "activating-connection"
|
||||||
|
#define NM_MANAGER_DEVICES "devices"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
NMObject parent;
|
||||||
|
} NMManager;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
NMObjectClass parent;
|
||||||
|
|
||||||
|
/* Signals */
|
||||||
|
void (*device_added) (NMManager *manager, NMDevice *device);
|
||||||
|
void (*device_removed) (NMManager *manager, NMDevice *device);
|
||||||
|
void (*permission_changed) (NMManager *manager,
|
||||||
|
NMClientPermission permission,
|
||||||
|
NMClientPermissionResult result);
|
||||||
|
} NMManagerClass;
|
||||||
|
|
||||||
|
GType nm_manager_get_type (void);
|
||||||
|
|
||||||
|
const char *nm_manager_get_version (NMManager *manager);
|
||||||
|
NMState nm_manager_get_state (NMManager *manager);
|
||||||
|
gboolean nm_manager_get_startup (NMManager *manager);
|
||||||
|
gboolean nm_manager_get_nm_running (NMManager *manager);
|
||||||
|
|
||||||
|
gboolean nm_manager_networking_get_enabled (NMManager *manager);
|
||||||
|
gboolean nm_manager_networking_set_enabled (NMManager *manager,
|
||||||
|
gboolean enabled,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
gboolean nm_manager_wireless_get_enabled (NMManager *manager);
|
||||||
|
void nm_manager_wireless_set_enabled (NMManager *manager, gboolean enabled);
|
||||||
|
gboolean nm_manager_wireless_hardware_get_enabled (NMManager *manager);
|
||||||
|
|
||||||
|
gboolean nm_manager_wwan_get_enabled (NMManager *manager);
|
||||||
|
void nm_manager_wwan_set_enabled (NMManager *manager, gboolean enabled);
|
||||||
|
gboolean nm_manager_wwan_hardware_get_enabled (NMManager *manager);
|
||||||
|
|
||||||
|
gboolean nm_manager_wimax_get_enabled (NMManager *manager);
|
||||||
|
void nm_manager_wimax_set_enabled (NMManager *manager, gboolean enabled);
|
||||||
|
gboolean nm_manager_wimax_hardware_get_enabled (NMManager *manager);
|
||||||
|
|
||||||
|
gboolean nm_manager_get_logging (NMManager *manager,
|
||||||
|
char **level,
|
||||||
|
char **domains,
|
||||||
|
GError **error);
|
||||||
|
gboolean nm_manager_set_logging (NMManager *manager,
|
||||||
|
const char *level,
|
||||||
|
const char *domains,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
NMClientPermissionResult nm_manager_get_permission_result (NMManager *manager,
|
||||||
|
NMClientPermission permission);
|
||||||
|
|
||||||
|
NMConnectivityState nm_manager_get_connectivity (NMManager *manager);
|
||||||
|
|
||||||
|
NMConnectivityState nm_manager_check_connectivity (NMManager *manager,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GError **error);
|
||||||
|
void nm_manager_check_connectivity_async (NMManager *manager,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data);
|
||||||
|
NMConnectivityState nm_manager_check_connectivity_finish (NMManager *manager,
|
||||||
|
GAsyncResult *result,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
/* Devices */
|
||||||
|
|
||||||
|
const GPtrArray *nm_manager_get_devices (NMManager *manager);
|
||||||
|
NMDevice *nm_manager_get_device_by_path (NMManager *manager, const char *object_path);
|
||||||
|
NMDevice *nm_manager_get_device_by_iface (NMManager *manager, const char *iface);
|
||||||
|
|
||||||
|
/* Active Connections */
|
||||||
|
|
||||||
|
const GPtrArray *nm_manager_get_active_connections (NMManager *manager);
|
||||||
|
|
||||||
|
NMActiveConnection *nm_manager_get_primary_connection (NMManager *manager);
|
||||||
|
NMActiveConnection *nm_manager_get_activating_connection (NMManager *manager);
|
||||||
|
|
||||||
|
void nm_manager_activate_connection_async (NMManager *manager,
|
||||||
|
NMConnection *connection,
|
||||||
|
NMDevice *device,
|
||||||
|
const char *specific_object,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data);
|
||||||
|
NMActiveConnection *nm_manager_activate_connection_finish (NMManager *manager,
|
||||||
|
GAsyncResult *result,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
void nm_manager_add_and_activate_connection_async (NMManager *manager,
|
||||||
|
NMConnection *partial,
|
||||||
|
NMDevice *device,
|
||||||
|
const char *specific_object,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data);
|
||||||
|
NMActiveConnection *nm_manager_add_and_activate_connection_finish (NMManager *manager,
|
||||||
|
GAsyncResult *result,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
gboolean nm_manager_deactivate_connection (NMManager *manager,
|
||||||
|
NMActiveConnection *active,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GError **error);
|
||||||
|
void nm_manager_deactivate_connection_async (NMManager *manager,
|
||||||
|
NMActiveConnection *active,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data);
|
||||||
|
gboolean nm_manager_deactivate_connection_finish (NMManager *manager,
|
||||||
|
GAsyncResult *result,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __NM_MANAGER_H__ */
|
Reference in New Issue
Block a user