aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-12-01 22:21:14 +0100
committerlaforge <laforge@osmocom.org>2020-12-02 21:04:51 +0000
commit53a2fde368d0161a38bc096d121ef61a9afbbe94 (patch)
tree85fbf0e7785397caa077823c1cf7a76438bdf5b9 /include/osmocom
parentb7fc3a0a6d2329174721f2baccc18fc770bb0d9a (diff)
Integrate libmnl (minimal netlink) library with libosmocore select loop
This adds an easy way to listen to netlink events form the Linux kernel from within libosmocore applications. The new dependency can be disabled via the "--disable-lbimnl" configure flag. Change-Id: I4f787ee68f0d6d04f0a5655eb57d55b3b326a42f
Diffstat (limited to 'include/osmocom')
-rw-r--r--include/osmocom/core/mnl.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/osmocom/core/mnl.h b/include/osmocom/core/mnl.h
new file mode 100644
index 00000000..11c83530
--- /dev/null
+++ b/include/osmocom/core/mnl.h
@@ -0,0 +1,22 @@
+/*! \file select.h
+ * libmnl integration
+ */
+#pragma once
+
+#include <osmocom/core/select.h>
+#include <libmnl/libmnl.h>
+
+/*! osmocom wrapper around libmnl abstraction of netlink socket */
+struct osmo_mnl {
+ /*! osmo-wrapped netlink file descriptor */
+ struct osmo_fd ofd;
+ /*! libmnl socket abstraction */
+ struct mnl_socket *mnls;
+ /*! call-back called for received netlink messages */
+ mnl_cb_t mnl_cb;
+ /*! opaque data provided by user */
+ void *priv;
+};
+
+struct osmo_mnl *osmo_mnl_init(void *ctx, int bus, unsigned int groups, mnl_cb_t mnl_cb, void *priv);
+void osmo_mnl_destroy(struct osmo_mnl *omnl);