IDF release/v4.0 08219f3cf

This commit is contained in:
me-no-dev
2020-01-25 14:51:58 +00:00
parent 8c723be135
commit 41ba143063
858 changed files with 37940 additions and 49396 deletions

View File

@ -0,0 +1,127 @@
/**
* @file
* lwIP netif implementing an IEEE 802.1D MAC Bridge
*/
/*
* Copyright (c) 2017 Simon Goldschmidt.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
* Author: Simon Goldschmidt <goldsimon@gmx.de>
*
*/
#ifndef LWIP_HDR_NETIF_BRIDGEIF_H
#define LWIP_HDR_NETIF_BRIDGEIF_H
#include "netif/bridgeif_opts.h"
#include "lwip/err.h"
#include "lwip/prot/ethernet.h"
#ifdef __cplusplus
extern "C" {
#endif
struct netif;
#if (BRIDGEIF_MAX_PORTS < 0) || (BRIDGEIF_MAX_PORTS >= 64)
#error BRIDGEIF_MAX_PORTS must be [1..63]
#elif BRIDGEIF_MAX_PORTS < 8
typedef u8_t bridgeif_portmask_t;
#elif BRIDGEIF_MAX_PORTS < 16
typedef u16_t bridgeif_portmask_t;
#elif BRIDGEIF_MAX_PORTS < 32
typedef u32_t bridgeif_portmask_t;
#elif BRIDGEIF_MAX_PORTS < 64
typedef u64_t bridgeif_portmask_t;
#endif
#define BR_FLOOD ((bridgeif_portmask_t)-1)
/** @ingroup bridgeif
* Initialisation data for @ref bridgeif_init.
* An instance of this type must be passed as parameter 'state' to @ref netif_add
* when the bridge is added.
*/
typedef struct bridgeif_initdata_s {
/** MAC address of the bridge (cannot use the netif's addresses) */
struct eth_addr ethaddr;
/** Maximum number of ports in the bridge (ports are stored in an array, this
influences memory allocated for netif->state of the bridge netif). */
u8_t max_ports;
/** Maximum number of dynamic/learning entries in the bridge's forwarding database.
In the default implementation, this controls memory consumption only. */
u16_t max_fdb_dynamic_entries;
/** Maximum number of static forwarding entries. Influences memory consumption! */
u16_t max_fdb_static_entries;
} bridgeif_initdata_t;
/** @ingroup bridgeif
* Use this for constant initialization of a bridgeif_initdat_t
* (ethaddr must be passed as ETH_ADDR())
*/
#define BRIDGEIF_INITDATA1(max_ports, max_fdb_dynamic_entries, max_fdb_static_entries, ethaddr) {ethaddr, max_ports, max_fdb_dynamic_entries, max_fdb_static_entries}
/** @ingroup bridgeif
* Use this for constant initialization of a bridgeif_initdat_t
* (each byte of ethaddr must be passed)
*/
#define BRIDGEIF_INITDATA2(max_ports, max_fdb_dynamic_entries, max_fdb_static_entries, e0, e1, e2, e3, e4, e5) {{e0, e1, e2, e3, e4, e5}, max_ports, max_fdb_dynamic_entries, max_fdb_static_entries}
err_t bridgeif_init(struct netif *netif);
err_t bridgeif_add_port(struct netif *bridgeif, struct netif *portif);
err_t bridgeif_fdb_add(struct netif *bridgeif, const struct eth_addr *addr, bridgeif_portmask_t ports);
err_t bridgeif_fdb_remove(struct netif *bridgeif, const struct eth_addr *addr);
/* FDB interface, can be replaced by own implementation */
void bridgeif_fdb_update_src(void *fdb_ptr, struct eth_addr *src_addr, u8_t port_idx);
bridgeif_portmask_t bridgeif_fdb_get_dst_ports(void *fdb_ptr, struct eth_addr *dst_addr);
void* bridgeif_fdb_init(u16_t max_fdb_entries);
#if BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT
#ifndef BRIDGEIF_DECL_PROTECT
/* define bridgeif protection to sys_arch_protect... */
#include "lwip/sys.h"
#define BRIDGEIF_DECL_PROTECT(lev) SYS_ARCH_DECL_PROTECT(lev)
#define BRIDGEIF_READ_PROTECT(lev) SYS_ARCH_PROTECT(lev)
#define BRIDGEIF_READ_UNPROTECT(lev) SYS_ARCH_UNPROTECT(lev)
#define BRIDGEIF_WRITE_PROTECT(lev)
#define BRIDGEIF_WRITE_UNPROTECT(lev)
#endif
#else /* BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT */
#include "lwip/tcpip.h"
#define BRIDGEIF_DECL_PROTECT(lev)
#define BRIDGEIF_READ_PROTECT(lev)
#define BRIDGEIF_READ_UNPROTECT(lev)
#define BRIDGEIF_WRITE_PROTECT(lev)
#define BRIDGEIF_WRITE_UNPROTECT(lev)
#endif /* BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT */
#ifdef __cplusplus
}
#endif
#endif /* LWIP_HDR_NETIF_BRIDGEIF_H */

View File

@ -0,0 +1,90 @@
/**
* @file
* lwIP netif implementing an IEEE 802.1D MAC Bridge
*/
/*
* Copyright (c) 2017 Simon Goldschmidt.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
* Author: Simon Goldschmidt <goldsimon@gmx.de>
*
*/
#ifndef LWIP_HDR_NETIF_BRIDGEIF_OPTS_H
#define LWIP_HDR_NETIF_BRIDGEIF_OPTS_H
#include "lwip/opt.h"
/**
* @defgroup bridgeif_opts Options
* @ingroup bridgeif
* @{
*/
/** BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT==1: set port netif's 'input' function
* to call directly into bridgeif code and on top of that, directly call into
* the selected forwarding port's 'linkoutput' function.
* This means that the bridgeif input/output path is protected from concurrent access
* but as well, *all* bridge port netif's drivers must correctly handle concurrent access!
* == 0: get into tcpip_thread for every input packet (no multithreading)
* ATTENTION: as ==0 relies on tcpip.h, the default depends on NO_SYS setting
*/
#ifndef BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT
#define BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT NO_SYS
#endif
/** BRIDGEIF_MAX_PORTS: this is used to create a typedef used for forwarding
* bit-fields: the number of bits required is this + 1 (for the internal/cpu port)
* (63 is the maximum, resulting in an u64_t for the bit mask)
* ATTENTION: this controls the maximum number of the implementation only!
* The max. number of ports per bridge must still be passed via netif_add parameter!
*/
#ifndef BRIDGEIF_MAX_PORTS
#define BRIDGEIF_MAX_PORTS 7
#endif
/** BRIDGEIF_DEBUG: Enable generic debugging in bridgeif.c. */
#ifndef BRIDGEIF_DEBUG
#define BRIDGEIF_DEBUG LWIP_DBG_OFF
#endif
/** BRIDGEIF_DEBUG: Enable FDB debugging in bridgeif.c. */
#ifndef BRIDGEIF_FDB_DEBUG
#define BRIDGEIF_FDB_DEBUG LWIP_DBG_OFF
#endif
/** BRIDGEIF_DEBUG: Enable forwarding debugging in bridgeif.c. */
#ifndef BRIDGEIF_FW_DEBUG
#define BRIDGEIF_FW_DEBUG LWIP_DBG_OFF
#endif
/**
* @}
*/
#endif /* LWIP_HDR_NETIF_BRIDGEIF_OPTS_H */

View File

@ -0,0 +1,112 @@
/**
* @file
* Definitions for IEEE 802.15.4 MAC frames
*/
/*
* Copyright (c) 2018 Simon Goldschmidt.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
* Author: Simon Goldschmidt <goldsimon@gmx.de>
*
*/
#ifndef LWIP_HDR_NETIF_IEEE802154_H
#define LWIP_HDR_NETIF_IEEE802154_H
#include "lwip/opt.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef PACK_STRUCT_USE_INCLUDES
# include "arch/bpstruct.h"
#endif
PACK_STRUCT_BEGIN
/** General MAC frame format
* This shows the full featured header, mainly for documentation.
* Some fields are omitted or shortened to achieve frame compression.
*/
struct ieee_802154_hdr {
/** See IEEE_802154_FC_* defines */
PACK_STRUCT_FIELD(u16_t frame_control);
/** Sequence number is omitted if IEEE_802154_FC_SEQNO_SUPPR is set in frame_control */
PACK_STRUCT_FLD_8(u8_t sequence_number);
/** Destination PAN ID is omitted if Destination Addressing Mode is 0 */
PACK_STRUCT_FIELD(u16_t destination_pan_id);
/** Destination Address is omitted if Destination Addressing Mode is 0 */
PACK_STRUCT_FLD_8(u8_t destination_address[8]);
/** Source PAN ID is omitted if Source Addressing Mode is 0
or if IEEE_802154_FC_PANID_COMPR is set in frame control*/
PACK_STRUCT_FIELD(u16_t source_pan_id);
/** Source Address is omitted if Source Addressing Mode is 0 */
PACK_STRUCT_FLD_8(u8_t source_address[8]);
/* The rest is variable */
} PACK_STRUCT_STRUCT;
PACK_STRUCT_END
#ifdef PACK_STRUCT_USE_INCLUDES
# include "arch/epstruct.h"
#endif
/* Addressing modes (2 bits) */
#define IEEE_802154_ADDR_MODE_NO_ADDR 0x00 /* PAN ID and address fields are not present */
#define IEEE_802154_ADDR_MODE_RESERVED 0x01 /* Reserved */
#define IEEE_802154_ADDR_MODE_SHORT 0x02 /* Address field contains a short address (16 bit) */
#define IEEE_802154_ADDR_MODE_EXT 0x03 /* Address field contains an extended address (64 bit) */
/* IEEE 802.15.4 Frame Control definitions (2 bytes; see IEEE 802.15.4-2015 ch. 7.2.1) */
#define IEEE_802154_FC_FT_MASK 0x0007 /* bits 0..2: Frame Type */
#define IEEE_802154_FC_FT_BEACON 0x00
#define IEEE_802154_FC_FT_DATA 0x01
#define IEEE_802154_FC_FT_ACK 0x02
#define IEEE_802154_FC_FT_MAC_CMD 0x03
#define IEEE_802154_FC_FT_RESERVED 0x04
#define IEEE_802154_FC_FT_MULTIPURPOSE 0x05
#define IEEE_802154_FC_FT_FRAG 0x06
#define IEEE_802154_FC_FT_EXT 0x07
#define IEEE_802154_FC_SEC_EN 0x0008 /* bit 3: Security Enabled */
#define IEEE_802154_FC_FRAME_PEND 0x0010 /* bit 4: Frame Pending */
#define IEEE_802154_FC_ACK_REQ 0x0020 /* bit 5: AR (ACK required) */
#define IEEE_802154_FC_PANID_COMPR 0x0040 /* bit 6: PAN ID Compression (src and dst are equal, src PAN ID omitted) */
#define IEEE_802154_FC_RESERVED 0x0080
#define IEEE_802154_FC_SEQNO_SUPPR 0x0100 /* bit 8: Sequence Number Suppression */
#define IEEE_802154_FC_IE_PRESENT 0x0200 /* bit 9: IE Present */
#define IEEE_802154_FC_DST_ADDR_MODE_MASK 0x0c00 /* bits 10..11: Destination Addressing Mode */
#define IEEE_802154_FC_DST_ADDR_MODE_NO_ADDR (IEEE_802154_ADDR_MODE_NO_ADDR << 10)
#define IEEE_802154_FC_DST_ADDR_MODE_SHORT (IEEE_802154_ADDR_MODE_SHORT << 10)
#define IEEE_802154_FC_DST_ADDR_MODE_EXT (IEEE_802154_ADDR_MODE_EXT << 10)
#define IEEE_802154_FC_FRAME_VERSION_MASK 0x3000 /* bits 12..13: Frame Version */
#define IEEE_802154_FC_FRAME_VERSION_GET(x) (((x) & IEEE_802154_FC_FRAME_VERSION_MASK) >> 12)
#define IEEE_802154_FC_SRC_ADDR_MODE_MASK 0xc000 /* bits 14..15: Source Addressing Mode */
#define IEEE_802154_FC_SRC_ADDR_MODE_SHORT (IEEE_802154_ADDR_MODE_SHORT << 14)
#define IEEE_802154_FC_SRC_ADDR_MODE_EXT (IEEE_802154_ADDR_MODE_EXT << 14)
#ifdef __cplusplus
}
#endif
#endif /* LWIP_HDR_NETIF_IEEE802154_H */

View File

@ -44,8 +44,9 @@
#include "netif/lowpan6_opts.h"
#if LWIP_IPV6 && LWIP_6LOWPAN /* don't build if not configured for use in lwipopts.h */
#if LWIP_IPV6
#include "netif/lowpan6_common.h"
#include "lwip/pbuf.h"
#include "lwip/ip.h"
#include "lwip/ip_addr.h"
@ -55,12 +56,12 @@
extern "C" {
#endif
/** 1 second period */
/** 1 second period for reassembly */
#define LOWPAN6_TMR_INTERVAL 1000
void lowpan6_tmr(void);
err_t lowpan6_set_context(u8_t index, const ip6_addr_t * context);
err_t lowpan6_set_context(u8_t idx, const ip6_addr_t * context);
err_t lowpan6_set_short_addr(u8_t addr_high, u8_t addr_low);
#if LWIP_IPV4
@ -73,6 +74,8 @@ err_t lowpan6_if_init(struct netif *netif);
/* pan_id in network byte order. */
err_t lowpan6_set_pan_id(u16_t pan_id);
u16_t lowpan6_calc_crc(const void *buf, u16_t len);
#if !NO_SYS
err_t tcpip_6lowpan_input(struct pbuf *p, struct netif *inp);
#endif /* !NO_SYS */
@ -81,6 +84,6 @@ err_t tcpip_6lowpan_input(struct pbuf *p, struct netif *inp);
}
#endif
#endif /* LWIP_IPV6 && LWIP_6LOWPAN */
#endif /* LWIP_IPV6 */
#endif /* LWIP_HDR_LOWPAN6_H */

View File

@ -0,0 +1,78 @@
/**
* @file
* 6LowPAN over BLE for IPv6 (RFC7668).
*/
/*
* Copyright (c) 2017 Benjamin Aigner
* Copyright (c) 2015 Inico Technologies Ltd. , Author: Ivan Delamer <delamer@inicotech.com>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* Author: Benjamin Aigner <aignerb@technikum-wien.at>
*
* Based on the original 6lowpan implementation of lwIP ( @see 6lowpan.c)
*/
#ifndef LWIP_HDR_LOWPAN6_BLE_H
#define LWIP_HDR_LOWPAN6_BLE_H
#include "netif/lowpan6_opts.h"
#if LWIP_IPV6 /* don't build if not configured for use in lwipopts.h */
#include "netif/lowpan6_common.h"
#include "lwip/pbuf.h"
#include "lwip/ip.h"
#include "lwip/ip_addr.h"
#include "lwip/netif.h"
#ifdef __cplusplus
extern "C" {
#endif
err_t rfc7668_output(struct netif *netif, struct pbuf *q, const ip6_addr_t *ip6addr);
err_t rfc7668_input(struct pbuf * p, struct netif *netif);
err_t rfc7668_set_local_addr_eui64(struct netif *netif, const u8_t *local_addr, size_t local_addr_len);
err_t rfc7668_set_local_addr_mac48(struct netif *netif, const u8_t *local_addr, size_t local_addr_len, int is_public_addr);
err_t rfc7668_set_peer_addr_eui64(struct netif *netif, const u8_t *peer_addr, size_t peer_addr_len);
err_t rfc7668_set_peer_addr_mac48(struct netif *netif, const u8_t *peer_addr, size_t peer_addr_len, int is_public_addr);
err_t rfc7668_set_context(u8_t index, const ip6_addr_t * context);
err_t rfc7668_if_init(struct netif *netif);
#if !NO_SYS
err_t tcpip_rfc7668_input(struct pbuf *p, struct netif *inp);
#endif
void ble_addr_to_eui64(uint8_t *dst, const uint8_t *src, int public_addr);
void eui64_to_ble_addr(uint8_t *dst, const uint8_t *src);
#ifdef __cplusplus
}
#endif
#endif /* LWIP_IPV6 */
#endif /* LWIP_HDR_LOWPAN6_BLE_H */

View File

@ -0,0 +1,82 @@
/**
* @file
*
* Common 6LowPAN routines for IPv6. Uses ND tables for link-layer addressing. Fragments packets to 6LowPAN units.
*/
/*
* Copyright (c) 2015 Inico Technologies Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
* Author: Ivan Delamer <delamer@inicotech.com>
*
*
* Please coordinate changes and requests with Ivan Delamer
* <delamer@inicotech.com>
*/
#ifndef LWIP_HDR_LOWPAN6_COMMON_H
#define LWIP_HDR_LOWPAN6_COMMON_H
#include "netif/lowpan6_opts.h"
#if LWIP_IPV6 /* don't build if IPv6 is disabled in lwipopts.h */
#include "lwip/pbuf.h"
#include "lwip/ip.h"
#include "lwip/ip6_addr.h"
#include "lwip/netif.h"
#ifdef __cplusplus
extern "C" {
#endif
/** Helper define for a link layer address, which can be encoded as 0, 2 or 8 bytes */
struct lowpan6_link_addr {
/* encoded length of the address */
u8_t addr_len;
/* address bytes */
u8_t addr[8];
};
s8_t lowpan6_get_address_mode(const ip6_addr_t *ip6addr, const struct lowpan6_link_addr *mac_addr);
#if LWIP_6LOWPAN_IPHC
err_t lowpan6_compress_headers(struct netif *netif, u8_t *inbuf, size_t inbuf_size, u8_t *outbuf, size_t outbuf_size,
u8_t *lowpan6_header_len_out, u8_t *hidden_header_len_out, ip6_addr_t *lowpan6_contexts,
const struct lowpan6_link_addr *src, const struct lowpan6_link_addr *dst);
struct pbuf *lowpan6_decompress(struct pbuf *p, u16_t datagram_size, ip6_addr_t *lowpan6_contexts,
struct lowpan6_link_addr *src, struct lowpan6_link_addr *dest);
#endif /* LWIP_6LOWPAN_IPHC */
#ifdef __cplusplus
}
#endif
#endif /* LWIP_IPV6 */
#endif /* LWIP_HDR_LOWPAN6_COMMON_H */

View File

@ -43,28 +43,80 @@
#include "lwip/opt.h"
#ifndef LWIP_6LOWPAN
#define LWIP_6LOWPAN 0
#endif
/** LWIP_6LOWPAN_NUM_CONTEXTS: define the number of compression
* contexts per netif type
*/
#ifndef LWIP_6LOWPAN_NUM_CONTEXTS
#define LWIP_6LOWPAN_NUM_CONTEXTS 10
#endif
/** LWIP_6LOWPAN_INFER_SHORT_ADDRESS: set this to 0 to disable creating
* short addresses for matching addresses (debug only)
*/
#ifndef LWIP_6LOWPAN_INFER_SHORT_ADDRESS
#define LWIP_6LOWPAN_INFER_SHORT_ADDRESS 1
#endif
/** LWIP_6LOWPAN_IPHC: set this to 0 to disable IP header compression as per
* RFC 6282 (which is mandatory for BLE)
*/
#ifndef LWIP_6LOWPAN_IPHC
#define LWIP_6LOWPAN_IPHC 1
#endif
#ifndef LWIP_6LOWPAN_HW_CRC
#define LWIP_6LOWPAN_HW_CRC 1
/** Set this to 1 if your IEEE 802.15.4 interface can calculate and check the
* CRC in hardware. This means TX packets get 2 zero bytes added on transmission
* which are to be filled with the CRC.
*/
#ifndef LWIP_6LOWPAN_802154_HW_CRC
#define LWIP_6LOWPAN_802154_HW_CRC 0
#endif
#ifndef LOWPAN6_DEBUG
#define LOWPAN6_DEBUG LWIP_DBG_OFF
/** If LWIP_6LOWPAN_802154_HW_CRC==0, this can override the default slow
* implementation of the CRC used for 6LoWPAN over IEEE 802.15.4 (which uses
* a shift register).
*/
#ifndef LWIP_6LOWPAN_CALC_CRC
#define LWIP_6LOWPAN_CALC_CRC(buf, len) lowpan6_calc_crc(buf, len)
#endif
/** Debug level for 6LoWPAN in general */
#ifndef LWIP_LOWPAN6_DEBUG
#define LWIP_LOWPAN6_DEBUG LWIP_DBG_OFF
#endif
/** Debug level for 6LoWPAN over IEEE 802.15.4 */
#ifndef LWIP_LOWPAN6_802154_DEBUG
#define LWIP_LOWPAN6_802154_DEBUG LWIP_DBG_OFF
#endif
/** LWIP_LOWPAN6_IP_COMPRESSED_DEBUG: enable compressed IP frame
* output debugging
*/
#ifndef LWIP_LOWPAN6_IP_COMPRESSED_DEBUG
#define LWIP_LOWPAN6_IP_COMPRESSED_DEBUG LWIP_DBG_OFF
#endif
/** LWIP_LOWPAN6_DECOMPRESSION_DEBUG: enable decompression debug output
*/
#ifndef LWIP_LOWPAN6_DECOMPRESSION_DEBUG
#define LWIP_LOWPAN6_DECOMPRESSION_DEBUG LWIP_DBG_OFF
#endif
/** LWIP_RFC7668_IP_UNCOMPRESSED_DEBUG: enable decompressed IP frame
* output debugging */
#ifndef LWIP_RFC7668_IP_UNCOMPRESSED_DEBUG
#define LWIP_RFC7668_IP_UNCOMPRESSED_DEBUG LWIP_DBG_OFF
#endif
/** LWIP_RFC7668_LINUX_WORKAROUND_PUBLIC_ADDRESS:
* Currently, the linux kernel driver for 6lowpan sets/clears a bit in
* the address, depending on the BD address (either public or not).
* Might not be RFC7668 conform, so you may select to do that (=1) or
* not (=0) */
#ifndef LWIP_RFC7668_LINUX_WORKAROUND_PUBLIC_ADDRESS
#define LWIP_RFC7668_LINUX_WORKAROUND_PUBLIC_ADDRESS 1
#endif
#endif /* LWIP_HDR_LOWPAN6_OPTS_H */

View File

@ -0,0 +1,33 @@
// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _NETTEST_LWIP_IF_H_
#define _NETTEST_LWIP_IF_H_
#include "lwip/err.h"
#ifdef __cplusplus
extern "C" {
#endif
err_t nettestif_init(struct netif *netif);
void nettestif_input(void *buffer, u16_t len);
#ifdef __cplusplus
}
#endif
#endif /* _NETTEST_LWIP_IF_H_ */

View File

@ -36,6 +36,10 @@
#ifndef CCP_H
#define CCP_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* CCP codes.
*/
@ -152,5 +156,9 @@ extern const struct protent ccp_protent;
void ccp_resetrequest(ppp_pcb *pcb); /* Issue a reset-request. */
#ifdef __cplusplus
}
#endif
#endif /* CCP_H */
#endif /* PPP_SUPPORT && CCP_SUPPORT */

View File

@ -36,6 +36,10 @@
#include "ppp.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* CHAP packets begin with a standard header with code, id, len (2 bytes).
*/
@ -188,5 +192,9 @@ extern void chap_auth_with_peer(ppp_pcb *pcb, const char *our_name, int digest_c
/* Represents the CHAP protocol to the main pppd code */
extern const struct protent chap_protent;
#ifdef __cplusplus
}
#endif
#endif /* CHAP_H */
#endif /* PPP_SUPPORT && CHAP_SUPPORT */

View File

@ -34,6 +34,13 @@
#include "netif/ppp/ppp_opts.h"
#if PPP_SUPPORT && ECP_SUPPORT /* don't build if not configured for use in lwipopts.h */
#ifndef ECP_H
#define ECP_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ecp_options {
bool required; /* Is ECP required? */
unsigned enctype; /* Encryption type */
@ -47,4 +54,9 @@ extern ecp_options ecp_hisoptions[];
extern const struct protent ecp_protent;
#ifdef __cplusplus
}
#endif
#endif /* ECP_H */
#endif /* PPP_SUPPORT && ECP_SUPPORT */

View File

@ -41,6 +41,10 @@
#ifndef EUI64_H
#define EUI64_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* @todo:
*
@ -90,5 +94,9 @@ typedef union
char *eui64_ntoa(eui64_t); /* Returns ascii representation of id */
#ifdef __cplusplus
}
#endif
#endif /* EUI64_H */
#endif /* PPP_SUPPORT && PPP_IPV6_SUPPORT */

View File

@ -50,6 +50,10 @@
#include "ppp.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Packet header = Code, id, length.
*/
@ -170,6 +174,9 @@ void fsm_input(fsm *f, u_char *inpacket, int l);
void fsm_protreject(fsm *f);
void fsm_sdata(fsm *f, u_char code, u_char id, const u_char *data, int datalen);
#ifdef __cplusplus
}
#endif
#endif /* FSM_H */
#endif /* PPP_SUPPORT */

View File

@ -48,6 +48,10 @@
#ifndef IPCP_H
#define IPCP_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Options.
*/
@ -122,5 +126,9 @@ char *ip_ntoa (u32_t);
extern const struct protent ipcp_protent;
#ifdef __cplusplus
}
#endif
#endif /* IPCP_H */
#endif /* PPP_SUPPORT && PPP_IPV4_SUPPORT */

View File

@ -146,6 +146,10 @@
#include "eui64.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Options.
*/
@ -179,5 +183,9 @@ typedef struct ipv6cp_options {
extern const struct protent ipv6cp_protent;
#ifdef __cplusplus
}
#endif
#endif /* IPV6CP_H */
#endif /* PPP_SUPPORT && PPP_IPV6_SUPPORT */

View File

@ -50,6 +50,10 @@
#include "ppp.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Options.
*/
@ -167,5 +171,9 @@ extern const struct protent lcp_protent;
#define DEFLOOPBACKFAIL 10
#endif /* moved to ppp_opts.h */
#ifdef __cplusplus
}
#endif
#endif /* LCP_H */
#endif /* PPP_SUPPORT */

View File

@ -80,6 +80,10 @@
#ifndef MAGIC_H
#define MAGIC_H
#ifdef __cplusplus
extern "C" {
#endif
/***********************
*** PUBLIC FUNCTIONS ***
***********************/
@ -117,6 +121,10 @@ void magic_random_bytes(unsigned char *buf, u32_t buf_len);
*/
u32_t magic_pow(u8_t pow);
#ifdef __cplusplus
}
#endif
#endif /* MAGIC_H */
#endif /* PPP_SUPPORT */

View File

@ -41,6 +41,10 @@
#include "netif/ppp/pppcrypt.h"
#ifdef __cplusplus
extern "C" {
#endif
#define MPPE_PAD 4 /* MPPE growth per frame */
#define MPPE_MAX_KEY_LEN 16 /* largest key length (128-bit) */
@ -169,5 +173,9 @@ err_t mppe_compress(ppp_pcb *pcb, ppp_mppe_state *state, struct pbuf **pb, u16_t
void mppe_decomp_reset(ppp_pcb *pcb, ppp_mppe_state *state);
err_t mppe_decompress(ppp_pcb *pcb, ppp_mppe_state *state, struct pbuf **pb);
#ifdef __cplusplus
}
#endif
#endif /* MPPE_H */
#endif /* PPP_SUPPORT && MPPE_SUPPORT */

View File

@ -47,6 +47,10 @@
#include "lwip/ip6_addr.h"
#endif /* PPP_IPV6_SUPPORT */
#ifdef __cplusplus
extern "C" {
#endif
/* Disable non-working or rarely used PPP feature, so rarely that we don't want to bloat ppp_opts.h with them */
#ifndef PPP_OPTIONS
#define PPP_OPTIONS 0
@ -685,6 +689,10 @@ err_t ppp_ioctl(ppp_pcb *pcb, u8_t cmd, void *arg);
#define ppp_set_netif_linkcallback(ppp, link_cb) \
netif_set_link_callback(ppp->netif, link_cb);
#ifdef __cplusplus
}
#endif
#endif /* PPP_H */
#endif /* PPP_SUPPORT */

View File

@ -53,6 +53,10 @@
#include "ppp.h"
#include "pppdebug.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Memory used for control packets.
*
@ -406,9 +410,6 @@ void ppp_link_end(ppp_pcb *pcb);
/* function called to process input packet */
void ppp_input(ppp_pcb *pcb, struct pbuf *pb);
/* helper function, merge a pbuf chain into one pbuf */
struct pbuf *ppp_singlebuf(struct pbuf *p);
/*
* Functions called by PPP protocols.
@ -624,6 +625,98 @@ void ppp_dump_packet(ppp_pcb *pcb, const char *tag, unsigned char *p, int len);
/* dump packet to debug log if interesting */
#endif /* PRINTPKT_SUPPORT */
/*
* Number of necessary timers analysis.
*
* PPP use at least one timer per each of its protocol, but not all protocols are
* active at the same time, thus the number of necessary timeouts is actually
* lower than enabled protocols. Here is the actual necessary timeouts based
* on code analysis.
*
* Note that many features analysed here are not working at all and are only
* there for a comprehensive analysis of necessary timers in order to prevent
* having to redo that each time we add a feature.
*
* Timer list
*
* | holdoff timeout
* | low level protocol timeout (PPPoE or PPPoL2P)
* | LCP delayed UP
* | LCP retransmit (FSM)
* | LCP Echo timer
* .| PAP or CHAP or EAP authentication
* . | ECP retransmit (FSM)
* . | CCP retransmit (FSM) when MPPE is enabled
* . | CCP retransmit (FSM) when MPPE is NOT enabled
* . | IPCP retransmit (FSM)
* . .| IP6CP retransmit (FSM)
* . . | Idle time limit
* . . | Max connect time
* . . | Max octets
* . . | CCP RACK timeout
* . . .
* PPP_PHASE_DEAD
* PPP_PHASE_HOLDOFF
* | . . .
* PPP_PHASE_INITIALIZE
* | . . .
* PPP_PHASE_ESTABLISH
* | . . .
* |. . .
* | . .
* PPP_PHASE_AUTHENTICATE
* | . .
* || . .
* PPP_PHASE_NETWORK
* | || . .
* | ||| .
* PPP_PHASE_RUNNING
* | .|||||
* | . ||||
* PPP_PHASE_TERMINATE
* | . ||||
* PPP_PHASE_NETWORK
* |. .
* PPP_PHASE_ESTABLISH
* PPP_PHASE_DISCONNECT
* PPP_PHASE_DEAD
*
* Alright, PPP basic retransmission and LCP Echo consume one timer.
* 1
*
* If authentication is enabled one timer is necessary during authentication.
* 1 + PPP_AUTH_SUPPORT
*
* If ECP is enabled one timer is necessary before IPCP and/or IP6CP, one more
* is necessary if CCP is enabled (only with MPPE support but we don't care much
* up to this detail level).
* 1 + ECP_SUPPORT + CCP_SUPPORT
*
* If CCP is enabled it might consume a timer during IPCP or IP6CP, thus
* we might use IPCP, IP6CP and CCP timers simultaneously.
* 1 + PPP_IPV4_SUPPORT + PPP_IPV6_SUPPORT + CCP_SUPPORT
*
* When entering running phase, IPCP or IP6CP is still running. If idle time limit
* is enabled one more timer is necessary. Same for max connect time and max
* octets features. Furthermore CCP RACK might be used past this point.
* 1 + PPP_IPV4_SUPPORT + PPP_IPV6_SUPPORT -1 + PPP_IDLETIMELIMIT + PPP_MAXCONNECT + MAXOCTETS + CCP_SUPPORT
*
* IPv4 or IPv6 must be enabled, therefore we don't need to take care the authentication
* and the CCP + ECP case, thus reducing overall complexity.
* 1 + LWIP_MAX(PPP_IPV4_SUPPORT + PPP_IPV6_SUPPORT + CCP_SUPPORT, PPP_IPV4_SUPPORT + PPP_IPV6_SUPPORT -1 + PPP_IDLETIMELIMIT + PPP_MAXCONNECT + MAXOCTETS + CCP_SUPPORT)
*
* We don't support PPP_IDLETIMELIMIT + PPP_MAXCONNECT + MAXOCTETS features
* and adding those defines to ppp_opts.h just for having the value always
* defined to 0 isn't worth it.
* 1 + LWIP_MAX(PPP_IPV4_SUPPORT + PPP_IPV6_SUPPORT + CCP_SUPPORT, PPP_IPV4_SUPPORT + PPP_IPV6_SUPPORT -1 + CCP_SUPPORT)
*
* Thus, the following is enough for now.
* 1 + PPP_IPV4_SUPPORT + PPP_IPV6_SUPPORT + CCP_SUPPORT
*/
#ifdef __cplusplus
}
#endif
#endif /* PPP_SUPPORT */
#endif /* LWIP_HDR_PPP_IMPL_H */

View File

@ -44,6 +44,13 @@
#define PPPOE_SUPPORT 0
#endif
/**
* PPPOE_SCNAME_SUPPORT==1: Enable PPP Over Ethernet Service Name and Concentrator Name support
*/
#ifndef PPPOE_SCNAME_SUPPORT
#define PPPOE_SCNAME_SUPPORT 0
#endif
/**
* PPPOL2TP_SUPPORT==1: Enable PPP Over L2TP
*/
@ -72,15 +79,27 @@
#define LWIP_PPP_API (PPP_SUPPORT && (NO_SYS == 0))
#endif
#if PPP_SUPPORT
/**
* MEMP_NUM_PPP_PCB: the number of simultaneously active PPP
* connections (requires the PPP_SUPPORT option)
*/
#ifndef MEMP_NUM_PPP_PCB
#define MEMP_NUM_PPP_PCB 1
#define MEMP_NUM_PPP_PCB 1
#endif
#if PPP_SUPPORT
/**
* PPP_NUM_TIMEOUTS_PER_PCB: the number of sys_timeouts running in parallel per
* ppp_pcb. See the detailed explanation at the end of ppp_impl.h about simultaneous
* timers analysis.
*/
#ifndef PPP_NUM_TIMEOUTS_PER_PCB
#define PPP_NUM_TIMEOUTS_PER_PCB (1 + PPP_IPV4_SUPPORT + PPP_IPV6_SUPPORT + CCP_SUPPORT)
#endif
/* The number of sys_timeouts required for the PPP module */
#define PPP_NUM_TIMEOUTS (PPP_SUPPORT * PPP_NUM_TIMEOUTS_PER_PCB * MEMP_NUM_PPP_PCB)
/**
* MEMP_NUM_PPPOS_INTERFACES: the number of concurrently active PPPoS
@ -590,4 +609,9 @@
#endif /* PPP_SUPPORT */
/* Default value if unset */
#ifndef PPP_NUM_TIMEOUTS
#define PPP_NUM_TIMEOUTS 0
#endif /* PPP_NUM_TIMEOUTS */
#endif /* LWIP_PPP_OPTS_H */

View File

@ -47,7 +47,7 @@ extern "C" {
struct pppapi_msg_msg {
ppp_pcb *ppp;
union {
#if ESP_LWIP
#if ESP_PPP
struct {
u8_t authtype;
const char *user;
@ -111,7 +111,7 @@ struct pppapi_msg {
/* API for application */
err_t pppapi_set_default(ppp_pcb *pcb);
#if ESP_LWIP
#if ESP_PPP
void pppapi_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passwd);
#endif
#if PPP_NOTIFY_PHASE

View File

@ -44,6 +44,10 @@
*/
#include "lwip/arch.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Map hashes and ciphers functions to PolarSSL
*/
@ -131,6 +135,10 @@
void pppcrypt_56_to_64_bit_key(u_char *key, u_char *des_key);
#ifdef __cplusplus
}
#endif
#endif /* PPPCRYPT_H */
#endif /* PPP_SUPPORT */

View File

@ -40,6 +40,10 @@
#ifndef PPPDEBUG_H
#define PPPDEBUG_H
#ifdef __cplusplus
extern "C" {
#endif
/* Trace levels. */
#define LOG_CRITICAL (PPP_DEBUG | LWIP_DBG_LEVEL_SEVERE)
#define LOG_ERR (PPP_DEBUG | LWIP_DBG_LEVEL_SEVERE)
@ -75,6 +79,10 @@
#endif /* PPP_DEBUG */
#ifdef __cplusplus
}
#endif
#endif /* PPPDEBUG_H */
#endif /* PPP_SUPPORT */

View File

@ -76,6 +76,10 @@
#include "ppp.h"
#include "lwip/etharp.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef PACK_STRUCT_USE_INCLUDES
# include "arch/bpstruct.h"
#endif
@ -145,10 +149,10 @@ struct pppoe_softc {
u16_t sc_session; /* PPPoE session id */
u8_t sc_state; /* discovery phase or session connected */
#ifdef PPPOE_TODO
u8_t *sc_service_name; /* if != NULL: requested name of service */
u8_t *sc_concentrator_name; /* if != NULL: requested concentrator id */
#endif /* PPPOE_TODO */
#if PPPOE_SCNAME_SUPPORT
const char *sc_service_name; /* if != NULL: requested name of service */
const char *sc_concentrator_name; /* if != NULL: requested concentrator id */
#endif /* PPPOE_SCNAME_SUPPORT */
u8_t sc_ac_cookie[PPPOE_MAX_AC_COOKIE_LEN]; /* content of AC cookie we must echo back */
u8_t sc_ac_cookie_len; /* length of cookie data */
#ifdef PPPOE_SERVER
@ -174,6 +178,10 @@ ppp_pcb *pppoe_create(struct netif *pppif,
void pppoe_disc_input(struct netif *netif, struct pbuf *p);
void pppoe_data_input(struct netif *netif, struct pbuf *p);
#ifdef __cplusplus
}
#endif
#endif /* PPP_OE_H */
#endif /* PPP_SUPPORT && PPPOE_SUPPORT */

View File

@ -39,6 +39,10 @@
#include "ppp.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Timeout */
#define PPPOL2TP_CONTROL_TIMEOUT (5*1000) /* base for quick timeout calculation */
#define PPPOL2TP_SLOW_RETRY (60*1000) /* persistent retry interval */
@ -179,7 +183,7 @@ struct pppol2tp_pcb_s {
u16_t tunnel_port; /* Tunnel port */
u16_t our_ns; /* NS to peer */
u16_t peer_nr; /* NR from peer */
u16_t peer_ns; /* NS from peer */
u16_t peer_ns; /* Expected NS from peer */
u16_t source_tunnel_id; /* Tunnel ID assigned by peer */
u16_t remote_tunnel_id; /* Tunnel ID assigned to peer */
u16_t source_session_id; /* Session ID assigned by peer */
@ -197,5 +201,9 @@ ppp_pcb *pppol2tp_create(struct netif *pppif,
const u8_t *secret, u8_t secret_len,
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
#ifdef __cplusplus
}
#endif
#endif /* PPPOL2TP_H */
#endif /* PPP_SUPPORT && PPPOL2TP_SUPPORT */

View File

@ -42,6 +42,10 @@
#include "ppp.h"
#include "vj.h"
#ifdef __cplusplus
extern "C" {
#endif
/* PPP packet parser states. Current state indicates operation yet to be
* completed. */
enum {
@ -114,5 +118,9 @@ void pppos_input(ppp_pcb *ppp, u8_t* data, int len);
err_t pppos_input_sys(struct pbuf *p, struct netif *inp);
#endif /* !NO_SYS && !PPP_INPROC_IRQ_SAFE */
#ifdef __cplusplus
}
#endif
#endif /* PPPOS_H */
#endif /* PPP_SUPPORT && PPPOL2TP_SUPPORT */

View File

@ -50,6 +50,10 @@
#include "ppp.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Packet header = Code, id, length.
*/
@ -119,5 +123,9 @@ void upap_authpeer(ppp_pcb *pcb);
extern const struct protent pap_protent;
#ifdef __cplusplus
}
#endif
#endif /* UPAP_H */
#endif /* PPP_SUPPORT && PAP_SUPPORT */

View File

@ -31,6 +31,10 @@
#include "lwip/ip.h"
#include "lwip/priv/tcp_priv.h"
#ifdef __cplusplus
extern "C" {
#endif
#define MAX_SLOTS 16 /* must be > 2 and < 256 */
#define MAX_HDR 128
@ -156,6 +160,10 @@ extern void vj_uncompress_err (struct vjcompress *comp);
extern int vj_uncompress_uncomp(struct pbuf *nb, struct vjcompress *comp);
extern int vj_uncompress_tcp (struct pbuf **nb, struct vjcompress *comp);
#ifdef __cplusplus
}
#endif
#endif /* VJ_H */
#endif /* PPP_SUPPORT && VJ_SUPPORT */

View File

@ -18,7 +18,7 @@
#include "esp_wifi.h"
#include "esp_wifi_internal.h"
#include "esp_private/wifi.h"
#include "lwip/err.h"

View File

@ -0,0 +1,81 @@
/**
* @file
*
* A netif implementing the ZigBee Eencapsulation Protocol (ZEP).
* This is used to tunnel 6LowPAN over UDP.
*/
/*
* Copyright (c) 2018 Simon Goldschmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
* Author: Simon Goldschmidt <goldsimon@gmx.de>
*
*/
#ifndef LWIP_HDR_ZEPIF_H
#define LWIP_HDR_ZEPIF_H
#include "lwip/opt.h"
#include "netif/lowpan6.h"
#if LWIP_IPV6 && LWIP_UDP /* don't build if not configured for use in lwipopts.h */
#include "lwip/netif.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ZEPIF_DEFAULT_UDP_PORT 17754
/** Pass this struct as 'state' to netif_add to control the behaviour
* of this netif. If NULL is passed, default behaviour is chosen */
struct zepif_init {
/** The UDP port used to ZEP frames from (0 = default) */
u16_t zep_src_udp_port;
/** The UDP port used to ZEP frames to (0 = default) */
u16_t zep_dst_udp_port;
/** The IP address to sed ZEP frames from (NULL = ANY) */
const ip_addr_t *zep_src_ip_addr;
/** The IP address to sed ZEP frames to (NULL = BROADCAST) */
const ip_addr_t *zep_dst_ip_addr;
/** If != NULL, the udp pcb is bound to this netif */
const struct netif *zep_netif;
/** MAC address of the 6LowPAN device */
u8_t addr[6];
};
err_t zepif_init(struct netif *netif);
#ifdef __cplusplus
}
#endif
#endif /* LWIP_IPV6 && LWIP_UDP */
#endif /* LWIP_HDR_ZEPIF_H */