All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] dbus: l_dbus_name_acquire public API and driver declarations
@ 2016-03-28 22:09 Andrew Zaborowski
  2016-03-28 22:09 ` [PATCH 2/5] dbus: kdbus driver->name_acquire implementation Andrew Zaborowski
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Andrew Zaborowski @ 2016-03-28 22:09 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 3184 bytes --]

---
 ell/dbus.c | 34 ++++++++++++++++++++++++++++++++++
 ell/dbus.h |  8 ++++++++
 2 files changed, 42 insertions(+)

diff --git a/ell/dbus.c b/ell/dbus.c
index b9864bd..7d873ff 100644
--- a/ell/dbus.c
+++ b/ell/dbus.c
@@ -64,6 +64,10 @@ struct l_dbus_ops {
 	struct l_dbus_message *(*recv_message)(struct l_dbus *bus);
 	void (*free)(struct l_dbus *bus);
 	struct _dbus_filter_ops filter_ops;
+	uint32_t (*name_acquire)(struct l_dbus *dbus, const char *name,
+				bool allow_replacement, bool replace_existing,
+				bool queue, l_dbus_name_acquire_func_t callback,
+				void *user_data);
 };
 
 struct l_dbus {
@@ -2011,3 +2015,33 @@ LIB_EXPORT bool l_dbus_remove_signal_watch(struct l_dbus *dbus, unsigned int id)
 {
 	return _dbus_filter_remove_rule(dbus->filter, id);
 }
+
+/**
+ * l_dbus_name_acquire:
+ * @dbus: D-Bus connection
+ * @name: Well-known bus name to be acquired
+ * @allow_replacement: Whether to allow another peer's name request to
+ *                     take the name ownership away from this connection
+ * @replace_existing: Whether to allow D-Bus to take the name's ownership
+ *                    away from another peer in case the name is already
+ *                    owned and allows replacement.  Ignored if name is
+ *                    currently free.
+ * @queue: Whether to allow the name request to be queued by D-Bus in
+ *         case it cannot be acquired now, rather than to return a failure.
+ * @callback: Callback to receive the request result when done.
+ *
+ * Acquire a well-known bus name (service name) on the bus.
+ *
+ * Returns: a non-zero request serial that can be passed to l_dbus_cancel
+ *          while waiting for the callback or zero if the callback has
+ *          has happened while l_dbus_name_acquire was running.
+ **/
+LIB_EXPORT uint32_t l_dbus_name_acquire(struct l_dbus *dbus, const char *name,
+				bool allow_replacement, bool replace_existing,
+				bool queue, l_dbus_name_acquire_func_t callback,
+				void *user_data)
+{
+	return dbus->driver->name_acquire(dbus, name, allow_replacement,
+						replace_existing, queue,
+						callback, user_data);
+}
diff --git a/ell/dbus.h b/ell/dbus.h
index 0f20499..b096ed3 100644
--- a/ell/dbus.h
+++ b/ell/dbus.h
@@ -67,6 +67,9 @@ typedef void (*l_dbus_interface_setup_func_t) (struct l_dbus_interface *);
 
 typedef void (*l_dbus_watch_func_t) (struct l_dbus *dbus, void *user_data);
 
+typedef void (*l_dbus_name_acquire_func_t) (struct l_dbus *dbus, bool success,
+						bool queued, void *user_data);
+
 struct l_dbus *l_dbus_new(const char *address);
 struct l_dbus *l_dbus_new_default(enum l_dbus_bus bus);
 void l_dbus_destroy(struct l_dbus *dbus);
@@ -252,6 +255,11 @@ unsigned int l_dbus_add_signal_watch(struct l_dbus *dbus,
 					const char *member, ...);
 bool l_dbus_remove_signal_watch(struct l_dbus *dbus, unsigned int id);
 
+uint32_t l_dbus_name_acquire(struct l_dbus *dbus, const char *name,
+				bool allow_replacement, bool replace_existing,
+				bool queue, l_dbus_name_acquire_func_t callback,
+				void *user_data);
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-03-29  1:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-28 22:09 [PATCH 1/5] dbus: l_dbus_name_acquire public API and driver declarations Andrew Zaborowski
2016-03-28 22:09 ` [PATCH 2/5] dbus: kdbus driver->name_acquire implementation Andrew Zaborowski
2016-03-28 22:09 ` [PATCH 3/5] dbus: Classic " Andrew Zaborowski
2016-03-28 22:09 ` [PATCH 4/5] unit: Use l_dbus_name_acquire to acquire well-known name Andrew Zaborowski
2016-03-28 22:09 ` [PATCH 5/5] examples: " Andrew Zaborowski
2016-03-29  1:00 ` [PATCH 1/5] dbus: l_dbus_name_acquire public API and driver declarations Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.