Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
|
Virtual network interface support functions. More...
Data Structures | |
struct | virtual_interface_api |
Virtual L2 API operations. More... | |
struct | virtual_interface_context |
Virtual L2 context that is needed to binding to the real network interface. More... | |
Macros | |
#define | NET_VIRTUAL_INTERFACE_INIT(dev_id, name, init_fn, pm, data, config, prio, api, mtu) |
Create a virtual network interface. | |
#define | NET_VIRTUAL_INTERFACE_INIT_INSTANCE(dev_id, name, inst, init_fn, pm, data, config, prio, api, mtu) |
Create a virtual network interface. | |
Enumerations | |
enum | virtual_interface_caps { VIRTUAL_INTERFACE_IPIP = BIT(1) , VIRTUAL_INTERFACE_VLAN = BIT(2) } |
Virtual interface capabilities. More... | |
Functions | |
int | net_virtual_interface_attach (struct net_if *virtual_iface, struct net_if *iface) |
Attach virtual network interface to the given network interface. | |
struct net_if * | net_virtual_get_iface (struct net_if *iface) |
Return network interface related to this virtual network interface. | |
char * | net_virtual_get_name (struct net_if *iface, char *buf, size_t len) |
Return the name of the virtual network interface L2. | |
void | net_virtual_set_name (struct net_if *iface, const char *name) |
Set the name of the virtual network interface L2. | |
enum net_l2_flags | net_virtual_set_flags (struct net_if *iface, enum net_l2_flags flags) |
Set the L2 flags of the virtual network interface. | |
enum net_verdict | net_virtual_input (struct net_if *input_iface, struct net_addr *remote_addr, struct net_pkt *pkt) |
Feed the IP pkt to stack if tunneling is enabled. | |
Virtual network interface support functions.
#define NET_VIRTUAL_INTERFACE_INIT | ( | dev_id, | |
name, | |||
init_fn, | |||
pm, | |||
data, | |||
config, | |||
prio, | |||
api, | |||
mtu | |||
) |
#include <zephyr/net/virtual.h>
Create a virtual network interface.
Binding to another interface is done at runtime by calling net_virtual_interface_attach(). The attaching is done automatically when setting up tunneling when peer IP address is set in IP tunneling driver.
dev_id | Network device id. |
name | The name this instance of the driver exposes to the system. |
init_fn | Address to the init function of the driver. |
pm | Reference to struct pm_device associated with the device. (optional). |
data | Pointer to the device's private data. |
config | The address to the structure containing the configuration information for this instance of the driver. |
prio | The initialization level at which configuration occurs. |
api | Provides an initial pointer to the API function struct used by the driver. Can be NULL. |
mtu | Maximum transfer unit in bytes for this network interface. This is the default value and its value can be tweaked at runtime. |
#define NET_VIRTUAL_INTERFACE_INIT_INSTANCE | ( | dev_id, | |
name, | |||
inst, | |||
init_fn, | |||
pm, | |||
data, | |||
config, | |||
prio, | |||
api, | |||
mtu | |||
) |
#include <zephyr/net/virtual.h>
Create a virtual network interface.
Binding to another interface is done at runtime by calling net_virtual_interface_attach(). The attaching is done automatically when setting up tunneling when peer IP address is set in IP tunneling driver.
dev_id | Network device id. |
name | The name this instance of the driver exposes to the system. |
inst | instance number |
init_fn | Address to the init function of the driver. |
pm | Reference to struct pm_device associated with the device. (optional). |
data | Pointer to the device's private data. |
config | The address to the structure containing the configuration information for this instance of the driver. |
prio | The initialization level at which configuration occurs. |
api | Provides an initial pointer to the API function struct used by the driver. Can be NULL. |
mtu | Maximum transfer unit in bytes for this network interface. This is the default value and its value can be tweaked at runtime. |
#include <zephyr/net/virtual.h>
Virtual interface capabilities.
Enumerator | |
---|---|
VIRTUAL_INTERFACE_IPIP | IPIP tunnel. |
VIRTUAL_INTERFACE_VLAN | Virtual LAN interface (VLAN) |
#include <zephyr/net/virtual.h>
Return network interface related to this virtual network interface.
The returned network interface is below this virtual network interface.
iface | Virtual network interface. |
#include <zephyr/net/virtual.h>
Return the name of the virtual network interface L2.
iface | Virtual network interface. |
buf | Buffer to store the name |
len | Max buffer length |
enum net_verdict net_virtual_input | ( | struct net_if * | input_iface, |
struct net_addr * | remote_addr, | ||
struct net_pkt * | pkt | ||
) |
#include <zephyr/net/virtual.h>
Feed the IP pkt to stack if tunneling is enabled.
input_iface | Network interface receiving the pkt. |
remote_addr | IP address of the sender. |
pkt | Network packet. |
#include <zephyr/net/virtual.h>
Attach virtual network interface to the given network interface.
virtual_iface | Virtual network interface. |
iface | Network interface we are attached to. This can be NULL, if we want to detach. |
enum net_l2_flags net_virtual_set_flags | ( | struct net_if * | iface, |
enum net_l2_flags | flags | ||
) |
#include <zephyr/net/virtual.h>
Set the L2 flags of the virtual network interface.
iface | Virtual network interface. |
flags | L2 flags to set. |
void net_virtual_set_name | ( | struct net_if * | iface, |
const char * | name | ||
) |
#include <zephyr/net/virtual.h>
Set the name of the virtual network interface L2.
iface | Virtual network interface. |
name | Name of the virtual L2 layer. |