diff options
author | Thomas Haller <thaller@redhat.com> | 2019-08-03 14:20:40 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-08-07 13:21:48 +0200 |
commit | 1b59d752beec43b82e53a4d14d9c6c5a09ceee86 (patch) | |
tree | 47f03ede97c384555a4c0a491487ff85fabc3ff8 /src/nm-firewall-manager.h | |
parent | 7d3a05d493afe705a1f3defb0c58d1a829c3604d (diff) | |
download | NetworkManager-1b59d752beec43b82e53a4d14d9c6c5a09ceee86.tar.gz |
firewall: refactor "nm-firewall-manager.c" to not use GDBusProxy
- Don't use GDBusProxy but plain GDBusConnection. NMFirewallManager
is very simple, it doesn't use any of the features that GDBusProxy
provides.
- make NMFirewallManagerCallId typedef a pointer to the opaque call-id
struct, instead of the struct itself. It's confusing to have a
variable that does not look like a pointer and assigning %NULL to
it.
- internally drop the CBInfo typename and name the call-id variable
constsistantly as "call_id".
- no need to keep the call-id struct alive after cancelling it. That
simplifies the lifetime managment of the pending call because the
completion callback is always invoked shortly before destroying
the call-id.
- note that the caller is no longer allowed to cancel a call-id from
inside the completion callback. That just complicates the
implementation and is not necessary. Assert against that.
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/230
Diffstat (limited to 'src/nm-firewall-manager.h')
-rw-r--r-- | src/nm-firewall-manager.h | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/src/nm-firewall-manager.h b/src/nm-firewall-manager.h index ceca58bea6..e7d10338bc 100644 --- a/src/nm-firewall-manager.h +++ b/src/nm-firewall-manager.h @@ -20,11 +20,6 @@ #ifndef __NETWORKMANAGER_FIREWALL_MANAGER_H__ #define __NETWORKMANAGER_FIREWALL_MANAGER_H__ -#define FIREWALL_DBUS_SERVICE "org.fedoraproject.FirewallD1" -#define FIREWALL_DBUS_PATH "/org/fedoraproject/FirewallD1" -#define FIREWALL_DBUS_INTERFACE "org.fedoraproject.FirewallD1" -#define FIREWALL_DBUS_INTERFACE_ZONE "org.fedoraproject.FirewallD1.zone" - #define NM_TYPE_FIREWALL_MANAGER (nm_firewall_manager_get_type ()) #define NM_FIREWALL_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_FIREWALL_MANAGER, NMFirewallManager)) #define NM_FIREWALL_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_FIREWALL_MANAGER, NMFirewallManagerClass)) @@ -34,7 +29,7 @@ #define NM_FIREWALL_MANAGER_STATE_CHANGED "state-changed" -typedef struct _NMFirewallManagerCallId *NMFirewallManagerCallId; +typedef struct _NMFirewallManagerCallId NMFirewallManagerCallId; typedef struct _NMFirewallManager NMFirewallManager; typedef struct _NMFirewallManagerClass NMFirewallManagerClass; @@ -46,22 +41,22 @@ NMFirewallManager *nm_firewall_manager_get (void); gboolean nm_firewall_manager_get_running (NMFirewallManager *self); typedef void (*NMFirewallManagerAddRemoveCallback) (NMFirewallManager *self, - NMFirewallManagerCallId call_id, + NMFirewallManagerCallId *call_id, GError *error, gpointer user_data); -NMFirewallManagerCallId nm_firewall_manager_add_or_change_zone (NMFirewallManager *mgr, - const char *iface, - const char *zone, - gboolean add, - NMFirewallManagerAddRemoveCallback callback, - gpointer user_data); -NMFirewallManagerCallId nm_firewall_manager_remove_from_zone (NMFirewallManager *mgr, - const char *iface, - const char *zone, - NMFirewallManagerAddRemoveCallback callback, - gpointer user_data); - -void nm_firewall_manager_cancel_call (NMFirewallManagerCallId fw_call); +NMFirewallManagerCallId *nm_firewall_manager_add_or_change_zone (NMFirewallManager *mgr, + const char *iface, + const char *zone, + gboolean add, + NMFirewallManagerAddRemoveCallback callback, + gpointer user_data); +NMFirewallManagerCallId *nm_firewall_manager_remove_from_zone (NMFirewallManager *mgr, + const char *iface, + const char *zone, + NMFirewallManagerAddRemoveCallback callback, + gpointer user_data); + +void nm_firewall_manager_cancel_call (NMFirewallManagerCallId *call_id); #endif /* __NETWORKMANAGER_FIREWALL_MANAGER_H__ */ |