Abstraction layer for GNRC's network interfaces. More...

Detailed Description

Abstraction layer for GNRC's network interfaces.

Network interfaces in the context of GNRC are threads for protocols that are below the network layer.

Modules

 Generic network interface header
 

Files

file  netif.h
 Definitions for GNRC's network interfaces.
 

Data Structures

struct  gnrc_netif_handler_t
 The add and remove handlers to set network layer protocol specific options for an interface. More...
 

Macros

#define GNRC_NETIF_NUMOF   (1)
 Maximum number of network interfaces.
 

Typedefs

typedef void(* gnrc_netif_op_t) (kernel_pid_t pid)
 The add/remove operation to set network layer protocol specific options for an interface. More...
 

Functions

void gnrc_netif_init (void)
 Initializes module.
 
int gnrc_netif_add (kernel_pid_t pid)
 Adds a thread as interface. More...
 
void gnrc_netif_remove (kernel_pid_t pid)
 Removes a thread as interface. More...
 
size_t gnrc_netif_get (kernel_pid_t *netifs)
 Get all active interfaces. More...
 
bool gnrc_netif_exist (kernel_pid_t pid)
 Check if an interface exist. More...
 
char * gnrc_netif_addr_to_str (char *out, size_t out_len, const uint8_t *addr, size_t addr_len)
 Converts a hardware address to a human readable string. More...
 
size_t gnrc_netif_addr_from_str (uint8_t *out, size_t out_len, const char *str)
 Parses a string of colon-separated hexadecimals to a hardware address. More...
 

Typedef Documentation

◆ gnrc_netif_op_t

typedef void(* gnrc_netif_op_t) (kernel_pid_t pid)

The add/remove operation to set network layer protocol specific options for an interface.

Parameters
[in]pidThe PID to the new interface.

Definition at line 49 of file netif.h.

Function Documentation

◆ gnrc_netif_add()

int gnrc_netif_add ( kernel_pid_t  pid)

Adds a thread as interface.

Parameters
[in]pidPID of the added thread.
Returns
0, on success,
-ENOMEM, if maximum number of interfaces has been exceeded.

◆ gnrc_netif_addr_from_str()

size_t gnrc_netif_addr_from_str ( uint8_t *  out,
size_t  out_len,
const char *  str 
)

Parses a string of colon-separated hexadecimals to a hardware address.

The input format must be like xx:xx:xx:xx where xx will be the bytes of addr in hexadecimal representation.

Parameters
[out]outThe resulting hardware address.
[out]out_lenLength of out.
[in]strA string of colon-separated hexadecimals.
Returns
Actual length of out on success.
0, on failure.

◆ gnrc_netif_addr_to_str()

char* gnrc_netif_addr_to_str ( char *  out,
size_t  out_len,
const uint8_t *  addr,
size_t  addr_len 
)

Converts a hardware address to a human readable string.

The format will be like xx:xx:xx:xx where xx are the bytes of addr in hexadecimal representation.

Precondition
out_len >= 3 * addr_len
Parameters
[out]outA string to store the output in.
[out]out_lenLength of out. Must be at least 3 * addr_len long.
[in]addrA hardware address.
[in]addr_lenLength of addr.
Returns
Copy of out on success.
NULL, if out_len < 3 * addr_len.

◆ gnrc_netif_exist()

bool gnrc_netif_exist ( kernel_pid_t  pid)

Check if an interface exist.

Parameters
[in]pidThe PID to be checked.
Returns
True, if an interface pid exists.
False, otherwise

◆ gnrc_netif_get()

size_t gnrc_netif_get ( kernel_pid_t netifs)

Get all active interfaces.

Parameters
[out]netifsList of all active interfaces. There is no order ensured. It must at least fit GNRC_NETIF_NUMOF elements.
Returns
The number of active interfaces.

◆ gnrc_netif_remove()

void gnrc_netif_remove ( kernel_pid_t  pid)

Removes a thread as interface.

Parameters
[in]pidPID of the removed thread.