Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
This file implements a RFC7668 implementation for 6LoWPAN over Bluetooth Low Energy. More...
Functions | |
void | ble_addr_to_eui64 (uint8_t *dst, const uint8_t *src, int public_addr) |
convert BT address to EUI64 addr | |
void | eui64_to_ble_addr (uint8_t *dst, const uint8_t *src) |
convert EUI64 address to Bluetooth MAC addr | |
err_t | rfc7668_set_context (u8_t idx, const ip6_addr_t *context) |
Set context id IPv6 address. | |
err_t | rfc7668_output (struct netif *netif, struct pbuf *q, const ip6_addr_t *ip6addr) |
Compress outgoing IPv6 packet and pass it on to netif->linkoutput. | |
err_t | rfc7668_input (struct pbuf *p, struct netif *netif) |
Process a received raw payload from an L2CAP channel. | |
err_t | rfc7668_if_init (struct netif *netif) |
Initialize the netif. |
Detailed Description
This file implements a RFC7668 implementation for 6LoWPAN over Bluetooth Low Energy.
The specification is very similar to 6LoWPAN, so most of the code is re-used. Compared to 6LoWPAN, much functionality is already implemented in lower BLE layers (fragmenting, session management,...).
Usage:
- add this netif
- don't add IPv4 addresses (no IPv4 support in RFC7668), pass 'NULL','NULL','NULL'
- use the BLE to EUI64 conversation util to create an IPv6 link-local address from the BLE MAC (ble_addr_to_eui64)
- input function: rfc7668_input
- set the link output function, which transmits output data to an established L2CAP channel
- If data arrives (HCI event "L2CAP_DATA_PACKET"):
- allocate a PBUF_RAW buffer
- let the pbuf struct point to the incoming data or copy it to the buffer
- call netif->input
Function Documentation
void ble_addr_to_eui64 | ( | uint8_t * | dst, |
const uint8_t * | src, | ||
int | public_addr | ||
) |
convert BT address to EUI64 addr
This method converts a Bluetooth MAC address to an EUI64 address, which is used within IPv6 communication
- Parameters:
-
dst IPv6 destination space src BLE MAC address source public_addr If the LWIP_RFC7668_LINUX_WORKAROUND_PUBLIC_ADDRESS option is set, bit 0x02 will be set if param=0 (no public addr); cleared otherwise
- See also:
- LWIP_RFC7668_LINUX_WORKAROUND_PUBLIC_ADDRESS
Definition at line 110 of file lwip_lowpan6_ble.c.
void eui64_to_ble_addr | ( | uint8_t * | dst, |
const uint8_t * | src | ||
) |
convert EUI64 address to Bluetooth MAC addr
This method converts an EUI64 address to a Bluetooth MAC address,
- Parameters:
-
dst BLE MAC address destination src IPv6 source
Definition at line 139 of file lwip_lowpan6_ble.c.
Initialize the netif.
No flags are used (broadcast not possible, not ethernet, ...) The shortname for this netif is "BT"
- Parameters:
-
netif the network interface to be initialized as RFC7668 netif
- Returns:
- ERR_OK if everything went fine
Definition at line 410 of file lwip_lowpan6_ble.c.
Process a received raw payload from an L2CAP channel.
- Parameters:
-
p the received packet, p->payload pointing to the IPv6 header (maybe compressed) netif the network interface on which the packet was received
- Returns:
- ERR_OK if everything was fine
Definition at line 347 of file lwip_lowpan6_ble.c.
err_t rfc7668_output | ( | struct netif * | netif, |
struct pbuf * | q, | ||
const ip6_addr_t * | ip6addr | ||
) |
Compress outgoing IPv6 packet and pass it on to netif->linkoutput.
- Parameters:
-
netif The lwIP network interface which the IP packet will be sent on. q The pbuf(s) containing the IP packet to be sent. ip6addr The IP address of the packet destination.
- Returns:
- See rfc7668_compress
Definition at line 328 of file lwip_lowpan6_ble.c.
err_t rfc7668_set_context | ( | u8_t | idx, |
const ip6_addr_t * | context | ||
) |
Set context id IPv6 address.
Store one IPv6 address to a given context id.
- Parameters:
-
idx Context id context IPv6 addr for this context
- Returns:
- ERR_OK (if everything is fine), ERR_ARG (if the context id is out of range), ERR_VAL (if contexts disabled)
Definition at line 300 of file lwip_lowpan6_ble.c.
Generated on Tue Jul 12 2022 13:55:24 by
