Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
 4.1.99
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Network Link Address Library

Network link address library . More...

Data Structures

struct  net_linkaddr
 Hardware link address structure. More...
 

Macros

#define NET_LINK_ADDR_MAX_LENGTH   6
 Maximum length of the link address.
 

Enumerations

enum  net_link_type {
  NET_LINK_UNKNOWN = 0 , NET_LINK_IEEE802154 , NET_LINK_BLUETOOTH , NET_LINK_ETHERNET ,
  NET_LINK_DUMMY , NET_LINK_CANBUS_RAW
}
 Type of the link address. More...
 

Functions

static bool net_linkaddr_cmp (struct net_linkaddr *lladdr1, struct net_linkaddr *lladdr2)
 Compare two link layer addresses.
 
static int net_linkaddr_set (struct net_linkaddr *lladdr, const uint8_t *new_addr, uint8_t new_len)
 Set the member data of a link layer address storage structure.
 
static int net_linkaddr_copy (struct net_linkaddr *dst, const struct net_linkaddr *src)
 Copy link address from one variable to another.
 
static int net_linkaddr_create (struct net_linkaddr *lladdr, const uint8_t *addr, uint8_t len, enum net_link_type type)
 Create a link address structure.
 
static int net_linkaddr_clear (struct net_linkaddr *lladdr)
 Clear link address.
 

Detailed Description

Network link address library .

Since
1.0
Version
1.0.0

Macro Definition Documentation

◆ NET_LINK_ADDR_MAX_LENGTH

#define NET_LINK_ADDR_MAX_LENGTH   6

#include <zephyr/net/net_linkaddr.h>

Maximum length of the link address.

Enumeration Type Documentation

◆ net_link_type

#include <zephyr/net/net_linkaddr.h>

Type of the link address.

This indicates the network technology that this address is used in. Note that in order to save space we store the value into a uint8_t variable, so please do not introduce any values > 255 in this enum.

Enumerator
NET_LINK_UNKNOWN 

Unknown link address type.

NET_LINK_IEEE802154 

IEEE 802.15.4 link address.

NET_LINK_BLUETOOTH 

Bluetooth IPSP link address.

NET_LINK_ETHERNET 

Ethernet link address.

NET_LINK_DUMMY 

Dummy link address.

Used in testing apps and loopback support.

NET_LINK_CANBUS_RAW 

CANBUS link address.

Function Documentation

◆ net_linkaddr_clear()

static int net_linkaddr_clear ( struct net_linkaddr * lladdr)
inlinestatic

#include <zephyr/net/net_linkaddr.h>

Clear link address.

Parameters
lladdrThe link address structure.
Returns
0 if ok, <0 if error

◆ net_linkaddr_cmp()

static bool net_linkaddr_cmp ( struct net_linkaddr * lladdr1,
struct net_linkaddr * lladdr2 )
inlinestatic

#include <zephyr/net/net_linkaddr.h>

Compare two link layer addresses.

Parameters
lladdr1Pointer to a link layer address
lladdr2Pointer to a link layer address
Returns
True if the addresses are the same, false otherwise.

◆ net_linkaddr_copy()

static int net_linkaddr_copy ( struct net_linkaddr * dst,
const struct net_linkaddr * src )
inlinestatic

#include <zephyr/net/net_linkaddr.h>

Copy link address from one variable to another.

Parameters
dstThe link address structure destination.
srcThe link address structure to source.
Returns
0 if ok, <0 if error

◆ net_linkaddr_create()

static int net_linkaddr_create ( struct net_linkaddr * lladdr,
const uint8_t * addr,
uint8_t len,
enum net_link_type type )
inlinestatic

#include <zephyr/net/net_linkaddr.h>

Create a link address structure.

Parameters
lladdrThe link address structure to change.
addrArray of bytes containing the link address. If set to NULL, the address will be cleared.
lenLength of the link address array.
typeType of the link address.
Returns
0 if ok, <0 if error

◆ net_linkaddr_set()

static int net_linkaddr_set ( struct net_linkaddr * lladdr,
const uint8_t * new_addr,
uint8_t new_len )
inlinestatic

#include <zephyr/net/net_linkaddr.h>

Set the member data of a link layer address storage structure.

Parameters
lladdrThe link address storage structure to change.
new_addrArray of bytes containing the link address.
new_lenLength of the link address array. This value should always be <= NET_LINK_ADDR_MAX_LENGTH.
Returns
0 if ok, <0 if error