Loading...
Searching...
No Matches

Detailed Description

See also
gnrc_netif_ops_t

Definition at line 281 of file netif.h.

#include <netif.h>

Data Fields

int(* init )(gnrc_netif_t *netif)
 Initializes and registers network interface.
 
int(* send )(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt)
 Send a packet over the network interface.
 
gnrc_pktsnip_t *(* recv )(gnrc_netif_t *netif)
 Receives a packet from the network interface.
 
int(* get )(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt)
 Gets an option from the network interface.
 
int(* set )(gnrc_netif_t *netif, const gnrc_netapi_opt_t *opt)
 Sets an option from the network interface.
 
void(* msg_handler )(gnrc_netif_t *netif, msg_t *msg)
 Message handler for network interface.
 

Field Documentation

◆ get

int(* gnrc_netif_ops::get) (gnrc_netif_t *netif, gnrc_netapi_opt_t *opt)

Gets an option from the network interface.

Use gnrc_netif_get_from_netdev() to just get options from gnrc_netif_t::dev.

Parameters
[in]netifThe network interface.
[in]optThe option parameters.
Returns
Number of bytes in data.
-EOVERFLOW, if max_len is lesser than the required space.
-ENOTSUP, if opt is not supported to be set.
Any negative error code reported by gnrc_netif_t::dev.

Definition at line 359 of file netif.h.

◆ init

int(* gnrc_netif_ops::init) (gnrc_netif_t *netif)

Initializes and registers network interface.

Precondition
netif != NULL
Parameters
[in]netifThe network interface.

This function should init the device driver or MAC underlying MAC layer. This is called right before the interface's thread starts receiving messages. It is not necessary to lock the interface's mutex gnrc_netif_t::mutex, since it is already locked. Set to gnrc_netif_default_init() if you do not need any special initialization. If you do need special initialization, it is recommended to call gnrc_netif_default_init() at the start of the custom initialization function set here. This function MUST call netif_register if the initialization is successful.

Returns
0 if the initialization of the device or MAC layer was successful
negative errno on error.

Definition at line 303 of file netif.h.

◆ msg_handler

void(* gnrc_netif_ops::msg_handler) (gnrc_netif_t *netif, msg_t *msg)

Message handler for network interface.

This message handler is used, when the network interface needs to handle message types beyond the ones defined in netapi. Leave NULL if this is not the case.

Parameters
[in]netifThe network interface.
[in]msgMessage to be handled.

Definition at line 388 of file netif.h.

◆ recv

gnrc_pktsnip_t *(* gnrc_netif_ops::recv) (gnrc_netif_t *netif)

Receives a packet from the network interface.

Precondition
netif != NULL
Note
The function takes the bytes received via netdev_driver_t::recv() from gnrc_netif_t::dev and re-formats it to a packet containing a Generic network interface header and a payload header in receive order.
Parameters
[in]netifThe network interface.
Returns
The packet received. Contains the payload (with the type marked accordingly) and a Generic network interface header in receive order.
NULL, if Packet buffer was full.

Definition at line 343 of file netif.h.

◆ send

int(* gnrc_netif_ops::send) (gnrc_netif_t *netif, gnrc_pktsnip_t *pkt)

Send a packet over the network interface.

Precondition
netif != NULL && pkt != NULL
Note
The function re-formats the content of pkt to a format expected by the netdev_driver_t::send() method of gnrc_netif_t::dev and releases the packet before returning (so no additional release should be required after calling this method).
Parameters
[in]netifThe network interface.
[in]pktA packet to send.
Returns
The number of bytes actually sent on success
-EBADMSG, if the Generic network interface header in pkt is missing or is in an unexpected format.
-ENOTSUP, if sending pkt in the given format isn't supported (e.g. empty payload with Ethernet).
Any negative error code reported by gnrc_netif_t::dev.

Definition at line 325 of file netif.h.

◆ set

int(* gnrc_netif_ops::set) (gnrc_netif_t *netif, const gnrc_netapi_opt_t *opt)

Sets an option from the network interface.

Use gnrc_netif_set_from_netdev() to just set options from gnrc_netif_t::dev.

Parameters
[in]netifThe network interface.
[in]optThe option parameters.
Returns
Number of bytes written to gnrc_netif_t::dev.
-EOVERFLOW, if data_len is greater than the allotted space in gnrc_netif_t::dev or gnrc_netif_t.
-ENOTSUP, if opt is not supported to be set.
Any negative error code reported by gnrc_netif_t::dev.

Definition at line 376 of file netif.h.


The documentation for this struct was generated from the following file: