1 /** 2 * @file 3 * 6LowPAN over BLE for IPv6 (RFC7668). 4 */ 5 6 /* 7 * Copyright (c) 2017 Benjamin Aigner 8 * Copyright (c) 2015 Inico Technologies Ltd. , Author: Ivan Delamer <delamer@inicotech.com> 9 * 10 * All rights reserved. 11 * 12 * Redistribution and use in source and binary forms, with or without modification, 13 * are permitted provided that the following conditions are met: 14 * 15 * 1. Redistributions of source code must retain the above copyright notice, 16 * this list of conditions and the following disclaimer. 17 * 2. Redistributions in binary form must reproduce the above copyright notice, 18 * this list of conditions and the following disclaimer in the documentation 19 * and/or other materials provided with the distribution. 20 * 3. The name of the author may not be used to endorse or promote products 21 * derived from this software without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 24 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 26 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 28 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 31 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 * OF SUCH DAMAGE. 33 * 34 * Author: Benjamin Aigner <aignerb@technikum-wien.at> 35 * 36 * Based on the original 6lowpan implementation of lwIP ( @see 6lowpan.c) 37 */ 38 39 #ifndef LWIP_HDR_LOWPAN6_BLE_H 40 #define LWIP_HDR_LOWPAN6_BLE_H 41 42 #include "netif/lowpan6_opts.h" 43 44 #if LWIP_IPV6 /* don't build if not configured for use in lwipopts.h */ 45 46 #include "netif/lowpan6_common.h" 47 #include "lwip/pbuf.h" 48 #include "lwip/ip.h" 49 #include "lwip/ip_addr.h" 50 #include "lwip/netif.h" 51 52 #ifdef __cplusplus 53 extern "C" { 54 #endif 55 56 err_t rfc7668_output(struct netif *netif, struct pbuf *q, const ip6_addr_t *ip6addr); 57 err_t rfc7668_input(struct pbuf * p, struct netif *netif); 58 err_t rfc7668_set_local_addr_eui64(struct netif *netif, const u8_t *local_addr, size_t local_addr_len); 59 err_t rfc7668_set_local_addr_mac48(struct netif *netif, const u8_t *local_addr, size_t local_addr_len, int is_public_addr); 60 err_t rfc7668_set_peer_addr_eui64(struct netif *netif, const u8_t *peer_addr, size_t peer_addr_len); 61 err_t rfc7668_set_peer_addr_mac48(struct netif *netif, const u8_t *peer_addr, size_t peer_addr_len, int is_public_addr); 62 err_t rfc7668_set_context(u8_t index, const ip6_addr_t * context); 63 err_t rfc7668_if_init(struct netif *netif); 64 65 #if !NO_SYS 66 err_t tcpip_rfc7668_input(struct pbuf *p, struct netif *inp); 67 #endif 68 69 void ble_addr_to_eui64(uint8_t *dst, const uint8_t *src, int public_addr); 70 void eui64_to_ble_addr(uint8_t *dst, const uint8_t *src); 71 72 #ifdef __cplusplus 73 } 74 #endif 75 76 #endif /* LWIP_IPV6 */ 77 78 #endif /* LWIP_HDR_LOWPAN6_BLE_H */ 79