Netdev layer helper functions. More...

Detailed Description

Netdev layer helper functions.

Author
Koen Zandberg koen@.nosp@m.berg.nosp@m.zand..nosp@m.net

Definition in file layer.h.

#include "net/netdev.h"
#include "assert.h"
+ Include dependency graph for layer.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

static netdev_tnetdev_add_layer (netdev_t *top, netdev_t *dev)
 Add a netdev layer to the netdev layer stack. More...
 
int netdev_init_pass (netdev_t *dev)
 Passthrough init function. More...
 
void netdev_isr_pass (netdev_t *dev)
 Passthrough isr function. More...
 
int netdev_send_pass (netdev_t *dev, const iolist_t *iolist)
 Passthrough send function. More...
 
int netdev_recv_pass (netdev_t *dev, void *buf, size_t len, void *info)
 Passthrough recv function. More...
 
int netdev_get_pass (netdev_t *dev, netopt_t opt, void *value, size_t max_len)
 Passthrough get function. More...
 
int netdev_set_pass (netdev_t *dev, netopt_t opt, const void *value, size_t value_len)
 Passthrough set function. More...
 
void netdev_event_cb_pass (netdev_t *dev, netdev_event_t event)
 Passthrough event callback function. More...
 

Function Documentation

◆ netdev_add_layer()

static netdev_t* netdev_add_layer ( netdev_t top,
netdev_t dev 
)
inlinestatic

Add a netdev layer to the netdev layer stack.

Parameters
[in]topLast netdev device added to the stack.
[in]devNew layer to push to the top of the stack.
Returns
The new top netdev layer of the netdev stack.

Definition at line 37 of file layer.h.

◆ netdev_event_cb_pass()

void netdev_event_cb_pass ( netdev_t dev,
netdev_event_t  event 
)

Passthrough event callback function.

Parameters
[in]devnetwork device descriptor
[in]eventtype of the event

◆ netdev_get_pass()

int netdev_get_pass ( netdev_t dev,
netopt_t  opt,
void *  value,
size_t  max_len 
)

Passthrough get function.

See also netdev_driver for the extended description of this functions behaviour

Parameters
[in]devnetwork device descriptor
[in]optoption type
[out]valuepointer to store the option's value in
[in]max_lenmaximal amount of byte that fit into value
Returns
number of bytes written to value
< 0 on error, 0 on success

◆ netdev_init_pass()

int netdev_init_pass ( netdev_t dev)

Passthrough init function.

See also netdev_driver for the extended description of this functions behaviour

Parameters
[in]devnetwork device descriptor
Returns
< 0 on error, 0 on success

◆ netdev_isr_pass()

void netdev_isr_pass ( netdev_t dev)

Passthrough isr function.

See also netdev_driver for the extended description of this functions behaviour

Parameters
[in]devnetwork device descriptor

◆ netdev_recv_pass()

int netdev_recv_pass ( netdev_t dev,
void *  buf,
size_t  len,
void *  info 
)

Passthrough recv function.

See also netdev_driver for the extended description of this functions behaviour

Parameters
[in]devnetwork device descriptor
[out]bufbuffer to write into or NULL
[in]lenmaximum number of bytes to read
[out]infostatus information for the received packet. Might be of different type for different netdev devices. May be NULL if not needed or applicable.
Returns
< 0 on error
number of bytes read if buf != NULL
packet size if buf == NULL

◆ netdev_send_pass()

int netdev_send_pass ( netdev_t dev,
const iolist_t iolist 
)

Passthrough send function.

See also netdev_driver for the extended description of this functions behaviour

Parameters
[in]devnetwork device descriptor
[in]iolistio vector list to send
Returns
number of bytes sent, or < 0 on error

◆ netdev_set_pass()

int netdev_set_pass ( netdev_t dev,
netopt_t  opt,
const void *  value,
size_t  value_len 
)

Passthrough set function.

See also netdev_driver for the extended description of this functions behaviour

Parameters
[in]devnetwork device descriptor
[in]optoption type
[in]valuevalue to set
[in]value_lenthe length of value
Returns
number of bytes used from value
< 0 on error, 0 on success