mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-12 01:53:07 +03:00
update to lwIP-2.1.0: partial SACK support by default (de-selectable in menu) (#5126)
* update to lwIP-2.1.0rc1: partial SACK support fix #4176 * hash fix * get some flash back due to mistake in conf (fragmentation & reassembly was incorrectly enabled) (ahah I scared you) * add missing include files * update to lwip-2.1.0(release) + remove unused lwIP's include files * lwIP release 2.1.0, SACK is now default, bigger, no-SACK is selectable * fix ldscript * pio * rename 'sack' option to 'feat'ure option, + IP fragmentation/reassembly * merge, fix pio * change internal/hidden string * pio: more lwip2 configuration: + without sack for no change in flash footprint
This commit is contained in:
@ -39,15 +39,13 @@
|
||||
#define LWIP_HDR_PROT_DHCP_H
|
||||
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/arch.h"
|
||||
#include "lwip/prot/ip4.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DHCP_CLIENT_PORT 68
|
||||
#define DHCP_SERVER_PORT 67
|
||||
|
||||
|
||||
/* DHCP message item offsets and length */
|
||||
#define DHCP_CHADDR_LEN 16U
|
||||
#define DHCP_SNAME_OFS 44U
|
||||
@ -128,9 +126,6 @@ typedef enum {
|
||||
#define DHCP_RELEASE 7
|
||||
#define DHCP_INFORM 8
|
||||
|
||||
/** DHCP hardware type, currently only ethernet is supported */
|
||||
#define DHCP_HTYPE_ETH 1
|
||||
|
||||
#define DHCP_MAGIC_COOKIE 0x63825363UL
|
||||
|
||||
/* This is a list of options for BOOTP and DHCP, see RFC 2132 for descriptions */
|
||||
@ -180,4 +175,4 @@ typedef enum {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*LWIP_HDR_PROT_DHCP_H*/
|
||||
#endif /* LWIP_HDR_PROT_DHCP_H */
|
||||
|
138
tools/sdk/lwip2/include/lwip/prot/dhcp6.h
Normal file
138
tools/sdk/lwip2/include/lwip/prot/dhcp6.h
Normal file
@ -0,0 +1,138 @@
|
||||
/**
|
||||
* @file
|
||||
* DHCPv6 protocol definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2017 Simon Goldschmidt <goldsimon@gmx.de>
|
||||
* 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_PROT_DHCP6_H
|
||||
#define LWIP_HDR_PROT_DHCP6_H
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DHCP6_CLIENT_PORT 546
|
||||
#define DHCP6_SERVER_PORT 547
|
||||
|
||||
|
||||
/* DHCPv6 message item offsets and length */
|
||||
#define DHCP6_TRANSACTION_ID_LEN 3
|
||||
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/bpstruct.h"
|
||||
#endif
|
||||
PACK_STRUCT_BEGIN
|
||||
/** minimum set of fields of any DHCPv6 message */
|
||||
struct dhcp6_msg
|
||||
{
|
||||
PACK_STRUCT_FLD_8(u8_t msgtype);
|
||||
PACK_STRUCT_FLD_8(u8_t transaction_id[DHCP6_TRANSACTION_ID_LEN]);
|
||||
/* options follow */
|
||||
} PACK_STRUCT_STRUCT;
|
||||
PACK_STRUCT_END
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/epstruct.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* DHCP6 client states */
|
||||
typedef enum {
|
||||
DHCP6_STATE_OFF = 0,
|
||||
DHCP6_STATE_STATELESS_IDLE = 1,
|
||||
DHCP6_STATE_REQUESTING_CONFIG = 2
|
||||
} dhcp6_state_enum_t;
|
||||
|
||||
/* DHCPv6 message types */
|
||||
#define DHCP6_SOLICIT 1
|
||||
#define DHCP6_ADVERTISE 2
|
||||
#define DHCP6_REQUEST 3
|
||||
#define DHCP6_CONFIRM 4
|
||||
#define DHCP6_RENEW 5
|
||||
#define DHCP6_REBIND 6
|
||||
#define DHCP6_REPLY 7
|
||||
#define DHCP6_RELEASE 8
|
||||
#define DHCP6_DECLINE 9
|
||||
#define DHCP6_RECONFIGURE 10
|
||||
#define DHCP6_INFOREQUEST 11
|
||||
#define DHCP6_RELAYFORW 12
|
||||
#define DHCP6_RELAYREPL 13
|
||||
/* More message types see https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml */
|
||||
|
||||
/** DHCPv6 status codes */
|
||||
#define DHCP6_STATUS_SUCCESS 0 /* Success. */
|
||||
#define DHCP6_STATUS_UNSPECFAIL 1 /* Failure, reason unspecified; this status code is sent by either a client or a server to indicate a failure not explicitly specified in this document. */
|
||||
#define DHCP6_STATUS_NOADDRSAVAIL 2 /* Server has no addresses available to assign to the IA(s). */
|
||||
#define DHCP6_STATUS_NOBINDING 3 /* Client record (binding) unavailable. */
|
||||
#define DHCP6_STATUS_NOTONLINK 4 /* The prefix for the address is not appropriate for the link to which the client is attached. */
|
||||
#define DHCP6_STATUS_USEMULTICAST 5 /* Sent by a server to a client to force the client to send messages to the server using the All_DHCP_Relay_Agents_and_Servers address. */
|
||||
/* More status codes see https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml */
|
||||
|
||||
/** DHCPv6 DUID types */
|
||||
#define DHCP6_DUID_LLT 1 /* LLT: Link-layer Address Plus Time */
|
||||
#define DHCP6_DUID_EN 2 /* EN: Enterprise number */
|
||||
#define DHCP6_DUID_LL 3 /* LL: Link-layer Address */
|
||||
#define DHCP6_DUID_UUID 4 /* UUID (RFC 6355) */
|
||||
|
||||
/* DHCPv6 options */
|
||||
#define DHCP6_OPTION_CLIENTID 1
|
||||
#define DHCP6_OPTION_SERVERID 2
|
||||
#define DHCP6_OPTION_IA_NA 3
|
||||
#define DHCP6_OPTION_IA_TA 4
|
||||
#define DHCP6_OPTION_IAADDR 5
|
||||
#define DHCP6_OPTION_ORO 6
|
||||
#define DHCP6_OPTION_PREFERENCE 7
|
||||
#define DHCP6_OPTION_ELAPSED_TIME 8
|
||||
#define DHCP6_OPTION_RELAY_MSG 9
|
||||
#define DHCP6_OPTION_AUTH 11
|
||||
#define DHCP6_OPTION_UNICAST 12
|
||||
#define DHCP6_OPTION_STATUS_CODE 13
|
||||
#define DHCP6_OPTION_RAPID_COMMIT 14
|
||||
#define DHCP6_OPTION_USER_CLASS 15
|
||||
#define DHCP6_OPTION_VENDOR_CLASS 16
|
||||
#define DHCP6_OPTION_VENDOR_OPTS 17
|
||||
#define DHCP6_OPTION_INTERFACE_ID 18
|
||||
#define DHCP6_OPTION_RECONF_MSG 19
|
||||
#define DHCP6_OPTION_RECONF_ACCEPT 20
|
||||
/* More options see https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml */
|
||||
#define DHCP6_OPTION_DNS_SERVERS 23 /* RFC 3646 */
|
||||
#define DHCP6_OPTION_DOMAIN_LIST 24 /* RFC 3646 */
|
||||
#define DHCP6_OPTION_SNTP_SERVERS 31 /* RFC 4075 */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_HDR_PROT_DHCP6_H */
|
@ -39,7 +39,6 @@
|
||||
|
||||
#include "lwip/arch.h"
|
||||
#include "lwip/prot/ethernet.h"
|
||||
#include "lwip/ip4_addr.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -49,6 +48,36 @@ extern "C" {
|
||||
#define ETHARP_HWADDR_LEN ETH_HWADDR_LEN
|
||||
#endif
|
||||
|
||||
/**
|
||||
* struct ip4_addr_wordaligned is used in the definition of the ARP packet format in
|
||||
* order to support compilers that don't have structure packing.
|
||||
*/
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/bpstruct.h"
|
||||
#endif
|
||||
PACK_STRUCT_BEGIN
|
||||
struct ip4_addr_wordaligned {
|
||||
PACK_STRUCT_FIELD(u16_t addrw[2]);
|
||||
} PACK_STRUCT_STRUCT;
|
||||
PACK_STRUCT_END
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/epstruct.h"
|
||||
#endif
|
||||
|
||||
/** MEMCPY-like copying of IP addresses where addresses are known to be
|
||||
* 16-bit-aligned if the port is correctly configured (so a port could define
|
||||
* this to copying 2 u16_t's) - no NULL-pointer-checking needed. */
|
||||
#ifndef IPADDR_WORDALIGNED_COPY_TO_IP4_ADDR_T
|
||||
#define IPADDR_WORDALIGNED_COPY_TO_IP4_ADDR_T(dest, src) SMEMCPY(dest, src, sizeof(ip4_addr_t))
|
||||
#endif
|
||||
|
||||
/** MEMCPY-like copying of IP addresses where addresses are known to be
|
||||
* 16-bit-aligned if the port is correctly configured (so a port could define
|
||||
* this to copying 2 u16_t's) - no NULL-pointer-checking needed. */
|
||||
#ifndef IPADDR_WORDALIGNED_COPY_FROM_IP4_ADDR_T
|
||||
#define IPADDR_WORDALIGNED_COPY_FROM_IP4_ADDR_T(dest, src) SMEMCPY(dest, src, sizeof(ip4_addr_t))
|
||||
#endif
|
||||
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/bpstruct.h"
|
||||
#endif
|
||||
@ -61,9 +90,9 @@ struct etharp_hdr {
|
||||
PACK_STRUCT_FLD_8(u8_t protolen);
|
||||
PACK_STRUCT_FIELD(u16_t opcode);
|
||||
PACK_STRUCT_FLD_S(struct eth_addr shwaddr);
|
||||
PACK_STRUCT_FLD_S(struct ip4_addr2 sipaddr);
|
||||
PACK_STRUCT_FLD_S(struct ip4_addr_wordaligned sipaddr);
|
||||
PACK_STRUCT_FLD_S(struct eth_addr dhwaddr);
|
||||
PACK_STRUCT_FLD_S(struct ip4_addr2 dipaddr);
|
||||
PACK_STRUCT_FLD_S(struct ip4_addr_wordaligned dipaddr);
|
||||
} PACK_STRUCT_STRUCT;
|
||||
PACK_STRUCT_END
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
@ -72,12 +101,6 @@ PACK_STRUCT_END
|
||||
|
||||
#define SIZEOF_ETHARP_HDR 28
|
||||
|
||||
/* ARP hwtype values */
|
||||
enum etharp_hwtype {
|
||||
HWTYPE_ETHERNET = 1
|
||||
/* others not used */
|
||||
};
|
||||
|
||||
/* ARP message types (opcodes) */
|
||||
enum etharp_opcode {
|
||||
ARP_REQUEST = 1,
|
||||
|
@ -38,6 +38,7 @@
|
||||
#define LWIP_HDR_PROT_ETHERNET_H
|
||||
|
||||
#include "lwip/arch.h"
|
||||
#include "lwip/prot/ieee.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -55,6 +56,7 @@ extern "C" {
|
||||
# include "arch/bpstruct.h"
|
||||
#endif
|
||||
PACK_STRUCT_BEGIN
|
||||
/** An Ethernet MAC address */
|
||||
struct eth_addr {
|
||||
PACK_STRUCT_FLD_8(u8_t addr[ETH_HWADDR_LEN]);
|
||||
} PACK_STRUCT_STRUCT;
|
||||
@ -63,6 +65,9 @@ PACK_STRUCT_END
|
||||
# include "arch/epstruct.h"
|
||||
#endif
|
||||
|
||||
/** Initialize a struct eth_addr with its 6 bytes (takes care of correct braces) */
|
||||
#define ETH_ADDR(b0, b1, b2, b3, b4, b5) {{b0, b1, b2, b3, b4, b5}}
|
||||
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/bpstruct.h"
|
||||
#endif
|
||||
@ -102,44 +107,6 @@ PACK_STRUCT_END
|
||||
#define SIZEOF_VLAN_HDR 4
|
||||
#define VLAN_ID(vlan_hdr) (lwip_htons((vlan_hdr)->prio_vid) & 0xFFF)
|
||||
|
||||
/**
|
||||
* @ingroup ethernet
|
||||
* A list of often ethtypes (although lwIP does not use all of them): */
|
||||
enum eth_type {
|
||||
/** Internet protocol v4 */
|
||||
ETHTYPE_IP = 0x0800U,
|
||||
/** Address resolution protocol */
|
||||
ETHTYPE_ARP = 0x0806U,
|
||||
/** Wake on lan */
|
||||
ETHTYPE_WOL = 0x0842U,
|
||||
/** RARP */
|
||||
ETHTYPE_RARP = 0x8035U,
|
||||
/** Virtual local area network */
|
||||
ETHTYPE_VLAN = 0x8100U,
|
||||
/** Internet protocol v6 */
|
||||
ETHTYPE_IPV6 = 0x86DDU,
|
||||
/** PPP Over Ethernet Discovery Stage */
|
||||
ETHTYPE_PPPOEDISC = 0x8863U,
|
||||
/** PPP Over Ethernet Session Stage */
|
||||
ETHTYPE_PPPOE = 0x8864U,
|
||||
/** Jumbo Frames */
|
||||
ETHTYPE_JUMBO = 0x8870U,
|
||||
/** Process field network */
|
||||
ETHTYPE_PROFINET = 0x8892U,
|
||||
/** Ethernet for control automation technology */
|
||||
ETHTYPE_ETHERCAT = 0x88A4U,
|
||||
/** Link layer discovery protocol */
|
||||
ETHTYPE_LLDP = 0x88CCU,
|
||||
/** Serial real-time communication system */
|
||||
ETHTYPE_SERCOS = 0x88CDU,
|
||||
/** Media redundancy protocol */
|
||||
ETHTYPE_MRP = 0x88E3U,
|
||||
/** Precision time protocol */
|
||||
ETHTYPE_PTP = 0x88F7U,
|
||||
/** Q-in-Q, 802.1ad */
|
||||
ETHTYPE_QINQ = 0x9100U
|
||||
};
|
||||
|
||||
/** The 24-bit IANA IPv4-multicast OUI is 01-00-5e: */
|
||||
#define LL_IP4_MULTICAST_ADDR_0 0x01
|
||||
#define LL_IP4_MULTICAST_ADDR_1 0x00
|
||||
@ -149,18 +116,6 @@ enum eth_type {
|
||||
#define LL_IP6_MULTICAST_ADDR_0 0x33
|
||||
#define LL_IP6_MULTICAST_ADDR_1 0x33
|
||||
|
||||
/** MEMCPY-like macro to copy to/from struct eth_addr's that are local variables
|
||||
* or known to be 32-bit aligned within the protocol header. */
|
||||
#ifndef ETHADDR32_COPY
|
||||
#define ETHADDR32_COPY(dst, src) SMEMCPY(dst, src, ETH_HWADDR_LEN)
|
||||
#endif
|
||||
|
||||
/** MEMCPY-like macro to copy to/from struct eth_addr's that are no local
|
||||
* variables and known to be 16-bit aligned within the protocol header. */
|
||||
#ifndef ETHADDR16_COPY
|
||||
#define ETHADDR16_COPY(dst, src) SMEMCPY(dst, src, ETH_HWADDR_LEN)
|
||||
#endif
|
||||
|
||||
#define eth_addr_cmp(addr1, addr2) (memcmp((addr1)->addr, (addr2)->addr, ETH_HWADDR_LEN) == 0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
97
tools/sdk/lwip2/include/lwip/prot/iana.h
Normal file
97
tools/sdk/lwip2/include/lwip/prot/iana.h
Normal file
@ -0,0 +1,97 @@
|
||||
/**
|
||||
* @file
|
||||
* IANA assigned numbers (RFC 1700 and successors)
|
||||
*
|
||||
* @defgroup iana IANA assigned numbers
|
||||
* @ingroup infrastructure
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2017 Dirk Ziegelmeier.
|
||||
* 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: Dirk Ziegelmeier <dziegel@gmx.de>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LWIP_HDR_PROT_IANA_H
|
||||
#define LWIP_HDR_PROT_IANA_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup iana
|
||||
* Hardware types
|
||||
*/
|
||||
enum lwip_iana_hwtype {
|
||||
/** Ethernet */
|
||||
LWIP_IANA_HWTYPE_ETHERNET = 1
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup iana
|
||||
* Port numbers
|
||||
* https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt
|
||||
*/
|
||||
enum lwip_iana_port_number {
|
||||
/** SMTP */
|
||||
LWIP_IANA_PORT_SMTP = 25,
|
||||
/** DHCP server */
|
||||
LWIP_IANA_PORT_DHCP_SERVER = 67,
|
||||
/** DHCP client */
|
||||
LWIP_IANA_PORT_DHCP_CLIENT = 68,
|
||||
/** TFTP */
|
||||
LWIP_IANA_PORT_TFTP = 69,
|
||||
/** HTTP */
|
||||
LWIP_IANA_PORT_HTTP = 80,
|
||||
/** SNTP */
|
||||
LWIP_IANA_PORT_SNTP = 123,
|
||||
/** NETBIOS */
|
||||
LWIP_IANA_PORT_NETBIOS = 137,
|
||||
/** SNMP */
|
||||
LWIP_IANA_PORT_SNMP = 161,
|
||||
/** SNMP traps */
|
||||
LWIP_IANA_PORT_SNMP_TRAP = 162,
|
||||
/** HTTPS */
|
||||
LWIP_IANA_PORT_HTTPS = 443,
|
||||
/** SMTPS */
|
||||
LWIP_IANA_PORT_SMTPS = 465,
|
||||
/** MQTT */
|
||||
LWIP_IANA_PORT_MQTT = 1883,
|
||||
/** MDNS */
|
||||
LWIP_IANA_PORT_MDNS = 5353,
|
||||
/** Secure MQTT */
|
||||
LWIP_IANA_PORT_SECURE_MQTT = 8883
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_HDR_PROT_IANA_H */
|
91
tools/sdk/lwip2/include/lwip/prot/ieee.h
Normal file
91
tools/sdk/lwip2/include/lwip/prot/ieee.h
Normal file
@ -0,0 +1,91 @@
|
||||
/**
|
||||
* @file
|
||||
* IEEE assigned numbers
|
||||
*
|
||||
* @defgroup ieee IEEE assigned numbers
|
||||
* @ingroup infrastructure
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2017 Dirk Ziegelmeier.
|
||||
* 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: Dirk Ziegelmeier <dziegel@gmx.de>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LWIP_HDR_PROT_IEEE_H
|
||||
#define LWIP_HDR_PROT_IEEE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup ieee
|
||||
* A list of often ethtypes (although lwIP does not use all of them).
|
||||
*/
|
||||
enum lwip_ieee_eth_type {
|
||||
/** Internet protocol v4 */
|
||||
ETHTYPE_IP = 0x0800U,
|
||||
/** Address resolution protocol */
|
||||
ETHTYPE_ARP = 0x0806U,
|
||||
/** Wake on lan */
|
||||
ETHTYPE_WOL = 0x0842U,
|
||||
/** RARP */
|
||||
ETHTYPE_RARP = 0x8035U,
|
||||
/** Virtual local area network */
|
||||
ETHTYPE_VLAN = 0x8100U,
|
||||
/** Internet protocol v6 */
|
||||
ETHTYPE_IPV6 = 0x86DDU,
|
||||
/** PPP Over Ethernet Discovery Stage */
|
||||
ETHTYPE_PPPOEDISC = 0x8863U,
|
||||
/** PPP Over Ethernet Session Stage */
|
||||
ETHTYPE_PPPOE = 0x8864U,
|
||||
/** Jumbo Frames */
|
||||
ETHTYPE_JUMBO = 0x8870U,
|
||||
/** Process field network */
|
||||
ETHTYPE_PROFINET = 0x8892U,
|
||||
/** Ethernet for control automation technology */
|
||||
ETHTYPE_ETHERCAT = 0x88A4U,
|
||||
/** Link layer discovery protocol */
|
||||
ETHTYPE_LLDP = 0x88CCU,
|
||||
/** Serial real-time communication system */
|
||||
ETHTYPE_SERCOS = 0x88CDU,
|
||||
/** Media redundancy protocol */
|
||||
ETHTYPE_MRP = 0x88E3U,
|
||||
/** Precision time protocol */
|
||||
ETHTYPE_PTP = 0x88F7U,
|
||||
/** Q-in-Q, 802.1ad */
|
||||
ETHTYPE_QINQ = 0x9100U
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_HDR_PROT_IEEE_H */
|
@ -38,7 +38,7 @@
|
||||
#define LWIP_HDR_PROT_IGMP_H
|
||||
|
||||
#include "lwip/arch.h"
|
||||
#include "lwip/ip4_addr.h"
|
||||
#include "lwip/prot/ip4.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -39,6 +39,10 @@
|
||||
|
||||
#include "lwip/arch.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define IP_PROTO_ICMP 1
|
||||
#define IP_PROTO_IGMP 2
|
||||
#define IP_PROTO_UDP 17
|
||||
@ -48,4 +52,8 @@
|
||||
/** This operates on a void* by loading the first byte */
|
||||
#define IP_HDR_GET_VERSION(ptr) ((*(u8_t*)(ptr)) >> 4)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_HDR_PROT_IP_H */
|
||||
|
@ -62,6 +62,8 @@ typedef struct ip4_addr_packed ip4_addr_p_t;
|
||||
|
||||
/* Size of the IPv4 header. Same as 'sizeof(struct ip_hdr)'. */
|
||||
#define IP_HLEN 20
|
||||
/* Maximum size of the IPv4 header with options. */
|
||||
#define IP_HLEN_MAX 60
|
||||
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/bpstruct.h"
|
||||
@ -101,10 +103,12 @@ PACK_STRUCT_END
|
||||
/* Macros to get struct ip_hdr fields: */
|
||||
#define IPH_V(hdr) ((hdr)->_v_hl >> 4)
|
||||
#define IPH_HL(hdr) ((hdr)->_v_hl & 0x0f)
|
||||
#define IPH_HL_BYTES(hdr) ((u8_t)(IPH_HL(hdr) * 4))
|
||||
#define IPH_TOS(hdr) ((hdr)->_tos)
|
||||
#define IPH_LEN(hdr) ((hdr)->_len)
|
||||
#define IPH_ID(hdr) ((hdr)->_id)
|
||||
#define IPH_OFFSET(hdr) ((hdr)->_offset)
|
||||
#define IPH_OFFSET_BYTES(hdr) ((u16_t)((lwip_ntohs(IPH_OFFSET(hdr)) & IP_OFFMASK) * 8U))
|
||||
#define IPH_TTL(hdr) ((hdr)->_ttl)
|
||||
#define IPH_PROTO(hdr) ((hdr)->_proto)
|
||||
#define IPH_CHKSUM(hdr) ((hdr)->_chksum)
|
||||
|
@ -43,7 +43,7 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/** This is the packed version of ip6_addr_t,
|
||||
used in network headers that are itself packed */
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
@ -94,13 +94,50 @@ PACK_STRUCT_END
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/epstruct.h"
|
||||
#endif
|
||||
#define IP6H_V(hdr) ((lwip_ntohl((hdr)->_v_tc_fl) >> 28) & 0x0f)
|
||||
#define IP6H_TC(hdr) ((lwip_ntohl((hdr)->_v_tc_fl) >> 20) & 0xff)
|
||||
#define IP6H_FL(hdr) (lwip_ntohl((hdr)->_v_tc_fl) & 0x000fffff)
|
||||
#define IP6H_PLEN(hdr) (lwip_ntohs((hdr)->_plen))
|
||||
#define IP6H_NEXTH(hdr) ((hdr)->_nexth)
|
||||
#define IP6H_NEXTH_P(hdr) ((u8_t *)(hdr) + 6)
|
||||
#define IP6H_HOPLIM(hdr) ((hdr)->_hoplim)
|
||||
#define IP6H_VTCFL_SET(hdr, v, tc, fl) (hdr)->_v_tc_fl = (lwip_htonl((((u32_t)(v)) << 28) | (((u32_t)(tc)) << 20) | (fl)))
|
||||
#define IP6H_PLEN_SET(hdr, plen) (hdr)->_plen = lwip_htons(plen)
|
||||
#define IP6H_NEXTH_SET(hdr, nexth) (hdr)->_nexth = (nexth)
|
||||
#define IP6H_HOPLIM_SET(hdr, hl) (hdr)->_hoplim = (u8_t)(hl)
|
||||
|
||||
/* ipv6 extended options header */
|
||||
#define IP6_PAD1_OPTION 0
|
||||
#define IP6_PADN_OPTION 1
|
||||
#define IP6_ROUTER_ALERT_OPTION 5
|
||||
#define IP6_JUMBO_OPTION 194
|
||||
#define IP6_HOME_ADDRESS_OPTION 201
|
||||
#define IP6_ROUTER_ALERT_DLEN 2
|
||||
#define IP6_ROUTER_ALERT_VALUE_MLD 0
|
||||
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/bpstruct.h"
|
||||
#endif
|
||||
PACK_STRUCT_BEGIN
|
||||
struct ip6_opt_hdr {
|
||||
/* router alert option type */
|
||||
PACK_STRUCT_FLD_8(u8_t _opt_type);
|
||||
/* router alert option data len */
|
||||
PACK_STRUCT_FLD_8(u8_t _opt_dlen);
|
||||
} PACK_STRUCT_STRUCT;
|
||||
PACK_STRUCT_END
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/epstruct.h"
|
||||
#endif
|
||||
#define IP6_OPT_HLEN 2
|
||||
#define IP6_OPT_TYPE_ACTION(hdr) ((((hdr)->_opt_type) >> 6) & 0x3)
|
||||
#define IP6_OPT_TYPE_CHANGE(hdr) ((((hdr)->_opt_type) >> 5) & 0x1)
|
||||
#define IP6_OPT_TYPE(hdr) ((hdr)->_opt_type)
|
||||
#define IP6_OPT_DLEN(hdr) ((hdr)->_opt_dlen)
|
||||
|
||||
/* Hop-by-Hop header. */
|
||||
#define IP6_HBH_HLEN 2
|
||||
|
||||
/* Hop-by-hop router alert option. */
|
||||
#define IP6_HBH_HLEN 8
|
||||
#define IP6_PAD1_OPTION 0
|
||||
#define IP6_PADN_ALERT_OPTION 1
|
||||
#define IP6_ROUTER_ALERT_OPTION 5
|
||||
#define IP6_ROUTER_ALERT_VALUE_MLD 0
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/bpstruct.h"
|
||||
#endif
|
||||
@ -108,28 +145,65 @@ PACK_STRUCT_BEGIN
|
||||
struct ip6_hbh_hdr {
|
||||
/* next header */
|
||||
PACK_STRUCT_FLD_8(u8_t _nexth);
|
||||
/* header length */
|
||||
/* header length in 8-octet units */
|
||||
PACK_STRUCT_FLD_8(u8_t _hlen);
|
||||
/* router alert option type */
|
||||
PACK_STRUCT_FLD_8(u8_t _ra_opt_type);
|
||||
/* router alert option data len */
|
||||
PACK_STRUCT_FLD_8(u8_t _ra_opt_dlen);
|
||||
/* router alert option data */
|
||||
PACK_STRUCT_FIELD(u16_t _ra_opt_data);
|
||||
/* PadN option type */
|
||||
PACK_STRUCT_FLD_8(u8_t _padn_opt_type);
|
||||
/* PadN option data len */
|
||||
PACK_STRUCT_FLD_8(u8_t _padn_opt_dlen);
|
||||
} PACK_STRUCT_STRUCT;
|
||||
PACK_STRUCT_END
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/epstruct.h"
|
||||
#endif
|
||||
#define IP6_HBH_NEXTH(hdr) ((hdr)->_nexth)
|
||||
|
||||
/* Destination header. */
|
||||
#define IP6_DEST_HLEN 2
|
||||
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/bpstruct.h"
|
||||
#endif
|
||||
PACK_STRUCT_BEGIN
|
||||
struct ip6_dest_hdr {
|
||||
/* next header */
|
||||
PACK_STRUCT_FLD_8(u8_t _nexth);
|
||||
/* header length in 8-octet units */
|
||||
PACK_STRUCT_FLD_8(u8_t _hlen);
|
||||
} PACK_STRUCT_STRUCT;
|
||||
PACK_STRUCT_END
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/epstruct.h"
|
||||
#endif
|
||||
#define IP6_DEST_NEXTH(hdr) ((hdr)->_nexth)
|
||||
|
||||
/* Routing header */
|
||||
#define IP6_ROUT_TYPE2 2
|
||||
#define IP6_ROUT_RPL 3
|
||||
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/bpstruct.h"
|
||||
#endif
|
||||
PACK_STRUCT_BEGIN
|
||||
struct ip6_rout_hdr {
|
||||
/* next header */
|
||||
PACK_STRUCT_FLD_8(u8_t _nexth);
|
||||
/* reserved */
|
||||
PACK_STRUCT_FLD_8(u8_t _hlen);
|
||||
/* fragment offset */
|
||||
PACK_STRUCT_FIELD(u8_t _routing_type);
|
||||
/* fragmented packet identification */
|
||||
PACK_STRUCT_FIELD(u8_t _segments_left);
|
||||
} PACK_STRUCT_STRUCT;
|
||||
PACK_STRUCT_END
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/epstruct.h"
|
||||
#endif
|
||||
#define IP6_ROUT_NEXTH(hdr) ((hdr)->_nexth)
|
||||
#define IP6_ROUT_TYPE(hdr) ((hdr)->_routing_type)
|
||||
#define IP6_ROUT_SEG_LEFT(hdr) ((hdr)->_segments_left)
|
||||
|
||||
/* Fragment header. */
|
||||
#define IP6_FRAG_HLEN 8
|
||||
#define IP6_FRAG_OFFSET_MASK 0xfff8
|
||||
#define IP6_FRAG_MORE_FLAG 0x0001
|
||||
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/bpstruct.h"
|
||||
#endif
|
||||
@ -148,19 +222,9 @@ PACK_STRUCT_END
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/epstruct.h"
|
||||
#endif
|
||||
|
||||
#define IP6H_V(hdr) ((lwip_ntohl((hdr)->_v_tc_fl) >> 28) & 0x0f)
|
||||
#define IP6H_TC(hdr) ((lwip_ntohl((hdr)->_v_tc_fl) >> 20) & 0xff)
|
||||
#define IP6H_FL(hdr) (lwip_ntohl((hdr)->_v_tc_fl) & 0x000fffff)
|
||||
#define IP6H_PLEN(hdr) (lwip_ntohs((hdr)->_plen))
|
||||
#define IP6H_NEXTH(hdr) ((hdr)->_nexth)
|
||||
#define IP6H_NEXTH_P(hdr) ((u8_t *)(hdr) + 6)
|
||||
#define IP6H_HOPLIM(hdr) ((hdr)->_hoplim)
|
||||
|
||||
#define IP6H_VTCFL_SET(hdr, v, tc, fl) (hdr)->_v_tc_fl = (lwip_htonl((((u32_t)(v)) << 28) | (((u32_t)(tc)) << 20) | (fl)))
|
||||
#define IP6H_PLEN_SET(hdr, plen) (hdr)->_plen = lwip_htons(plen)
|
||||
#define IP6H_NEXTH_SET(hdr, nexth) (hdr)->_nexth = (nexth)
|
||||
#define IP6H_HOPLIM_SET(hdr, hl) (hdr)->_hoplim = (u8_t)(hl)
|
||||
#define IP6_FRAG_NEXTH(hdr) ((hdr)->_nexth)
|
||||
#define IP6_FRAG_MBIT(hdr) (lwip_ntohs((hdr)->_fragment_offset) & 0x1)
|
||||
#define IP6_FRAG_ID(hdr) (lwip_ntohl((hdr)->_identification))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -44,6 +44,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MLD6_HBH_HLEN 8
|
||||
/** Multicast listener report/query/done message header. */
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/bpstruct.h"
|
||||
|
@ -248,11 +248,6 @@ PACK_STRUCT_END
|
||||
#endif
|
||||
|
||||
/** Recursive DNS Server Option. */
|
||||
#if LWIP_ND6_RDNSS_MAX_DNS_SERVERS
|
||||
#define LWIP_RDNSS_OPTION_MAX_SERVERS LWIP_ND6_RDNSS_MAX_DNS_SERVERS
|
||||
#else
|
||||
#define LWIP_RDNSS_OPTION_MAX_SERVERS 1
|
||||
#endif
|
||||
#define ND6_OPTION_TYPE_RDNSS (25)
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/bpstruct.h"
|
||||
@ -263,13 +258,15 @@ struct rdnss_option {
|
||||
PACK_STRUCT_FLD_8(u8_t length);
|
||||
PACK_STRUCT_FIELD(u16_t reserved);
|
||||
PACK_STRUCT_FIELD(u32_t lifetime);
|
||||
PACK_STRUCT_FLD_S(ip6_addr_p_t rdnss_address[LWIP_RDNSS_OPTION_MAX_SERVERS]);
|
||||
PACK_STRUCT_FLD_S(ip6_addr_p_t rdnss_address[1]);
|
||||
} PACK_STRUCT_STRUCT;
|
||||
PACK_STRUCT_END
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/epstruct.h"
|
||||
#endif
|
||||
|
||||
#define SIZEOF_RDNSS_OPTION_BASE 8 /* size without addresses */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -80,8 +80,11 @@ PACK_STRUCT_END
|
||||
/* Valid TCP header flags */
|
||||
#define TCP_FLAGS 0x3fU
|
||||
|
||||
#define TCP_MAX_OPTION_BYTES 40
|
||||
|
||||
#define TCPH_HDRLEN(phdr) ((u16_t)(lwip_ntohs((phdr)->_hdrlen_rsvd_flags) >> 12))
|
||||
#define TCPH_FLAGS(phdr) ((u16_t)(lwip_ntohs((phdr)->_hdrlen_rsvd_flags) & TCP_FLAGS))
|
||||
#define TCPH_HDRLEN_BYTES(phdr) ((u8_t)(TCPH_HDRLEN(phdr) << 2))
|
||||
#define TCPH_FLAGS(phdr) ((u8_t)((lwip_ntohs((phdr)->_hdrlen_rsvd_flags) & TCP_FLAGS)))
|
||||
|
||||
#define TCPH_HDRLEN_SET(phdr, len) (phdr)->_hdrlen_rsvd_flags = lwip_htons(((len) << 12) | TCPH_FLAGS(phdr))
|
||||
#define TCPH_FLAGS_SET(phdr, flags) (phdr)->_hdrlen_rsvd_flags = (((phdr)->_hdrlen_rsvd_flags & PP_HTONS(~TCP_FLAGS)) | lwip_htons(flags))
|
||||
|
Reference in New Issue
Block a user