summaryrefslogtreecommitdiff
path: root/src/libsystemd-rtnl/rtnl-internal.h
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2013-11-13 23:18:20 +0100
committerTom Gundersen <teg@jklm.no>2013-11-14 14:32:48 +0100
commite16bcf986e3e2da2e01afc96f264edfc7bb00d1a (patch)
treeb6908953b2fe630af11e53480eb405054e296634 /src/libsystemd-rtnl/rtnl-internal.h
parent24710f6d2fbe25282fd96a8f869b7e4a9c3b50d8 (diff)
rtnl: add call_async and call_async_cancel
They work in the same way as the sd-bus equivalents.
Diffstat (limited to 'src/libsystemd-rtnl/rtnl-internal.h')
-rw-r--r--src/libsystemd-rtnl/rtnl-internal.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/libsystemd-rtnl/rtnl-internal.h b/src/libsystemd-rtnl/rtnl-internal.h
index 03297bb8de..adad7850c5 100644
--- a/src/libsystemd-rtnl/rtnl-internal.h
+++ b/src/libsystemd-rtnl/rtnl-internal.h
@@ -24,6 +24,17 @@
#include <linux/netlink.h>
#include "refcnt.h"
+#include "prioq.h"
+
+#include "sd-rtnl.h"
+
+struct reply_callback {
+ sd_rtnl_message_handler_t callback;
+ void *userdata;
+ usec_t timeout;
+ uint64_t serial;
+ unsigned prioq_idx;
+};
struct sd_rtnl {
RefCount n_ref;
@@ -45,6 +56,9 @@ struct sd_rtnl {
uint32_t serial;
+ struct Prioq *reply_callbacks_prioq;
+ Hashmap *reply_callbacks;
+
pid_t original_pid;
};
@@ -53,8 +67,12 @@ struct sd_rtnl {
#define RTNL_WQUEUE_MAX 1024
#define RTNL_RQUEUE_MAX 64*1024
-int message_get_errno(sd_rtnl_message *m);
+int message_new_synthetic_error(int error, uint32_t serial, sd_rtnl_message **ret);
uint32_t message_get_serial(sd_rtnl_message *m);
int message_seal(sd_rtnl *nl, sd_rtnl_message *m);
int socket_write_message(sd_rtnl *nl, sd_rtnl_message *m);
int socket_read_message(sd_rtnl *nl, sd_rtnl_message **ret);
+
+/* Make sure callbacks don't destroy the rtnl connection */
+#define RTNL_DONT_DESTROY(rtnl) \
+ _cleanup_sd_rtnl_unref_ sd_rtnl *_dont_destroy_##rtnl = sd_rtnl_ref(rtnl)