1*d6eebaa4SHervé Poussineau /** 2*d6eebaa4SHervé Poussineau * @file 3*d6eebaa4SHervé Poussineau * 4*d6eebaa4SHervé Poussineau * A netif implementing the ZigBee Eencapsulation Protocol (ZEP). 5*d6eebaa4SHervé Poussineau * This is used to tunnel 6LowPAN over UDP. 6*d6eebaa4SHervé Poussineau */ 7*d6eebaa4SHervé Poussineau 8*d6eebaa4SHervé Poussineau /* 9*d6eebaa4SHervé Poussineau * Copyright (c) 2018 Simon Goldschmidt 10*d6eebaa4SHervé Poussineau * All rights reserved. 11*d6eebaa4SHervé Poussineau * 12*d6eebaa4SHervé Poussineau * Redistribution and use in source and binary forms, with or without modification, 13*d6eebaa4SHervé Poussineau * are permitted provided that the following conditions are met: 14*d6eebaa4SHervé Poussineau * 15*d6eebaa4SHervé Poussineau * 1. Redistributions of source code must retain the above copyright notice, 16*d6eebaa4SHervé Poussineau * this list of conditions and the following disclaimer. 17*d6eebaa4SHervé Poussineau * 2. Redistributions in binary form must reproduce the above copyright notice, 18*d6eebaa4SHervé Poussineau * this list of conditions and the following disclaimer in the documentation 19*d6eebaa4SHervé Poussineau * and/or other materials provided with the distribution. 20*d6eebaa4SHervé Poussineau * 3. The name of the author may not be used to endorse or promote products 21*d6eebaa4SHervé Poussineau * derived from this software without specific prior written permission. 22*d6eebaa4SHervé Poussineau * 23*d6eebaa4SHervé Poussineau * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 24*d6eebaa4SHervé Poussineau * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25*d6eebaa4SHervé Poussineau * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 26*d6eebaa4SHervé Poussineau * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27*d6eebaa4SHervé Poussineau * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 28*d6eebaa4SHervé Poussineau * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29*d6eebaa4SHervé Poussineau * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30*d6eebaa4SHervé Poussineau * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 31*d6eebaa4SHervé Poussineau * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32*d6eebaa4SHervé Poussineau * OF SUCH DAMAGE. 33*d6eebaa4SHervé Poussineau * 34*d6eebaa4SHervé Poussineau * This file is part of the lwIP TCP/IP stack. 35*d6eebaa4SHervé Poussineau * 36*d6eebaa4SHervé Poussineau * Author: Simon Goldschmidt <goldsimon@gmx.de> 37*d6eebaa4SHervé Poussineau * 38*d6eebaa4SHervé Poussineau */ 39*d6eebaa4SHervé Poussineau 40*d6eebaa4SHervé Poussineau #ifndef LWIP_HDR_ZEPIF_H 41*d6eebaa4SHervé Poussineau #define LWIP_HDR_ZEPIF_H 42*d6eebaa4SHervé Poussineau 43*d6eebaa4SHervé Poussineau #include "lwip/opt.h" 44*d6eebaa4SHervé Poussineau #include "netif/lowpan6.h" 45*d6eebaa4SHervé Poussineau 46*d6eebaa4SHervé Poussineau #if LWIP_IPV6 && LWIP_UDP /* don't build if not configured for use in lwipopts.h */ 47*d6eebaa4SHervé Poussineau 48*d6eebaa4SHervé Poussineau #include "lwip/netif.h" 49*d6eebaa4SHervé Poussineau 50*d6eebaa4SHervé Poussineau #ifdef __cplusplus 51*d6eebaa4SHervé Poussineau extern "C" { 52*d6eebaa4SHervé Poussineau #endif 53*d6eebaa4SHervé Poussineau 54*d6eebaa4SHervé Poussineau #define ZEPIF_DEFAULT_UDP_PORT 17754 55*d6eebaa4SHervé Poussineau 56*d6eebaa4SHervé Poussineau /** Pass this struct as 'state' to netif_add to control the behaviour 57*d6eebaa4SHervé Poussineau * of this netif. If NULL is passed, default behaviour is chosen */ 58*d6eebaa4SHervé Poussineau struct zepif_init { 59*d6eebaa4SHervé Poussineau /** The UDP port used to ZEP frames from (0 = default) */ 60*d6eebaa4SHervé Poussineau u16_t zep_src_udp_port; 61*d6eebaa4SHervé Poussineau /** The UDP port used to ZEP frames to (0 = default) */ 62*d6eebaa4SHervé Poussineau u16_t zep_dst_udp_port; 63*d6eebaa4SHervé Poussineau /** The IP address to sed ZEP frames from (NULL = ANY) */ 64*d6eebaa4SHervé Poussineau const ip_addr_t *zep_src_ip_addr; 65*d6eebaa4SHervé Poussineau /** The IP address to sed ZEP frames to (NULL = BROADCAST) */ 66*d6eebaa4SHervé Poussineau const ip_addr_t *zep_dst_ip_addr; 67*d6eebaa4SHervé Poussineau /** If != NULL, the udp pcb is bound to this netif */ 68*d6eebaa4SHervé Poussineau const struct netif *zep_netif; 69*d6eebaa4SHervé Poussineau /** MAC address of the 6LowPAN device */ 70*d6eebaa4SHervé Poussineau u8_t addr[6]; 71*d6eebaa4SHervé Poussineau }; 72*d6eebaa4SHervé Poussineau 73*d6eebaa4SHervé Poussineau err_t zepif_init(struct netif *netif); 74*d6eebaa4SHervé Poussineau 75*d6eebaa4SHervé Poussineau #ifdef __cplusplus 76*d6eebaa4SHervé Poussineau } 77*d6eebaa4SHervé Poussineau #endif 78*d6eebaa4SHervé Poussineau 79*d6eebaa4SHervé Poussineau #endif /* LWIP_IPV6 && LWIP_UDP */ 80*d6eebaa4SHervé Poussineau 81*d6eebaa4SHervé Poussineau #endif /* LWIP_HDR_ZEPIF_H */ 82