Go to the documentation of this file.
29 #ifndef NET_GNRC_NETIF_H
30 #define NET_GNRC_NETIF_H
38 #ifdef MODULE_GNRC_NETIF_BUS
46 #if IS_USED(MODULE_GNRC_NETIF_LORAWAN)
49 #if IS_USED(MODULE_GNRC_NETIF_6LO)
52 #if defined(MODULE_GNRC_NETIF_DEDUP) && (GNRC_NETIF_L2ADDR_MAXLEN > 0)
56 #if IS_USED(MODULE_GNRC_NETIF_IPV6)
59 #if IS_USED(MODULE_GNRC_NETIF_MAC)
62 #if IS_USED(MODULE_GNRC_NETIF_PKTQ)
68 #ifdef MODULE_NETSTATS_L2
82 #ifdef MODULE_GNRC_IPV6
120 #ifdef MODULE_NETSTATS_L2
123 #if IS_USED(MODULE_GNRC_NETIF_LORAWAN) || defined(DOXYGEN)
126 #if IS_USED(MODULE_GNRC_NETIF_IPV6) || defined(DOXYGEN)
129 #if IS_USED(MODULE_GNRC_NETIF_MAC) || defined(DOXYGEN)
132 #if IS_USED(MODULE_GNRC_NETIF_BUS) || DOXYGEN
141 #if IS_USED(MODULE_GNRC_NETIF_EVENTS) || defined(DOXYGEN)
151 #if (GNRC_NETIF_L2ADDR_MAXLEN > 0) || DOXYGEN
166 #if defined(MODULE_GNRC_NETIF_DEDUP) || DOXYGEN
175 #if IS_USED(MODULE_GNRC_NETIF_6LO) || defined(DOXYGEN)
178 #if IS_USED(MODULE_GNRC_NETIF_PKTQ) || defined(DOXYGEN)
326 char priority,
const char *name,
netdev_t *dev,
349 return IS_USED(MODULE_GNRC_NETIF_SINGLE);
429 assert((pfx_len > 0) && (pfx_len <= 128));
431 ((pfx_len << 8U) | flags), addr,
630 #if defined(MODULE_GNRC_NETIF_BUS) || DOXYGEN
642 assert(type < GNRC_NETIF_BUS_NUMOF);
643 return &netif->
bus[type];
Generic interface to communicate with GNRC modules.
gnrc_ipv6_event_t
Event types for GNRC_NETIF_BUS_IPV6 per-interface message bus.
int16_t kernel_pid_t
Unique process identifier.
Network interface descriptor.
static int gnrc_netapi_get(kernel_pid_t pid, netopt_t opt, uint16_t context, void *data, size_t max_len)
Shortcut function for sending GNRC_NETAPI_MSG_TYPE_GET messages and parsing the returned GNRC_NETAPI_...
Global statistics struct.
int(* send)(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt)
Send a packet over the network interface.
static int gnrc_netif_ipv6_groups_get(const gnrc_netif_t *netif, ipv6_addr_t *groups, size_t max_len)
Gets the IPv6 multicast groups an interface is joined to (if IPv6 is supported)
gnrc_netif_6lo_t sixlo
6Lo component
gnrc_netif_lorawan_t lorawan
LoRaWAN component.
int(* set)(gnrc_netif_t *netif, const gnrc_netapi_opt_t *opt)
Sets an option from the network interface.
static int gnrc_netif_ipv6_group_leave(const gnrc_netif_t *netif, ipv6_addr_t *group)
Leaves an IPv6 multicast group on an interface (if IPv6 is supported)
gnrc_netif_mac_t mac
Common MAC module component
Messaging Bus API for inter process message broadcast.
@ NETOPT_IPV6_ADDR_REMOVE
(ipv6_addr_t) Removes an IPv6 address from an interface
@ GNRC_IPV6_EVENT_ADDR_VALID
Address becomes valid.
size_t netif_addr_from_str(const char *str, uint8_t *out)
Parses a string of colon-separated hexadecimals to a hardware address.
#define assert(cond)
abort the program if assertion is false
Data type to represent an IPv6 address.
gnrc_netif_dedup_t last_pkt
Last received packet information.
Data structure to be send for setting (GNRC_NETAPI_MSG_TYPE_SET) and getting (GNRC_NETAPI_MSG_TYPE_GE...
Definitions for IPv6 addresses.
Definition of global configuration options.
static int gnrc_netif_ipv6_addr_add(const gnrc_netif_t *netif, ipv6_addr_t *addr, unsigned pfx_len, uint8_t flags)
Adds an (unicast or anycast) IPv6 address to an interface (if IPv6 is supported)
int gnrc_netif_set_from_netdev(gnrc_netif_t *netif, const gnrc_netapi_opt_t *opt)
Default operation for gnrc_netif_ops_t::set()
@ NETOPT_IPV6_GROUP
(ipv6_addr_t) get IPv6 multicast groups of an interface as array of ipv6_addr_t or join an IPv6 multi...
int gnrc_netif_get_from_netdev(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt)
Default operation for gnrc_netif_ops_t::get()
static int gnrc_netif_ipv6_addr_remove(const gnrc_netif_t *netif, ipv6_addr_t *addr)
Removes a (unicast or anycast) IPv6 address from an interface (if IPv6 is supported)
event_t event_isr
ISR event for the network device.
static msg_bus_t * gnrc_netif_get_bus(gnrc_netif_t *netif, gnrc_netif_bus_t type)
Get a message bus of a given gnrc_netif_t interface.
static int gnrc_netapi_send(kernel_pid_t pid, gnrc_pktsnip_t *pkt)
Shortcut function for sending GNRC_NETAPI_MSG_TYPE_SND messages.
static char * gnrc_netif_addr_to_str(const uint8_t *addr, size_t addr_len, char *out)
Converts a hardware address to a human readable string.
Messaging API for inter process communication.
LoRaWAN adaption for Network interface API.
uint8_t cur_hl
Current hop-limit for out-going packets.
Scheduler API definition.
static int gnrc_netapi_set(kernel_pid_t pid, netopt_t opt, uint16_t context, const void *data, size_t data_len)
Shortcut function for sending GNRC_NETAPI_MSG_TYPE_SET messages and parsing the returned GNRC_NETAPI_...
Send queue for Network interface API type definitions
#define GNRC_NETIF_L2ADDR_MAXLEN
Maximum length of the link-layer address.
IPv6 component for gnrc_netif_t.
static bool gnrc_netif_highlander(void)
Check if there can only be one gnrc_netif_t interface.
Structure to store information on the last broadcast packet received.
Common MAC module definitions for Network interface API
uint32_t flags
Flags for the interface.
@ NETOPT_IPV6_ADDR
(ipv6_addr_t[]) get IPv6 addresses of an interface as array of ipv6_addr_t or add an IPv6 address as ...
Common network interface API definitions.
int gnrc_netif_create(gnrc_netif_t *netif, char *stack, int stacksize, char priority, const char *name, netdev_t *dev, const gnrc_netif_ops_t *ops)
Creates a network interface.
static int gnrc_netif_send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt)
Send a GNRC packet via a given gnrc_netif_t interface.
Configuration macros for Network interface API.
IPv6 definitions for Network interface API.
gnrc_netif_ipv6_t ipv6
IPv6 component.
Representation of a network interface.
Definitions low-level network driver interface.
GNRC LoRaWAN interface descriptor.
static size_t gnrc_netif_addr_from_str(const char *str, uint8_t *out)
Parses a string of colon-separated hexadecimals to a hardware address.
General definitions for network packets and their helper functions.
gnrc_netif_bus_t
Per-Interface Event Message Buses.
kernel_pid_t pid
PID of the network interface's thread.
void gnrc_netif_init_devs(void)
Initialize all available network interfaces.
IPv6 neighbor discovery message type definitions.
int(* get)(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt)
Gets an option from the network interface.
void(* init)(gnrc_netif_t *netif)
Initializes network interface beyond the default settings.
Structure to hold driver state.
rmutex_t mutex
Mutex of the interface.
gnrc_netif_t * gnrc_netif_get_by_pid(kernel_pid_t pid)
Get network interface by PID.
Recursive Mutex for thread synchronization.
A message bus is just a list of subscribers.
void gnrc_netif_default_init(gnrc_netif_t *netif)
Default operation for gnrc_netif_ops_t::init()
netdev_t * dev
Network device of the network interface.
6Lo component of gnrc_netif_t
#define IS_USED(module)
Checks whether a module is being used or not. Can be used in C conditionals.
@ NETOPT_IPV6_GROUP_LEAVE
(ipv6_addr_t) Leave an IPv6 multicast group on an interface
event_queue_t evq
Event queue for asynchronous events.
gnrc_netif_pktq_t send_queue
Packet queue for sending.
static int gnrc_netif_ipv6_group_join(const gnrc_netif_t *netif, ipv6_addr_t *group)
Joins an IPv6 multicast group on an interface (if IPv6 is supported)
uint8_t device_type
Device type.
Describes a message object which can be sent between threads.
A packet queue for Network interface API with a de-queue timer.
@ GNRC_NETIF_BUS_IPV6
provides gnrc_ipv6_event_t messages to subscribers
gnrc_netif_t * gnrc_netif_iter(const gnrc_netif_t *prev)
Iterate over all network interfaces.
Flag definitions for Network interface API.
Definition of net statistics.
netif_t netif
network interface descriptor
unsigned gnrc_netif_numof(void)
Get number of network interfaces actually allocated.
void(* msg_handler)(gnrc_netif_t *netif, msg_t *msg)
Message handler for network interface.
uint8_t l2addr_len
Length in bytes of gnrc_netif_t::l2addr.
static int gnrc_netif_ipv6_addrs_get(const gnrc_netif_t *netif, ipv6_addr_t *addrs, size_t max_len)
Gets the (unicast on anycast) IPv6 address of an interface (if IPv6 is supported)
const gnrc_netif_ops_t * ops
Operations of the network interface.
6LoWPAN definitions for Network interface API
Type to represent parts (either headers or payload) of a packet, called snips.
char * netif_addr_to_str(const uint8_t *addr, size_t addr_len, char *out)
Converts a hardware address to a human readable string.
msg_bus_t bus[GNRC_NETIF_BUS_NUMOF]
Event Message Bus.
Common MAC module component of gnrc_netif_mac_t