1 /**
2  * @file
3  *
4  * A netif implementing the ZigBee Eencapsulation Protocol (ZEP).
5  * This is used to tunnel 6LowPAN over UDP.
6  */
7 
8 /*
9  * Copyright (c) 2018 Simon Goldschmidt
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  * This file is part of the lwIP TCP/IP stack.
35  *
36  * Author: Simon Goldschmidt <goldsimon@gmx.de>
37  *
38  */
39 
40 #ifndef LWIP_HDR_ZEPIF_H
41 #define LWIP_HDR_ZEPIF_H
42 
43 #include "lwip/opt.h"
44 #include "netif/lowpan6.h"
45 
46 #if LWIP_IPV6 && LWIP_UDP /* don't build if not configured for use in lwipopts.h */
47 
48 #include "lwip/netif.h"
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 #define ZEPIF_DEFAULT_UDP_PORT  17754
55 
56 /** Pass this struct as 'state' to netif_add to control the behaviour
57  * of this netif. If NULL is passed, default behaviour is chosen */
58 struct zepif_init {
59   /** The UDP port used to ZEP frames from (0 = default) */
60   u16_t               zep_src_udp_port;
61   /** The UDP port used to ZEP frames to (0 = default) */
62   u16_t               zep_dst_udp_port;
63   /** The IP address to sed ZEP frames from (NULL = ANY) */
64   const ip_addr_t    *zep_src_ip_addr;
65   /** The IP address to sed ZEP frames to (NULL = BROADCAST) */
66   const ip_addr_t    *zep_dst_ip_addr;
67   /** If != NULL, the udp pcb is bound to this netif */
68   const struct netif *zep_netif;
69   /** MAC address of the 6LowPAN device */
70   u8_t                addr[6];
71 };
72 
73 err_t zepif_init(struct netif *netif);
74 
75 #ifdef __cplusplus
76 }
77 #endif
78 
79 #endif /* LWIP_IPV6 && LWIP_UDP */
80 
81 #endif /* LWIP_HDR_ZEPIF_H */
82