libosmocore 1.10.0.64-ff3d
Osmocom core library
|
This code integrates libmnl (minimal netlink library) into the osmocom select loop abstraction. More...
#include <osmocom/core/select.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/mnl.h>
#include <libmnl/libmnl.h>
#include <errno.h>
#include <string.h>
Functions | |
static int | osmo_mnl_fd_cb (struct osmo_fd *ofd, unsigned int what) |
struct osmo_mnl * | osmo_mnl_init (void *ctx, int bus, unsigned int groups, mnl_cb_t mnl_cb, void *priv) |
create an osmocom-wrapped limnl netlink socket. More... | |
void | osmo_mnl_destroy (struct osmo_mnl *omnl) |
destroy an existing osmocom-wrapped mnl netlink socket: Unregister + close + free. More... | |
This code integrates libmnl (minimal netlink library) into the osmocom select loop abstraction.
It allows other osmocom libraries or application code to create netlink sockets and subscribe to netlink events via libmnl. The completion handler / callbacks are dispatched via libosmocore select loop handling.
void osmo_mnl_destroy | ( | struct osmo_mnl * | omnl | ) |
destroy an existing osmocom-wrapped mnl netlink socket: Unregister + close + free.
[in] | omnl | osmo_mnl socket previously returned by osmo_mnl_init() |
References osmo_mnl::mnls, osmo_mnl::ofd, and osmo_fd_unregister().
Referenced by netdev_netns_ctx_free().
|
static |
References osmo_fd::data, DLGLOBAL, LOGL_ERROR, LOGP, osmo_mnl::mnl_cb, osmo_mnl::mnls, osmo_mnl::ofd, and OSMO_FD_READ.
Referenced by osmo_mnl_init().
struct osmo_mnl * osmo_mnl_init | ( | void * | ctx, |
int | bus, | ||
unsigned int | groups, | ||
mnl_cb_t | mnl_cb, | ||
void * | priv | ||
) |
create an osmocom-wrapped limnl netlink socket.
[in] | ctx | talloc context from which to allocate |
[in] | bus | netlink socket bus ID (see NETLINK_* constants) |
[in] | groups | groups of messages to bind/subscribe to |
[in] | mnl_cb | callback function called for each incoming message |
[in] | priv | opaque private user data |
References DLGLOBAL, LOGL_ERROR, LOGP, osmo_mnl::mnl_cb, osmo_mnl::mnls, osmo_mnl::ofd, OSMO_FD_READ, osmo_fd_register(), osmo_fd_setup(), osmo_mnl_fd_cb(), and osmo_mnl::priv.
Referenced by netdev_netns_ctx_init().