libosmocore 1.9.0.196-9975
Osmocom core library
netdev.h File Reference

network device (interface) convenience functions. More...

#include <stddef.h>
#include <stdint.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/socket.h>

Go to the source code of this file.

Typedefs

typedef int(* osmo_netdev_ifupdown_ind_cb_t) (struct osmo_netdev *netdev, bool ifupdown)
 
typedef int(* osmo_netdev_dev_name_chg_cb_t) (struct osmo_netdev *netdev, const char *new_dev_name)
 
typedef int(* osmo_netdev_mtu_chg_cb_t) (struct osmo_netdev *netdev, unsigned int new_mtu)
 

Functions

struct osmo_netdevosmo_netdev_alloc (void *ctx, const char *name)
 Allocate a new netdev object. More...
 
void osmo_netdev_free (struct osmo_netdev *netdev)
 Free an allocated netdev object. More...
 
int osmo_netdev_register (struct osmo_netdev *netdev)
 Start managing the network device referenced by the netdev object. More...
 
int osmo_netdev_unregister (struct osmo_netdev *netdev)
 Unregister the netdev object (stop managing /moniutoring the interface) More...
 
bool osmo_netdev_is_registered (struct osmo_netdev *netdev)
 Retrieve whether the netdev object is in "registered" state. More...
 
const char * osmo_netdev_get_name (const struct osmo_netdev *netdev)
 Get name used to identify the netdev object. More...
 
void osmo_netdev_set_priv_data (struct osmo_netdev *netdev, void *priv_data)
 Set private user data pointer on the netdev object. More...
 
void * osmo_netdev_get_priv_data (struct osmo_netdev *netdev)
 Get private user data pointer from the netdev object. More...
 
int osmo_netdev_set_ifindex (struct osmo_netdev *netdev, unsigned int ifindex)
 Set (specify) interface index identifying the network interface to manage. More...
 
unsigned int osmo_netdev_get_ifindex (const struct osmo_netdev *netdev)
 Get interface index identifying the interface managed by netdev. More...
 
const char * osmo_netdev_get_dev_name (const struct osmo_netdev *netdev)
 Get name used to name the network interface created by the netdev object. More...
 
int osmo_netdev_set_netns_name (struct osmo_netdev *netdev, const char *netns)
 Set (specify) name of the network namespace where the network interface to manage is located. More...
 
const char * osmo_netdev_get_netns_name (const struct osmo_netdev *netdev)
 Get name of network namespace used when opening the netdev interface. More...
 
void osmo_netdev_set_ifupdown_ind_cb (struct osmo_netdev *netdev, osmo_netdev_ifupdown_ind_cb_t ifupdown_ind_cb)
 Set data_ind_cb callback, called when a new packet is received on the network interface. More...
 
void osmo_netdev_set_dev_name_chg_cb (struct osmo_netdev *netdev, osmo_netdev_dev_name_chg_cb_t dev_name_chg_cb)
 Set dev_name_chg_cb callback, called when a change in the network name is detected. More...
 
void osmo_netdev_set_mtu_chg_cb (struct osmo_netdev *netdev, osmo_netdev_mtu_chg_cb_t mtu_chg_cb)
 Set mtu_chg_cb callback, called when a change in the network name is detected. More...
 
int osmo_netdev_add_addr (struct osmo_netdev *netdev, const struct osmo_sockaddr *addr, uint8_t prefixlen)
 Add IP address to netdev interface. More...
 
int osmo_netdev_add_route (struct osmo_netdev *netdev, const struct osmo_sockaddr *dst_addr, uint8_t dst_prefixlen, const struct osmo_sockaddr *gw_addr)
 Add IP route to netdev interface. More...
 
int osmo_netdev_ifupdown (struct osmo_netdev *netdev, bool ifupdown)
 Bring netdev interface UP or DOWN. More...
 

Detailed Description

network device (interface) convenience functions.

Typedef Documentation

◆ osmo_netdev_dev_name_chg_cb_t

typedef int(* osmo_netdev_dev_name_chg_cb_t) (struct osmo_netdev *netdev, const char *new_dev_name)

◆ osmo_netdev_ifupdown_ind_cb_t

typedef int(* osmo_netdev_ifupdown_ind_cb_t) (struct osmo_netdev *netdev, bool ifupdown)

◆ osmo_netdev_mtu_chg_cb_t

typedef int(* osmo_netdev_mtu_chg_cb_t) (struct osmo_netdev *netdev, unsigned int new_mtu)