l2util.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Freie Universität Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
25 #ifndef NET_L2UTIL_H
26 #define NET_L2UTIL_H
27 
28 #include <stdint.h>
29 
30 #include "net/eui64.h"
31 #include "net/ndp.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #define L2UTIL_ADDR_MAX_LEN (8U)
57 int l2util_eui64_from_addr(int dev_type, const uint8_t *addr, size_t addr_len,
58  eui64_t *eui64);
59 
78 int l2util_ipv6_iid_from_addr(int dev_type,
79  const uint8_t *addr, size_t addr_len,
80  eui64_t *iid);
81 
106 int l2util_ipv6_iid_to_addr(int dev_type, const eui64_t *iid, uint8_t *addr);
107 
133 int l2util_ndp_addr_len_from_l2ao(int dev_type,
134  const ndp_opt_t *opt);
135 
136 
152 int l2util_ipv6_group_to_l2_group(int dev_type,
153  const ipv6_addr_t *ipv6_group,
154  uint8_t *l2_group);
155 
156 #ifdef __cplusplus
157 }
158 #endif
159 
160 #endif /* NET_L2UTIL_H */
161 
ipv6_addr_t
Data type to represent an IPv6 address.
Definition: addr.h:74
l2util_ndp_addr_len_from_l2ao
int l2util_ndp_addr_len_from_l2ao(int dev_type, const ndp_opt_t *opt)
Derives the length of the link-layer address in an NDP link-layer address option from that option's l...
l2util_ipv6_group_to_l2_group
int l2util_ipv6_group_to_l2_group(int dev_type, const ipv6_addr_t *ipv6_group, uint8_t *l2_group)
Converts an IPv6 multicast address to a multicast address of the respective link layer.
ndp.h
IPv6 neighbor discovery message type definitions.
l2util_ipv6_iid_from_addr
int l2util_ipv6_iid_from_addr(int dev_type, const uint8_t *addr, size_t addr_len, eui64_t *iid)
Converts a given hardware address to an IPv6 IID.
eui64_t
Data type to represent an EUI-64.
Definition: eui64.h:55
eui64.h
EUI-64 data type definition.
ndp_opt_t
General NDP option format.
Definition: ndp.h:286
l2util_ipv6_iid_to_addr
int l2util_ipv6_iid_to_addr(int dev_type, const eui64_t *iid, uint8_t *addr)
Converts an IPv6 IID to a hardware address.