1 /* 2 * FreeRTOS+TCP V2.3.1 3 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 * this software and associated documentation files (the "Software"), to deal in 7 * the Software without restriction, including without limitation the rights to 8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 * the Software, and to permit persons to whom the Software is furnished to do so, 10 * subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice shall be included in all 13 * copies or substantial portions of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 * 22 * http://aws.amazon.com/freertos 23 * http://www.FreeRTOS.org 24 */ 25 26 #ifndef FREERTOS_IPV6_H 27 #define FREERTOS_IPV6_H 28 29 #include "FreeRTOS.h" 30 #include "task.h" 31 #include "FreeRTOS_IP.h" 32 #include "FreeRTOS_IP_Common.h" 33 34 /* *INDENT-OFF* */ 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 /* *INDENT-ON* */ 39 40 /* Some constants defining the sizes of several parts of a packet. 41 * These defines come before including the configuration header files. */ 42 #define ipSIZE_OF_IPv6_HEADER 40U 43 #define ipSIZE_OF_ICMPv6_HEADER 24U 44 45 #define ipSIZE_OF_IPv6_ADDRESS 16U 46 47 #define ipPROTOCOL_ICMP_IPv6 ( 58U ) 48 #define ipTYPE_IPv6 ( 0x60U ) 49 50 /* Some IPv6 ICMP requests. */ 51 #define ipICMP_DEST_UNREACHABLE_IPv6 ( ( uint8_t ) 1U ) 52 #define ipICMP_PACKET_TOO_BIG_IPv6 ( ( uint8_t ) 2U ) 53 #define ipICMP_TIME_EXEEDED_IPv6 ( ( uint8_t ) 3U ) 54 #define ipICMP_PARAMETER_PROBLEM_IPv6 ( ( uint8_t ) 4U ) 55 #define ipICMP_PING_REQUEST_IPv6 ( ( uint8_t ) 128U ) 56 #define ipICMP_PING_REPLY_IPv6 ( ( uint8_t ) 129U ) 57 #define ipICMP_ROUTER_SOLICITATION_IPv6 ( ( uint8_t ) 133U ) 58 #define ipICMP_ROUTER_ADVERTISEMENT_IPv6 ( ( uint8_t ) 134U ) 59 #define ipICMP_NEIGHBOR_SOLICITATION_IPv6 ( ( uint8_t ) 135U ) 60 #define ipICMP_NEIGHBOR_ADVERTISEMENT_IPv6 ( ( uint8_t ) 136U ) 61 62 63 #define ipIPv6_EXT_HEADER_HOP_BY_HOP 0U 64 #define ipIPv6_EXT_HEADER_ROUTING_HEADER 43U 65 #define ipIPv6_EXT_HEADER_FRAGMENT_HEADER 44U 66 #define ipIPv6_EXT_HEADER_SECURE_PAYLOAD 50U 67 #define ipIPv6_EXT_HEADER_AUTHEN_HEADER 51U 68 #define ipIPv6_EXT_HEADER_DESTINATION_OPTIONS 60U 69 /* Destination options may follow here in case there are no routing options. */ 70 #define ipIPv6_EXT_HEADER_MOBILITY_HEADER 135U 71 72 extern const struct xIPv6_Address FreeRTOS_in6addr_any; 73 extern const struct xIPv6_Address FreeRTOS_in6addr_loopback; 74 75 /* IPv6 multicast MAC address starts with 33-33-. */ 76 #define ipMULTICAST_MAC_ADDRESS_IPv6_0 0x33U 77 #define ipMULTICAST_MAC_ADDRESS_IPv6_1 0x33U 78 79 80 /* A forward declaration of 'struct xNetworkEndPoint' and 'xNetworkInterface'. 81 * The actual declaration can be found in FreeRTOS_Routing.h which is included 82 * as the last +TCP header file. */ 83 struct xNetworkEndPoint; 84 struct xNetworkInterface; 85 86 /* The function 'prvAllowIPPacket()' checks if a IPv6 packets should be processed. */ 87 eFrameProcessingResult_t prvAllowIPPacketIPv6( const IPHeader_IPv6_t * const pxIPv6Header, 88 const NetworkBufferDescriptor_t * const pxNetworkBuffer, 89 UBaseType_t uxHeaderLength ); 90 91 /** @brief Handle the IPv6 extension headers. */ 92 eFrameProcessingResult_t eHandleIPv6ExtensionHeaders( NetworkBufferDescriptor_t * const pxNetworkBuffer, 93 BaseType_t xDoRemove ); 94 95 extern void FreeRTOS_ClearND( void ); 96 97 /* Check whether this IPv6 address is an allowed multicast address or not. */ 98 BaseType_t xIsIPv6AllowedMulticast( const IPv6_Address_t * pxIPAddress ); 99 100 /* Note that 'xCompareIPv6_Address' will also check if 'pxRight' is 101 * the special unicast address: ff02::1:ffnn:nnnn, where nn:nnnn are 102 * the last 3 bytes of the IPv6 address. */ 103 BaseType_t xCompareIPv6_Address( const IPv6_Address_t * pxLeft, 104 const IPv6_Address_t * pxRight, 105 size_t uxPrefixLength ); 106 107 /* FreeRTOS_dnslookup6() returns pdTRUE when a host has been found. */ 108 uint32_t FreeRTOS_dnslookup6( const char * pcHostName, 109 IPv6_Address_t * pxAddress_IPv6 ); 110 111 /* Return IPv6 header extension order number */ 112 BaseType_t xGetExtensionOrder( uint8_t ucProtocol, 113 uint8_t ucNextHeader ); 114 115 /* *INDENT-OFF* */ 116 #ifdef __cplusplus 117 } /* extern "C" */ 118 #endif 119 /* *INDENT-ON* */ 120 121 #endif /* FREERTOS_IP_H */ 122