1
0
mirror of https://github.com/FreeRTOS/FreeRTOS-Plus-TCP synced 2025-10-24 03:32:36 +08:00
Files
FreeRTOS-Plus-TCP/source/include/FreeRTOS_IPv4.h
Tony Josi 1f98752059 Adding IPv4/v6 build level separation: integration branch (#855)
* use matching endpoint instead of first endpoint

* update with @htibosch  latest changes

* fix formatting

* fix misra and spellings

* code clean up

* wip separation IP

* separation IP

* separation IP

* wip buils separation

* fixing unit tests

* fix unit tests

* fix formatting

* wip , next prvProcessNetworkDownEvent

* adding build separation to ip utils

* fix unit tests

* fix formatting

* update xCheckRequiresARPResolution

* update vARPAgeCache

* update vARPAgeCache

* misra checks

* fix formatting

* fix misra

* wip s/w: FreeRTOS_recvfrom

* wip sockets till prvSocketBindAdd

* adding  build separation to FreeRTOS_Sockets.c

* add build config support to FreeRTOS_inet_pton FreeRTOS_inet_ntop FreeRTOS_GetIPType

* adding build config support

* fix build  issues

* check misra

* minor fix

* fix unit tests

* fix unit tests build

* Uncrustify: triggered by comment

* fix formatting

* build separate FreeRTOS_TCP_IP.c

* build separate FreeRTOS_TCP_Reception.c

* misra fix

* build separate FreeRTOS_TCP_State_Handling.c

* build separate FreeRTOS_TCP_Transmission.c

* build separate FreeRTOS_TCP_Transmission.c fix build

* adding build separation for FreeRTOS_TCP_Utils.c and FreeRTOS_TCP_Transmission.c

* fix formatting

* UDP: Build Separation Changes

Changes in UDP files to support IPv4 and IPv6 Build Separation.

* fix IPv4 build issues post build sep merge

* IPv4 only build

* more - fix IPv4 build issues post build sep merge

* fix DHCP v4

* fix v6 build

* add v6 build checks

* separate v4v6 tcp files

* fix rebase conflicts

* fix formatting

* fix build when TCP disabled

* add more build checks

* adding more ipv4 flags to v4 specific files

* fix udp unit tests

* add build config build tests to CI

* fix formatting

* fix build checks yml

* DNS: Build Separation Changes

Changes for supporting IPv4 and IPv6 build separation in DNS.

* Routing: Build Separtion Changes

Changes for supporting IPv4 and IPv6 build separation in Routing.

* DNS build fix and rebase to latest changes

* fix formatting

* fix unit tests

* fix formatting

* fix MISRA

* updaating ARP functions to be available on all configs

* plus_tcp_demo_cli build config changes

* fix formatting, guard FreeRTOS_FillEndPoint inside ipconfigUSE_IPv4 check

* more build sepration changes to routing

* build separation plus_tcp_demo_cli.c

* fixing issues with routing, fix formatting

* adding pxFindEndpoint of plus_tcp_demo_cli inside ipconfigUSE_IPv6 != 0 check

* minor build fix

* moving usDNSType of endpoint struct out of ipconfigUSE_IPv6 check

* update code to use IP family while using socket APIs

* moving vSetMultiCastIPv4MacAddress to FreeRTOS_IPv4_Utils.c

* fix routing

* build DNS only if IPv4 is enabled

* fix review feedback

* fix build

* fix build

* fix formatting

* fix comment

* fix wrt reeview feedback

* fix unit tests

* cleanup FreeRTOS_MatchingEndpoint

* fix FreeRTOS_MatchingEndpoint to handle cusstom frames

---------

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: shubnil <103672514+shubnil@users.noreply.github.com>
2023-05-09 19:48:59 +05:30

106 lines
4.0 KiB
C

/*
* FreeRTOS+TCP <DEVELOPMENT BRANCH>
* Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://aws.amazon.com/freertos
* http://www.FreeRTOS.org
*/
#ifndef FREERTOS_IPV4_H
#define FREERTOS_IPV4_H
/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */
#include "FreeRTOS.h"
#include "task.h"
#include "FreeRTOS_IP.h"
/* Application level configuration options. */
#include "FreeRTOSIPConfig.h"
#include "FreeRTOSIPConfigDefaults.h"
#include "IPTraceMacroDefaults.h"
#define ipSIZE_OF_IPv4_HEADER 20U
#define ipSIZE_OF_IPv4_ADDRESS 4U
#define ipSIZE_OF_ICMPv4_HEADER 8U
#define ipTYPE_IPv4 ( 0x40U )
/* The number of octets in the IP addresses respectively. */
#define ipIP_ADDRESS_LENGTH_BYTES ( 4U )
#define ipFIRST_LOOPBACK_IPv4 0x7F000000UL /**< Lowest IPv4 loopback address (including). */
#define ipLAST_LOOPBACK_IPv4 0x80000000UL /**< Highest IPv4 loopback address (excluding). */
/* The first byte in the IPv4 header combines the IP version (4) with
* with the length of the IP header. */
#define ipIPV4_VERSION_HEADER_LENGTH_MIN 0x45U /**< Minimum IPv4 header length. */
#define ipIPV4_VERSION_HEADER_LENGTH_MAX 0x4FU /**< Maximum IPv4 header length. */
/*
* These functions come from the IPv4-only library.
* TODO : They should get an extra parameter, the end-point
* void FreeRTOS_SetIPAddress( uint32_t ulIPAddress );
* void FreeRTOS_SetNetmask( uint32_t ulNetmask );
* void FreeRTOS_SetGatewayAddress( uint32_t ulGatewayAddress );
* uint32_t FreeRTOS_GetGatewayAddress( void );
* uint32_t FreeRTOS_GetDNSServerAddress( void );
* uint32_t FreeRTOS_GetNetmask( void );
*/
void FreeRTOS_SetIPAddress( uint32_t ulIPAddress );
void FreeRTOS_SetNetmask( uint32_t ulNetmask );
void FreeRTOS_SetGatewayAddress( uint32_t ulGatewayAddress );
uint32_t FreeRTOS_GetGatewayAddress( void );
uint32_t FreeRTOS_GetDNSServerAddress( void );
uint32_t FreeRTOS_GetNetmask( void );
uint32_t FreeRTOS_GetIPAddress( void );
/* Show all valid ARP entries
*/
#if ( ipconfigHAS_PRINTF != 0 ) || ( ipconfigHAS_DEBUG_PRINTF != 0 )
void FreeRTOS_PrintARPCache( void );
#endif
/* Return pdTRUE if the IPv4 address is a multicast address. */
BaseType_t xIsIPv4Multicast( uint32_t ulIPAddress );
/* The function 'prvAllowIPPacket()' checks if a packets should be processed. */
eFrameProcessingResult_t prvAllowIPPacketIPv4( const IPPacket_t * const pxIPPacket,
const NetworkBufferDescriptor_t * const pxNetworkBuffer,
UBaseType_t uxHeaderLength );
/* Check if the IP-header is carrying options. */
eFrameProcessingResult_t prvCheckIP4HeaderOptions( NetworkBufferDescriptor_t * const pxNetworkBuffer );
/* *INDENT-OFF* */
#ifdef __cplusplus
} /* extern "C" */
#endif
/* *INDENT-ON* */
#endif /* FREERTOS_IP_H */