Implements endpoint interfaces functions and utilities. More...
#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_ARP.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DHCP.h"
#include "NetworkBufferManagement.h"
#include "FreeRTOS_DNS.h"
#include "FreeRTOS_Routing.h"
Data Structures | |
struct | xIPv6_Couple |
A util struct to list the IPv6 IP types, prefix and type bit mask. More... | |
Macros | |
#define | rMATCH_IP_ADDR 0 |
Check IP-type, IP- and MAC-address found in the network packet. | |
#define | rMATCH_IPv6_TYPE 1 |
#define | rMATCH_MAC_ADDR 2 |
#define | rMATCH_IP_TYPE 3 |
#define | rMATCH_COUNT 4 |
Functions | |
static NetworkEndPoint_t * | FreeRTOS_AddEndPoint (NetworkInterface_t *pxInterface, NetworkEndPoint_t *pxEndPoint) |
Add an end-point to a given interface. | |
void | FreeRTOS_FillEndPoint (NetworkInterface_t *pxNetworkInterface, NetworkEndPoint_t *pxEndPoint, const uint8_t ucIPAddress[ipIP_ADDRESS_LENGTH_BYTES], const uint8_t ucNetMask[ipIP_ADDRESS_LENGTH_BYTES], const uint8_t ucGatewayAddress[ipIP_ADDRESS_LENGTH_BYTES], const uint8_t ucDNSServerAddress[ipIP_ADDRESS_LENGTH_BYTES], const uint8_t ucMACAddress[ipMAC_ADDRESS_LENGTH_BYTES]) |
Configure and install a new IPv4 end-point. | |
NetworkInterface_t * | FreeRTOS_AddNetworkInterface (NetworkInterface_t *pxInterface) |
Add a network interface to the list of interfaces. Check if the interface was already added in an earlier call. | |
NetworkInterface_t * | FreeRTOS_FirstNetworkInterface (void) |
Get the first Network Interface, or NULL if none has been added. | |
NetworkInterface_t * | FreeRTOS_NextNetworkInterface (const NetworkInterface_t *pxInterface) |
Get the next interface. | |
NetworkEndPoint_t * | FreeRTOS_FirstEndPoint (const NetworkInterface_t *pxInterface) |
Find the first end-point bound to a given interface. | |
NetworkEndPoint_t * | FreeRTOS_NextEndPoint (const NetworkInterface_t *pxInterface, NetworkEndPoint_t *pxEndPoint) |
Get the next end-point. The parameter 'pxInterface' may be NULL, which means: don't care which interface the end-point is bound to. | |
NetworkEndPoint_t * | FreeRTOS_FindEndPointOnIP_IPv4 (uint32_t ulIPAddress, uint32_t ulWhere) |
Find the end-point which has a given IPv4 address. | |
NetworkEndPoint_t * | FreeRTOS_FindEndPointOnIP_IPv6 (const IPv6_Address_t *pxIPAddress) |
Find the end-point which handles a given IPv6 address. | |
NetworkEndPoint_t * | FreeRTOS_FindEndPointOnMAC (const MACAddress_t *pxMACAddress, const NetworkInterface_t *pxInterface) |
Find the end-point that has a certain MAC-address. | |
NetworkEndPoint_t * | FreeRTOS_FindEndPointOnNetMask (uint32_t ulIPAddress, uint32_t ulWhere) |
Find an end-point that handles a given IPv4-address. | |
NetworkEndPoint_t * | FreeRTOS_InterfaceEndPointOnNetMask (const NetworkInterface_t *pxInterface, uint32_t ulIPAddress, uint32_t ulWhere) |
Find an end-point that handles a given IPv4-address. | |
void | FreeRTOS_FillEndPoint_IPv6 (NetworkInterface_t *pxNetworkInterface, NetworkEndPoint_t *pxEndPoint, const IPv6_Address_t *pxIPAddress, const IPv6_Address_t *pxNetPrefix, size_t uxPrefixLength, const IPv6_Address_t *pxGatewayAddress, const IPv6_Address_t *pxDNSServerAddress, const uint8_t ucMACAddress[ipMAC_ADDRESS_LENGTH_BYTES]) |
Configure and install a new IPv6 end-point. | |
NetworkEndPoint_t * | FreeRTOS_FindEndPointOnNetMask_IPv6 (const IPv6_Address_t *pxIPv6Address) |
Find an end-point that handles a given IPv6-address. | |
NetworkEndPoint_t * | pxEasyFit (const NetworkInterface_t *pxNetworkInterface, const uint16_t usFrameType, const IP_Address_t *pxIPAddressFrom, const IP_Address_t *pxIPAddressTo, const MACAddress_t *pxMACAddress) |
Find an end-point that handles an incoming packet based on its type, source/destination & MAC address. | |
NetworkEndPoint_t * | FreeRTOS_MatchingEndpoint (const NetworkInterface_t *pxNetworkInterface, const uint8_t *pucEthernetBuffer) |
Find out the best matching end-point given an incoming Ethernet packet. | |
NetworkEndPoint_t * | FreeRTOS_FindGateWay (BaseType_t xIPType) |
Find an end-point that defines a gateway of a certain type ( IPv4 or IPv6 ). | |
NetworkEndPoint_t * | FreeRTOS_FirstEndPoint_IPv6 (const NetworkInterface_t *pxInterface) |
Find the first IPv6 end-point. | |
NetworkEndPoint_t * | pxGetSocketEndpoint (ConstSocket_t xSocket) |
Get the end-point that is bound to a socket. | |
void | vSetSocketEndpoint (Socket_t xSocket, NetworkEndPoint_t *pxEndPoint) |
Assign an end-point to a socket. | |
IPv6_Type_t | xIPv6_GetIPType (const IPv6_Address_t *pxAddress) |
Returns the IP type of the given IPv6 address. | |
const char * | pcEndpointName (const NetworkEndPoint_t *pxEndPoint, char *pcBuffer, size_t uxSize) |
Returns the string representation of the IP address of the end point. | |
Variables | |
struct xNetworkEndPoint * | pxNetworkEndPoints = NULL |
A list of all network end-points. Each element has a next pointer. | |
struct xNetworkInterface * | pxNetworkInterfaces = NULL |
A list of all network interfaces: | |
Implements endpoint interfaces functions and utilities.
#define rMATCH_IP_ADDR 0 |
Check IP-type, IP- and MAC-address found in the network packet.
Find an endpoint with a matching IP-address.
#define rMATCH_IPv6_TYPE 1 |
Find an endpoint with a matching IPv6 type (both global or non global).
#define rMATCH_MAC_ADDR 2 |
Find an endpoint with a matching MAC-address.
#define rMATCH_IP_TYPE 3 |
Find an endpoint with a matching IP-type, v4 or v6.
#define rMATCH_COUNT 4 |
The number of methods.
|
static |
Add an end-point to a given interface.
[in] | pxInterface | The interface that gets a new end-point. |
[in] | pxEndPoint | The end-point to be added. |
void FreeRTOS_FillEndPoint | ( | NetworkInterface_t * | pxNetworkInterface, |
NetworkEndPoint_t * | pxEndPoint, | ||
const uint8_t | ucIPAddress[ipIP_ADDRESS_LENGTH_BYTES], | ||
const uint8_t | ucNetMask[ipIP_ADDRESS_LENGTH_BYTES], | ||
const uint8_t | ucGatewayAddress[ipIP_ADDRESS_LENGTH_BYTES], | ||
const uint8_t | ucDNSServerAddress[ipIP_ADDRESS_LENGTH_BYTES], | ||
const uint8_t | ucMACAddress[ipMAC_ADDRESS_LENGTH_BYTES] | ||
) |
Configure and install a new IPv4 end-point.
[in] | pxNetworkInterface | The interface to which it belongs. |
[in] | pxEndPoint | Space for the new end-point. This memory is dedicated for the end-point and should not be freed or get any other purpose. |
[in] | ucIPAddress | The IP-address. |
[in] | ucNetMask | The prefix which shall be used for this end-point. |
[in] | ucGatewayAddress | The IP-address of a device on the LAN which can serve as as a gateway to the Internet. |
[in] | ucDNSServerAddress | The IP-address of a DNS server. |
[in] | ucMACAddress | The MAC address of the end-point. |
NetworkInterface_t * FreeRTOS_AddNetworkInterface | ( | NetworkInterface_t * | pxInterface | ) |
Add a network interface to the list of interfaces. Check if the interface was already added in an earlier call.
[in] | pxInterface | The address of the new interface. |
NetworkInterface_t * FreeRTOS_FirstNetworkInterface | ( | void | ) |
Get the first Network Interface, or NULL if none has been added.
NetworkInterface_t * FreeRTOS_NextNetworkInterface | ( | const NetworkInterface_t * | pxInterface | ) |
Get the next interface.
NetworkEndPoint_t * FreeRTOS_FirstEndPoint | ( | const NetworkInterface_t * | pxInterface | ) |
Find the first end-point bound to a given interface.
[in] | pxInterface | The interface whose first end-point will be returned. |
NetworkEndPoint_t * FreeRTOS_NextEndPoint | ( | const NetworkInterface_t * | pxInterface, |
NetworkEndPoint_t * | pxEndPoint | ||
) |
Get the next end-point. The parameter 'pxInterface' may be NULL, which means: don't care which interface the end-point is bound to.
[in] | pxInterface | An interface of interest, or NULL when iterating through all end-points. |
[in] | pxEndPoint | This is the current end-point. |
NetworkEndPoint_t * FreeRTOS_FindEndPointOnIP_IPv4 | ( | uint32_t | ulIPAddress, |
uint32_t | ulWhere | ||
) |
Find the end-point which has a given IPv4 address.
[in] | ulIPAddress | The IP-address of interest, or 0 if any IPv4 end-point may be returned. |
[in] | ulWhere | For maintaining routing statistics ulWhere acts as an index to the data structure that keep track of the number of times 'FreeRTOS_FindEndPointOnIP_IPv4()' has been called from a particular location. Used only if ipconfigHAS_ROUTING_STATISTICS is enabled. |
NetworkEndPoint_t * FreeRTOS_FindEndPointOnIP_IPv6 | ( | const IPv6_Address_t * | pxIPAddress | ) |
Find the end-point which handles a given IPv6 address.
[in] | pxIPAddress | The IP-address of interest. |
NetworkEndPoint_t * FreeRTOS_FindEndPointOnMAC | ( | const MACAddress_t * | pxMACAddress, |
const NetworkInterface_t * | pxInterface | ||
) |
Find the end-point that has a certain MAC-address.
[in] | pxMACAddress | The Ethernet packet. |
[in] | pxInterface | The interface on which the packet was received, or NULL when unknown. |
NetworkEndPoint_t * FreeRTOS_FindEndPointOnNetMask | ( | uint32_t | ulIPAddress, |
uint32_t | ulWhere | ||
) |
Find an end-point that handles a given IPv4-address.
[in] | ulIPAddress | The IP-address for which an end-point is looked-up. |
[in] | ulWhere | For maintaining routing statistics ulWhere acts as an index to the data structure that keep track of the number of times 'FreeRTOS_InterfaceEndPointOnNetMask()' has been called from a particular location. Used only if ipconfigHAS_ROUTING_STATISTICS is enabled. |
NetworkEndPoint_t * FreeRTOS_InterfaceEndPointOnNetMask | ( | const NetworkInterface_t * | pxInterface, |
uint32_t | ulIPAddress, | ||
uint32_t | ulWhere | ||
) |
Find an end-point that handles a given IPv4-address.
[in] | pxInterface | Only end-points that have this interface are returned, unless pxInterface is NULL. |
[in] | ulIPAddress | The IP-address for which an end-point is looked-up. |
[in] | ulWhere | For maintaining routing statistics ulWhere acts as an index to the data structure that keep track of the number of times 'FreeRTOS_InterfaceEndPointOnNetMask()' has been called from a particular location. Used only if ipconfigHAS_ROUTING_STATISTICS is enabled. |
void FreeRTOS_FillEndPoint_IPv6 | ( | NetworkInterface_t * | pxNetworkInterface, |
NetworkEndPoint_t * | pxEndPoint, | ||
const IPv6_Address_t * | pxIPAddress, | ||
const IPv6_Address_t * | pxNetPrefix, | ||
size_t | uxPrefixLength, | ||
const IPv6_Address_t * | pxGatewayAddress, | ||
const IPv6_Address_t * | pxDNSServerAddress, | ||
const uint8_t | ucMACAddress[ipMAC_ADDRESS_LENGTH_BYTES] | ||
) |
Configure and install a new IPv6 end-point.
[in] | pxNetworkInterface | The interface to which it belongs. |
[in] | pxEndPoint | Space for the new end-point. This memory is dedicated for the end-point and should not be freed or get any other purpose. |
[in] | pxIPAddress | The IP-address. |
[in] | pxNetPrefix | The prefix which shall be used for this end-point. |
[in] | uxPrefixLength | The length of the above end-point. |
[in] | pxGatewayAddress | The IP-address of a device on the LAN which can serve as as a gateway to the Internet. |
[in] | pxDNSServerAddress | The IP-address of a DNS server. |
[in] | ucMACAddress | The MAC address of the end-point. |
NetworkEndPoint_t * FreeRTOS_FindEndPointOnNetMask_IPv6 | ( | const IPv6_Address_t * | pxIPv6Address | ) |
Find an end-point that handles a given IPv6-address.
[in] | pxIPv6Address | The IP-address for which an end-point is looked-up. |
NetworkEndPoint_t * pxEasyFit | ( | const NetworkInterface_t * | pxNetworkInterface, |
const uint16_t | usFrameType, | ||
const IP_Address_t * | pxIPAddressFrom, | ||
const IP_Address_t * | pxIPAddressTo, | ||
const MACAddress_t * | pxMACAddress | ||
) |
Find an end-point that handles an incoming packet based on its type, source/destination & MAC address.
[in] | pxNetworkInterface | The interface via which the packet was received. |
[in] | usFrameType | Frame type of the packet. |
[in] | pxIPAddressFrom | Source IP address of the packet. |
[in] | pxIPAddressTo | Destination IP address of the packet. |
[in] | pxMACAddress | Destination MAC address of the packet. |
NetworkEndPoint_t * FreeRTOS_MatchingEndpoint | ( | const NetworkInterface_t * | pxNetworkInterface, |
const uint8_t * | pucEthernetBuffer | ||
) |
Find out the best matching end-point given an incoming Ethernet packet.
[in] | pxNetworkInterface | The interface on which the packet was received. |
[in] | pucEthernetBuffer | The Ethernet packet that was just received. |
NetworkEndPoint_t * FreeRTOS_FindGateWay | ( | BaseType_t | xIPType | ) |
Find an end-point that defines a gateway of a certain type ( IPv4 or IPv6 ).
[in] | xIPType | The type of Gateway to look for ( ipTYPE_IPv4 or ipTYPE_IPv6 ). |
NetworkEndPoint_t * FreeRTOS_FirstEndPoint_IPv6 | ( | const NetworkInterface_t * | pxInterface | ) |
Find the first IPv6 end-point.
[in] | pxInterface | Either NULL ( don't care ), or a specific interface. |
NetworkEndPoint_t * pxGetSocketEndpoint | ( | ConstSocket_t | xSocket | ) |
Get the end-point that is bound to a socket.
[in] | xSocket | The socket of interest. |
void vSetSocketEndpoint | ( | Socket_t | xSocket, |
NetworkEndPoint_t * | pxEndPoint | ||
) |
Assign an end-point to a socket.
[in] | xSocket | The socket to which an end-point will be assigned. |
[in] | pxEndPoint | The end-point to be assigned. |
IPv6_Type_t xIPv6_GetIPType | ( | const IPv6_Address_t * | pxAddress | ) |
Returns the IP type of the given IPv6 address.
[in] | pxAddress | The IPv6 address whose type needs to be returned. |
const char * pcEndpointName | ( | const NetworkEndPoint_t * | pxEndPoint, |
char * | pcBuffer, | ||
size_t | uxSize | ||
) |
Returns the string representation of the IP address of the end point.
[in] | pxEndPoint | End point for which IP address needs to be returned. |
[in] | pcBuffer | A char buffer of required size to which the string will be written. |
[in] | uxSize | Size of the char buffer - pcBuffer. |