diff --git a/V4.3.1/_free_r_t_o_s___a_r_p_8c.html b/V4.3.1/_free_r_t_o_s___a_r_p_8c.html new file mode 100644 index 000000000..4ed1563a8 --- /dev/null +++ b/V4.3.1/_free_r_t_o_s___a_r_p_8c.html @@ -0,0 +1,858 @@ + + +
+ + + + +Implements the Address Resolution Protocol for the FreeRTOS+TCP network stack. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_IP_Timers.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_ARP.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DHCP.h"
#include "FreeRTOS_DNS.h"
#include "NetworkBufferManagement.h"
#include "NetworkInterface.h"
#include "FreeRTOS_Routing.h"
+Functions | |
static void | vARPProcessPacketRequest (ARPPacket_t *pxARPFrame, NetworkEndPoint_t *pxTargetEndPoint, uint32_t ulSenderProtocolAddress) |
Process an ARP request packets. | |
static void | vARPProcessPacketReply (const ARPPacket_t *pxARPFrame, NetworkEndPoint_t *pxTargetEndPoint, uint32_t ulSenderProtocolAddress) |
A device has sent an ARP reply, process it. | |
static eResolutionLookupResult_t | prvCacheLookup (uint32_t ulAddressToLookup, MACAddress_t *const pxMACAddress, NetworkEndPoint_t **ppxEndPoint) |
Lookup an IP address in the ARP cache. | |
static eResolutionLookupResult_t | eARPGetCacheEntryGateWay (uint32_t *pulIPAddress, MACAddress_t *const pxMACAddress, struct xNetworkEndPoint **ppxEndPoint) |
The IPv4 address is apparently a web-address. Find a gateway.. | |
static BaseType_t | prvFindCacheEntry (const MACAddress_t *pxMACAddress, const uint32_t ulIPAddress, struct xNetworkEndPoint *pxEndPoint, CacheLocation_t *pxLocation) |
The results of an ARP look-up shall be stored in the ARP cache. This helper function looks up the location. | |
eFrameProcessingResult_t | eARPProcessPacket (const NetworkBufferDescriptor_t *pxNetworkBuffer) |
Process the ARP packets. | |
BaseType_t | xIsIPInARPCache (uint32_t ulAddressToLookup) |
Check whether an IP address is in the ARP cache. | |
BaseType_t | xCheckRequiresARPResolution (const NetworkBufferDescriptor_t *pxNetworkBuffer) |
Check whether a packet needs ARP resolution if it is on local subnet. If required send an ARP request. | |
void | vARPRefreshCacheEntryAge (const MACAddress_t *pxMACAddress, const uint32_t ulIPAddress) |
Look for an IP-MAC couple in ARP cache and reset the 'age' field. If no match is found then no action will be taken. | |
void | vARPRefreshCacheEntry (const MACAddress_t *pxMACAddress, const uint32_t ulIPAddress, struct xNetworkEndPoint *pxEndPoint) |
Add/update the ARP cache entry MAC-address to IP-address mapping. | |
eResolutionLookupResult_t | eARPGetCacheEntry (uint32_t *pulIPAddress, MACAddress_t *const pxMACAddress, struct xNetworkEndPoint **ppxEndPoint) |
Look for ulIPAddress in the ARP cache. | |
+void | vARPAgeCache (void) |
A call to this function will update (or 'Age') the ARP cache entries. The function will also try to prevent a removal of entry by sending an ARP query. It will also check whether we are waiting on an ARP reply - if we are, then an ARP request will be re-sent. In case an ARP entry has 'Aged' to 0, it will be removed from the ARP cache. | |
+void | vARPSendGratuitous (void) |
Send a Gratuitous ARP packet to allow this node to announce the IP-MAC mapping to the entire network. | |
void | FreeRTOS_OutputARPRequest_Multi (NetworkEndPoint_t *pxEndPoint, uint32_t ulIPAddress) |
Create and send an ARP request packet to given IPv4 endpoint. | |
void | FreeRTOS_OutputARPRequest (uint32_t ulIPAddress) |
Create and send an ARP request packet. | |
BaseType_t | xARPWaitResolution (uint32_t ulIPAddress, TickType_t uxTicksToWait) |
Wait for address resolution: look-up the IP-address in the ARP-cache, and if needed send an ARP request, and wait for a reply. This function is useful when called before FreeRTOS_sendto(). | |
void | vARPGenerateRequestPacket (NetworkBufferDescriptor_t *const pxNetworkBuffer) |
Generate an ARP request packet by copying various constant details to the buffer. | |
void | FreeRTOS_ClearARP (const struct xNetworkEndPoint *pxEndPoint) |
A call to this function will clear the ARP cache. | |
Implements the Address Resolution Protocol for the FreeRTOS+TCP network stack.
+
+
|
+ +static | +
Process an ARP request packets.
+[in] | pxARPFrame | the complete ARP-frame. |
[in] | pxTargetEndPoint | the end-point that handles the peer's address. |
[in] | ulSenderProtocolAddress | the IP-address of the sender. |
+
|
+ +static | +
A device has sent an ARP reply, process it.
+[in] | pxARPFrame | The ARP packet received. |
[in] | pxTargetEndPoint | The end-point on which it is received. |
[in] | ulSenderProtocolAddress | The IPv4 address involved. |
+
|
+ +static | +
Lookup an IP address in the ARP cache.
+[in] | ulAddressToLookup | The 32-bit representation of an IP address to lookup. |
[out] | pxMACAddress | A pointer to MACAddress_t variable where, if there is an ARP cache hit, the MAC address corresponding to the IP address will be stored. |
[in,out] | ppxEndPoint | a pointer to the end-point will be stored. |
+
|
+ +static | +
The IPv4 address is apparently a web-address. Find a gateway..
+[in] | pulIPAddress | The target IP-address. It may be replaced with the IP address of a gateway. |
[in] | pxMACAddress | In case the MAC-address is found in cache, it will be stored to the buffer provided. |
[out] | ppxEndPoint | The end-point of the gateway will be copy to the pointee. |
+
|
+ +static | +
The results of an ARP look-up shall be stored in the ARP cache. This helper function looks up the location.
+[in] | pxMACAddress | The MAC-address belonging to the IP-address. |
[in] | ulIPAddress | The IP-address of the entry. |
[in] | pxEndPoint | The end-point that will stored in the table. |
[out] | pxLocation | The results of this search are written in this struct. |
eFrameProcessingResult_t eARPProcessPacket | +( | +const NetworkBufferDescriptor_t * | +pxNetworkBuffer | ) | ++ |
Process the ARP packets.
+[in] | pxNetworkBuffer | The network buffer with the packet to be processed. |
BaseType_t xIsIPInARPCache | +( | +uint32_t | +ulAddressToLookup | ) | ++ |
Check whether an IP address is in the ARP cache.
+[in] | ulAddressToLookup | The 32-bit representation of an IP address to check for. |
BaseType_t xCheckRequiresARPResolution | +( | +const NetworkBufferDescriptor_t * | +pxNetworkBuffer | ) | ++ |
Check whether a packet needs ARP resolution if it is on local subnet. If required send an ARP request.
+[in] | pxNetworkBuffer | The network buffer with the packet to be checked. |
void vARPRefreshCacheEntryAge | +( | +const MACAddress_t * | +pxMACAddress, | +
+ | + | const uint32_t | +ulIPAddress | +
+ | ) | ++ |
Look for an IP-MAC couple in ARP cache and reset the 'age' field. If no match is found then no action will be taken.
+[in] | pxMACAddress | Pointer to the MAC address whose entry needs to be updated. |
[in] | ulIPAddress | the IP address whose corresponding entry needs to be updated. |
void vARPRefreshCacheEntry | +( | +const MACAddress_t * | +pxMACAddress, | +
+ | + | const uint32_t | +ulIPAddress, | +
+ | + | struct xNetworkEndPoint * | +pxEndPoint | +
+ | ) | ++ |
Add/update the ARP cache entry MAC-address to IP-address mapping.
+[in] | pxMACAddress | Pointer to the MAC address whose mapping is being updated. |
[in] | ulIPAddress | 32-bit representation of the IP-address whose mapping is being updated. |
[in] | pxEndPoint | The end-point stored in the table. |
eResolutionLookupResult_t eARPGetCacheEntry | +( | +uint32_t * | +pulIPAddress, | +
+ | + | MACAddress_t *const | +pxMACAddress, | +
+ | + | struct xNetworkEndPoint ** | +ppxEndPoint | +
+ | ) | ++ |
Look for ulIPAddress in the ARP cache.
+[in,out] | pulIPAddress | Pointer to the IP-address to be queried to the ARP cache. |
[in,out] | pxMACAddress | Pointer to a MACAddress_t variable where the MAC address will be stored, if found. |
[out] | ppxEndPoint | Pointer to the end-point of the gateway will be stored. |
void FreeRTOS_OutputARPRequest_Multi | +( | +NetworkEndPoint_t * | +pxEndPoint, | +
+ | + | uint32_t | +ulIPAddress | +
+ | ) | ++ |
Create and send an ARP request packet to given IPv4 endpoint.
+[in] | pxEndPoint | Endpoint through which the requests should be sent. |
[in] | ulIPAddress | A 32-bit representation of the IP-address whose physical (MAC) address is required. |
void FreeRTOS_OutputARPRequest | +( | +uint32_t | +ulIPAddress | ) | ++ |
Create and send an ARP request packet.
+[in] | ulIPAddress | A 32-bit representation of the IP-address whose physical (MAC) address is required. |
BaseType_t xARPWaitResolution | +( | +uint32_t | +ulIPAddress, | +
+ | + | TickType_t | +uxTicksToWait | +
+ | ) | ++ |
Wait for address resolution: look-up the IP-address in the ARP-cache, and if needed send an ARP request, and wait for a reply. This function is useful when called before FreeRTOS_sendto().
+[in] | ulIPAddress | The IP-address to look-up. |
[in] | uxTicksToWait | The maximum number of clock ticks to wait for a reply. |
void vARPGenerateRequestPacket | +( | +NetworkBufferDescriptor_t *const | +pxNetworkBuffer | ) | ++ |
Generate an ARP request packet by copying various constant details to the buffer.
+[in,out] | pxNetworkBuffer | Pointer to the buffer which has to be filled with the ARP request packet details. |
void FreeRTOS_ClearARP | +( | +const struct xNetworkEndPoint * | +pxEndPoint | ) | ++ |
A call to this function will clear the ARP cache.
+[in] | pxEndPoint | only clean entries with this end-point, or when NULL, clear the entire ARP cache. |
Some functions that help when analysing a binary stream of information. It offers an alternative to using packet structs with unaligned data members. +More...
+#include <stdint.h>
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_BitConfig.h"
+Functions | |
BaseType_t | xBitConfig_init (BitConfig_t *pxConfig, const uint8_t *pucData, size_t uxSize) |
Initialise a bit-config struct. | |
BaseType_t | xBitConfig_read_uc (BitConfig_t *pxConfig, uint8_t *pucData, size_t uxSize) |
Read from a bit-config struct. | |
BaseType_t | pucBitConfig_peek_last_index_uc (BitConfig_t *pxConfig, uint8_t *pucData, size_t uxSize) |
Peek the last byte from a bit-config struct. | |
uint8_t | ucBitConfig_read_8 (BitConfig_t *pxConfig) |
Read a byte from the bit stream. | |
uint16_t | usBitConfig_read_16 (BitConfig_t *pxConfig) |
Read 2 bytes from the bit stream. | |
uint32_t | ulBitConfig_read_32 (BitConfig_t *pxConfig) |
Read 4 bytes from the bit stream. | |
void | vBitConfig_write_uc (BitConfig_t *pxConfig, const uint8_t *pucData, size_t uxSize) |
Read any number bytes from the bit stream. | |
void | vBitConfig_write_8 (BitConfig_t *pxConfig, uint8_t ucValue) |
Write a byte to the bit stream. | |
void | vBitConfig_write_16 (BitConfig_t *pxConfig, uint16_t usValue) |
Write a short word to the bit stream. | |
void | vBitConfig_write_32 (BitConfig_t *pxConfig, uint32_t ulValue) |
Write a 32-bit word to the bit stream. | |
void | vBitConfig_release (BitConfig_t *pxConfig) |
Deallocate ( release ) the buffer, and clear the bit stream structure. Note that the struct must have be initialised before calling this function. | |
Some functions that help when analysing a binary stream of information. It offers an alternative to using packet structs with unaligned data members.
+BaseType_t xBitConfig_init | +( | +BitConfig_t * | +pxConfig, | +
+ | + | const uint8_t * | +pucData, | +
+ | + | size_t | +uxSize | +
+ | ) | ++ |
Initialise a bit-config struct.
+[in] | pxConfig | The structure containing a copy of the bits. |
[in] | pucData | Not NULL if a bit-stream must be analysed, otherwise NULL. |
[in] | uxSize | The length of the binary data stream. |
BaseType_t xBitConfig_read_uc | +( | +BitConfig_t * | +pxConfig, | +
+ | + | uint8_t * | +pucData, | +
+ | + | size_t | +uxSize | +
+ | ) | ++ |
Read from a bit-config struct.
+[in] | pxConfig | The structure containing a copy of the bits. |
[in] | pucData | Not NULL if a bit-stream must be analysed, otherwise NULL. |
[in] | uxSize | The length of the binary data stream. |
BaseType_t pucBitConfig_peek_last_index_uc | +( | +BitConfig_t * | +pxConfig, | +
+ | + | uint8_t * | +pucData, | +
+ | + | size_t | +uxSize | +
+ | ) | ++ |
Peek the last byte from a bit-config struct.
+[in] | pxConfig | The structure containing a copy of the bits. |
[in] | pucData | The buffer to stored peeked data. |
[in] | uxSize | The length of the binary data stream. |
uint8_t ucBitConfig_read_8 | +( | +BitConfig_t * | +pxConfig | ) | ++ |
Read a byte from the bit stream.
+[in] | pxConfig | The structure containing a copy of the bits. |
uint16_t usBitConfig_read_16 | +( | +BitConfig_t * | +pxConfig | ) | ++ |
Read 2 bytes from the bit stream.
+[in] | pxConfig | The structure containing a copy of the bits. |
uint32_t ulBitConfig_read_32 | +( | +BitConfig_t * | +pxConfig | ) | ++ |
Read 4 bytes from the bit stream.
+[in] | pxConfig | The structure containing a copy of the bits. |
void vBitConfig_write_uc | +( | +BitConfig_t * | +pxConfig, | +
+ | + | const uint8_t * | +pucData, | +
+ | + | size_t | +uxSize | +
+ | ) | ++ |
Read any number bytes from the bit stream.
+[in] | pxConfig | The structure containing a copy of the bit stream. |
[in] | pucData | The binary data to be written. |
[in] | uxSize | The number of bytes to be written. |
There is no return value. If the operation has failed, the field xHasError will be set.
+ +void vBitConfig_write_8 | +( | +BitConfig_t * | +pxConfig, | +
+ | + | uint8_t | +ucValue | +
+ | ) | ++ |
Write a byte to the bit stream.
+[in] | pxConfig | The structure containing a copy of the bits. |
[in] | ucValue | The byte to be written. |
There is no return value. If the operation has failed, the field xHasError will be set.
+ +void vBitConfig_write_16 | +( | +BitConfig_t * | +pxConfig, | +
+ | + | uint16_t | +usValue | +
+ | ) | ++ |
Write a short word to the bit stream.
+[in] | pxConfig | The structure containing a copy of the bits. |
[in] | usValue | The 16-bit value to be written. |
There is no return value. If the operation has failed, the field xHasError will be set.
+ +void vBitConfig_write_32 | +( | +BitConfig_t * | +pxConfig, | +
+ | + | uint32_t | +ulValue | +
+ | ) | ++ |
Write a 32-bit word to the bit stream.
+[in] | pxConfig | The structure containing a copy of the bits. |
[in] | ulValue | The 32-bit value to be written. |
There is no return value. If the operation has failed, the field xHasError will be set.
+ +void vBitConfig_release | +( | +BitConfig_t * | +pxConfig | ) | ++ |
Deallocate ( release ) the buffer, and clear the bit stream structure. Note that the struct must have be initialised before calling this function.
+[in] | pxConfig | The structure containing a copy of the bits. |
Implements the Dynamic Host Configuration Protocol for the FreeRTOS+TCP network stack. +More...
+#include <stdint.h>
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DHCP.h"
#include "FreeRTOS_ARP.h"
#include "FreeRTOS_IP_Timers.h"
#include "NetworkInterface.h"
#include "NetworkBufferManagement.h"
#include "FreeRTOS_Routing.h"
+Macros | |
#define | EP_DHCPData pxEndPoint->xDHCPData |
#define | EP_IPv4_SETTINGS pxEndPoint->ipv4_settings |
+Functions | |
static BaseType_t | prvSendDHCPDiscover (NetworkEndPoint_t *pxEndPoint) |
Create and send a DHCP discover packet through the DHCP socket. | |
static BaseType_t | prvProcessDHCPReplies (BaseType_t xExpectedMessageType, NetworkEndPoint_t *pxEndPoint) |
Process the DHCP replies. | |
static BaseType_t | prvSendDHCPRequest (NetworkEndPoint_t *pxEndPoint) |
Create and send a DHCP request message through the DHCP socket. | |
static void | prvInitialiseDHCP (NetworkEndPoint_t *pxEndPoint) |
Initialise the DHCP state machine by creating DHCP socket and begin the transaction. | |
static uint8_t * | prvCreatePartDHCPMessage (struct freertos_sockaddr *pxAddress, BaseType_t xOpcode, const uint8_t *const pucOptionsArray, size_t *pxOptionsArraySize, const NetworkEndPoint_t *pxEndPoint) |
Create a partial DHCP message by filling in all the 'constant' fields. | |
+_static void | prvCreateDHCPSocket (NetworkEndPoint_t *pxEndPoint) |
Create a DHCP socket with the defined timeouts. The same socket will be shared among all end-points that need DHCP. | |
static void | prvCloseDHCPSocket (NetworkEndPoint_t *pxEndPoint) |
Close the DHCP socket, but only when there are no other end-points using it. | |
static void | vDHCPProcessEndPoint (BaseType_t xReset, BaseType_t xDoCheck, NetworkEndPoint_t *pxEndPoint) |
Process the DHCP state machine based on current state. | |
static BaseType_t | xHandleWaitingOffer (NetworkEndPoint_t *pxEndPoint, BaseType_t xDoCheck) |
Called by vDHCPProcessEndPoint(), this function handles the state 'eWaitingOffer'. If there is a reply, it will be examined, if there is a time-out, there may be a new new attempt, or it will give up. | |
static void | vHandleWaitingAcknowledge (NetworkEndPoint_t *pxEndPoint, BaseType_t xDoCheck) |
Called by vDHCPProcessEndPoint(), this function handles the state 'eWaitingAcknowledge'. If there is a reply, it will be examined, if there is a time-out, there may be a new new attempt, or it will give up. After the acknowledge, the leasing of an IP-address will start. | |
static BaseType_t | xHandleWaitingFirstDiscover (NetworkEndPoint_t *pxEndPoint) |
Called by vDHCPProcessEndPoint(), this function handles the state 'eWaitingSendFirstDiscover'. If will send a DISCOVER message to a DHCP server, and move to the next status 'eWaitingOffer'. | |
static void | prvHandleWaitingeLeasedAddress (NetworkEndPoint_t *pxEndPoint) |
Called by vDHCPProcessEndPoint(), this function handles the state 'eLeasedAddress'. If waits until the lease must be renewed, and then send a new request. | |
static void | vProcessHandleOption (NetworkEndPoint_t *pxEndPoint, ProcessSet_t *pxSet, BaseType_t xExpectedMessageType) |
Called by prvProcessDHCPReplies(), which walks through an array of DHCP options, this function will check a single option. | |
static BaseType_t | xProcessCheckOption (ProcessSet_t *pxSet) |
Check an incoming DHCP option. | |
BaseType_t | xIsDHCPSocket (const ConstSocket_t xSocket) |
Check whether a given socket is the DHCP socket or not. | |
void | vDHCPProcess (BaseType_t xReset, struct xNetworkEndPoint *pxEndPoint) |
Process the DHCP state machine based on current state. | |
void | vDHCPStop (struct xNetworkEndPoint *pxEndPoint) |
Stop the DHCP process. Close the DHCP socket when it's no longer used by any end-point. | |
static BaseType_t | prvIsValidDHCPResponse (const DHCPMessage_IPv4_t *pxDHCPMessage) |
Check whether the DHCP response from the server has all valid invariant parameters and valid (non broadcast and non localhost) IP address being assigned to the device. | |
Implements the Dynamic Host Configuration Protocol for the FreeRTOS+TCP network stack.
+#define EP_DHCPData pxEndPoint->xDHCPData | +
Temporary define to make /single source similar to /multi version.
+ +#define EP_IPv4_SETTINGS pxEndPoint->ipv4_settings | +
Temporary define to make /single source similar to /multi version.
+ +
+
|
+ +static | +
Create and send a DHCP discover packet through the DHCP socket.
+[in] | pxEndPoint | the end-point for which the discover message will be sent. |
+
|
+ +static | +
Process the DHCP replies.
+[in] | xExpectedMessageType | The type of the message the DHCP state machine is expecting. Messages of different type will be dropped. |
[in] | pxEndPoint | The end-point to whom the replies are addressed. |
+
|
+ +static | +
Create and send a DHCP request message through the DHCP socket.
+[in] | pxEndPoint | The end-point for which the request will be sent. |
+
|
+ +static | +
Initialise the DHCP state machine by creating DHCP socket and begin the transaction.
+[in] | pxEndPoint | The end-point that needs DHCP. |
+
|
+ +static | +
Create a partial DHCP message by filling in all the 'constant' fields.
+[out] | pxAddress | Address to be filled in. |
[out] | xOpcode | Opcode to be filled in the packet. Will always be 'dhcpREQUEST_OPCODE'. |
[in] | pucOptionsArray | The options to be added to the packet. |
[in,out] | pxOptionsArraySize | Byte count of the options. Its value might change. |
[in] | pxEndPoint | The end-point for which the request will be sent. |
+
|
+ +static | +
Close the DHCP socket, but only when there are no other end-points using it.
+[in] | pxEndPoint | The end-point that stops using the socket. |
+
|
+ +static | +
Process the DHCP state machine based on current state.
+[in] | xReset | Is the DHCP state machine starting over? pdTRUE/pdFALSE. |
[in] | xDoCheck | true when an incoming message is to be expected, and prvProcessDHCPReplies() will be called. |
[in] | pxEndPoint | The end-point for which the DHCP state machine should make one cycle. |
+
|
+ +static | +
Called by vDHCPProcessEndPoint(), this function handles the state 'eWaitingOffer'. If there is a reply, it will be examined, if there is a time-out, there may be a new new attempt, or it will give up.
+[in] | pxEndPoint | The end-point that is getting an IP-address from a DHCP server |
[in] | xDoCheck | When true, the function must handle any replies. |
+
|
+ +static | +
Called by vDHCPProcessEndPoint(), this function handles the state 'eWaitingAcknowledge'. If there is a reply, it will be examined, if there is a time-out, there may be a new new attempt, or it will give up. After the acknowledge, the leasing of an IP-address will start.
+[in] | pxEndPoint | The end-point that is getting an IP-address from a DHCP server |
[in] | xDoCheck | When true, the function must handle any replies. |
+
|
+ +static | +
Called by vDHCPProcessEndPoint(), this function handles the state 'eWaitingSendFirstDiscover'. If will send a DISCOVER message to a DHCP server, and move to the next status 'eWaitingOffer'.
+[in] | pxEndPoint | The end-point that is getting an IP-address from a DHCP server |
+
|
+ +static | +
Called by vDHCPProcessEndPoint(), this function handles the state 'eLeasedAddress'. If waits until the lease must be renewed, and then send a new request.
+[in] | pxEndPoint | The end-point that is getting an IP-address from a DHCP server |
+
|
+ +static | +
Called by prvProcessDHCPReplies(), which walks through an array of DHCP options, this function will check a single option.
+[in] | pxEndPoint | The end-point that needs an IP-address. |
[in] | pxSet | A set of variables that describe the parsing process. |
[in] | xExpectedMessageType | The type of message expected in the dhcpIPv4_MESSAGE_TYPE_OPTION_CODE option. |
+
|
+ +static | +
Check an incoming DHCP option.
+[in] | pxSet | A set of variables needed to parse the DHCP reply. |
BaseType_t xIsDHCPSocket | +( | +const ConstSocket_t | +xSocket | ) | ++ |
Check whether a given socket is the DHCP socket or not.
+[in] | xSocket | The socket to be checked. |
void vDHCPProcess | +( | +BaseType_t | +xReset, | +
+ | + | struct xNetworkEndPoint * | +pxEndPoint | +
+ | ) | ++ |
Process the DHCP state machine based on current state.
+[in] | xReset | Is the DHCP state machine starting over? pdTRUE/pdFALSE. |
[in] | pxEndPoint | The end-point for which the DHCP state machine should make one cycle. |
void vDHCPStop | +( | +struct xNetworkEndPoint * | +pxEndPoint | ) | ++ |
Stop the DHCP process. Close the DHCP socket when it's no longer used by any end-point.
+[in] | pxEndPoint | The end-point for which we want to stop the DHCP process. |
+
|
+ +static | +
Check whether the DHCP response from the server has all valid invariant parameters and valid (non broadcast and non localhost) IP address being assigned to the device.
+[in] | pxDHCPMessage | The DHCP message. |
A DHCPv6 client. +More...
+#include <stdio.h>
#include <ctype.h>
#include <FreeRTOS.h>
#include "task.h"
#include "timers.h"
#include "queue.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_DHCPv6.h"
#include "FreeRTOS_DNS.h"
#include "NetworkBufferManagement.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_IP_Timers.h"
#include "FreeRTOS_BitConfig.h"
#include "FreeRTOS_Routing.h"
+Macros | |
+#define | dhcpINITIAL_TIMER_PERIOD ( pdMS_TO_TICKS( 250U ) ) |
DHCP timer period in ms. | |
+#define | dhcpINITIAL_DHCP_TX_PERIOD ( pdMS_TO_TICKS( 5000U ) ) |
DHCP transmit period in ms. | |
+#define | EP_DHCPData pxEndPoint->xDHCPData |
The following define is temporary and serves to make the /single source code more similar to the /multi version. | |
+#define | EP_IPv6_SETTINGS pxEndPoint->ipv6_settings |
Macro to access the IPv6 settings from the pxEndPoint. | |
+#define | DHCPv6_SEND_MAX_BUFFER_SIZE ( 256 ) |
The maximum size of send buffer. | |
#define | dhcpMANDATORY_OPTIONS |
When a reply is received, some options are mandatory for this driver. | |
+Functions | |
static BaseType_t | prvIsOptionLengthValid (uint16_t usOption, size_t uxOptionLength, size_t uxRemainingSize) |
Check if option length is less than buffer size and larger than minimum requirement. | |
static BaseType_t | prvDHCPv6Analyse (struct xNetworkEndPoint *pxEndPoint, const uint8_t *pucAnswer, size_t uxTotalLength, DHCPMessage_IPv6_t *pxDHCPMessage) |
Analyse the reply from a DHCP server. | |
static void | vDHCPv6ProcessEndPoint (BaseType_t xReset, NetworkEndPoint_t *pxEndPoint, DHCPMessage_IPv6_t *pxDHCPMessage) |
Run one cycle of the DHCP state machine. | |
static void | prvInitialiseDHCPv6 (NetworkEndPoint_t *pxEndPoint) |
Initialise the DHCP state machine of a given end-point. | |
static void | prvSendDHCPMessage (NetworkEndPoint_t *pxEndPoint) |
Send a DHCPv6 message to a DHCP server. | |
static void | prvCreateDHCPv6Socket (NetworkEndPoint_t *pxEndPoint) |
Return the UDP/DHCP socket, or create if it doesn't exist. | |
static void | prvCloseDHCPv6Socket (NetworkEndPoint_t *pxEndPoint) |
Close the shared UDP/DHCP socket. This results in lowering the reference count. The last user of the socket will close it. | |
static BaseType_t | xDHCPv6Process_PassReplyToEndPoint (struct xNetworkEndPoint *pxEndPoint) |
A DHCPv6 reply has been received. See to which end-point it belongs and pass it. | |
static void | vDHCPv6ProcessEndPoint_HandleReply (NetworkEndPoint_t *pxEndPoint, DHCPMessage_IPv6_t *pxDHCPMessage) |
The DHCP process is about ready: the server sends a confirmation that the assigned IPv6 address may be used. The settings will be copied to 'pxEndPoint->ipv6_settings'. | |
static BaseType_t | xDHCPv6ProcessEndPoint_HandleAdvertise (NetworkEndPoint_t *pxEndPoint, DHCPMessage_IPv6_t *pxDHCPMessage) |
An advertise packet has been received. Ask the application if it it shall send a request to obtain this IP-address. | |
static BaseType_t | xDHCPv6ProcessEndPoint_HandleState (NetworkEndPoint_t *pxEndPoint, DHCPMessage_IPv6_t *pxDHCPMessage) |
This function is called periodically, or when a message was received for this end-point. | |
static BaseType_t | prvDHCPv6_subOption (uint16_t usOption, const DHCPOptionSet_t *pxSet, DHCPMessage_IPv6_t *pxDHCPMessage, BitConfig_t *pxMessage) |
Either the option 'NonTemporaryAddress' or 'IA_for_Prefix_Delegation' was received. This function will read sub options like 'IA_Address', IA_Prefix, and Status_Code. It parses the raw message and fills 'pxDHCPMessage'. | |
static BaseType_t | prvDHCPv6_handleOption (struct xNetworkEndPoint *pxEndPoint, uint16_t usOption, const DHCPOptionSet_t *pxSet, DHCPMessage_IPv6_t *pxDHCPMessage, BitConfig_t *pxMessage) |
A DHCP packet has a list of options, each one starting with a type and a length field. This function parses a single DHCP option. | |
eDHCPState_t | eGetDHCPv6State (struct xNetworkEndPoint *pxEndPoint) |
Get the DHCP state from a given endpoint. | |
static BaseType_t | prvDHCPv6_handleStatusCode (size_t uxLength, BitConfig_t *pxMessage) |
A DHCP packet has a list of options, one of them is Status Code. This function is used to parse it. | |
void | vDHCPv6Process (BaseType_t xReset, struct xNetworkEndPoint *pxEndPoint) |
Check the DHCP socket and run one cycle of the DHCP state machine. | |
void | vDHCPv6Stop (struct xNetworkEndPoint *pxEndPoint) |
Stop the DHCP process. Close the DHCP socket when it's no longer used by any end-point. | |
A DHCPv6 client.
+#define dhcpMANDATORY_OPTIONS | +
When a reply is received, some options are mandatory for this driver.
+ +
+
|
+ +static | +
Check if option length is less than buffer size and larger than minimum requirement.
+[in] | usOption | The option code. |
[in] | uxOptionLength | The option length to check. |
[in] | uxRemainingSize | Remaining size in the buffer. |
+
|
+ +static | +
Analyse the reply from a DHCP server.
+[in] | pxEndPoint | The end-point that wants a DHCPv6 address. |
[in] | pucAnswer | The payload text of the incoming packet. |
[in] | uxTotalLength | The number of valid bytes in pucAnswer. |
[in] | pxDHCPMessage | The DHCP object of the end-point. |
+
|
+ +static | +
Run one cycle of the DHCP state machine.
+[in] | xReset | pdTRUE is the state machine has to be reset. |
[in] | pxEndPoint | The end-point that needs DHCP. |
[in] | pxDHCPMessage | A DHCP message that has just been received, or NULL. |
+
|
+ +static | +
Initialise the DHCP state machine of a given end-point.
+[in] | pxEndPoint | The end-point. |
+
|
+ +static | +
Send a DHCPv6 message to a DHCP server.
+[in] | pxEndPoint | The end-point for which a message will be sent. |
+
|
+ +static | +
Return the UDP/DHCP socket, or create if it doesn't exist.
+[in] | pxEndPoint | The end-point that needs the socket. |
+
|
+ +static | +
Close the shared UDP/DHCP socket. This results in lowering the reference count. The last user of the socket will close it.
+[in] | pxEndPoint | The end-point that wants to close the socket. |
+
|
+ +static | +
A DHCPv6 reply has been received. See to which end-point it belongs and pass it.
+[in] | pxEndPoint | The end-point for which vDHCPv6Process() is called. |
+
|
+ +static | +
The DHCP process is about ready: the server sends a confirmation that the assigned IPv6 address may be used. The settings will be copied to 'pxEndPoint->ipv6_settings'.
+[in] | pxEndPoint | The end-point that is asking for an IP-address. |
[in] | pxDHCPMessage | The reply received from the DHCP server. |
+
|
+ +static | +
An advertise packet has been received. Ask the application if it it shall send a request to obtain this IP-address.
+[in] | pxEndPoint | The end-point that is asking for an IP-address. |
[in] | pxDHCPMessage | The advertisement received from the DHCP server. |
+
|
+ +static | +
This function is called periodically, or when a message was received for this end-point.
+[in] | pxEndPoint | The end-point that is asking for an IP-address. |
[in] | pxDHCPMessage | when not NULL, a message that was received for this end-point. |
+
|
+ +static | +
Either the option 'NonTemporaryAddress' or 'IA_for_Prefix_Delegation' was received. This function will read sub options like 'IA_Address', IA_Prefix, and Status_Code. It parses the raw message and fills 'pxDHCPMessage'.
+[in] | usOption | The DHCPv6 option that was received. |
[in] | pxSet | It contains the length and offset of the DHCP option. |
[out] | pxDHCPMessage | it will be filled with the information from the option. |
[in] | pxMessage | The raw packet as it was received. |
+
|
+ +static | +
A DHCP packet has a list of options, each one starting with a type and a length field. This function parses a single DHCP option.
+[in] | pxEndPoint | The end-point that wants a DHCPv6 address. |
[in] | usOption | IPv6 DHCP option to be handled. |
[in] | pxSet | It contains the length and offset of the DHCP option. |
[out] | pxDHCPMessage | it will be filled with the information from the option. |
[in] | pxMessage | The raw packet as it was received. |
eDHCPState_t eGetDHCPv6State | +( | +struct xNetworkEndPoint * | +pxEndPoint | ) | ++ |
Get the DHCP state from a given endpoint.
+[in] | pxEndPoint | The end-point for which vDHCPv6Process() is called. |
+
|
+ +static | +
A DHCP packet has a list of options, one of them is Status Code. This function is used to parse it.
+[in] | uxLength | Total length for status code. |
[in] | pxMessage | The raw packet as it was received. |
void vDHCPv6Process | +( | +BaseType_t | +xReset, | +
+ | + | struct xNetworkEndPoint * | +pxEndPoint | +
+ | ) | ++ |
Check the DHCP socket and run one cycle of the DHCP state machine.
+[in] | xReset | When pdTRUE, the state machine needs to be reset. This may happen when the end-point has just become up. |
[in] | pxEndPoint | The end-point that wants a DHCPv6 address. |
void vDHCPv6Stop | +( | +struct xNetworkEndPoint * | +pxEndPoint | ) | ++ |
Stop the DHCP process. Close the DHCP socket when it's no longer used by any end-point.
+[in] | pxEndPoint | The end-point for which we want to stop the DHCP process. |
Implements the Domain Name System for the FreeRTOS+TCP network stack. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_IP_Timers.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DNS.h"
#include "FreeRTOS_DHCP.h"
#include "NetworkBufferManagement.h"
#include "FreeRTOS_Routing.h"
#include "NetworkInterface.h"
#include "FreeRTOS_DNS_Globals.h"
#include "FreeRTOS_DNS_Cache.h"
#include "FreeRTOS_DNS_Parser.h"
#include "FreeRTOS_DNS_Networking.h"
#include "FreeRTOS_DNS_Callback.h"
#include "pack_struct_start.h"
#include "pack_struct_end.h"
+Data Structures | |
struct | struct |
A DNS query consists of a header, as described in 'struct xDNSMessage' It is followed by 1 or more queries, each one consisting of a name and a tail, with two fields: type and class. More... | |
+Functions | |
static size_t | prvCreateDNSMessage (uint8_t *pucUDPPayloadBuffer, const char *pcHostName, TickType_t uxIdentifier, UBaseType_t uxHostType) |
Create the DNS message in the zero copy buffer passed in the first parameter. | |
static uint32_t | prvPrepareLookup (const char *pcHostName, struct freertos_addrinfo **ppxAddressInfo, BaseType_t xFamily, FOnDNSEvent pCallbackFunction, void *pvSearchID, TickType_t uxTimeout) |
Check if hostname is already known. If not, call prvGetHostByName() to send a DNS request. | |
static uint32_t | prvGetHostByName (const char *pcHostName, TickType_t uxIdentifier, TickType_t uxReadTimeOut_ticks, struct freertos_addrinfo **ppxAddressInfo, BaseType_t xFamily) |
Prepare and send a message to a DNS server. 'uxReadTimeOut_ticks' will be passed as zero, in case the user has supplied a call-back function. | |
static void | prvIncreaseDNS4Index (NetworkEndPoint_t *pxEndPoint) |
Increment the field 'ucDNSIndex', which is an index in the array. | |
static void | prvIncreaseDNS6Index (NetworkEndPoint_t *pxEndPoint) |
Increment the field 'ucDNSIndex', which is an index in the array. | |
uint32_t | FreeRTOS_gethostbyname (const char *pcHostName) |
Define FreeRTOS_gethostbyname() as a normal blocking call. | |
+void | vDNSInitialise (void) |
Initialise the list of call-back structures. | |
void | FreeRTOS_gethostbyname_cancel (void *pvSearchID) |
Remove the entry defined by the search ID to cancel a DNS request. | |
BaseType_t | FreeRTOS_getaddrinfo (const char *pcName, const char *pcService, const struct freertos_addrinfo *pxHints, struct freertos_addrinfo **ppxResult) |
Look-up the IP-address of a host. | |
struct freertos_addrinfo * | pxNew_AddrInfo (const char *pcName, BaseType_t xFamily, const uint8_t *pucAddress) |
Internal function: allocate and initialise a new struct of type freertos_addrinfo. | |
void | FreeRTOS_freeaddrinfo (struct freertos_addrinfo *pxInfo) |
Free a chain of structs of type 'freertos_addrinfo'. | |
BaseType_t | FreeRTOS_getaddrinfo_a (const char *pcName, const char *pcService, const struct freertos_addrinfo *pxHints, struct freertos_addrinfo **ppxResult, FOnDNSEvent pCallback, void *pvSearchID, TickType_t uxTimeout) |
Asynchronous version of getaddrinfo(). | |
uint32_t | FreeRTOS_gethostbyname_a (const char *pcHostName, FOnDNSEvent pCallback, void *pvSearchID, TickType_t uxTimeout) |
Get the IP-address corresponding to the given hostname. | |
static uint8_t * | prvGetPayloadBuffer (NetworkBufferDescriptor_t **ppxNetworkBuffer, const char *pcHostName, size_t uxHeaderBytes) |
create a payload buffer and return it through the parameter | |
static NetworkEndPoint_t * | prvFillSockAddress (struct freertos_sockaddr *pxAddress, const char *pcHostName) |
fill pxAddress from pucUDPPayloadBuffer | |
static uint32_t | prvDNSReply (const struct xDNSBuffer *pxReceiveBuffer, struct freertos_addrinfo **ppxAddressInfo, TickType_t uxIdentifier, uint16_t usPort) |
return ip address from the dns reply message | |
static BaseType_t | prvSendBuffer (const char *pcHostName, TickType_t uxIdentifier, Socket_t xDNSSocket, BaseType_t xFamily, const struct freertos_sockaddr *pxAddress) |
prepare the buffer before sending | |
static uint32_t | prvGetHostByNameOp (const char *pcHostName, TickType_t uxIdentifier, Socket_t xDNSSocket, struct freertos_addrinfo **ppxAddressInfo, BaseType_t xFamily, TickType_t uxReadTimeOut_ticks) |
main dns operation description function | |
static uint32_t | prvGetHostByNameOp_WithRetry (const char *pcHostName, TickType_t uxIdentifier, Socket_t xDNSSocket, struct freertos_addrinfo **ppxAddressInfo, BaseType_t xFamily, TickType_t uxReadTimeOut_ticks) |
helper function to prvGetHostByNameOP with multiple retries equal to ipconfigDNS_REQUEST_ATTEMPTS | |
uint32_t | ulDNSHandlePacket (const NetworkBufferDescriptor_t *pxNetworkBuffer) |
Perform some preliminary checks and then parse the DNS packet. | |
uint32_t | ulNBNSHandlePacket (NetworkBufferDescriptor_t *pxNetworkBuffer) |
Handle an NBNS packet. | |
BaseType_t | FreeRTOS_SetDNSIPPreference (IPPreference_t eIPPreference) |
Sets the DNS IP preference while doing DNS lookup to indicate the preference for a DNS server: either IPv4 or IPv6. Defaults to xPreferenceIPv4. | |
+Variables | |
+const MACAddress_t | xLLMNR_MacAddress = { { 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfc } } |
The MAC address used for LLMNR. | |
+const MACAddress_t | xLLMNR_MacAddressIPv6 = { { 0x33, 0x33, 0x00, 0x01, 0x00, 0x03 } } |
The IPv6 link-scope multicast MAC address. | |
const IPv6_Address_t | ipLLMNR_IP_ADDR_IPv6 |
The IPv6 link-scope multicast address. | |
+const MACAddress_t | xMDNS_MacAddress = { { 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb } } |
The MAC address used for MDNS. | |
+const MACAddress_t | xMDNS_MacAddressIPv6 = { { 0x33, 0x33, 0x00, 0x00, 0x00, 0xFB } } |
The IPv6 multicast DNS MAC address. | |
+IPPreference_t | xDNS_IP_Preference = xPreferenceIPv4 |
This global variable is being used to indicate to the driver which IP type is preferred for name service lookup, either IPv6 or IPv4. | |
Implements the Domain Name System for the FreeRTOS+TCP network stack.
+
+
|
+ +static | +
Create the DNS message in the zero copy buffer passed in the first parameter.
+[in,out] | pucUDPPayloadBuffer | The zero copy buffer where the DNS message will be created. |
[in] | pcHostName | Hostname to be looked up. |
[in] | uxIdentifier | Identifier to match sent and received packets |
[in] | uxHostType | dnsTYPE_A_HOST ( IPv4 ) or dnsTYPE_AAAA_HOST ( IPv6 ). |
+
|
+ +static | +
Check if hostname is already known. If not, call prvGetHostByName() to send a DNS request.
+[in] | pcHostName | The hostname whose IP address is being queried. |
[in,out] | ppxAddressInfo | A pointer to a pointer where the find results will be stored. |
[in] | xFamily | indicate what type of record is needed: FREERTOS_AF_INET4 or FREERTOS_AF_INET6. |
[in] | pCallbackFunction | The callback function which will be called upon DNS response. |
[in] | pvSearchID | Search ID for the callback function. |
[in] | uxTimeout | Timeout for the callback function. |
+
|
+ +static | +
Prepare and send a message to a DNS server. 'uxReadTimeOut_ticks' will be passed as zero, in case the user has supplied a call-back function.
+[in] | pcHostName | The hostname for which an IP address is required. |
[in] | uxIdentifier | Identifier to match sent and received packets |
[in] | uxReadTimeOut_ticks | The timeout in ticks for waiting. In case the user has supplied a call-back function, this value should be zero. |
[in,out] | ppxAddressInfo | A pointer to a pointer where the find results will be stored. |
[in] | xFamily | Either FREERTOS_AF_INET4 or FREERTOS_AF_INET6. |
+
|
+ +static | +
Increment the field 'ucDNSIndex', which is an index in the array.
+Increment the field 'ucDNSIndex', which is an index in the array of DNS addresses.
+[in] | pxEndPoint | The end-point of which the DNS index should be incremented. |
+
|
+ +static | +
Increment the field 'ucDNSIndex', which is an index in the array.
+Increment the field 'ucDNSIndex', which is an index in the array of DNS addresses.
+[in] | pxEndPoint | The end-point of which the DNS index should be incremented. |
uint32_t FreeRTOS_gethostbyname | +( | +const char * | +pcHostName | ) | ++ |
Define FreeRTOS_gethostbyname() as a normal blocking call.
+[in] | pcHostName | The hostname whose IP address is being searched for. |
void FreeRTOS_gethostbyname_cancel | +( | +void * | +pvSearchID | ) | ++ |
Remove the entry defined by the search ID to cancel a DNS request.
+[in] | pvSearchID | The search ID of the callback function associated with the DNS request being cancelled. Note that the value of the pointer matters, not the pointee. |
BaseType_t FreeRTOS_getaddrinfo | +( | +const char * | +pcName, | +
+ | + | const char * | +pcService, | +
+ | + | const struct freertos_addrinfo * | +pxHints, | +
+ | + | struct freertos_addrinfo ** | +ppxResult | +
+ | ) | ++ |
Look-up the IP-address of a host.
+[in] | pcName | The name of the node or device |
[in] | pcService | Ignored for now. |
[in] | pxHints | If not NULL preferences. Can be used to indicate the preferred type if IP ( v4 or v6 ). |
[out] | ppxResult | An allocated struct, containing the results. |
struct freertos_addrinfo * pxNew_AddrInfo | +( | +const char * | +pcName, | +
+ | + | BaseType_t | +xFamily, | +
+ | + | const uint8_t * | +pucAddress | +
+ | ) | ++ |
Internal function: allocate and initialise a new struct of type freertos_addrinfo.
+[in] | pcName | the name of the host. |
[in] | xFamily | the type of IP-address: FREERTOS_AF_INET4 or FREERTOS_AF_INET6. |
[in] | pucAddress | The IP-address of the host. |
void FreeRTOS_freeaddrinfo | +( | +struct freertos_addrinfo * | +pxInfo | ) | ++ |
Free a chain of structs of type 'freertos_addrinfo'.
+[in] | pxInfo | The first find result. |
BaseType_t FreeRTOS_getaddrinfo_a | +( | +const char * | +pcName, | +
+ | + | const char * | +pcService, | +
+ | + | const struct freertos_addrinfo * | +pxHints, | +
+ | + | struct freertos_addrinfo ** | +ppxResult, | +
+ | + | FOnDNSEvent | +pCallback, | +
+ | + | void * | +pvSearchID, | +
+ | + | TickType_t | +uxTimeout | +
+ | ) | ++ |
Asynchronous version of getaddrinfo().
+[in] | pcName | The name of the node or device |
[in] | pcService | Ignored for now. |
[in] | pxHints | If not NULL preferences. Can be used to indicate the preferred type if IP ( v4 or v6 ). |
[out] | ppxResult | An allocated struct, containing the results. |
[in] | pCallback | A user-defined function which will be called on completion, either when found or after a time-out. |
[in] | pvSearchID | A user provided void pointer that will be communicated on completion. |
[in] | uxTimeout | The maximum number of clock ticks that must be waited for a reply. |
uint32_t FreeRTOS_gethostbyname_a | +( | +const char * | +pcHostName, | +
+ | + | FOnDNSEvent | +pCallback, | +
+ | + | void * | +pvSearchID, | +
+ | + | TickType_t | +uxTimeout | +
+ | ) | ++ |
Get the IP-address corresponding to the given hostname.
+[in] | pcHostName | The hostname whose IP address is being queried. |
[in] | pCallback | The callback function which will be called upon DNS response. It will be called with pcHostName, pvSearchID and pxAddressInfo which points to address info. The pxAddressInfo should be freed by the application once the callback has been called by the FreeRTOS_freeaddrinfo(). In case of timeouts pxAddressInfo can be NULL. |
[in] | pvSearchID | Search ID for the callback function. |
[in] | uxTimeout | Timeout for the callback function. |
+
|
+ +static | +
create a payload buffer and return it through the parameter
+[out] | ppxNetworkBuffer | network buffer to create |
[in] | pcHostName | hostname to get its length |
[in] | uxHeaderBytes | Size of the header (IPv4/IPv6) |
+
|
+ +static | +
fill pxAddress from pucUDPPayloadBuffer
+[out] | pxAddress | ip address and port ... structure |
[in] | pcHostName | hostname to get its length |
+
|
+ +static | +
return ip address from the dns reply message
+[in] | pxReceiveBuffer | received buffer from the DNS server |
[in,out] | ppxAddressInfo | A pointer to a pointer where the find results will be stored. |
[in] | uxIdentifier | matches sent and received packets |
[in] | usPort | Port from which DNS reply was read |
+
|
+ +static | +
prepare the buffer before sending
+[in] | pcHostName | hostname to be looked up |
[in] | uxIdentifier | matches sent and received packets |
[in] | xDNSSocket | a valid socket |
[in] | xFamily | indicate what type of record is needed: FREERTOS_AF_INET4 or FREERTOS_AF_INET6. |
[in] | pxAddress | address structure |
+
|
+ +static | +
main dns operation description function
+[in] | pcHostName | hostname to get its ip address |
[in] | uxIdentifier | Identifier to match sent and received packets |
[in] | xDNSSocket | socket |
[in,out] | ppxAddressInfo | A pointer to a pointer where the find results will be stored. |
[in] | xFamily | Either FREERTOS_AF_INET4 or FREERTOS_AF_INET6. |
[in] | uxReadTimeOut_ticks | The timeout in ticks for waiting. In case the user has supplied a call-back function, this value should be zero. |
+
|
+ +static | +
helper function to prvGetHostByNameOP with multiple retries equal to ipconfigDNS_REQUEST_ATTEMPTS
+[in] | pcHostName | hostname to get its ip address |
[in] | uxIdentifier | Identifier to match sent and received packets |
[in] | xDNSSocket | socket |
[in,out] | ppxAddressInfo | A pointer to a pointer where the find results will be stored. |
[in] | xFamily | Either FREERTOS_AF_INET4 or FREERTOS_AF_INET6. |
[in] | uxReadTimeOut_ticks | The timeout in ticks for waiting. In case the user has supplied a call-back function, this value should be zero. |
uint32_t ulDNSHandlePacket | +( | +const NetworkBufferDescriptor_t * | +pxNetworkBuffer | ) | ++ |
Perform some preliminary checks and then parse the DNS packet.
+[in] | pxNetworkBuffer | The network buffer to be parsed. |
uint32_t ulNBNSHandlePacket | +( | +NetworkBufferDescriptor_t * | +pxNetworkBuffer | ) | ++ |
Handle an NBNS packet.
+[in] | pxNetworkBuffer | The network buffer holding the NBNS packet. |
BaseType_t FreeRTOS_SetDNSIPPreference | +( | +IPPreference_t | +eIPPreference | ) | ++ |
Sets the DNS IP preference while doing DNS lookup to indicate the preference for a DNS server: either IPv4 or IPv6. Defaults to xPreferenceIPv4.
+[in] | eIPPreference | IP preference, can be either xPreferenceIPv4 or xPreferenceIPv6 |
const IPv6_Address_t ipLLMNR_IP_ADDR_IPv6 | +
The IPv6 link-scope multicast address.
+ +File that handles the DNS caching option. +More...
+#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DHCP.h"
#include "NetworkBufferManagement.h"
#include "NetworkInterface.h"
#include "FreeRTOS_DNS_Cache.h"
#include "FreeRTOS_DNS_Globals.h"
#include <stdint.h>
#include <stdio.h>
#include <string.h>
+Functions | |
static BaseType_t | prvFindEntryIndex (const char *pcName, const IPv46_Address_t *pxIP, UBaseType_t *uxResult) |
returns the index of the hostname entry in the dns cache. | |
static BaseType_t | prvGetCacheIPEntry (UBaseType_t uxIndex, IPv46_Address_t *pxIP, uint32_t ulCurrentTimeSeconds, struct freertos_addrinfo **ppxAddressInfo) |
get entry at index from the cache | |
static void | prvUpdateCacheEntry (UBaseType_t uxIndex, uint32_t ulTTL, const IPv46_Address_t *pxIP, uint32_t ulCurrentTimeSeconds) |
update entry at index in the cache | |
static void | prvInsertCacheEntry (const char *pcName, uint32_t ulTTL, const IPv46_Address_t *pxIP, uint32_t ulCurrentTimeSeconds) |
insert entry in the cache | |
static void | prvReadDNSCache (BaseType_t uxIndex, struct freertos_addrinfo **ppxAddressInfo) |
Copy DNS cache entries at uxIndex to a linked struct addrinfo. | |
uint32_t | FreeRTOS_dnslookup (const char *pcHostName) |
perform a dns lookup in the local cache | |
uint32_t | FreeRTOS_dnslookup6 (const char *pcHostName, IPv6_Address_t *pxAddress_IPv6) |
Perform a dns lookup in the local cache (IPv6) | |
BaseType_t | FreeRTOS_dns_update (const char *pcName, IPv46_Address_t *pxIP, uint32_t ulTTL, BaseType_t xLookUp, struct freertos_addrinfo **ppxAddressInfo) |
perform a dns update in the local cache | |
void | FreeRTOS_dnsclear (void) |
perform a dns clear in the local cache | |
BaseType_t | FreeRTOS_ProcessDNSCache (const char *pcName, IPv46_Address_t *pxIP, uint32_t ulTTL, BaseType_t xLookUp, struct freertos_addrinfo **ppxAddressInfo) |
process a DNS Cache request (get, update, or insert) | |
uint32_t | Prepare_CacheLookup (const char *pcHostName, BaseType_t xFamily, struct freertos_addrinfo **ppxAddressInfo) |
Lookup the given hostname in the DNS cache. | |
File that handles the DNS caching option.
+
+
|
+ +static | +
returns the index of the hostname entry in the dns cache.
+returns the index of the hostname entry in the dns cache.
+[in] | pcName | find it in the cache |
[in] | pxIP | ip address |
[out] | uxResult | index number |
+
|
+ +static | +
get entry at index
from the cache
get entry at index
from the cache.
[in] | uxIndex | index in the cache |
[out] | pxIP | fill it with the result |
[in] | ulCurrentTimeSeconds | current time |
[out] | ppxAddressInfo | Target to store the DNS entries. |
pdTRUE
if the value is valid pdFALSE
otherwise
+
|
+ +static | +
update entry at index
in the cache
update entry at index
in the cache.
[in] | uxIndex | index in the cache |
[in] | ulTTL | time to live (in seconds) |
[in] | pxIP | ip to update the cache with |
[in] | ulCurrentTimeSeconds | current time |
+
|
+ +static | +
insert entry in the cache
+insert entry in the cache.
+[in] | pcName | cache entry key |
[in] | ulTTL | time to live (in seconds) |
[in] | pxIP | ip address |
[in] | ulCurrentTimeSeconds | current time |
+
|
+ +static | +
Copy DNS cache entries at uxIndex to a linked struct addrinfo.
+Copy DNS cache entries at xIndex to a linked struct addrinfo.
+[in] | uxIndex | The index from where entries must be copied. |
[out] | ppxAddressInfo | Target to store the DNS entries. |
uint32_t FreeRTOS_dnslookup | +( | +const char * | +pcHostName | ) | ++ |
perform a dns lookup in the local cache
+pcHostName | the lookup name |
uint32_t FreeRTOS_dnslookup6 | +( | +const char * | +pcHostName, | +
+ | + | IPv6_Address_t * | +pxAddress_IPv6 | +
+ | ) | ++ |
Perform a dns lookup in the local cache (IPv6)
+pcHostName | The lookup name |
pxAddress_IPv6 | The IPv6 address looked up from the cache if the return value is non zero. |
BaseType_t FreeRTOS_dns_update | +( | +const char * | +pcName, | +
+ | + | IPv46_Address_t * | +pxIP, | +
+ | + | uint32_t | +ulTTL, | +
+ | + | BaseType_t | +xLookUp, | +
+ | + | struct freertos_addrinfo ** | +ppxAddressInfo | +
+ | ) | ++ |
perform a dns update in the local cache
+pcName | the lookup name |
pxIP | the ip value to insert/replace (IPv4/v6) |
ulTTL | Time To live (in seconds) |
xLookUp | Ignored |
ppxAddressInfo | A pointer to a pointer where the find results will be stored. |
void FreeRTOS_dnsclear | +( | +void | +) | ++ |
perform a dns clear in the local cache
+BaseType_t FreeRTOS_ProcessDNSCache | +( | +const char * | +pcName, | +
+ | + | IPv46_Address_t * | +pxIP, | +
+ | + | uint32_t | +ulTTL, | +
+ | + | BaseType_t | +xLookUp, | +
+ | + | struct freertos_addrinfo ** | +ppxAddressInfo | +
+ | ) | ++ |
process a DNS Cache request (get, update, or insert)
+[in] | pcName | the name of the host |
[in,out] | pxIP | when doing a lookup, will be set, when doing an update, will be read. |
[in] | ulTTL | Time To Live (in seconds) |
[in] | xLookUp | pdTRUE if a look-up is expected, pdFALSE, when the DNS cache must be updated. |
[in,out] | ppxAddressInfo | A pointer to a pointer where the find results will be stored. |
uint32_t Prepare_CacheLookup | +( | +const char * | +pcHostName, | +
+ | + | BaseType_t | +xFamily, | +
+ | + | struct freertos_addrinfo ** | +ppxAddressInfo | +
+ | ) | ++ |
Lookup the given hostname in the DNS cache.
+[in] | pcHostName | THe host name to lookup |
[in] | xFamily | IP type FREERTOS_AF_INET6 / FREERTOS_AF_INET4 |
[out] | ppxAddressInfo | Target to store the DNS entries. |
File that handles the DNS Callback option. +More...
+#include "FreeRTOS_DNS_Callback.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_DNS_Globals.h"
#include "FreeRTOS_IP_Timers.h"
+Functions | |
BaseType_t | xDNSDoCallback (ParseSet_t *pxSet, struct freertos_addrinfo *pxAddress) |
A DNS reply was received, see if there is any matching entry and call the handler. | |
BaseType_t | xDNSSetCallBack (const char *pcHostName, void *pvSearchID, FOnDNSEvent pCallbackFunction, TickType_t uxTimeout, TickType_t uxIdentifier, BaseType_t xIsIPv6) |
FreeRTOS_gethostbyname_a() was called along with callback parameters. Store them in a list for later reference. | |
void | vDNSCheckCallBack (void *pvSearchID) |
Iterate through the list of call-back structures and remove old entries which have reached a timeout. As soon as the list has become empty, the DNS timer will be stopped. In case pvSearchID is supplied, the user wants to cancel a DNS request. | |
void | vDNSCallbackInitialise () |
initialize the cache | |
+Variables | |
+static List_t | xCallbackList |
list of callbacks to send | |
File that handles the DNS Callback option.
+BaseType_t xDNSDoCallback | +( | +ParseSet_t * | +pxSet, | +
+ | + | struct freertos_addrinfo * | +pxAddress | +
+ | ) | ++ |
A DNS reply was received, see if there is any matching entry and call the handler.
+[in,out] | pxSet | a set of variables that are shared among the helper functions. |
[in] | pxAddress | Pointer to address info ( IPv4/IPv6 ) obtained from the DNS server. |
BaseType_t xDNSSetCallBack | +( | +const char * | +pcHostName, | +
+ | + | void * | +pvSearchID, | +
+ | + | FOnDNSEvent | +pCallbackFunction, | +
+ | + | TickType_t | +uxTimeout, | +
+ | + | TickType_t | +uxIdentifier, | +
+ | + | BaseType_t | +xIsIPv6 | +
+ | ) | ++ |
FreeRTOS_gethostbyname_a() was called along with callback parameters. Store them in a list for later reference.
+[in] | pcHostName | The hostname whose IP address is being searched for. |
[in] | pvSearchID | The search ID of the DNS callback function to set. |
[in] | pCallbackFunction | The callback function pointer. |
[in] | uxTimeout | Timeout of the callback function. |
[in] | uxIdentifier | Random number used as ID in the DNS message. |
[in] | xIsIPv6 | pdTRUE if the address type should be IPv6. |
void vDNSCheckCallBack | +( | +void * | +pvSearchID | ) | ++ |
Iterate through the list of call-back structures and remove old entries which have reached a timeout. As soon as the list has become empty, the DNS timer will be stopped. In case pvSearchID is supplied, the user wants to cancel a DNS request.
+[in] | pvSearchID | The search ID of callback function whose associated DNS request is being cancelled. If non-ID specific checking of all requests is required, then this field should be kept as NULL. |
void vDNSCallbackInitialise | +( | +) | ++ |
initialize the cache
+Implements the Domain Name System Networking for the FreeRTOS+TCP network stack. +More...
+#include "FreeRTOS.h"
#include "FreeRTOS_DNS_Networking.h"
+Functions | |
BaseType_t | DNS_BindSocket (Socket_t xSocket, uint16_t usPort) |
Bind the socket to a port number. | |
Socket_t | DNS_CreateSocket (TickType_t uxReadTimeOut_ticks) |
Create a socket and bind it to the standard DNS port number. | |
BaseType_t | DNS_SendRequest (Socket_t xDNSSocket, const struct freertos_sockaddr *xAddress, const struct xDNSBuffer *pxDNSBuf) |
perform a DNS network request | |
BaseType_t | DNS_ReadReply (ConstSocket_t xDNSSocket, struct freertos_sockaddr *xAddress, struct xDNSBuffer *pxReceiveBuffer) |
perform a DNS network read | |
void | DNS_CloseSocket (Socket_t xDNSSocket) |
perform a DNS network close | |
Implements the Domain Name System Networking for the FreeRTOS+TCP network stack.
+BaseType_t DNS_BindSocket | +( | +Socket_t | +xSocket, | +
+ | + | uint16_t | +usPort | +
+ | ) | ++ |
Bind the socket to a port number.
+[in] | xSocket | the socket that must be bound. |
[in] | usPort | the port number to bind to. |
Socket_t DNS_CreateSocket | +( | +TickType_t | +uxReadTimeOut_ticks | ) | ++ |
Create a socket and bind it to the standard DNS port number.
+BaseType_t DNS_SendRequest | +( | +Socket_t | +xDNSSocket, | +
+ | + | const struct freertos_sockaddr * | +xAddress, | +
+ | + | const struct xDNSBuffer * | +pxDNSBuf | +
+ | ) | ++ |
perform a DNS network request
+xDNSSocket | Created socket |
xAddress | address structure (ip, port etc) |
pxDNSBuf | buffer to send |
BaseType_t DNS_ReadReply | +( | +ConstSocket_t | +xDNSSocket, | +
+ | + | struct freertos_sockaddr * | +xAddress, | +
+ | + | struct xDNSBuffer * | +pxReceiveBuffer | +
+ | ) | ++ |
perform a DNS network read
+xDNSSocket | socket |
xAddress | address to read from |
pxReceiveBuffer | buffer to fill with received data |
void DNS_CloseSocket | +( | +Socket_t | +xDNSSocket | ) | ++ |
perform a DNS network close
+xDNSSocket | the DNS socket to close |
Implements the DNS message parser. +More...
+#include "FreeRTOS.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_DNS_Globals.h"
#include "FreeRTOS_DNS_Parser.h"
#include "FreeRTOS_DNS_Cache.h"
#include "FreeRTOS_DNS_Callback.h"
#include "NetworkBufferManagement.h"
#include <string.h>
+Functions | |
size_t | DNS_ReadNameField (ParseSet_t *pxSet, size_t uxDestLen) |
Read the Name field out of a DNS response packet. | |
size_t | DNS_SkipNameField (const uint8_t *pucByte, size_t uxLength) |
Simple routine that jumps over the NAME field of a resource record. | |
uint32_t | DNS_ParseDNSReply (uint8_t *pucUDPPayloadBuffer, size_t uxBufferLength, struct freertos_addrinfo **ppxAddressInfo, BaseType_t xExpected, uint16_t usPort) |
Process a response packet from a DNS server, or an LLMNR reply. | |
uint32_t | parseDNSAnswer (ParseSet_t *pxSet, struct freertos_addrinfo **ppxAddressInfo, size_t *uxBytesRead) |
Process DNS answer field in a DNS response packet from a DNS server. | |
void | prepareReplyDNSMessage (NetworkBufferDescriptor_t *pxNetworkBuffer, BaseType_t lNetLength) |
Send a DNS message to be used in MDNS, LLMNR or NBNS. | |
void | DNS_TreatNBNS (uint8_t *pucPayload, size_t uxBufferLength, uint32_t ulIPAddress) |
Respond to an NBNS query or an NBNS reply. | |
Implements the DNS message parser.
+size_t DNS_ReadNameField | +( | +ParseSet_t * | +pxSet, | +
+ | + | size_t | +uxDestLen | +
+ | ) | ++ |
Read the Name field out of a DNS response packet.
+[in,out] | pxSet | a set of variables that are shared among the helper functions. |
[in] | uxDestLen | Size of the pcName array. |
size_t DNS_SkipNameField | +( | +const uint8_t * | +pucByte, | +
+ | + | size_t | +uxLength | +
+ | ) | ++ |
Simple routine that jumps over the NAME field of a resource record.
+[in] | pucByte | The pointer to the resource record. |
[in] | uxLength | Length of the resource record. |
uint32_t DNS_ParseDNSReply | +( | +uint8_t * | +pucUDPPayloadBuffer, | +
+ | + | size_t | +uxBufferLength, | +
+ | + | struct freertos_addrinfo ** | +ppxAddressInfo, | +
+ | + | BaseType_t | +xExpected, | +
+ | + | uint16_t | +usPort | +
+ | ) | ++ |
Process a response packet from a DNS server, or an LLMNR reply.
+[in] | pucUDPPayloadBuffer | The DNS response received as a UDP payload. |
[in] | uxBufferLength | Length of the UDP payload buffer. |
[in] | ppxAddressInfo | A pointer to a pointer where the results will be stored. |
[in] | xExpected | indicates whether the identifier in the reply was expected, and thus if the DNS cache may be updated with the reply. |
[in] | usPort | The server port number in order to identify the protocol. |
uint32_t parseDNSAnswer | +( | +ParseSet_t * | +pxSet, | +
+ | + | struct freertos_addrinfo ** | +ppxAddressInfo, | +
+ | + | size_t * | +uxBytesRead | +
+ | ) | ++ |
Process DNS answer field in a DNS response packet from a DNS server.
+[in] | pxSet | a set of variables that are shared among the helper functions. |
[out] | ppxAddressInfo | a linked list storing the DNS answers. |
[out] | uxBytesRead | total bytes consumed by the function |
void prepareReplyDNSMessage | +( | +NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | BaseType_t | +lNetLength | +
+ | ) | ++ |
Send a DNS message to be used in MDNS, LLMNR or NBNS.
+[in] | pxNetworkBuffer | The network buffer descriptor with the DNS message. |
[in] | lNetLength | The length of the DNS message. |
void DNS_TreatNBNS | +( | +uint8_t * | +pucPayload, | +
+ | + | size_t | +uxBufferLength, | +
+ | + | uint32_t | +ulIPAddress | +
+ | ) | ++ |
Respond to an NBNS query or an NBNS reply.
+[in] | pucPayload | the UDP payload of the NBNS message. |
[in] | uxBufferLength | Length of the Buffer. |
[in] | ulIPAddress | IP address of the sender. |
Implements the Internet Control Message Protocol for the FreeRTOS+TCP network stack. +More...
+#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_ICMP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DHCP.h"
#include "NetworkInterface.h"
#include "NetworkBufferManagement.h"
#include "FreeRTOS_DNS.h"
+Functions | |
static eFrameProcessingResult_t | prvProcessICMPEchoRequest (ICMPPacket_t *const pxICMPPacket, const NetworkBufferDescriptor_t *const pxNetworkBuffer) |
Process an ICMP echo request. | |
static void | prvProcessICMPEchoReply (ICMPPacket_t *const pxICMPPacket) |
Process an ICMP echo reply. | |
eFrameProcessingResult_t | ProcessICMPPacket (const NetworkBufferDescriptor_t *const pxNetworkBuffer) |
Process an ICMP packet. Only echo requests and echo replies are recognised and handled. | |
Implements the Internet Control Message Protocol for the FreeRTOS+TCP network stack.
+
+
|
+ +static | +
Process an ICMP echo request.
+[in,out] | pxICMPPacket | The IP packet that contains the ICMP message. |
pxNetworkBuffer | Pointer to the network buffer containing the ICMP packet. |
+
|
+ +static | +
Process an ICMP echo reply.
+[in] | pxICMPPacket | The IP packet that contains the ICMP message. |
eFrameProcessingResult_t ProcessICMPPacket | +( | +const NetworkBufferDescriptor_t *const | +pxNetworkBuffer | ) | ++ |
Process an ICMP packet. Only echo requests and echo replies are recognised and handled.
+[in,out] | pxNetworkBuffer | The pointer to the network buffer descriptor that contains the ICMP message. |
Implements the basic functionality for the FreeRTOS+TCP network stack. +More...
+#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_ICMP.h"
#include "FreeRTOS_IP_Timers.h"
#include "FreeRTOS_IP_Utils.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_ARP.h"
#include "FreeRTOS_ND.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DHCP.h"
#include "FreeRTOS_DHCPv6.h"
#include "NetworkInterface.h"
#include "NetworkBufferManagement.h"
#include "FreeRTOS_DNS.h"
#include "FreeRTOS_Routing.h"
+Macros | |
+#define | ipINITIALISATION_RETRY_DELAY ( pdMS_TO_TICKS( 3000U ) ) |
Time delay between repeated attempts to initialise the network hardware. | |
+#define | ipARP_RESOLUTION_MAX_DELAY ( pdMS_TO_TICKS( 2000U ) ) |
Maximum time to wait for an ARP resolution while holding a packet. | |
+#define | ipND_RESOLUTION_MAX_DELAY ( pdMS_TO_TICKS( 2000U ) ) |
Maximum time to wait for a ND resolution while holding a packet. | |
+#define | ipARP_TIMER_PERIOD_MS ( 10000U ) |
Defines how often the ARP resolution timer callback function is executed. The time is shorter in the Windows simulator as simulated time is not real time. | |
+#define | ipND_TIMER_PERIOD_MS ( 10000U ) |
Defines how often the ND resolution timer callback function is executed. The time is shorter in the Windows simulator as simulated time is not real time. | |
+#define | ipTCP_TIMER_PERIOD_MS ( 1000U ) |
When initialising the TCP timer, give it an initial time-out of 1 second. | |
#define | iptraceIP_TASK_STARTING() do {} while( ipFALSE_BOOL ) |
+#define | ipIS_ETHERNET_FRAME_TYPE_INVALID(usFrameType) ( ( usFrameType ) <= 0x0600U ) |
The frame type field in the Ethernet header must have a value greater than 0x0600. If the configuration option ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES is enabled, the stack will discard packets with a frame type value less than or equal to 0x0600. However, if this option is disabled, the stack will continue to process these packets. | |
+Functions | |
static void | prvCallDHCP_RA_Handler (NetworkEndPoint_t *pxEndPoint) |
Call the state machine of either DHCP, DHCPv6, or RA, whichever is activated. | |
+static void | prvIPTask_Initialise (void) |
Helper function for prvIPTask, it does the first initializations at start-up. No parameters, no return type. | |
+static void | prvIPTask_CheckPendingEvents (void) |
Check the value of 'xNetworkDownEventPending'. When non-zero, pending network-down events will be handled. | |
static void | prvProcessIPEventsAndTimers (void) |
The pointer to buffer with packet waiting for ARP resolution. | |
static void | prvIPTask (void *pvParameters) |
The IP task handles all requests from the user application and the network interface. It receives messages through a FreeRTOS queue called 'xNetworkEventQueue'. prvIPTask() is the only task which has access to the data of the IP-stack, and so it has no need of using mutexes. | |
static void | prvProcessEthernetPacket (NetworkBufferDescriptor_t *const pxNetworkBuffer) |
Process the Ethernet packet. | |
static eFrameProcessingResult_t | prvProcessIPPacket (const IPPacket_t *pxIPPacket, NetworkBufferDescriptor_t *const pxNetworkBuffer) |
Process an IP-packet. | |
static void | prvHandleEthernetPacket (NetworkBufferDescriptor_t *pxBuffer) |
Handle the incoming Ethernet packets. | |
static void | prvForwardTxPacket (NetworkBufferDescriptor_t *pxNetworkBuffer, BaseType_t xReleaseAfterSend) |
Send a network packet. | |
static eFrameProcessingResult_t | prvProcessUDPPacket (NetworkBufferDescriptor_t *const pxNetworkBuffer) |
Check the sizes of the UDP packet and forward it to the UDP module ( xProcessReceivedUDPPacket() ) | |
TaskHandle_t | FreeRTOS_GetIPTaskHandle (void) |
The variable 'xIPTaskHandle' is declared static. This function gives read-only access to it. | |
void | vIPNetworkUpCalls (struct xNetworkEndPoint *pxEndPoint) |
Perform all the required tasks when the network gets connected. | |
void | FreeRTOS_NetworkDown (struct xNetworkInterface *pxNetworkInterface) |
Send a network down event to the IP-task. If it fails to post a message, the failure will be noted in the variable 'xNetworkDownEventPending' and later on a 'network-down' event, it will be executed. | |
BaseType_t | FreeRTOS_NetworkDownFromISR (struct xNetworkInterface *pxNetworkInterface) |
Utility function. Process Network Down event from ISR. This function is supposed to be called form an ISR. It is recommended. | |
void * | FreeRTOS_GetUDPPayloadBuffer_Multi (size_t uxRequestedSizeBytes, TickType_t uxBlockTimeTicks, uint8_t ucIPType) |
Obtain a buffer big enough for a UDP payload of given size and given IP type. | |
+BaseType_t | FreeRTOS_IPInit_Multi (void) |
Initialise the FreeRTOS-Plus-TCP network stack and initialise the IP-task. Before calling this function, at least 1 interface and 1 end-point must have been set-up. | |
void | FreeRTOS_ReleaseUDPPayloadBuffer (void const *pvBuffer) |
Release the UDP payload buffer. | |
void | FreeRTOS_GetEndPointConfiguration (uint32_t *pulIPAddress, uint32_t *pulNetMask, uint32_t *pulGatewayAddress, uint32_t *pulDNSServerAddress, const struct xNetworkEndPoint *pxEndPoint) |
Get the current IPv4 address configuration. Only non-NULL pointers will be filled in. pxEndPoint must be non-NULL. | |
void | FreeRTOS_SetEndPointConfiguration (const uint32_t *pulIPAddress, const uint32_t *pulNetMask, const uint32_t *pulGatewayAddress, const uint32_t *pulDNSServerAddress, struct xNetworkEndPoint *pxEndPoint) |
Set the current IPv4 network address configuration. Only non-NULL pointers will pointers will be used. pxEndPoint must pointer to a valid end-point. | |
BaseType_t | FreeRTOS_ReleaseTCPPayloadBuffer (Socket_t xSocket, void const *pvBuffer, BaseType_t xByteCount) |
Release the memory that was previously obtained by calling FreeRTOS_recv() with the flag 'FREERTOS_ZERO_COPY'. | |
BaseType_t | FreeRTOS_SendPingRequest (uint32_t ulIPAddress, size_t uxNumberOfBytesToSend, TickType_t uxBlockTimeTicks) |
Send a ping request to the given IP address. After receiving a reply, IP-task will call a user-supplied function 'vApplicationPingReplyHook()'. | |
BaseType_t | xSendEventToIPTask (eIPEvent_t eEvent) |
Send an event to the IP task. It calls 'xSendEventStructToIPTask' internally. | |
BaseType_t | xSendEventStructToIPTask (const IPStackEvent_t *pxEvent, TickType_t uxTimeout) |
Send an event (in form of struct) to the IP task to be processed. | |
eFrameProcessingResult_t | eConsiderFrameForProcessing (const uint8_t *const pucEthernetBuffer) |
Decide whether this packet should be processed or not based on the IP address in the packet. | |
void | vReturnEthernetFrame (NetworkBufferDescriptor_t *pxNetworkBuffer, BaseType_t xReleaseAfterSend) |
Send the Ethernet frame after checking for some conditions. | |
uint32_t | FreeRTOS_GetIPAddress (void) |
Returns the IP address of the NIC. | |
BaseType_t | xIPIsNetworkTaskReady (void) |
Returns whether the IP task is ready. | |
BaseType_t | FreeRTOS_IsNetworkUp (void) |
Returns whether all end-points are up. | |
BaseType_t | xIsNetworkDownEventPending (void) |
The variable 'xNetworkDownEventPending' is declared static. This function gives read-only access to it. | |
BaseType_t | FreeRTOS_IsEndPointUp (const struct xNetworkEndPoint *pxEndPoint) |
Returns whether a particular end-point is up. | |
BaseType_t | FreeRTOS_AllEndPointsUp (const struct xNetworkInterface *pxInterface) |
Return pdTRUE if all end-points belonging to a given interface are up. When pxInterface is null, all end-points will be checked. | |
size_t | uxIPHeaderSizePacket (const NetworkBufferDescriptor_t *pxNetworkBuffer) |
Get the size of the IP-header, by checking the type of the network buffer. | |
size_t | uxIPHeaderSizeSocket (const FreeRTOS_Socket_t *pxSocket) |
Get the size of the IP-header, by checking if the socket bIsIPv6 set. | |
Implements the basic functionality for the FreeRTOS+TCP network stack.
+#define iptraceIP_TASK_STARTING | +( | +) | +do {} while( ipFALSE_BOOL ) | +
Empty definition in case iptraceIP_TASK_STARTING is not defined.
+ +
+
|
+ +static | +
Call the state machine of either DHCP, DHCPv6, or RA, whichever is activated.
+[in] | pxEndPoint | The end-point for which the state-machine will be called. |
+
|
+ +static | +
The pointer to buffer with packet waiting for ARP resolution.
+Process the events sent to the IP task and process the timers.
+The pointer to buffer with packet waiting for ND resolution.
+ +
+
|
+ +static | +
The IP task handles all requests from the user application and the network interface. It receives messages through a FreeRTOS queue called 'xNetworkEventQueue'. prvIPTask() is the only task which has access to the data of the IP-stack, and so it has no need of using mutexes.
+[in] | pvParameters | Not used. |
Stores interface structures.
+ +
+
|
+ +static | +
Process the Ethernet packet.
+[in,out] | pxNetworkBuffer | the network buffer containing the ethernet packet. If the buffer is large enough, it may be reused to send a reply. |
+
|
+ +static | +
Process an IP-packet.
+[in] | pxIPPacket | The IP packet to be processed. |
[in] | pxNetworkBuffer | The networkbuffer descriptor having the IP packet. |
+
|
+ +static | +
Handle the incoming Ethernet packets.
+[in] | pxBuffer | Linked/un-linked network buffer descriptor(s) to be processed. |
+
|
+ +static | +
Send a network packet.
+[in] | pxNetworkBuffer | The message buffer. |
[in] | xReleaseAfterSend | When true, the network interface will own the buffer and is responsible for it's release. |
+
|
+ +static | +
Check the sizes of the UDP packet and forward it to the UDP module ( xProcessReceivedUDPPacket() )
+[in] | pxNetworkBuffer | The network buffer containing the UDP packet. |
TaskHandle_t FreeRTOS_GetIPTaskHandle | +( | +void | +) | ++ |
The variable 'xIPTaskHandle' is declared static. This function gives read-only access to it.
+void vIPNetworkUpCalls | +( | +struct xNetworkEndPoint * | +pxEndPoint | ) | ++ |
Perform all the required tasks when the network gets connected.
+pxEndPoint | The end-point which goes up. |
void FreeRTOS_NetworkDown | +( | +struct xNetworkInterface * | +pxNetworkInterface | ) | ++ |
Send a network down event to the IP-task. If it fails to post a message, the failure will be noted in the variable 'xNetworkDownEventPending' and later on a 'network-down' event, it will be executed.
+[in] | pxNetworkInterface | The interface that goes down. |
BaseType_t FreeRTOS_NetworkDownFromISR | +( | +struct xNetworkInterface * | +pxNetworkInterface | ) | ++ |
Utility function. Process Network Down event from ISR. This function is supposed to be called form an ISR. It is recommended.
+[in] | pxNetworkInterface | The interface that goes down. |
void * FreeRTOS_GetUDPPayloadBuffer_Multi | +( | +size_t | +uxRequestedSizeBytes, | +
+ | + | TickType_t | +uxBlockTimeTicks, | +
+ | + | uint8_t | +ucIPType | +
+ | ) | ++ |
Obtain a buffer big enough for a UDP payload of given size and given IP type.
+[in] | uxRequestedSizeBytes | The size of the UDP payload. |
[in] | uxBlockTimeTicks | Maximum amount of time for which this call can block. This value is capped internally. |
[in] | ucIPType | Either ipTYPE_IPv4 (0x40) or ipTYPE_IPv6 (0x60) |
void FreeRTOS_ReleaseUDPPayloadBuffer | +( | +void const * | +pvBuffer | ) | ++ |
Release the UDP payload buffer.
+[in] | pvBuffer | Pointer to the UDP buffer that is to be released. |
void FreeRTOS_GetEndPointConfiguration | +( | +uint32_t * | +pulIPAddress, | +
+ | + | uint32_t * | +pulNetMask, | +
+ | + | uint32_t * | +pulGatewayAddress, | +
+ | + | uint32_t * | +pulDNSServerAddress, | +
+ | + | const struct xNetworkEndPoint * | +pxEndPoint | +
+ | ) | ++ |
Get the current IPv4 address configuration. Only non-NULL pointers will be filled in. pxEndPoint must be non-NULL.
+[out] | pulIPAddress | The current IP-address assigned. |
[out] | pulNetMask | The netmask used for current subnet. |
[out] | pulGatewayAddress | The gateway address. |
[out] | pulDNSServerAddress | The DNS server address. |
[in] | pxEndPoint | The end-point which is being questioned. |
void FreeRTOS_SetEndPointConfiguration | +( | +const uint32_t * | +pulIPAddress, | +
+ | + | const uint32_t * | +pulNetMask, | +
+ | + | const uint32_t * | +pulGatewayAddress, | +
+ | + | const uint32_t * | +pulDNSServerAddress, | +
+ | + | struct xNetworkEndPoint * | +pxEndPoint | +
+ | ) | ++ |
Set the current IPv4 network address configuration. Only non-NULL pointers will pointers will be used. pxEndPoint must pointer to a valid end-point.
+[in] | pulIPAddress | The current IP-address assigned. |
[in] | pulNetMask | The netmask used for current subnet. |
[in] | pulGatewayAddress | The gateway address. |
[in] | pulDNSServerAddress | The DNS server address. |
[in] | pxEndPoint | The end-point which is being questioned. |
BaseType_t FreeRTOS_ReleaseTCPPayloadBuffer | +( | +Socket_t | +xSocket, | +
+ | + | void const * | +pvBuffer, | +
+ | + | BaseType_t | +xByteCount | +
+ | ) | ++ |
Release the memory that was previously obtained by calling FreeRTOS_recv() with the flag 'FREERTOS_ZERO_COPY'.
+[in] | xSocket | The socket that was read from. |
[in] | pvBuffer | The buffer returned in the call to FreeRTOS_recv(). |
[in] | xByteCount | The number of bytes that have been used. |
BaseType_t FreeRTOS_SendPingRequest | +( | +uint32_t | +ulIPAddress, | +
+ | + | size_t | +uxNumberOfBytesToSend, | +
+ | + | TickType_t | +uxBlockTimeTicks | +
+ | ) | ++ |
Send a ping request to the given IP address. After receiving a reply, IP-task will call a user-supplied function 'vApplicationPingReplyHook()'.
+[in] | ulIPAddress | The IP address to which the ping is to be sent. |
[in] | uxNumberOfBytesToSend | Number of bytes in the ping request. |
[in] | uxBlockTimeTicks | Maximum number of ticks to wait. |
BaseType_t xSendEventToIPTask | +( | +eIPEvent_t | +eEvent | ) | ++ |
Send an event to the IP task. It calls 'xSendEventStructToIPTask' internally.
+[in] | eEvent | The event to be sent. |
BaseType_t xSendEventStructToIPTask | +( | +const IPStackEvent_t * | +pxEvent, | +
+ | + | TickType_t | +uxTimeout | +
+ | ) | ++ |
Send an event (in form of struct) to the IP task to be processed.
+[in] | pxEvent | The event to be sent. |
[in] | uxTimeout | Timeout for waiting in case the queue is full. 0 for non-blocking calls. |
eFrameProcessingResult_t eConsiderFrameForProcessing | +( | +const uint8_t *const | +pucEthernetBuffer | ) | ++ |
Decide whether this packet should be processed or not based on the IP address in the packet.
+[in] | pucEthernetBuffer | The ethernet packet under consideration. |
void vReturnEthernetFrame | +( | +NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | BaseType_t | +xReleaseAfterSend | +
+ | ) | ++ |
Send the Ethernet frame after checking for some conditions.
+[in,out] | pxNetworkBuffer | The network buffer which is to be sent. |
[in] | xReleaseAfterSend | Whether this network buffer is to be released or not. |
uint32_t FreeRTOS_GetIPAddress | +( | +void | +) | ++ |
Returns the IP address of the NIC.
+BaseType_t xIPIsNetworkTaskReady | +( | +void | +) | ++ |
Returns whether the IP task is ready.
+BaseType_t FreeRTOS_IsNetworkUp | +( | +void | +) | ++ |
Returns whether all end-points are up.
+BaseType_t xIsNetworkDownEventPending | +( | +void | +) | ++ |
The variable 'xNetworkDownEventPending' is declared static. This function gives read-only access to it.
+BaseType_t FreeRTOS_IsEndPointUp | +( | +const struct xNetworkEndPoint * | +pxEndPoint | ) | ++ |
Returns whether a particular end-point is up.
+BaseType_t FreeRTOS_AllEndPointsUp | +( | +const struct xNetworkInterface * | +pxInterface | ) | ++ |
Return pdTRUE if all end-points belonging to a given interface are up. When pxInterface is null, all end-points will be checked.
+[in] | pxInterface | The network interface of interest, or NULL to check all end-points. |
size_t uxIPHeaderSizePacket | +( | +const NetworkBufferDescriptor_t * | +pxNetworkBuffer | ) | ++ |
Get the size of the IP-header, by checking the type of the network buffer.
+[in] | pxNetworkBuffer | The network buffer. |
size_t uxIPHeaderSizeSocket | +( | +const FreeRTOS_Socket_t * | +pxSocket | ) | ++ |
Get the size of the IP-header, by checking if the socket bIsIPv6 set.
+[in] | pxSocket | The socket. |
Implements the Internet Control Message Protocol for the FreeRTOS+TCP network stack. +More...
+#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_IP_Timers.h"
#include "FreeRTOS_IP_Utils.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DHCP.h"
#include "FreeRTOS_ARP.h"
#include "FreeRTOS_ND.h"
#include "NetworkInterface.h"
#include "NetworkBufferManagement.h"
#include "FreeRTOS_Routing.h"
#include "FreeRTOS_DNS.h"
+Functions | |
static void | prvIPTimerStart (IPTimer_t *pxTimer, TickType_t xTime) |
Start an IP timer. The IP-task has its own implementation of a timer called 'IPTimer_t', which is based on the FreeRTOS 'TimeOut_t'. | |
static BaseType_t | prvIPTimerCheck (IPTimer_t *pxTimer) |
Check the IP timer to see whether an IP event should be processed or not. | |
static void | prvIPTimerReload (IPTimer_t *pxTimer, TickType_t xTime) |
Sets the reload time of an IP timer and restarts it. | |
TickType_t | xCalculateSleepTime (void) |
Calculate the maximum sleep time remaining. It will go through all timers to see which timer will expire first. That will be the amount of time to block in the next call to xQueueReceive(). | |
+void | vCheckNetworkTimers (void) |
Check the network timers (ARP/ND/DHCP/DNS/TCP) and if they are expired, send an event to the IP-Task. | |
void | vTCPTimerReload (TickType_t xTime) |
Sets the reload time of the TCP timer and restarts it. | |
void | vDNSTimerReload (uint32_t ulCheckTime) |
Reload the DNS timer. | |
void | vDHCP_RATimerReload (NetworkEndPoint_t *pxEndPoint, TickType_t uxClockTicks) |
Set the reload time of the DHCP/DHCPv6/RA timer. | |
void | vNetworkTimerReload (TickType_t xTime) |
Reload the Network timer. | |
void | vIPSetTCPTimerExpiredState (BaseType_t xExpiredState) |
Enable/disable the TCP timer. | |
void | vIPSetDHCP_RATimerEnableState (NetworkEndPoint_t *pxEndPoint, BaseType_t xEnableState) |
Enable or disable the DHCP/DHCPv6/RA timer. | |
void | vIPSetDNSTimerEnableState (BaseType_t xEnableState) |
Enable/disable the DNS timer. | |
+void | vSetAllNetworksUp (BaseType_t xIsAllNetworksUp) |
Mark whether all interfaces are up or at least one interface is down. If all interfaces are up, the 'xNetworkTimer' will not be checked. | |
Implements the Internet Control Message Protocol for the FreeRTOS+TCP network stack.
+
+
|
+ +static | +
Start an IP timer. The IP-task has its own implementation of a timer called 'IPTimer_t', which is based on the FreeRTOS 'TimeOut_t'.
+Start an IP timer. The IP-task has its own implementation of a timer called 'IPTimer_t', which is based on the FreeRTOS 'TimeOut_t'.
+[in] | pxTimer | Pointer to the IP timer. When zero, the timer is marked as expired. |
[in] | xTime | Time to be loaded into the IP timer. |
+
|
+ +static | +
Check the IP timer to see whether an IP event should be processed or not.
+Check the IP timer to see whether an IP event should be processed or not.
+[in] | pxTimer | Pointer to the IP timer. |
+
|
+ +static | +
Sets the reload time of an IP timer and restarts it.
+Sets the reload time of an IP timer and restarts it.
+[in] | pxTimer | Pointer to the IP timer. |
[in] | xTime | Time to be reloaded into the IP timer. |
TickType_t xCalculateSleepTime | +( | +void | +) | ++ |
Calculate the maximum sleep time remaining. It will go through all timers to see which timer will expire first. That will be the amount of time to block in the next call to xQueueReceive().
+void vTCPTimerReload | +( | +TickType_t | +xTime | ) | ++ |
Sets the reload time of the TCP timer and restarts it.
+[in] | xTime | Time to be reloaded into the TCP timer. |
void vDNSTimerReload | +( | +uint32_t | +ulCheckTime | ) | ++ |
Reload the DNS timer.
+[in] | ulCheckTime | The reload value. |
void vDHCP_RATimerReload | +( | +NetworkEndPoint_t * | +pxEndPoint, | +
+ | + | TickType_t | +uxClockTicks | +
+ | ) | ++ |
Set the reload time of the DHCP/DHCPv6/RA timer.
+[in] | pxEndPoint | The end-point that needs to acquire an IP-address. |
[in] | uxClockTicks | The number of clock-ticks after which the timer should expire. |
void vNetworkTimerReload | +( | +TickType_t | +xTime | ) | ++ |
Reload the Network timer.
+[in] | xTime | Time to be reloaded into the Network timer. |
void vIPSetTCPTimerExpiredState | +( | +BaseType_t | +xExpiredState | ) | ++ |
Enable/disable the TCP timer.
+[in] | xExpiredState | pdTRUE - set as expired; pdFALSE - set as non-expired. |
void vIPSetDHCP_RATimerEnableState | +( | +NetworkEndPoint_t * | +pxEndPoint, | +
+ | + | BaseType_t | +xEnableState | +
+ | ) | ++ |
Enable or disable the DHCP/DHCPv6/RA timer.
+[in] | pxEndPoint | The end-point that needs to acquire an IP-address. |
[in] | xEnableState | pdTRUE if the timer must be enabled, pdFALSE otherwise. |
void vIPSetDNSTimerEnableState | +( | +BaseType_t | +xEnableState | ) | ++ |
Enable/disable the DNS timer.
+[in] | xEnableState | pdTRUE - enable timer; pdFALSE - disable timer. |
Implements the basic functionality for the FreeRTOS+TCP network stack. +More...
+#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_IP_Utils.h"
#include "FreeRTOS_IP_Timers.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_ARP.h"
#include "FreeRTOS_ND.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DHCP.h"
#include "NetworkInterface.h"
#include "NetworkBufferManagement.h"
#include "FreeRTOS_DNS.h"
#include "FreeRTOS_Routing.h"
+Data Structures | |
union | xUnion32_t |
union | xUnionPtr_t |
union | uIntPtr |
uintptr_t is an unsigned integer type that is capable of storing a data pointer. Therefore it is safe to convert from a void pointer to a uintptr_t, using a union. More... | |
+Macros | |
#define | ipEXPECTED_EthernetHeader_t_SIZE ( ( size_t ) 14 ) |
#define | ipEXPECTED_ARPHeader_t_SIZE ( ( size_t ) 28 ) |
#define | ipEXPECTED_IPHeader_t_SIZE ( ( size_t ) 20 ) |
#define | ipEXPECTED_IGMPHeader_t_SIZE ( ( size_t ) 8 ) |
#define | ipEXPECTED_ICMPHeader_t_SIZE ( ( size_t ) 8 ) |
#define | ipEXPECTED_UDPHeader_t_SIZE ( ( size_t ) 8 ) |
#define | ipEXPECTED_TCPHeader_t_SIZE ( ( size_t ) 20 ) |
+#define | ipINITIALISATION_RETRY_DELAY ( pdMS_TO_TICKS( 3000U ) ) |
Time delay between repeated attempts to initialise the network hardware. | |
+#define | FREERTOS_MINIMUM_TCP_OFFSET ( 5U ) |
The minimum value of TCP offset value. | |
+Functions | |
static NetworkBufferDescriptor_t * | prvPacketBuffer_to_NetworkBuffer (const void *pvBuffer, size_t uxOffset) |
Get the network buffer descriptor from the packet buffer. | |
static uintptr_t | void_ptr_to_uintptr (const void *pvPointer) |
Helper function: cast a pointer to a numeric value 'uintptr_t', using a union as defined here above. | |
static BaseType_t | prvChecksumProtocolChecks (size_t uxBufferLength, struct xPacketSummary *pxSet) |
Get and check the specific lengths depending on the protocol ( TCP/UDP/ICMP/IGMP ). | |
static BaseType_t | prvChecksumProtocolMTUCheck (struct xPacketSummary *pxSet) |
See if the packet doesn't get bigger than the value of MTU. | |
static void | prvChecksumProtocolCalculate (BaseType_t xOutgoingPacket, const uint8_t *pucEthernetBuffer, struct xPacketSummary *pxSet) |
Do the actual checksum calculations, both the pseudo header, and the payload. | |
static void | prvChecksumProtocolSetChecksum (BaseType_t xOutgoingPacket, const uint8_t *pucEthernetBuffer, size_t uxBufferLength, const struct xPacketSummary *pxSet) |
For outgoing packets, set the checksum in the packet, for incoming packets: show logging in case an error occurred. | |
static void | prvSetChecksumInPacket (const struct xPacketSummary *pxSet, uint16_t usChecksum) |
Set checksum in the packet. | |
static uint16_t | prvGetChecksumFromPacket (const struct xPacketSummary *pxSet) |
Get checksum from the packet summary. | |
BaseType_t | xSendDHCPEvent (struct xNetworkEndPoint *pxEndPoint) |
Create a DHCP event. | |
NetworkBufferDescriptor_t * | pxDuplicateNetworkBufferWithDescriptor (const NetworkBufferDescriptor_t *const pxNetworkBuffer, size_t uxNewLength) |
Duplicate the given network buffer descriptor with a modified length. | |
NetworkBufferDescriptor_t * | pxUDPPayloadBuffer_to_NetworkBuffer (const void *pvBuffer) |
Get the network buffer from the UDP Payload buffer. | |
BaseType_t | xIsCallingFromIPTask (void) |
Function to check whether the current context belongs to the IP-task. | |
void | prvProcessNetworkDownEvent (struct xNetworkInterface *pxInterface) |
Process a 'Network down' event and complete required processing. | |
+void | vPreCheckConfigs (void) |
Check the values of configuration options and assert on it. Also verify that the IP-task has not already been initialized. | |
uint16_t | usGenerateProtocolChecksum (uint8_t *pucEthernetBuffer, size_t uxBufferLength, BaseType_t xOutgoingPacket) |
Generate or check the protocol checksum of the data sent in the first parameter. At the same time, the length of the packet and the length of the different layers will be checked. | |
uint16_t | usGenerateChecksum (uint16_t usSum, const uint8_t *pucNextData, size_t uxByteCount) |
Calculates the 16-bit checksum of an array of bytes. | |
int32_t | FreeRTOS_max_int32 (int32_t a, int32_t b) |
Get the highest value of two int32's. | |
uint32_t | FreeRTOS_max_uint32 (uint32_t a, uint32_t b) |
Get the highest value of two uint32_t's. | |
size_t | FreeRTOS_max_size_t (size_t a, size_t b) |
Get the highest value of two size_t's. | |
int32_t | FreeRTOS_min_int32 (int32_t a, int32_t b) |
Get the lowest value of two int32_t's. | |
uint32_t | FreeRTOS_min_uint32 (uint32_t a, uint32_t b) |
Get the lowest value of two uint32_t's. | |
size_t | FreeRTOS_min_size_t (size_t a, size_t b) |
Get the lowest value of two size_t's. | |
int32_t | FreeRTOS_add_int32 (int32_t a, int32_t b) |
Performs a safe addition of two 32-bit integers, preventing overflow and underflow. | |
int32_t | FreeRTOS_multiply_int32 (int32_t a, int32_t b) |
Performs a safe multiplication of two 32-bit integers, preventing overflow and underflow. | |
uint32_t | FreeRTOS_round_up (uint32_t a, uint32_t d) |
Round-up a number to a multiple of 'd'. | |
uint32_t | FreeRTOS_round_down (uint32_t a, uint32_t d) |
Round-down a number to a multiple of 'd'. | |
uint32_t | ulChar2u32 (const uint8_t *pucPtr) |
Convert character array (of size 4) to equivalent 32-bit value. | |
uint16_t | usChar2u16 (const uint8_t *pucPtr) |
Convert character array (of size 2) to equivalent 16-bit value. | |
eDHCPState_t | eGetDHCPState (const struct xNetworkEndPoint *pxEndPoint) |
Returns the current state of a DHCP process. | |
Implements the basic functionality for the FreeRTOS+TCP network stack.
+#define ipEXPECTED_EthernetHeader_t_SIZE ( ( size_t ) 14 ) | +
Ethernet Header size in bytes.
+ +#define ipEXPECTED_ARPHeader_t_SIZE ( ( size_t ) 28 ) | +
ARP header size in bytes.
+ +#define ipEXPECTED_IPHeader_t_SIZE ( ( size_t ) 20 ) | +
IP header size in bytes.
+ +#define ipEXPECTED_IGMPHeader_t_SIZE ( ( size_t ) 8 ) | +
IGMP header size in bytes.
+ +#define ipEXPECTED_ICMPHeader_t_SIZE ( ( size_t ) 8 ) | +
ICMP header size in bytes.
+ +#define ipEXPECTED_UDPHeader_t_SIZE ( ( size_t ) 8 ) | +
UDP header size in bytes.
+ +#define ipEXPECTED_TCPHeader_t_SIZE ( ( size_t ) 20 ) | +
TCP header size in bytes.
+ +
+
|
+ +static | +
Get the network buffer descriptor from the packet buffer.
+[in] | pvBuffer | The pointer to packet buffer. |
[in] | uxOffset | Additional offset (such as the packet length of UDP packet etc.). |
+
|
+ +static | +
Helper function: cast a pointer to a numeric value 'uintptr_t', using a union as defined here above.
+[in] | pvPointer | A void pointer to be converted. |
+
|
+ +static | +
Get and check the specific lengths depending on the protocol ( TCP/UDP/ICMP/IGMP ).
+[in] | uxBufferLength | The number of bytes to be sent or received. |
[in] | pxSet | A struct describing this packet. |
+
|
+ +static | +
See if the packet doesn't get bigger than the value of MTU.
+[in] | pxSet | A struct describing this packet. |
+
|
+ +static | +
Do the actual checksum calculations, both the pseudo header, and the payload.
+[in] | xOutgoingPacket | pdTRUE when the packet is to be sent. |
[in] | pucEthernetBuffer | The buffer containing the packet. |
[in] | pxSet | A struct describing this packet. |
+
|
+ +static | +
For outgoing packets, set the checksum in the packet, for incoming packets: show logging in case an error occurred.
+[in] | xOutgoingPacket | Non-zero if this is an outgoing packet. |
[in] | pucEthernetBuffer | The buffer containing the packet. |
[in] | uxBufferLength | the total number of bytes received, or the number of bytes written |
[in] | pxSet | A struct describing this packet. |
+
|
+ +static | +
Set checksum in the packet.
+pxSet | Pointer to the packet summary that describes the packet, to which the checksum will be set. |
usChecksum | Checksum value to be set. |
+
|
+ +static | +
Get checksum from the packet summary.
+pxSet | Pointer to the packet summary that describes the packet, from which the checksum will be retrieved. |
BaseType_t xSendDHCPEvent | +( | +struct xNetworkEndPoint * | +pxEndPoint | ) | ++ |
Create a DHCP event.
+pxEndPoint | The end-point that needs DHCP. |
NetworkBufferDescriptor_t * pxDuplicateNetworkBufferWithDescriptor | +( | +const NetworkBufferDescriptor_t *const | +pxNetworkBuffer, | +
+ | + | size_t | +uxNewLength | +
+ | ) | ++ |
Duplicate the given network buffer descriptor with a modified length.
+[in] | pxNetworkBuffer | The network buffer to be duplicated. |
[in] | uxNewLength | The length for the new buffer. |
NetworkBufferDescriptor_t * pxUDPPayloadBuffer_to_NetworkBuffer | +( | +const void * | +pvBuffer | ) | ++ |
Get the network buffer from the UDP Payload buffer.
+[in] | pvBuffer | Pointer to the UDP payload buffer. |
BaseType_t xIsCallingFromIPTask | +( | +void | +) | ++ |
Function to check whether the current context belongs to the IP-task.
+void prvProcessNetworkDownEvent | +( | +struct xNetworkInterface * | +pxInterface | ) | ++ |
Process a 'Network down' event and complete required processing.
+pxInterface | The interface that goes down. |
uint16_t usGenerateProtocolChecksum | +( | +uint8_t * | +pucEthernetBuffer, | +
+ | + | size_t | +uxBufferLength, | +
+ | + | BaseType_t | +xOutgoingPacket | +
+ | ) | ++ |
Generate or check the protocol checksum of the data sent in the first parameter. At the same time, the length of the packet and the length of the different layers will be checked.
+[in] | pucEthernetBuffer | The Ethernet buffer for which the checksum is to be calculated or checked. 'pucEthernetBuffer' is now non-const because the function will set the checksum fields, in case 'xOutgoingPacket' is pdTRUE. |
[in] | uxBufferLength | the total number of bytes received, or the number of bytes written in the packet buffer. |
[in] | xOutgoingPacket | Whether this is an outgoing packet or not. |
uint16_t usGenerateChecksum | +( | +uint16_t | +usSum, | +
+ | + | const uint8_t * | +pucNextData, | +
+ | + | size_t | +uxByteCount | +
+ | ) | ++ |
Calculates the 16-bit checksum of an array of bytes.
+This method generates a checksum for a given IPv4 header, per RFC791 (page 14). The checksum algorithm is described as: "[T]he 16 bit one's complement of the one's complement sum of all 16 bit words in the + header. For purposes of computing the checksum, the value of the checksum field is zero."
+In a nutshell, that means that each 16-bit 'word' must be summed, after which the number of 'carries' (overflows) is added to the result. If that addition produces an overflow, that 'carry' must also be added to the final result. The final checksum should be the bitwise 'not' (ones-complement) of the result if the packet is meant to be transmitted, but this method simply returns the raw value, probably because when a packet is received, the checksum is verified by checking that ((received & calculated) == 0) without applying a bitwise 'not' to the 'calculated' checksum.
+This logic is optimized for microcontrollers which have limited resources, so the logic looks odd. It iterates over the full range of 16-bit words, but it does so by processing several 32-bit words at once whenever possible. Its first step is to align the memory pointer to a 32-bit boundary, after which it runs a fast loop to process multiple 32-bit words at once and adding their 'carries'. Finally, it finishes up by processing any remaining 16-bit words, and adding up all of the 'carries'. With 32-bit arithmetic, the number of 16-bit 'carries' produced by sequential additions can be found by looking at the 16 most-significant bits of the 32-bit integer, since a 32-bit int will continue counting up instead of overflowing after 16 bits. That is why the actual checksum calculations look like: union.u32 = ( uint32_t ) union.u16[ 0 ] + union.u16[ 1 ];
+Arguments: ulSum: This argument provides a value to initialise the progressive summation of the header's values to. It is often 0, but protocols like TCP or UDP can have pseudo-header fields which need to be included in the checksum. pucNextData: This argument contains the address of the first byte which this method should process. The method's memory iterator is initialised to this value. uxDataLengthBytes: This argument contains the number of bytes that this method should process.
+[in] | usSum | The initial sum, obtained from earlier data. |
[in] | pucNextData | The actual data. |
[in] | uxByteCount | The number of bytes. |
int32_t FreeRTOS_max_int32 | +( | +int32_t | +a, | +
+ | + | int32_t | +b | +
+ | ) | ++ |
Get the highest value of two int32's.
+[in] | a | the first value. |
[in] | b | the second value. |
uint32_t FreeRTOS_max_uint32 | +( | +uint32_t | +a, | +
+ | + | uint32_t | +b | +
+ | ) | ++ |
Get the highest value of two uint32_t's.
+[in] | a | the first value. |
[in] | b | the second value. |
size_t FreeRTOS_max_size_t | +( | +size_t | +a, | +
+ | + | size_t | +b | +
+ | ) | ++ |
Get the highest value of two size_t's.
+[in] | a | the first value. |
[in] | b | the second value. |
int32_t FreeRTOS_min_int32 | +( | +int32_t | +a, | +
+ | + | int32_t | +b | +
+ | ) | ++ |
Get the lowest value of two int32_t's.
+[in] | a | the first value. |
[in] | b | the second value. |
uint32_t FreeRTOS_min_uint32 | +( | +uint32_t | +a, | +
+ | + | uint32_t | +b | +
+ | ) | ++ |
Get the lowest value of two uint32_t's.
+[in] | a | the first value. |
[in] | b | the second value. |
size_t FreeRTOS_min_size_t | +( | +size_t | +a, | +
+ | + | size_t | +b | +
+ | ) | ++ |
Get the lowest value of two size_t's.
+[in] | a | the first value. |
[in] | b | the second value. |
int32_t FreeRTOS_add_int32 | +( | +int32_t | +a, | +
+ | + | int32_t | +b | +
+ | ) | ++ |
Performs a safe addition of two 32-bit integers, preventing overflow and underflow.
+[in] | a | the first value. |
[in] | b | the second value. |
int32_t FreeRTOS_multiply_int32 | +( | +int32_t | +a, | +
+ | + | int32_t | +b | +
+ | ) | ++ |
Performs a safe multiplication of two 32-bit integers, preventing overflow and underflow.
+[in] | a | the first value. |
[in] | b | the second value. |
uint32_t FreeRTOS_round_up | +( | +uint32_t | +a, | +
+ | + | uint32_t | +d | +
+ | ) | ++ |
Round-up a number to a multiple of 'd'.
+[in] | a | the first value. |
[in] | d | the second value. |
uint32_t FreeRTOS_round_down | +( | +uint32_t | +a, | +
+ | + | uint32_t | +d | +
+ | ) | ++ |
Round-down a number to a multiple of 'd'.
+[in] | a | the first value. |
[in] | d | the second value. |
uint32_t ulChar2u32 | +( | +const uint8_t * | +pucPtr | ) | ++ |
Convert character array (of size 4) to equivalent 32-bit value.
+[in] | pucPtr | The character array. |
uint16_t usChar2u16 | +( | +const uint8_t * | +pucPtr | ) | ++ |
Convert character array (of size 2) to equivalent 16-bit value.
+[in] | pucPtr | The character array. |
eDHCPState_t eGetDHCPState | +( | +const struct xNetworkEndPoint * | +pxEndPoint | ) | ++ |
Returns the current state of a DHCP process.
+[in] | pxEndPoint | the end-point which is going through the DHCP process. |
Implements the basic functionality for the FreeRTOS+TCP network stack. +More...
+#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "FreeRTOS.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_IPv4.h"
+Macros | |
#define | ipFIRST_MULTI_CAST_IPv4 0xE0000000U |
#define | ipLAST_MULTI_CAST_IPv4 0xF0000000U |
+Functions | |
BaseType_t | xIsIPv4Multicast (uint32_t ulIPAddress) |
Is the IP address an IPv4 multicast address. | |
BaseType_t | xBadIPv4Loopback (const IPHeader_t *const pxIPHeader) |
Check if the packet is an illegal loopback packet. | |
BaseType_t | xIsIPv4Loopback (uint32_t ulAddress) |
Is the IP address an IPv4 loopback address. | |
enum eFrameProcessingResult | prvAllowIPPacketIPv4 (const struct xIP_PACKET *const pxIPPacket, const struct xNETWORK_BUFFER *const pxNetworkBuffer, UBaseType_t uxHeaderLength) |
Check whether this IPv4 packet is to be allowed or to be dropped. | |
enum eFrameProcessingResult | prvCheckIP4HeaderOptions (struct xNETWORK_BUFFER *const pxNetworkBuffer) |
Check if the IP-header is carrying options. | |
Implements the basic functionality for the FreeRTOS+TCP network stack.
+#define ipFIRST_MULTI_CAST_IPv4 0xE0000000U | +
Lower bound of the IPv4 multicast address.
+ +#define ipLAST_MULTI_CAST_IPv4 0xF0000000U | +
Higher bound of the IPv4 multicast address.
+ +BaseType_t xIsIPv4Multicast | +( | +uint32_t | +ulIPAddress | ) | ++ |
Is the IP address an IPv4 multicast address.
+[in] | ulIPAddress | The IP address being checked. |
BaseType_t xBadIPv4Loopback | +( | +const IPHeader_t *const | +pxIPHeader | ) | ++ |
Check if the packet is an illegal loopback packet.
+[in] | pxIPHeader | The IP-header being checked. |
BaseType_t xIsIPv4Loopback | +( | +uint32_t | +ulAddress | ) | ++ |
Is the IP address an IPv4 loopback address.
+[in] | ulAddress | The IP address being checked. |
enum eFrameProcessingResult prvAllowIPPacketIPv4 | +( | +const struct xIP_PACKET *const | +pxIPPacket, | +
+ | + | const struct xNETWORK_BUFFER *const | +pxNetworkBuffer, | +
+ | + | UBaseType_t | +uxHeaderLength | +
+ | ) | ++ |
Check whether this IPv4 packet is to be allowed or to be dropped.
+[in] | pxIPPacket | The IP packet under consideration. |
[in] | pxNetworkBuffer | The whole network buffer. |
[in] | uxHeaderLength | The length of the header. |
enum eFrameProcessingResult prvCheckIP4HeaderOptions | +( | +struct xNETWORK_BUFFER *const | +pxNetworkBuffer | ) | ++ |
Check if the IP-header is carrying options.
+[in] | pxNetworkBuffer | the network buffer that contains the packet. |
Implements the Sockets API based on Berkeley sockets for the FreeRTOS+TCP network stack. Sockets are used by the application processes to interact with the IP-task which in turn interacts with the hardware. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_IPv4_Sockets.h"
+Macros | |
+#define | socketMAX_IP_ADDRESS_OCTETS ( 4U ) |
The number of octets that make up an IP address. | |
+Functions | |
BaseType_t | FreeRTOS_inet_pton4 (const char *pcSource, void *pvDestination) |
This function converts the character string pcSource into a network address structure, then copies the network address structure to pvDestination. pvDestination is written in network byte order. | |
const char * | FreeRTOS_inet_ntop4 (const void *pvSource, char *pcDestination, socklen_t uxSize) |
Convert the 32-bit representation of the IP-address to the dotted decimal format. | |
void * | xSend_UDP_Update_IPv4 (NetworkBufferDescriptor_t *pxNetworkBuffer, const struct freertos_sockaddr *pxDestinationAddress) |
Called by prvSendUDPPacket(), this function will UDP packet fields and IPv4 address for the packet to be send. | |
size_t | xRecv_Update_IPv4 (const NetworkBufferDescriptor_t *pxNetworkBuffer, struct freertos_sockaddr *pxSourceAddress) |
Called by FreeRTOS_recvfrom(), this function will update socket address with IPv4 address from the packet received. | |
Implements the Sockets API based on Berkeley sockets for the FreeRTOS+TCP network stack. Sockets are used by the application processes to interact with the IP-task which in turn interacts with the hardware.
+BaseType_t FreeRTOS_inet_pton4 | +( | +const char * | +pcSource, | +
+ | + | void * | +pvDestination | +
+ | ) | ++ |
This function converts the character string pcSource into a network address structure, then copies the network address structure to pvDestination. pvDestination is written in network byte order.
+[in] | pcSource | The character string in holding the IP address. |
[out] | pvDestination | The returned network address in 32-bit network-endian format. |
const char * FreeRTOS_inet_ntop4 | +( | +const void * | +pvSource, | +
+ | + | char * | +pcDestination, | +
+ | + | socklen_t | +uxSize | +
+ | ) | ++ |
Convert the 32-bit representation of the IP-address to the dotted decimal format.
+[in] | pvSource | The pointer to the 32-bit representation of the IP-address. |
[out] | pcDestination | The pointer to a character array where the string of the dotted decimal IP format. |
[in] | uxSize | Size of the character array. This value makes sure that the code doesn't write beyond it's bounds. |
void * xSend_UDP_Update_IPv4 | +( | +NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | const struct freertos_sockaddr * | +pxDestinationAddress | +
+ | ) | ++ |
Called by prvSendUDPPacket(), this function will UDP packet fields and IPv4 address for the packet to be send.
+[in] | pxNetworkBuffer | The packet to be sent. |
[in] | pxDestinationAddress | The IPv4 socket address. |
size_t xRecv_Update_IPv4 | +( | +const NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | struct freertos_sockaddr * | +pxSourceAddress | +
+ | ) | ++ |
Called by FreeRTOS_recvfrom(), this function will update socket address with IPv4 address from the packet received.
+[in] | pxNetworkBuffer | The packet received. |
[in] | pxSourceAddress | The IPv4 socket address. |
Implements the basic functionality for the FreeRTOS+TCP network stack functions for IPv4. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "FreeRTOS_IP.h"
+Functions | |
void | vSetMultiCastIPv4MacAddress (uint32_t ulIPAddress, MACAddress_t *pxMACAddress) |
Set multicast MAC address. | |
BaseType_t | prvChecksumIPv4Checks (uint8_t *pucEthernetBuffer, size_t uxBufferLength, struct xPacketSummary *pxSet) |
Do the first IPv4 length checks at the IP-header level. | |
Implements the basic functionality for the FreeRTOS+TCP network stack functions for IPv4.
+void vSetMultiCastIPv4MacAddress | +( | +uint32_t | +ulIPAddress, | +
+ | + | MACAddress_t * | +pxMACAddress | +
+ | ) | ++ |
Set multicast MAC address.
+[in] | ulIPAddress | IP address. |
[out] | pxMACAddress | Pointer to MAC address. |
BaseType_t prvChecksumIPv4Checks | +( | +uint8_t * | +pucEthernetBuffer, | +
+ | + | size_t | +uxBufferLength, | +
+ | + | struct xPacketSummary * | +pxSet | +
+ | ) | ++ |
Do the first IPv4 length checks at the IP-header level.
+[in] | pucEthernetBuffer | The buffer containing the packet. |
[in] | uxBufferLength | The number of bytes to be sent or received. |
[in] | pxSet | A struct describing this packet. |
Implements the basic functionality for the FreeRTOS+TCP network stack. +More...
+#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "FreeRTOS.h"
#include "FreeRTOS_IP.h"
+Macros | |
+#define | IPv6MC_GET_SCOPE_VALUE(pxIPv6Address) ( ( ( pxIPv6Address )->ucBytes[ 1 ] ) & 0x0FU ) |
Get the scope field in IPv6 multicast address. | |
+#define | IPv6MC_GET_FLAGS_VALUE(pxIPv6Address) ( ( ( pxIPv6Address )->ucBytes[ 1 ] ) & 0xF0U ) |
Get the flags field in IPv6 multicast address. | |
+#define | IPv6MC_GET_GROUP_ID(pxIPv6Address, pxReturnGroupID) ( xGetIPv6MulticastGroupID( pxIPv6Address, pxReturnGroupID ) ) |
Get the group ID field in IPv6 multicast address. | |
+Functions | |
static void | xGetIPv6MulticastGroupID (const IPv6_Address_t *pxIPv6Address, IPv6_Address_t *pxReturnGroupID) |
Get the group ID and stored into IPv6_Address_t. | |
BaseType_t | xIsIPv6Loopback (const IPv6_Address_t *pxAddress) |
Check if the IP-address is an IPv6 loopback address. | |
BaseType_t | xBadIPv6Loopback (const IPHeader_IPv6_t *const pxIPv6Header) |
Check if the packet is an illegal loopback packet. | |
BaseType_t | xIsIPv6AllowedMulticast (const IPv6_Address_t *pxIPAddress) |
Check whether this IPv6 address is an allowed multicast address or not. | |
BaseType_t | xCompareIPv6_Address (const IPv6_Address_t *pxLeft, const IPv6_Address_t *pxRight, size_t uxPrefixLength) |
Compares 2 IPv6 addresses and checks if the one on the left can handle the one on right. Note that 'xCompareIPv6_Address' will also check if 'pxRight' is the special unicast address: ff02::1:ffnn:nnnn, where nn:nnnn are the last 3 bytes of the IPv6 address. | |
eFrameProcessingResult_t | prvAllowIPPacketIPv6 (const IPHeader_IPv6_t *const pxIPv6Header, const NetworkBufferDescriptor_t *const pxNetworkBuffer, UBaseType_t uxHeaderLength) |
Check whether this IPv6 packet is to be allowed or to be dropped. | |
BaseType_t | xGetExtensionOrder (uint8_t ucProtocol, uint8_t ucNextHeader) |
Check extension header and next header and return their order. | |
eFrameProcessingResult_t | eHandleIPv6ExtensionHeaders (NetworkBufferDescriptor_t *const pxNetworkBuffer, BaseType_t xDoRemove) |
Handle the IPv6 extension headers. | |
+Variables | |
const struct xIPv6_Address | FreeRTOS_in6addr_any = { 0 } |
const struct xIPv6_Address | FreeRTOS_in6addr_loopback = { { 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 1U } } |
Implements the basic functionality for the FreeRTOS+TCP network stack.
+
+
|
+ +static | +
Get the group ID and stored into IPv6_Address_t.
+[in] | pxIPv6Address | The multicast address to filter group ID. |
[out] | pxReturnGroupID | The buffer to store group ID. |
BaseType_t xIsIPv6Loopback | +( | +const IPv6_Address_t * | +pxAddress | ) | ++ |
Check if the IP-address is an IPv6 loopback address.
+[in] | pxAddress | The IP-address being checked. |
BaseType_t xBadIPv6Loopback | +( | +const IPHeader_IPv6_t *const | +pxIPv6Header | ) | ++ |
Check if the packet is an illegal loopback packet.
+[in] | pxIPv6Header | The IP-header of the packet. |
BaseType_t xIsIPv6AllowedMulticast | +( | +const IPv6_Address_t * | +pxIPAddress | ) | ++ |
Check whether this IPv6 address is an allowed multicast address or not.
+[in] | pxIPAddress | The IP address to be checked. |
BaseType_t xCompareIPv6_Address | +( | +const IPv6_Address_t * | +pxLeft, | +
+ | + | const IPv6_Address_t * | +pxRight, | +
+ | + | size_t | +uxPrefixLength | +
+ | ) | ++ |
Compares 2 IPv6 addresses and checks if the one on the left can handle the one on right. Note that 'xCompareIPv6_Address' will also check if 'pxRight' is the special unicast address: ff02::1:ffnn:nnnn, where nn:nnnn are the last 3 bytes of the IPv6 address.
+[in] | pxLeft | First IP address. |
[in] | pxRight | Second IP address. |
[in] | uxPrefixLength | The IP address prefix length in bits. |
eFrameProcessingResult_t prvAllowIPPacketIPv6 | +( | +const IPHeader_IPv6_t *const | +pxIPv6Header, | +
+ | + | const NetworkBufferDescriptor_t *const | +pxNetworkBuffer, | +
+ | + | UBaseType_t | +uxHeaderLength | +
+ | ) | ++ |
Check whether this IPv6 packet is to be allowed or to be dropped.
+[in] | pxIPv6Header | The IP packet under consideration. |
[in] | pxNetworkBuffer | The whole network buffer. |
[in] | uxHeaderLength | The length of the header. |
BaseType_t xGetExtensionOrder | +( | +uint8_t | +ucProtocol, | +
+ | + | uint8_t | +ucNextHeader | +
+ | ) | ++ |
Check extension header and next header and return their order.
+[in] | ucProtocol | Extension header ID. |
[in] | ucNextHeader | Next header ID. |
eFrameProcessingResult_t eHandleIPv6ExtensionHeaders | +( | +NetworkBufferDescriptor_t *const | +pxNetworkBuffer, | +
+ | + | BaseType_t | +xDoRemove | +
+ | ) | ++ |
Handle the IPv6 extension headers.
+[in,out] | pxNetworkBuffer | The received packet that contains IPv6 extension headers. |
[in] | xDoRemove | Function removes the extension header if xDoRemove is set to pdTRUE. |
const struct xIPv6_Address FreeRTOS_in6addr_any = { 0 } | +
This variable is initialized by the system to contain the wildcard IPv6 address.
+ +const struct xIPv6_Address FreeRTOS_in6addr_loopback = { { 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 1U } } | +
This variable is initialized by the system to contain the loopback IPv6 address.
+ +Implements the Sockets API based on Berkeley sockets for the FreeRTOS+TCP network stack. Sockets are used by the application processes to interact with the IP-task which in turn interacts with the hardware. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_IPv6_Sockets.h"
+Functions | |
FreeRTOS_Socket_t * | pxTCPSocketLookup_IPv6 (FreeRTOS_Socket_t *pxSocket, const IPv46_Address_t *pxAddress) |
Called by pxTCPSocketLookup(), this function will check if a socket is connected to a remote IP-address. It will be called from a loop iterating through all sockets. | |
void * | xSend_UDP_Update_IPv6 (NetworkBufferDescriptor_t *pxNetworkBuffer, const struct freertos_sockaddr *pxDestinationAddress) |
Called by prvSendUDPPacket(), this function will UDP packet fields and IPv6 address for the packet to be send. | |
size_t | xRecv_Update_IPv6 (const NetworkBufferDescriptor_t *pxNetworkBuffer, struct freertos_sockaddr *pxSourceAddress) |
Called by FreeRTOS_recvfrom(), this function will update socket address with IPv6 address from the packet received. | |
char | cHexToChar (uint16_t usValue) |
Converts a 4 bit (nibble) value to a readable hex character, e.g. 14 becomes 'e'. | |
socklen_t | uxHexPrintShort (char *pcBuffer, size_t uxBufferSize, uint16_t usValue) |
Convert a short numeric value to a hex string of at most 4 characters. The resulting string is not null-terminated. The resulting string will not have leading zero's, except when 'usValue' equals zero. | |
void | prv_ntop6_search_zeros (struct sNTOP6_Set *pxSet) |
Scan the binary IPv6 address and find the longest train of consecutive zero's. The result of this search will be stored in 'xZeroStart' and 'xZeroLength'. | |
static BaseType_t | prv_ntop6_write_zeros (char *pcDestination, size_t uxSize, struct sNTOP6_Set *pxSet) |
The location is now at the longest train of zero's. Two colons have to be printed without a numeric value, e.g. "ff02::1". | |
static BaseType_t | prv_ntop6_write_short (char *pcDestination, size_t uxSize, struct sNTOP6_Set *pxSet) |
Write a short value, as a hex number with at most 4 characters. E.g. the value 15 will be printed as "f". | |
const char * | FreeRTOS_inet_ntop6 (const void *pvSource, char *pcDestination, socklen_t uxSize) |
This function converts a binary IPv6 address to a human readable notation. | |
static BaseType_t | prv_inet_pton6_add_nibble (struct sPTON6_Set *pxSet, uint8_t ucNew, char ch) |
Converting a readable IPv6 address to its binary form, add one nibble. | |
static void | prv_inet_pton6_set_zeros (struct sPTON6_Set *pxSet) |
Convert an ASCII character to its corresponding hexadecimal value. A :: block was found, now fill in the zero's. | |
BaseType_t | FreeRTOS_inet_pton6 (const char *pcSource, void *pvDestination) |
Convert an IPv6 address in hexadecimal notation to a binary format of 16 bytes. | |
Implements the Sockets API based on Berkeley sockets for the FreeRTOS+TCP network stack. Sockets are used by the application processes to interact with the IP-task which in turn interacts with the hardware.
+FreeRTOS_Socket_t * pxTCPSocketLookup_IPv6 | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | const IPv46_Address_t * | +pxAddress | +
+ | ) | ++ |
Called by pxTCPSocketLookup(), this function will check if a socket is connected to a remote IP-address. It will be called from a loop iterating through all sockets.
+[in] | pxSocket | The socket to be inspected. |
[in] | pxAddress | The IPv4/IPv6 address. |
void * xSend_UDP_Update_IPv6 | +( | +NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | const struct freertos_sockaddr * | +pxDestinationAddress | +
+ | ) | ++ |
Called by prvSendUDPPacket(), this function will UDP packet fields and IPv6 address for the packet to be send.
+[in] | pxNetworkBuffer | The packet to be sent. |
[in] | pxDestinationAddress | The IPv4 socket address. |
size_t xRecv_Update_IPv6 | +( | +const NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | struct freertos_sockaddr * | +pxSourceAddress | +
+ | ) | ++ |
Called by FreeRTOS_recvfrom(), this function will update socket address with IPv6 address from the packet received.
+[in] | pxNetworkBuffer | The packet received. |
[in] | pxSourceAddress | The IPv4 socket address. |
char cHexToChar | +( | +uint16_t | +usValue | ) | ++ |
Converts a 4 bit (nibble) value to a readable hex character, e.g. 14 becomes 'e'.
+usValue | The value to be converted, must be between 0 and 15. |
socklen_t uxHexPrintShort | +( | +char * | +pcBuffer, | +
+ | + | size_t | +uxBufferSize, | +
+ | + | uint16_t | +usValue | +
+ | ) | ++ |
Convert a short numeric value to a hex string of at most 4 characters. The resulting string is not null-terminated. The resulting string will not have leading zero's, except when 'usValue' equals zero.
+[in] | pcBuffer | The buffer to which the string is written. |
[in] | uxBufferSize | The size of the buffer pointed to by 'pcBuffer'. |
[in] | usValue | The 16-bit value to be converted. |
void prv_ntop6_search_zeros | +( | +struct sNTOP6_Set * | +pxSet | ) | ++ |
Scan the binary IPv6 address and find the longest train of consecutive zero's. The result of this search will be stored in 'xZeroStart' and 'xZeroLength'.
+pxSet | the set of parameters as used by FreeRTOS_inet_ntop6(). |
+
|
+ +static | +
The location is now at the longest train of zero's. Two colons have to be printed without a numeric value, e.g. "ff02::1".
+pcDestination | the output buffer where the colons will be printed. |
uxSize | the remaining length of the output buffer. |
pxSet | the set of parameters as used by FreeRTOS_inet_ntop6(). |
+
|
+ +static | +
Write a short value, as a hex number with at most 4 characters. E.g. the value 15 will be printed as "f".
+pcDestination | the output buffer where the hex number is to be printed. |
uxSize | the remaining length of the output buffer. |
pxSet | the set of parameters as used by FreeRTOS_inet_ntop6(). |
const char * FreeRTOS_inet_ntop6 | +( | +const void * | +pvSource, | +
+ | + | char * | +pcDestination, | +
+ | + | socklen_t | +uxSize | +
+ | ) | ++ |
This function converts a binary IPv6 address to a human readable notation.
+[in] | pvSource | The binary address, 16 bytes long.. |
[out] | pcDestination | The human-readable ( hexadecimal ) notation of the address. |
[in] | uxSize | The size of pvDestination. A value of 40 is recommended. |
+
|
+ +static | +
Converting a readable IPv6 address to its binary form, add one nibble.
+[in] | pxSet | A set of variables describing the conversion. |
[in] | ucNew | The hex value, between 0 and 15 |
[in] | ch | The character, such as '5', 'f', or ':'. |
+
|
+ +static | +
Convert an ASCII character to its corresponding hexadecimal value. A :: block was found, now fill in the zero's.
+[in] | pxSet | A set of variables describing the conversion. |
BaseType_t FreeRTOS_inet_pton6 | +( | +const char * | +pcSource, | +
+ | + | void * | +pvDestination | +
+ | ) | ++ |
Convert an IPv6 address in hexadecimal notation to a binary format of 16 bytes.
+[in] | pcSource | The address in hexadecimal notation. |
[out] | pvDestination | The address in binary format, 16 bytes long. |
Implements the basic functionality for the FreeRTOS+TCP network stack functions for IPv6. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "FreeRTOS_IP.h"
+Functions | |
void | vSetMultiCastIPv6MacAddress (const IPv6_Address_t *pxAddress, MACAddress_t *pxMACAddress) |
Set multicast MAC address. | |
BaseType_t | prvChecksumIPv6Checks (uint8_t *pucEthernetBuffer, size_t uxBufferLength, struct xPacketSummary *pxSet) |
Do the first IPv6 length checks at the IP-header level. | |
BaseType_t | prvChecksumICMPv6Checks (size_t uxBufferLength, struct xPacketSummary *pxSet) |
Check the buffer lengths of an ICMPv6 packet. | |
size_t | usGetExtensionHeaderLength (const uint8_t *pucEthernetBuffer, size_t uxBufferLength, uint8_t *pucProtocol) |
Get total length of all extension headers in IPv6 packet. | |
void | vManageSolicitedNodeAddress (const struct xNetworkEndPoint *pxEndPoint, BaseType_t xNetworkGoingUp) |
Every IPv6 end-point has a solicited node multicast address and a corresponding multicast MAC address. The IPv6 solicited node address also has an MLD reports associated with it. This function manages both the MAC address and the MLD report associated with the end-point's solicited-node address. On network UP, this function registers the MAC address with the network driver's filter and creates and MLD report for the UPv6 multicast address. On network DOWN, the function unregisters the MAC address and removes the MLD report. This is a "convenience" function that keeps all these tasks under one roof for easier maintenance. | |
Implements the basic functionality for the FreeRTOS+TCP network stack functions for IPv6.
+void vSetMultiCastIPv6MacAddress | +( | +const IPv6_Address_t * | +pxAddress, | +
+ | + | MACAddress_t * | +pxMACAddress | +
+ | ) | ++ |
Set multicast MAC address.
+[in] | pxAddress | IPv6 address. |
[out] | pxMACAddress | Pointer to MAC address. |
BaseType_t prvChecksumIPv6Checks | +( | +uint8_t * | +pucEthernetBuffer, | +
+ | + | size_t | +uxBufferLength, | +
+ | + | struct xPacketSummary * | +pxSet | +
+ | ) | ++ |
Do the first IPv6 length checks at the IP-header level.
+[in] | pucEthernetBuffer | The buffer containing the packet. |
[in] | uxBufferLength | The number of bytes to be sent or received. |
[in] | pxSet | A struct describing this packet. |
BaseType_t prvChecksumICMPv6Checks | +( | +size_t | +uxBufferLength, | +
+ | + | struct xPacketSummary * | +pxSet | +
+ | ) | ++ |
Check the buffer lengths of an ICMPv6 packet.
+[in] | uxBufferLength | The total length of the packet. |
[in] | pxSet | A struct describing this packet. |
size_t usGetExtensionHeaderLength | +( | +const uint8_t * | +pucEthernetBuffer, | +
+ | + | size_t | +uxBufferLength, | +
+ | + | uint8_t * | +pucProtocol | +
+ | ) | ++ |
Get total length of all extension headers in IPv6 packet.
+[in] | pucEthernetBuffer | The buffer containing the packet. |
[in] | uxBufferLength | The number of bytes to be sent or received. |
[out] | pucProtocol | The L4 protocol, such as TCP/UDP/ICMPv6. |
void vManageSolicitedNodeAddress | +( | +const struct xNetworkEndPoint * | +pxEndPoint, | +
+ | + | BaseType_t | +xNetworkGoingUp | +
+ | ) | ++ |
Every IPv6 end-point has a solicited node multicast address and a corresponding multicast MAC address. The IPv6 solicited node address also has an MLD reports associated with it. This function manages both the MAC address and the MLD report associated with the end-point's solicited-node address. On network UP, this function registers the MAC address with the network driver's filter and creates and MLD report for the UPv6 multicast address. On network DOWN, the function unregisters the MAC address and removes the MLD report. This is a "convenience" function that keeps all these tasks under one roof for easier maintenance.
+[in] | pxEndPoint | The end-point for which a network up/down event is being handled. |
[in] | xNetworkGoingUp | pdTRUE when the network goes UP, pdFALSE when the network goes DOWN. |
Implements a few functions that handle Neighbour Discovery and other ICMPv6 messages. +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_UDP_IP.h"
#include "FreeRTOS_Routing.h"
#include "FreeRTOS_ND.h"
#include "FreeRTOS_IP_Timers.h"
#include "FreeRTOS_DNS.h"
#include "NetworkBufferManagement.h"
+Functions | |
static eResolutionLookupResult_t | prvMACResolve (const IPv6_Address_t *pxAddressToLookup, MACAddress_t *const pxMACAddress, NetworkEndPoint_t **ppxEndPoint) |
See if the MAC-address can be resolved because it is a multi-cast address. | |
static eResolutionLookupResult_t | prvNDCacheLookup (const IPv6_Address_t *pxAddressToLookup, MACAddress_t *const pxMACAddress, NetworkEndPoint_t **ppxEndPoint) |
Lookup an MAC address in the ND cache from the IP address. | |
static NetworkEndPoint_t * | pxFindLocalEndpoint (void) |
Find the first end-point of type IPv6. | |
eResolutionLookupResult_t | eNDGetCacheEntry (IPv6_Address_t *pxIPAddress, MACAddress_t *const pxMACAddress, struct xNetworkEndPoint **ppxEndPoint) |
Find the MAC-address of an IPv6 address. It will first determine if is a multicast address, if not, it will check the ND cache. | |
void | vNDRefreshCacheEntry (const MACAddress_t *pxMACAddress, const IPv6_Address_t *pxIPAddress, NetworkEndPoint_t *pxEndPoint) |
Store a combination of IP-address, MAC-address and an end-point in a free location in the ND cache. | |
+void | vNDAgeCache (void) |
Reduce the age counter in each entry within the ND cache. An entry is no longer considered valid and is deleted if its age reaches zero. Just before getting to zero, 3 times a neighbour solicitation will be sent. | |
void | FreeRTOS_ClearND (const struct xNetworkEndPoint *pxEndPoint) |
A call to this function will clear the ND cache. | |
static void | prvReturnICMP_IPv6 (NetworkBufferDescriptor_t *const pxNetworkBuffer, size_t uxICMPSize) |
Return an ICMPv6 packet to the peer. | |
void | vNDSendNeighbourSolicitation (NetworkBufferDescriptor_t *pxNetworkBuffer, const IPv6_Address_t *pxIPAddress) |
Send out an ND request for the IPv6 address contained in pxNetworkBuffer, and add an entry into the ND table that indicates that an ND reply is outstanding so re-transmissions can be generated. | |
BaseType_t | FreeRTOS_SendPingRequestIPv6 (const IPv6_Address_t *pxIPAddress, size_t uxNumberOfBytesToSend, TickType_t uxBlockTimeTicks) |
Send a PING request using an ICMPv6 format. | |
+static void | prvCheckWaitingBuffer (const IPv6_Address_t *pxIPv6Address) |
When a neighbour advertisement has been received, check if 'pxNDWaitingNetworkBuffer' was waiting for this new address look-up. If so, feed it to the IP-task as a new incoming packet. | |
eFrameProcessingResult_t | prvProcessICMPMessage_IPv6 (NetworkBufferDescriptor_t *const pxNetworkBuffer) |
Process an ICMPv6 packet and send replies when applicable. | |
void | FreeRTOS_OutputAdvertiseIPv6 (NetworkEndPoint_t *pxEndPoint) |
Send out a Neighbour Advertisement message. | |
BaseType_t | FreeRTOS_CreateIPv6Address (IPv6_Address_t *pxIPAddress, const IPv6_Address_t *pxPrefix, size_t uxPrefixLength, BaseType_t xDoRandom) |
Create an IPv16 address, based on a prefix. | |
BaseType_t | xCheckRequiresNDResolution (const NetworkBufferDescriptor_t *pxNetworkBuffer) |
Check whether a packet needs ND resolution if it is on local subnet. If required send an ND Solicitation. | |
+void | vNDSendUnsolicited (void) |
Send an unsolicited ND packet to allow this node to announce the IP-MAC mapping to the entire network. | |
Implements a few functions that handle Neighbour Discovery and other ICMPv6 messages.
+
+
|
+ +static | +
See if the MAC-address can be resolved because it is a multi-cast address.
+[in] | pxAddressToLookup | The IP-address to look-up. |
[out] | pxMACAddress | The resulting MAC-address is stored here. |
[out] | ppxEndPoint | A pointer to an end-point pointer where the end-point will be stored. |
+
|
+ +static | +
Lookup an MAC address in the ND cache from the IP address.
+Look-up an IPv6 address in the cache.
+[in] | pxAddressToLookup | The IPv6 address to look-up.Ethernet packet. |
[out] | pxMACAddress | The resulting MAC-address will be stored here. |
[out] | ppxEndPoint | A pointer to a pointer to an end-point, where the end-point will be stored. |
+
|
+ +static | +
Find the first end-point of type IPv6.
+eResolutionLookupResult_t eNDGetCacheEntry | +( | +IPv6_Address_t * | +pxIPAddress, | +
+ | + | MACAddress_t *const | +pxMACAddress, | +
+ | + | struct xNetworkEndPoint ** | +ppxEndPoint | +
+ | ) | ++ |
Find the MAC-address of an IPv6 address. It will first determine if is a multicast address, if not, it will check the ND cache.
+[in] | pxIPAddress | The IPv6 address to be looked up. |
[out] | pxMACAddress | The MAC-address found. |
[out] | ppxEndPoint | A pointer to a pointer to an end-point, where the end-point will be stored. |
void vNDRefreshCacheEntry | +( | +const MACAddress_t * | +pxMACAddress, | +
+ | + | const IPv6_Address_t * | +pxIPAddress, | +
+ | + | NetworkEndPoint_t * | +pxEndPoint | +
+ | ) | ++ |
Store a combination of IP-address, MAC-address and an end-point in a free location in the ND cache.
+[in] | pxMACAddress | The MAC-address |
[in] | pxIPAddress | The IP-address |
[in] | pxEndPoint | The end-point through which the IP-address can be reached. |
void FreeRTOS_ClearND | +( | +const struct xNetworkEndPoint * | +pxEndPoint | ) | ++ |
A call to this function will clear the ND cache.
+[in] | pxEndPoint | only clean entries with this end-point, or when NULL, clear the entire ND cache. |
+
|
+ +static | +
Return an ICMPv6 packet to the peer.
+[in] | pxNetworkBuffer | The Ethernet packet. |
[in] | uxICMPSize | The number of bytes to be sent. |
void vNDSendNeighbourSolicitation | +( | +NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | const IPv6_Address_t * | +pxIPAddress | +
+ | ) | ++ |
Send out an ND request for the IPv6 address contained in pxNetworkBuffer, and add an entry into the ND table that indicates that an ND reply is outstanding so re-transmissions can be generated.
+[in] | pxNetworkBuffer | The network buffer in which the message shall be stored. |
[in] | pxIPAddress | The IPv6 address that is asked to send a Neighbour Advertisement. |
BaseType_t FreeRTOS_SendPingRequestIPv6 | +( | +const IPv6_Address_t * | +pxIPAddress, | +
+ | + | size_t | +uxNumberOfBytesToSend, | +
+ | + | TickType_t | +uxBlockTimeTicks | +
+ | ) | ++ |
Send a PING request using an ICMPv6 format.
+[in] | pxIPAddress | Send an IPv6 PING request. |
[in] | uxNumberOfBytesToSend | The number of bytes to be sent. |
[in] | uxBlockTimeTicks | The maximum number of clock-ticks to wait while putting the message on the queue for the IP-task. |
eFrameProcessingResult_t prvProcessICMPMessage_IPv6 | +( | +NetworkBufferDescriptor_t *const | +pxNetworkBuffer | ) | ++ |
Process an ICMPv6 packet and send replies when applicable.
+[in] | pxNetworkBuffer | The Ethernet packet which contains an IPv6 message. |
void FreeRTOS_OutputAdvertiseIPv6 | +( | +NetworkEndPoint_t * | +pxEndPoint | ) | ++ |
Send out a Neighbour Advertisement message.
+[in] | pxEndPoint | The end-point to use. |
BaseType_t FreeRTOS_CreateIPv6Address | +( | +IPv6_Address_t * | +pxIPAddress, | +
+ | + | const IPv6_Address_t * | +pxPrefix, | +
+ | + | size_t | +uxPrefixLength, | +
+ | + | BaseType_t | +xDoRandom | +
+ | ) | ++ |
Create an IPv16 address, based on a prefix.
+[out] | pxIPAddress | The location where the new IPv6 address will be stored. |
[in] | pxPrefix | The prefix to be used. |
[in] | uxPrefixLength | The length of the prefix. |
[in] | xDoRandom | A non-zero value if the bits after the prefix should have a random value. |
BaseType_t xCheckRequiresNDResolution | +( | +const NetworkBufferDescriptor_t * | +pxNetworkBuffer | ) | ++ |
Check whether a packet needs ND resolution if it is on local subnet. If required send an ND Solicitation.
+[in] | pxNetworkBuffer | The network buffer with the packet to be checked. |
A client implementation of Router advertisement protocol. +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_IP_Timers.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_Routing.h"
#include "FreeRTOS_ND.h"
#include "FreeRTOS_DNS.h"
#include "NetworkBufferManagement.h"
+Macros | |
#define | raDONT_BLOCK ( ( TickType_t ) 0 ) |
#define | raDEFAULT_VERSION_TRAFFIC_CLASS 0x60U |
#define | raDEFAULT_HOP_LIMIT 255U |
+Functions | |
static void | vRAProcessInit (NetworkEndPoint_t *pxEndPoint) |
Initialise the RA state machine. | |
static BaseType_t | xGetLinkLocalAddress (const NetworkInterface_t *pxInterface, IPv6_Address_t *pxAddress) |
Find a link-local address that is bound to a given interface. | |
static ICMPPrefixOption_IPv6_t * | vReceiveRA_ReadReply (const NetworkBufferDescriptor_t *pxNetworkBuffer) |
Read a received RA reply and return the prefix option from the packet. | |
static TickType_t | xRAProcess_HandleWaitStates (NetworkEndPoint_t *pxEndPoint, TickType_t uxReloadTime) |
Handles the RA wait state and calculates the new timer reload value based on the wait state. Also checks if any timer has expired. If its found that there is no other device using the same IP-address vIPNetworkUpCalls() is called to send the network up event. | |
static TickType_t | xRAProcess_HandleOtherStates (NetworkEndPoint_t *pxEndPoint, TickType_t uxReloadTime) |
Handles the RA states other than the wait states. | |
void | vNDSendRouterSolicitation (NetworkBufferDescriptor_t *pxNetworkBuffer, IPv6_Address_t *pxIPAddress) |
Send an ICMPv6 message of the type: Router Solicitation. | |
void | vReceiveNA (const NetworkBufferDescriptor_t *pxNetworkBuffer) |
Receive a NA ( Neighbour Advertisement ) message to see if a chosen IP-address is already in use. | |
void | vReceiveRA (const NetworkBufferDescriptor_t *pxNetworkBuffer) |
Receive and analyse a RA ( Router Advertisement ) message. If the reply is satisfactory, the end-point will do SLAAC: choose an IP-address using the prefix offered, and completed with random bits. It will start testing if another device already exists that uses the same IP-address. | |
void | vRAProcess (BaseType_t xDoReset, NetworkEndPoint_t *pxEndPoint) |
Do a single cycle of the RA state machine. | |
A client implementation of Router advertisement protocol.
+#define raDONT_BLOCK ( ( TickType_t ) 0 ) | +
A block time of 0 simply means "don't block".
+ +#define raDEFAULT_VERSION_TRAFFIC_CLASS 0x60U | +
The default value for the IPv6-field 'ucVersionTrafficClass'.
+ +#define raDEFAULT_HOP_LIMIT 255U | +
The default value for the IPv6-field 'ucHopLimit'.
+ +
+
|
+ +static | +
Initialise the RA state machine.
+[in] | pxEndPoint | The end-point for which Router Advertisement is required. |
+
|
+ +static | +
Find a link-local address that is bound to a given interface.
+[in] | pxInterface | The interface for which a link-local address is looked up. |
[out] | pxAddress | The IP address will be copied to this parameter. |
+
|
+ +static | +
Read a received RA reply and return the prefix option from the packet.
+[in] | pxNetworkBuffer | The buffer that contains the message. |
+
|
+ +static | +
Handles the RA wait state and calculates the new timer reload value based on the wait state. Also checks if any timer has expired. If its found that there is no other device using the same IP-address vIPNetworkUpCalls() is called to send the network up event.
+[in] | pxEndPoint | The end point for which RA assignment is required. |
[out] | uxReloadTime | Timer reload value in ticks. |
+
|
+ +static | +
Handles the RA states other than the wait states.
+[in] | pxEndPoint | The end point for which RA assignment is required. |
[out] | uxReloadTime | Timer reload value in ticks. |
void vNDSendRouterSolicitation | +( | +NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | IPv6_Address_t * | +pxIPAddress | +
+ | ) | ++ |
Send an ICMPv6 message of the type: Router Solicitation.
+[in] | pxNetworkBuffer | The network buffer which can be used for this. |
[in] | pxIPAddress | The target address, normally ff02::2 |
void vReceiveNA | +( | +const NetworkBufferDescriptor_t * | +pxNetworkBuffer | ) | ++ |
Receive a NA ( Neighbour Advertisement ) message to see if a chosen IP-address is already in use.
+[in] | pxNetworkBuffer | The buffer that contains the message. |
void vReceiveRA | +( | +const NetworkBufferDescriptor_t * | +pxNetworkBuffer | ) | ++ |
Receive and analyse a RA ( Router Advertisement ) message. If the reply is satisfactory, the end-point will do SLAAC: choose an IP-address using the prefix offered, and completed with random bits. It will start testing if another device already exists that uses the same IP-address.
+[in] | pxNetworkBuffer | The buffer that contains the message. |
void vRAProcess | +( | +BaseType_t | +xDoReset, | +
+ | + | NetworkEndPoint_t * | +pxEndPoint | +
+ | ) | ++ |
Do a single cycle of the RA state machine.
+[in] | xDoReset | pdTRUE if the state machine must be reset. |
[in] | pxEndPoint | The end-point for which a RA assignment is required. |
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_ND.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) |
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) |
Find an end-point that handles a given IPv4-address. | |
NetworkEndPoint_t * | FreeRTOS_InterfaceEndPointOnNetMask (const NetworkInterface_t *pxInterface, uint32_t ulIPAddress) |
Find an end-point that handles a given IPv4-address. | |
NetworkEndPoint_t * | FreeRTOS_InterfaceEPInSameSubnet_IPv6 (const NetworkInterface_t *pxInterface, const IPv6_Address_t *pxIPAddress) |
Finds an endpoint on the given interface which is in the same subnet as the given IP address. If NULL is passed for pxInterface, it looks through all the interfaces to find an endpoint in the same subnet as the given IP 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. | |
BaseType_t | xCheckRequiresResolution (const NetworkBufferDescriptor_t *pxNetworkBuffer) |
Check whether a packet needs resolution if it is on local subnet. If required send a request. | |
+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 | ) | ++ |
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. |
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 | ) | ++ |
Find an end-point that handles a given IPv4-address.
+[in] | ulIPAddress | The IP-address for which an end-point is looked-up. |
NetworkEndPoint_t * FreeRTOS_InterfaceEndPointOnNetMask | +( | +const NetworkInterface_t * | +pxInterface, | +
+ | + | uint32_t | +ulIPAddress | +
+ | ) | ++ |
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. |
NetworkEndPoint_t * FreeRTOS_InterfaceEPInSameSubnet_IPv6 | +( | +const NetworkInterface_t * | +pxInterface, | +
+ | + | const IPv6_Address_t * | +pxIPAddress | +
+ | ) | ++ |
Finds an endpoint on the given interface which is in the same subnet as the given IP address. If NULL is passed for pxInterface, it looks through all the interfaces to find an endpoint in the same subnet as the given IP address.
+[in] | pxInterface | Only end-points that have this interface are returned, unless pxInterface is NULL. |
[in] | pxIPAddress | The IPv6-address for which an end-point is looked-up. |
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. |
BaseType_t xCheckRequiresResolution | +( | +const NetworkBufferDescriptor_t * | +pxNetworkBuffer | ) | ++ |
Check whether a packet needs resolution if it is on local subnet. If required send a request.
+[in] | pxNetworkBuffer | The network buffer with the packet to be checked. |
Implements the Sockets API based on Berkeley sockets for the FreeRTOS+TCP network stack. Sockets are used by the application processes to interact with the IP-task which in turn interacts with the hardware. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IPv4_Sockets.h"
#include "FreeRTOS_IPv6_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_DNS.h"
#include "NetworkBufferManagement.h"
#include "FreeRTOS_Routing.h"
+Macros | |
+#define | socketSET_SOCKET_PORT(pxSocket, usPort) listSET_LIST_ITEM_VALUE( ( &( ( pxSocket )->xBoundSocketListItem ) ), ( usPort ) ) |
Set the port number for the socket in the xBoundSocketListItem. | |
+#define | socketGET_SOCKET_PORT(pxSocket) listGET_LIST_ITEM_VALUE( ( &( ( pxSocket )->xBoundSocketListItem ) ) ) |
Get the port number for the socket in the xBoundSocketListItem. | |
+#define | socketSOCKET_IS_BOUND(pxSocket) ( listLIST_ITEM_CONTAINER( &( pxSocket )->xBoundSocketListItem ) != NULL ) |
Test if a socket it bound which means it is either included in xBoundUDPSocketsList or xBoundTCPSocketsList. | |
#define | socketAUTO_PORT_ALLOCATION_START_NUMBER ( ( uint16_t ) 0x0400 ) |
If FreeRTOS_sendto() is called on a socket that is not bound to a port number then, depending on the FreeRTOSIPConfig.h settings, it might be that a port number is automatically generated for the socket. Automatically generated port numbers will be between socketAUTO_PORT_ALLOCATION_START_NUMBER and 0xffff. | |
+#define | socketAUTO_PORT_ALLOCATION_MAX_NUMBER ( ( uint16_t ) 0xffff ) |
Maximum value of port number which can be auto assigned. | |
+#define | socketDONT_BLOCK ( ( TickType_t ) 0 ) |
A block time of 0 simply means "don't block". | |
+#define | ipTCP_TIMER_PERIOD_MS ( 1000U ) |
TCP timer period in milliseconds. | |
#define | sock20_PERCENT 20U |
#define | sock80_PERCENT 80U |
#define | sock100_PERCENT 100U |
#define | sockDIGIT_COUNT ( 3U ) |
+Functions | |
static uint16_t | prvGetPrivatePortNumber (BaseType_t xProtocol) |
Find an available port number per https://tools.ietf.org/html/rfc6056. | |
static const ListItem_t * | pxListFindListItemWithValue (const List_t *pxList, TickType_t xWantedItemValue) |
Find a list item associated with the wanted-item. | |
static BaseType_t | prvValidSocket (const FreeRTOS_Socket_t *pxSocket, BaseType_t xProtocol, BaseType_t xIsBound) |
Check whether the socket is valid or not. | |
static BaseType_t | prvSockopt_so_buffer (FreeRTOS_Socket_t *pxSocket, int32_t lOptionName, const void *pvOptionValue) |
Set the value of receive/send buffer after some preliminary checks. | |
static BaseType_t | prvDetermineSocketSize (BaseType_t xDomain, BaseType_t xType, BaseType_t xProtocol, size_t *pxSocketSize) |
Determine the socket size for the given protocol. | |
static BaseType_t | prvSocketBindAdd (FreeRTOS_Socket_t *pxSocket, const struct freertos_sockaddr *pxAddress, List_t *pxSocketList, BaseType_t xInternal) |
: Bind a socket to a port number. | |
static NetworkBufferDescriptor_t * | prvRecvFromWaitForPacket (FreeRTOS_Socket_t const *pxSocket, BaseType_t xFlags, EventBits_t *pxEventBits) |
: called from FreeRTOS_recvfrom(). This function waits for an incoming UDP packet, or until a time-out occurs. | |
static int32_t | prvSendUDPPacket (const FreeRTOS_Socket_t *pxSocket, NetworkBufferDescriptor_t *pxNetworkBuffer, size_t uxTotalDataLength, BaseType_t xFlags, const struct freertos_sockaddr *pxDestinationAddress, TickType_t xTicksToWait, size_t uxPayloadOffset) |
Forward a UDP packet to the IP-task, so it will be sent. | |
static FreeRTOS_Socket_t * | prvAcceptWaitClient (FreeRTOS_Socket_t *pxParentSocket, struct freertos_sockaddr *pxAddress, socklen_t *pxAddressLength) |
Check if a new connection has come in for a socket in listen mode. | |
static StreamBuffer_t * | prvTCPCreateStream (FreeRTOS_Socket_t *pxSocket, BaseType_t xIsInputStream) |
Create the stream buffer for the given socket. | |
static int32_t | prvTCPSendCheck (FreeRTOS_Socket_t *pxSocket, size_t uxDataLength) |
Called from FreeRTOS_send(): some checks which will be done before sending a TCP packed. | |
static void | prvTCPSetSocketCount (FreeRTOS_Socket_t const *pxSocketToDelete) |
When a child socket gets closed, make sure to update the child-count of the parent. When a listening parent socket is closed, make sure to close also all orphaned child-sockets. | |
static BaseType_t | prvTCPConnectStart (FreeRTOS_Socket_t *pxSocket, struct freertos_sockaddr const *pxAddress) |
Called from FreeRTOS_connect(): make some checks and if allowed, send a message to the IP-task to start connecting to a remote socket. | |
static BaseType_t | bMayConnect (FreeRTOS_Socket_t const *pxSocket) |
Check if it makes any sense to wait for a connect event. | |
static BaseType_t | prvMakeSureSocketIsBound (FreeRTOS_Socket_t *pxSocket) |
Check if a socket is already bound to a 'random' port number, if not, try bind it to port 0. | |
static void | prvFindSelectedSocket (SocketSelect_t *pxSocketSet) |
Send a message to the IP-task to have it check all sockets belonging to 'pxSocketSet'. | |
static BaseType_t | prvRecvWait (const FreeRTOS_Socket_t *pxSocket, EventBits_t *pxEventBits, BaseType_t xFlags) |
This routine will wait for data to arrive in the stream buffer. | |
static BaseType_t | prvRecvData (FreeRTOS_Socket_t *pxSocket, void *pvBuffer, size_t uxBufferLength, BaseType_t xFlags) |
Read the data from the stream buffer. | |
static BaseType_t | prvTCPSendLoop (FreeRTOS_Socket_t *pxSocket, const void *pvBuffer, size_t uxDataLength, BaseType_t xFlags) |
This function tries to send TCP-data in a loop with a time-out. | |
static BaseType_t | prvSetOptionTCPWindows (FreeRTOS_Socket_t *pxSocket, const void *pvOptionValue) |
Handle the socket option FREERTOS_SO_WIN_PROPERTIES. | |
static BaseType_t | prvSetOptionLowHighWater (FreeRTOS_Socket_t *pxSocket, const void *pvOptionValue) |
Handle the socket option FREERTOS_SO_SET_LOW_HIGH_WATER. | |
static BaseType_t | prvSetOptionSetFullSize (FreeRTOS_Socket_t *pxSocket, const void *pvOptionValue) |
Handle the socket option FREERTOS_SO_SET_FULL_SIZE. | |
static BaseType_t | prvSetOptionStopRX (FreeRTOS_Socket_t *pxSocket, const void *pvOptionValue) |
Handle the socket option FREERTOS_SO_STOP_RX. | |
static void | prvSetOptionTimeout (FreeRTOS_Socket_t *pxSocket, const void *pvOptionValue, BaseType_t xForSend) |
Handle the socket options FREERTOS_SO_RCVTIMEO and FREERTOS_SO_SNDTIMEO. | |
static BaseType_t | prvSetOptionCloseAfterSend (FreeRTOS_Socket_t *pxSocket, const void *pvOptionValue) |
Handle the socket options FREERTOS_SO_CLOSE_AFTER_SEND. | |
static BaseType_t | prvSetOptionReuseListenSocket (FreeRTOS_Socket_t *pxSocket, const void *pvOptionValue) |
Handle the socket options FREERTOS_SO_REUSE_LISTEN_SOCKET. | |
static void | prvInitialiseTCPFields (FreeRTOS_Socket_t *pxSocket, size_t uxSocketSize) |
Called by FreeRTOS_socket(), it will initialise some essential TCP fields in the socket. | |
static int32_t | prvRecvFrom_CopyPacket (uint8_t *pucEthernetBuffer, void *pvBuffer, size_t uxBufferLength, BaseType_t xFlags, int32_t lDataLength) |
Called by FreeRTOS_recvfrom(). it will copy the received data or just a pointer to the received data in case of zero-copy, to the buffer provided by the caller. | |
static int32_t | prvSendTo_ActualSend (const FreeRTOS_Socket_t *pxSocket, const void *pvBuffer, size_t uxTotalDataLength, BaseType_t xFlags, const struct freertos_sockaddr *pxDestinationAddress, size_t uxPayloadOffset) |
Called by FreeRTOS_sendto(), it will actually send a UDP packet. | |
static void | vTCPAddRxdata_Stored (FreeRTOS_Socket_t *pxSocket) |
Called by lTCPAddRxdata(), the received data has just been added to the RX-stream. When the space is dropped below a threshold, it may set the bit field 'bLowWater'. Also the socket's events bits for READ will be set. | |
+void | vNetworkSocketsInit (void) |
Initialise the bound TCP/UDP socket lists. | |
Socket_t | FreeRTOS_socket (BaseType_t xDomain, BaseType_t xType, BaseType_t xProtocol) |
allocate and initialise a socket. | |
SocketSet_t | FreeRTOS_CreateSocketSet (void) |
Create a socket set. | |
void | FreeRTOS_DeleteSocketSet (SocketSet_t xSocketSet) |
Delete a given socket set. | |
void | FreeRTOS_FD_SET (Socket_t xSocket, SocketSet_t xSocketSet, EventBits_t xBitsToSet) |
Add a socket to a set. | |
void | FreeRTOS_FD_CLR (Socket_t xSocket, SocketSet_t xSocketSet, EventBits_t xBitsToClear) |
Clear select bits for a socket. If the mask becomes 0, remove the socket from the set. | |
EventBits_t | FreeRTOS_FD_ISSET (const ConstSocket_t xSocket, const ConstSocketSet_t xSocketSet) |
Test if a socket belongs to a socket-set and if so, which event bit(s) are set. | |
BaseType_t | FreeRTOS_select (SocketSet_t xSocketSet, TickType_t xBlockTimeTicks) |
The select() statement: wait for an event to occur on any of the sockets included in a socket set and return its event bits when the event occurs. | |
int32_t | FreeRTOS_recvfrom (const ConstSocket_t xSocket, void *pvBuffer, size_t uxBufferLength, BaseType_t xFlags, struct freertos_sockaddr *pxSourceAddress, socklen_t *pxSourceAddressLength) |
Receive data from a bound socket. In this library, the function can only be used with connection-less sockets (UDP). For TCP sockets, please use FreeRTOS_recv(). | |
int32_t | FreeRTOS_sendto (Socket_t xSocket, const void *pvBuffer, size_t uxTotalDataLength, BaseType_t xFlags, const struct freertos_sockaddr *pxDestinationAddress, socklen_t xDestinationAddressLength) |
Send data to a socket. The socket must have already been created by a successful call to FreeRTOS_socket(). It works for UDP-sockets only. | |
BaseType_t | FreeRTOS_bind (Socket_t xSocket, struct freertos_sockaddr const *pxAddress, socklen_t xAddressLength) |
binds a socket to a local port number. If port 0 is provided, a system provided port number will be assigned. This function can be used for both UDP and TCP sockets. The actual binding will be performed by the IP-task to avoid mutual access to the bound-socket-lists (xBoundUDPSocketsList or xBoundTCPSocketsList). | |
BaseType_t | vSocketBind (FreeRTOS_Socket_t *pxSocket, struct freertos_sockaddr *pxBindAddress, size_t uxAddressLength, BaseType_t xInternal) |
Internal version of bind() that should not be called directly. 'xInternal' is used for TCP sockets only: it allows to have several (connected) child sockets bound to the same server port. | |
BaseType_t | FreeRTOS_closesocket (Socket_t xSocket) |
Close a socket and free the allocated space. In case of a TCP socket: the connection will not be closed automatically. Subsequent messages for the closed socket will be responded to with a RST. The IP-task will actually close the socket, after receiving a 'eSocketCloseEvent' message. | |
void * | vSocketClose (FreeRTOS_Socket_t *pxSocket) |
This is the internal version of FreeRTOS_closesocket(). It will be called by the IPtask only to avoid problems with synchronicity. | |
BaseType_t | FreeRTOS_setsockopt (Socket_t xSocket, int32_t lLevel, int32_t lOptionName, const void *pvOptionValue, size_t uxOptionLength) |
Set the socket options for the given socket. | |
FreeRTOS_Socket_t * | pxUDPSocketLookup (UBaseType_t uxLocalPort) |
Find the UDP socket corresponding to the port number. | |
const char * | FreeRTOS_inet_ntoa (uint32_t ulIPAddress, char *pcBuffer) |
Convert the 32-bit representation of the IP-address to the dotted decimal notation after some checks. A safe alternative is FreeRTOS_inet_ntop4(). | |
BaseType_t | FreeRTOS_inet_pton (BaseType_t xAddressFamily, const char *pcSource, void *pvDestination) |
Convert the dotted decimal format of the IP-address to the 32-bit representation. | |
const char * | FreeRTOS_inet_ntop (BaseType_t xAddressFamily, const void *pvSource, char *pcDestination, socklen_t uxSize) |
Convert the 32-bit representation of the IP-address to the dotted decimal format based on the Address Family. (Only FREERTOS_AF_INET is allowed). | |
uint8_t | ucASCIIToHex (char cChar) |
Convert an ASCII character to its corresponding hexadecimal value. Accepted characters are 0-9, a-f, and A-F. | |
void | FreeRTOS_EUI48_ntop (const uint8_t *pucSource, char *pcTarget, char cTen, char cSeparator) |
This function converts a 48-bit MAC address to a human readable string. | |
BaseType_t | FreeRTOS_EUI48_pton (const char *pcSource, uint8_t *pucTarget) |
This function converts a human readable string, representing an 48-bit MAC address, into a 6-byte address. Valid inputs are e.g. "62:48:5:83:A0:b2" and "0-12-34-fe-dc-ba". | |
uint32_t | FreeRTOS_inet_addr (const char *pcIPAddress) |
Convert the IP address from "w.x.y.z" (dotted decimal) format to the 32-bit format. | |
size_t | FreeRTOS_GetLocalAddress (ConstSocket_t xSocket, struct freertos_sockaddr *pxAddress) |
Function to get the local address and IP port of the given socket. | |
void | vSocketWakeUpUser (FreeRTOS_Socket_t *pxSocket) |
Wake up the user of the given socket through event-groups. | |
BaseType_t | FreeRTOS_connect (Socket_t xClientSocket, const struct freertos_sockaddr *pxAddress, socklen_t xAddressLength) |
Connect to a remote port. | |
Socket_t | FreeRTOS_accept (Socket_t xServerSocket, struct freertos_sockaddr *pxAddress, socklen_t *pxAddressLength) |
Accept a connection on an listening socket. | |
BaseType_t | FreeRTOS_recv (Socket_t xSocket, void *pvBuffer, size_t uxBufferLength, BaseType_t xFlags) |
Read incoming data from a TCP socket. Only after the last byte has been read, a close error might be returned. | |
uint8_t * | FreeRTOS_get_tx_base (Socket_t xSocket) |
Get a direct pointer to the beginning of the circular transmit buffer. | |
uint8_t * | FreeRTOS_get_tx_head (Socket_t xSocket, BaseType_t *pxLength) |
Get a direct pointer to the TX head of the circular transmit buffer. | |
BaseType_t | FreeRTOS_send (Socket_t xSocket, const void *pvBuffer, size_t uxDataLength, BaseType_t xFlags) |
Send data using a TCP socket. It is not necessary to have the socket connected already. Outgoing data will be stored and delivered as soon as the socket gets connected. | |
BaseType_t | FreeRTOS_listen (Socket_t xSocket, BaseType_t xBacklog) |
Request to put a socket in listen mode. | |
BaseType_t | FreeRTOS_shutdown (Socket_t xSocket, BaseType_t xHow) |
Shutdown - This function will shut down the connection in both directions. However, it will first deliver all data queued for transmission, and also it will first wait to receive any missing packets from the peer. | |
TickType_t | xTCPTimerCheck (BaseType_t xWillSleep) |
A TCP timer has expired, now check all TCP sockets for: | |
FreeRTOS_Socket_t * | pxTCPSocketLookup (uint32_t ulLocalIP, UBaseType_t uxLocalPort, IPv46_Address_t xRemoteIP, UBaseType_t uxRemotePort) |
As multiple sockets may be bound to the same local port number looking up a socket is a little more complex: Both a local port, and a remote port and IP address are being used to find a match. For a socket in listening mode, the remote port and IP address are both 0. | |
const struct xSTREAM_BUFFER * | FreeRTOS_get_rx_buf (ConstSocket_t xSocket) |
For the web server: borrow the circular Rx buffer for inspection. HTML driver wants to see if a sequence of 13/10/13/10 is available. | |
int32_t | lTCPAddRxdata (FreeRTOS_Socket_t *pxSocket, size_t uxOffset, const uint8_t *pcData, uint32_t ulByteCount) |
Add data to the RxStream. When uxOffset > 0, data has come in out-of-order and will be put in front of the head so it can not be popped by the user. | |
BaseType_t | FreeRTOS_GetRemoteAddress (ConstSocket_t xSocket, struct freertos_sockaddr *pxAddress) |
Function to get the remote IP-address and port number. | |
BaseType_t | FreeRTOS_maywrite (ConstSocket_t xSocket) |
Check the number of bytes that may be added to txStream. | |
BaseType_t | FreeRTOS_tx_space (ConstSocket_t xSocket) |
Get the number of bytes that can be written in the Tx buffer of the given socket. | |
BaseType_t | FreeRTOS_tx_size (ConstSocket_t xSocket) |
Returns the number of bytes stored in the Tx buffer. | |
BaseType_t | FreeRTOS_issocketconnected (ConstSocket_t xSocket) |
Is the socket connected. | |
BaseType_t | FreeRTOS_mss (ConstSocket_t xSocket) |
Get the actual value of Maximum Segment Size ( MSS ) being used. | |
BaseType_t | FreeRTOS_connstatus (ConstSocket_t xSocket) |
Get the connection status. The values correspond to the members of the enum 'eIPTCPState_t'. | |
BaseType_t | FreeRTOS_rx_size (ConstSocket_t xSocket) |
Returns the number of bytes which can be read from the RX stream buffer. | |
BaseType_t | xSocketValid (const ConstSocket_t xSocket) |
Check whether a given socket is valid or not. Validity is defined as the socket not being NULL and not being Invalid. | |
+void | FreeRTOS_netstat (void) |
Get the net status. The IP-task will print a summary of all sockets and their connections. | |
BaseType_t | xSocketSetSocketID (const Socket_t xSocket, void *pvSocketID) |
Set the value of the SocketID of a socket. | |
void * | pvSocketGetSocketID (const ConstSocket_t xSocket) |
Retrieve the SocketID that is associated with a socket. | |
BaseType_t | FreeRTOS_GetIPType (ConstSocket_t xSocket) |
Get the version of IP: either 'ipTYPE_IPv4' or 'ipTYPE_IPv6'. | |
static EventBits_t | vSocketSelectTCP (FreeRTOS_Socket_t *pxSocket) |
This internal function will check if a given TCP socket has had any select event, either READ, WRITE, or EXCEPT. | |
void | vSocketSelect (const SocketSelect_t *pxSocketSet) |
This internal non-blocking function will check all sockets that belong to a select set. The events bits of each socket will be updated, and it will check if an ongoing select() call must be interrupted because of an event has occurred. | |
Implements the Sockets API based on Berkeley sockets for the FreeRTOS+TCP network stack. Sockets are used by the application processes to interact with the IP-task which in turn interacts with the hardware.
+#define socketAUTO_PORT_ALLOCATION_START_NUMBER ( ( uint16_t ) 0x0400 ) | +
If FreeRTOS_sendto() is called on a socket that is not bound to a port number then, depending on the FreeRTOSIPConfig.h settings, it might be that a port number is automatically generated for the socket. Automatically generated port numbers will be between socketAUTO_PORT_ALLOCATION_START_NUMBER and 0xffff.
+#define sock20_PERCENT 20U | +
20% of the defined limit.
+ +#define sock80_PERCENT 80U | +
80% of the defined limit.
+ +#define sock100_PERCENT 100U | +
100% of the defined limit.
+ +#define sockDIGIT_COUNT ( 3U ) | +
Each nibble is expressed in at most 3 digits such as "192".
+ +
+
|
+ +static | +
Find an available port number per https://tools.ietf.org/html/rfc6056.
+[in] | xProtocol | FREERTOS_IPPROTO_TCP/FREERTOS_IPPROTO_UDP. |
+
|
+ +static | +
Find a list item associated with the wanted-item.
+[in] | pxList | The list through which the search is to be conducted. |
[in] | xWantedItemValue | The wanted item whose association is to be found. |
+
|
+ +static | +
Check whether the socket is valid or not.
+[in] | pxSocket | The socket being checked. |
[in] | xProtocol | The protocol for which the socket was created. |
[in] | xIsBound | pdTRUE when the socket should be bound, otherwise pdFALSE. |
+
|
+ +static | +
Set the value of receive/send buffer after some preliminary checks.
+[in] | pxSocket | The socket whose options are being set. |
[in] | lOptionName | The option name: either FREERTOS_SO_SNDBUF or FREERTOS_SO_SNDBUF. |
[in] | pvOptionValue | The value of the option being set. |
+
|
+ +static | +
Determine the socket size for the given protocol.
+[in] | xDomain | The domain for which the size of socket is being determined. |
[in] | xType | Is this a datagram socket or a stream socket. |
[in] | xProtocol | The protocol being used. |
[out] | pxSocketSize | Pointer to a variable in which the size shall be returned if all checks pass. |
+
|
+ +static | +
: Bind a socket to a port number.
+[in] | pxSocket | The socket to be bound. |
[in] | pxAddress | The socket will be bound to this address. |
[in] | pxSocketList | will either point to xBoundUDPSocketsList or xBoundTCPSocketsList. |
[in] | xInternal | pdTRUE if this function is called 'internally', i.e. by the IP-task. |
+
|
+ +static | +
: called from FreeRTOS_recvfrom(). This function waits for an incoming UDP packet, or until a time-out occurs.
+[in] | pxSocket | The socket that receives UDP packets. |
[in] | xFlags | The flags as passed to FreeRTOS_recvfrom(). |
[in,out] | pxEventBits | The last even received in this function, either eSOCKET_INTR or eSOCKET_RECEIVE. |
+
|
+ +static | +
Forward a UDP packet to the IP-task, so it will be sent.
+[in] | pxSocket | The socket on which a packet is sent. |
[in] | pxNetworkBuffer | The packet to be sent. |
[in] | uxTotalDataLength | The total number of payload bytes in the packet. |
[in] | xFlags | The flag 'FREERTOS_ZERO_COPY' will be checked. |
[in] | pxDestinationAddress | The address of the destination. |
[in] | xTicksToWait | Number of ticks to wait, in case the IP-queue is full. |
[in] | uxPayloadOffset | The number of bytes in the packet before the payload. |
+
|
+ +static | +
Check if a new connection has come in for a socket in listen mode.
+[in] | pxParentSocket | The parent socket, which is in listening mode. |
[out] | pxAddress | The address of the peer will be filled in 'pxAddress'. |
[in] | pxAddressLength | The actual size of the space pointed to by 'pxAddress'. |
+
|
+ +static | +
Create the stream buffer for the given socket.
+[in] | pxSocket | the socket to create the stream for. |
[in] | xIsInputStream | Is this input stream? pdTRUE/pdFALSE? |
+
|
+ +static | +
Called from FreeRTOS_send(): some checks which will be done before sending a TCP packed.
+[in] | pxSocket | The socket owning the connection. |
[in] | uxDataLength | The length of the data to be sent. |
+
|
+ +static | +
When a child socket gets closed, make sure to update the child-count of the parent. When a listening parent socket is closed, make sure to close also all orphaned child-sockets.
+[in] | pxSocketToDelete | The socket being closed. |
+
|
+ +static | +
Called from FreeRTOS_connect(): make some checks and if allowed, send a message to the IP-task to start connecting to a remote socket.
+[in] | pxSocket | The socket attempting to connect to a remote port. |
[in] | pxAddress | The address the socket is trying to connect to. |
+
|
+ +static | +
Check if it makes any sense to wait for a connect event.
+[in] | pxSocket | The socket trying to connect. |
+
|
+ +static | +
Check if a socket is already bound to a 'random' port number, if not, try bind it to port 0.
+Check if a socket is a valid UDP socket. In case it is not yet bound, bind it to port 0 ( random port ).
+[in] | pxSocket | The socket that must be bound to a port number. |
+
|
+ +static | +
Send a message to the IP-task to have it check all sockets belonging to 'pxSocketSet'.
+[in] | pxSocketSet | The socket set being asked to check. |
+
|
+ +static | +
This routine will wait for data to arrive in the stream buffer.
+After FreeRTOS_recv() has checked the validity of the parameters, this routine will wait for data to arrive in the stream buffer.
+[in] | pxSocket | The socket owning the connection. |
[out] | pxEventBits | A bit-mask of socket events will be set: eSOCKET_RECEIVE, eSOCKET_CLOSED, and or eSOCKET_INTR. |
[in] | xFlags | flags passed by the user, only 'FREERTOS_MSG_DONTWAIT' is checked in this function. |
+
|
+ +static | +
Read the data from the stream buffer.
+After all checks have been done in FreeRTOS_recv() read the data from the stream buffer.
+[in] | pxSocket | The socket owning the connection. |
[out] | pvBuffer | The buffer to store the incoming data in. |
[in] | uxBufferLength | The length of the buffer so that the function does not do out of bound access. |
[in] | xFlags | The flags for conveying preference. This routine will check for 'FREERTOS_ZERO_COPY and/or'. |
+
|
+ +static | +
This function tries to send TCP-data in a loop with a time-out.
+This internal function will try to send as many bytes as possible to a TCP-socket.
+[in] | pxSocket | The socket owning the connection. |
[in] | pvBuffer | The buffer containing the data to be sent. |
[in] | uxDataLength | The number of bytes contained in the buffer. |
[in] | xFlags | Only the flag 'FREERTOS_MSG_DONTWAIT' will be tested. |
+
|
+ +static | +
Handle the socket option FREERTOS_SO_WIN_PROPERTIES.
+Handle the socket option FREERTOS_SO_WIN_PROPERTIES, which sets the sizes of the TCP windows and the sizes of the stream buffers.
+[in] | pxSocket | The socket whose options are being set. |
[in] | pvOptionValue | The pointer that is passed by the application. |
+
|
+ +static | +
Handle the socket option FREERTOS_SO_SET_LOW_HIGH_WATER.
+Handle the socket option FREERTOS_SO_SET_LOW_HIGH_WATER, which sets the low- and the high-water values for TCP reception. Useful when streaming music.
+[in] | pxSocket | The socket whose options are being set. |
[in] | pvOptionValue | The pointer that is passed by the application. |
+
|
+ +static | +
Handle the socket option FREERTOS_SO_SET_FULL_SIZE.
+Handle the socket option FREERTOS_SO_SET_FULL_SIZE. When enabled, the IP-stack will only send packets when there are at least MSS bytes to send.
+[in] | pxSocket | The socket whose options are being set. |
[in] | pvOptionValue | The option name like FREERTOS_SO_xxx_HANDLER. |
+
|
+ +static | +
Handle the socket option FREERTOS_SO_STOP_RX.
+Handle the socket option FREERTOS_SO_STOP_RX. Used in applications with streaming audio: tell the peer to stop or continue sending data.
+[in] | pxSocket | The TCP socket used for the connection. |
[in] | pvOptionValue | The option name like FREERTOS_SO_xxx_HANDLER. |
+
|
+ +static | +
Handle the socket options FREERTOS_SO_RCVTIMEO and FREERTOS_SO_SNDTIMEO.
+Handle the socket options FREERTOS_SO_RCVTIMEO and FREERTOS_SO_SNDTIMEO. Used in applications with streaming audio: tell the peer to stop or continue sending data.
+[in] | pxSocket | The TCP socket used for the connection. |
[in] | pvOptionValue | The option name like FREERTOS_SO_xxx_HANDLER. |
[in] | xForSend | when true, handle 'FREERTOS_SO_SNDTIMEO', otherwise handle the option FREERTOS_SO_RCVTIMEO . |
+
|
+ +static | +
Handle the socket options FREERTOS_SO_CLOSE_AFTER_SEND.
+Handle the socket options FREERTOS_SO_CLOSE_AFTER_SEND. As soon as the last byte has been transmitted, initiate a graceful closure of the TCP connection.
+[in] | pxSocket | The TCP socket used for the connection. |
[in] | pvOptionValue | A pointer to a binary value of size BaseType_t. |
+
|
+ +static | +
Handle the socket options FREERTOS_SO_REUSE_LISTEN_SOCKET.
+Handle the socket options FREERTOS_SO_REUSE_LISTEN_SOCKET. When set, a listening socket will turn itself into a child socket when it receives a connection.
+[in] | pxSocket | The TCP socket used for the connection. |
[in] | pvOptionValue | The option name like FREERTOS_SO_xxx_HANDLER. |
+
|
+ +static | +
Called by FreeRTOS_socket(), it will initialise some essential TCP fields in the socket.
+[in] | pxSocket | the TCP socket to be initialised. |
[in] | uxSocketSize | The calculated size of the socket, only used to gather memory usage statistics. |
+
|
+ +static | +
Called by FreeRTOS_recvfrom(). it will copy the received data or just a pointer to the received data in case of zero-copy, to the buffer provided by the caller.
+[in] | pucEthernetBuffer | The packet that was received. |
[in] | pvBuffer | The user-supplied buffer. |
[in] | uxBufferLength | The size of the user-supplied buffer. |
[in] | xFlags | Only 'FREERTOS_ZERO_COPY' will be tested. |
[in] | lDataLength | The number of bytes in the UDP payload. |
+
|
+ +static | +
Called by FreeRTOS_sendto(), it will actually send a UDP packet.
+[in] | pxSocket | The socket used for sending. |
[in] | pvBuffer | The character buffer as provided by the caller. |
[in] | uxTotalDataLength | The number of byte in the buffer. |
[in] | xFlags | The flags that were passed to FreeRTOS_sendto() It will test for FREERTOS_MSG_DONTWAIT and for FREERTOS_ZERO_COPY. |
[in] | pxDestinationAddress | The IP-address to which the packet must be sent. |
[in] | uxPayloadOffset | The calculated UDP payload offset, which depends on the IP type: IPv4 or IPv6. |
+
|
+ +static | +
Called by lTCPAddRxdata(), the received data has just been added to the RX-stream. When the space is dropped below a threshold, it may set the bit field 'bLowWater'. Also the socket's events bits for READ will be set.
+[in] | pxSocket | the socket that has received new data. |
Socket_t FreeRTOS_socket | +( | +BaseType_t | +xDomain, | +
+ | + | BaseType_t | +xType, | +
+ | + | BaseType_t | +xProtocol | +
+ | ) | ++ |
allocate and initialise a socket.
+[in] | xDomain | The domain in which the socket should be created. |
[in] | xType | The type of the socket. |
[in] | xProtocol | The protocol of the socket. |
SocketSet_t FreeRTOS_CreateSocketSet | +( | +void | +) | ++ |
Create a socket set.
+void FreeRTOS_DeleteSocketSet | +( | +SocketSet_t | +xSocketSet | ) | ++ |
Delete a given socket set.
+[in] | xSocketSet | The socket set being deleted. |
void FreeRTOS_FD_SET | +( | +Socket_t | +xSocket, | +
+ | + | SocketSet_t | +xSocketSet, | +
+ | + | EventBits_t | +xBitsToSet | +
+ | ) | ++ |
Add a socket to a set.
+[in] | xSocket | The socket being added. |
[in] | xSocketSet | The socket set being added to. |
[in] | xBitsToSet | The event bits to set, a combination of the values defined in 'eSelectEvent_t', for read, write, exception, etc. |
void FreeRTOS_FD_CLR | +( | +Socket_t | +xSocket, | +
+ | + | SocketSet_t | +xSocketSet, | +
+ | + | EventBits_t | +xBitsToClear | +
+ | ) | ++ |
Clear select bits for a socket. If the mask becomes 0, remove the socket from the set.
+[in] | xSocket | The socket whose select bits are being cleared. |
[in] | xSocketSet | The socket set of the socket. |
[in] | xBitsToClear | The bits to be cleared. Every '1' means that the corresponding bit will be cleared. See 'eSelectEvent_t' for the possible values. |
EventBits_t FreeRTOS_FD_ISSET | +( | +const ConstSocket_t | +xSocket, | +
+ | + | const ConstSocketSet_t | +xSocketSet | +
+ | ) | ++ |
Test if a socket belongs to a socket-set and if so, which event bit(s) are set.
+[in] | xSocket | The socket of interest. |
[in] | xSocketSet | The socket set to which the socket belongs. |
BaseType_t FreeRTOS_select | +( | +SocketSet_t | +xSocketSet, | +
+ | + | TickType_t | +xBlockTimeTicks | +
+ | ) | ++ |
The select() statement: wait for an event to occur on any of the sockets included in a socket set and return its event bits when the event occurs.
+[in] | xSocketSet | The socket set including the sockets on which we are waiting for an event to occur. |
[in] | xBlockTimeTicks | Maximum time ticks to wait for an event to occur. If the value is 'portMAX_DELAY' then the function will wait indefinitely for an event to occur. |
int32_t FreeRTOS_recvfrom | +( | +const ConstSocket_t | +xSocket, | +
+ | + | void * | +pvBuffer, | +
+ | + | size_t | +uxBufferLength, | +
+ | + | BaseType_t | +xFlags, | +
+ | + | struct freertos_sockaddr * | +pxSourceAddress, | +
+ | + | socklen_t * | +pxSourceAddressLength | +
+ | ) | ++ |
Receive data from a bound socket. In this library, the function can only be used with connection-less sockets (UDP). For TCP sockets, please use FreeRTOS_recv().
+[in] | xSocket | The socket to which the data is sent i.e. the listening socket. |
[out] | pvBuffer | The buffer in which the data being received is to be stored. |
[in] | uxBufferLength | The length of the buffer. |
[in] | xFlags | The flags to indicate preferences while calling this function. |
[out] | pxSourceAddress | The source address from which the data is being sent. |
[out] | pxSourceAddressLength | The length of the source address structure. This would always be a constant - 24 (in case of no error) as FreeRTOS+TCP makes the sizes of IPv4 and IPv6 structures equal (24-bytes) for compatibility. |
int32_t FreeRTOS_sendto | +( | +Socket_t | +xSocket, | +
+ | + | const void * | +pvBuffer, | +
+ | + | size_t | +uxTotalDataLength, | +
+ | + | BaseType_t | +xFlags, | +
+ | + | const struct freertos_sockaddr * | +pxDestinationAddress, | +
+ | + | socklen_t | +xDestinationAddressLength | +
+ | ) | ++ |
Send data to a socket. The socket must have already been created by a successful call to FreeRTOS_socket(). It works for UDP-sockets only.
+[in] | xSocket | The socket being sent to. |
[in] | pvBuffer | Pointer to the data being sent. |
[in] | uxTotalDataLength | Length (in bytes) of the data being sent. |
[in] | xFlags | Flags used to communicate preferences to the function. Possibly FREERTOS_MSG_DONTWAIT and/or FREERTOS_ZERO_COPY. |
[in] | pxDestinationAddress | The address to which the data is to be sent. |
[in] | xDestinationAddressLength | This parameter is present to adhere to the Berkeley sockets standard. Else, it is not used. |
BaseType_t FreeRTOS_bind | +( | +Socket_t | +xSocket, | +
+ | + | struct freertos_sockaddr const * | +pxAddress, | +
+ | + | socklen_t | +xAddressLength | +
+ | ) | ++ |
binds a socket to a local port number. If port 0 is provided, a system provided port number will be assigned. This function can be used for both UDP and TCP sockets. The actual binding will be performed by the IP-task to avoid mutual access to the bound-socket-lists (xBoundUDPSocketsList or xBoundTCPSocketsList).
+[in] | xSocket | The socket being bound. |
[in] | pxAddress | The address struct carrying the port number to which this socket is to be bound. |
[in] | xAddressLength | This parameter is not used internally. The function signature is used to adhere to standard Berkeley sockets API. |
BaseType_t vSocketBind | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | struct freertos_sockaddr * | +pxBindAddress, | +
+ | + | size_t | +uxAddressLength, | +
+ | + | BaseType_t | +xInternal | +
+ | ) | ++ |
Internal version of bind() that should not be called directly. 'xInternal' is used for TCP sockets only: it allows to have several (connected) child sockets bound to the same server port.
+[in] | pxSocket | The socket is to be bound. |
[in] | pxBindAddress | The port to which this socket should be bound. |
[in] | uxAddressLength | The address length. |
[in] | xInternal | pdTRUE is calling internally, else pdFALSE. |
BaseType_t FreeRTOS_closesocket | +( | +Socket_t | +xSocket | ) | ++ |
Close a socket and free the allocated space. In case of a TCP socket: the connection will not be closed automatically. Subsequent messages for the closed socket will be responded to with a RST. The IP-task will actually close the socket, after receiving a 'eSocketCloseEvent' message.
+[in] | xSocket | the socket being closed. |
void * vSocketClose | +( | +FreeRTOS_Socket_t * | +pxSocket | ) | ++ |
This is the internal version of FreeRTOS_closesocket(). It will be called by the IPtask only to avoid problems with synchronicity.
+[in] | pxSocket | The socket descriptor of the socket being closed. |
BaseType_t FreeRTOS_setsockopt | +( | +Socket_t | +xSocket, | +
+ | + | int32_t | +lLevel, | +
+ | + | int32_t | +lOptionName, | +
+ | + | const void * | +pvOptionValue, | +
+ | + | size_t | +uxOptionLength | +
+ | ) | ++ |
Set the socket options for the given socket.
+[in] | xSocket | The socket for which the options are to be set. |
[in] | lLevel | Not used. Parameter is used to maintain the Berkeley sockets standard. |
[in] | lOptionName | The name of the option to be set. |
[in] | pvOptionValue | The value of the option to be set. |
[in] | uxOptionLength | Not used. Parameter is used to maintain the Berkeley sockets standard. |
FreeRTOS_Socket_t * pxUDPSocketLookup | +( | +UBaseType_t | +uxLocalPort | ) | ++ |
Find the UDP socket corresponding to the port number.
+[in] | uxLocalPort | The port whose corresponding bound UDP socket is to be found. |
const char * FreeRTOS_inet_ntoa | +( | +uint32_t | +ulIPAddress, | +
+ | + | char * | +pcBuffer | +
+ | ) | ++ |
Convert the 32-bit representation of the IP-address to the dotted decimal notation after some checks. A safe alternative is FreeRTOS_inet_ntop4().
+[in] | ulIPAddress | 32-bit representation of the IP-address. |
[out] | pcBuffer | The buffer where the dotted decimal representation will be stored if all checks pass. The buffer must be at least 16 bytes long. |
BaseType_t FreeRTOS_inet_pton | +( | +BaseType_t | +xAddressFamily, | +
+ | + | const char * | +pcSource, | +
+ | + | void * | +pvDestination | +
+ | ) | ++ |
Convert the dotted decimal format of the IP-address to the 32-bit representation.
+[in] | xAddressFamily | The Address family to which the IP-address belongs to. Only FREERTOS_AF_INET (IPv4) is supported. |
[in] | pcSource | Pointer to the string holding the dotted decimal representation of the IP-address. |
[out] | pvDestination | The pointer to the address struct/variable where the converted IP-address will be stored. The buffer must be 4 bytes long in case of a IPv4 address. |
const char * FreeRTOS_inet_ntop | +( | +BaseType_t | +xAddressFamily, | +
+ | + | const void * | +pvSource, | +
+ | + | char * | +pcDestination, | +
+ | + | socklen_t | +uxSize | +
+ | ) | ++ |
Convert the 32-bit representation of the IP-address to the dotted decimal format based on the Address Family. (Only FREERTOS_AF_INET is allowed).
+[in] | xAddressFamily | The address family of the IP-address. |
[in] | pvSource | Pointer to the 32-bit representation of IP-address. |
[out] | pcDestination | The pointer to the character array where the dotted decimal address will be stored if every check does pass. |
[in] | uxSize | Size of the character array. This value makes sure that the code doesn't write beyond it's bounds. |
uint8_t ucASCIIToHex | +( | +char | +cChar | ) | ++ |
Convert an ASCII character to its corresponding hexadecimal value. Accepted characters are 0-9, a-f, and A-F.
+[in] | cChar | The character to be converted. |
void FreeRTOS_EUI48_ntop | +( | +const uint8_t * | +pucSource, | +
+ | + | char * | +pcTarget, | +
+ | + | char | +cTen, | +
+ | + | char | +cSeparator | +
+ | ) | ++ |
This function converts a 48-bit MAC address to a human readable string.
+[in] | pucSource | A pointer to an array of 6 bytes. |
[out] | pcTarget | A buffer that is 18 bytes long, it will contain the resulting string. |
[in] | cTen | Either an 'A' or an 'a'. It determines whether the hex numbers will use capital or small letters. |
[in] | cSeparator | The separator that should appear between the bytes, either ':' or '-'. |
BaseType_t FreeRTOS_EUI48_pton | +( | +const char * | +pcSource, | +
+ | + | uint8_t * | +pucTarget | +
+ | ) | ++ |
This function converts a human readable string, representing an 48-bit MAC address, into a 6-byte address. Valid inputs are e.g. "62:48:5:83:A0:b2" and "0-12-34-fe-dc-ba".
+[in] | pcSource | The null terminated string to be parsed. |
[out] | pucTarget | A buffer that is 6 bytes long, it will contain the MAC address. |
uint32_t FreeRTOS_inet_addr | +( | +const char * | +pcIPAddress | ) | ++ |
Convert the IP address from "w.x.y.z" (dotted decimal) format to the 32-bit format.
+[in] | pcIPAddress | The character string pointer holding the IP-address in the "W.X.Y.Z" (dotted decimal) format. |
size_t FreeRTOS_GetLocalAddress | +( | +ConstSocket_t | +xSocket, | +
+ | + | struct freertos_sockaddr * | +pxAddress | +
+ | ) | ++ |
Function to get the local address and IP port of the given socket.
+[in] | xSocket | Socket whose port is to be added to the pxAddress. |
[out] | pxAddress | Structure in which the IP address and the port number is returned. |
void vSocketWakeUpUser | +( | +FreeRTOS_Socket_t * | +pxSocket | ) | ++ |
Wake up the user of the given socket through event-groups.
+[in] | pxSocket | The socket whose user is to be woken up. |
BaseType_t FreeRTOS_connect | +( | +Socket_t | +xClientSocket, | +
+ | + | const struct freertos_sockaddr * | +pxAddress, | +
+ | + | socklen_t | +xAddressLength | +
+ | ) | ++ |
Connect to a remote port.
+[in] | xClientSocket | The socket initiating the connection. |
[in] | pxAddress | The address of the remote socket. |
[in] | xAddressLength | This parameter is not used. It is kept in the function signature to adhere to the Berkeley sockets standard. |
Socket_t FreeRTOS_accept | +( | +Socket_t | +xServerSocket, | +
+ | + | struct freertos_sockaddr * | +pxAddress, | +
+ | + | socklen_t * | +pxAddressLength | +
+ | ) | ++ |
Accept a connection on an listening socket.
+[in] | xServerSocket | The socket in listening mode. |
[out] | pxAddress | The address of the machine trying to connect to this node is returned in this pointer. |
[out] | pxAddressLength | The length of the address of the remote machine. |
BaseType_t FreeRTOS_recv | +( | +Socket_t | +xSocket, | +
+ | + | void * | +pvBuffer, | +
+ | + | size_t | +uxBufferLength, | +
+ | + | BaseType_t | +xFlags | +
+ | ) | ++ |
Read incoming data from a TCP socket. Only after the last byte has been read, a close error might be returned.
+[in] | xSocket | The socket owning the connection. |
[out] | pvBuffer | The buffer to store the incoming data in. |
[in] | uxBufferLength | The length of the buffer so that the function does not do out of bound access. |
[in] | xFlags | The flags for conveying preference. The values FREERTOS_MSG_DONTWAIT, FREERTOS_ZERO_COPY and/or FREERTOS_MSG_PEEK can be used. |
uint8_t * FreeRTOS_get_tx_base | +( | +Socket_t | +xSocket | ) | ++ |
Get a direct pointer to the beginning of the circular transmit buffer.
+[in] | xSocket | The socket owning the buffer. |
uint8_t * FreeRTOS_get_tx_head | +( | +Socket_t | +xSocket, | +
+ | + | BaseType_t * | +pxLength | +
+ | ) | ++ |
Get a direct pointer to the TX head of the circular transmit buffer.
+[in] | xSocket | The socket owning the buffer. |
[in] | pxLength | This will contain the number of bytes that may be written. |
BaseType_t FreeRTOS_send | +( | +Socket_t | +xSocket, | +
+ | + | const void * | +pvBuffer, | +
+ | + | size_t | +uxDataLength, | +
+ | + | BaseType_t | +xFlags | +
+ | ) | ++ |
Send data using a TCP socket. It is not necessary to have the socket connected already. Outgoing data will be stored and delivered as soon as the socket gets connected.
+[in] | xSocket | The socket owning the connection. |
[in] | pvBuffer | The buffer containing the data. The value of this pointer may be NULL in case zero-copy transmissions are used. It is used in combination with 'FreeRTOS_get_tx_head()'. |
[in] | uxDataLength | The length of the data to be added. |
[in] | xFlags | This parameter is not used. (zero or FREERTOS_MSG_DONTWAIT). |
BaseType_t FreeRTOS_listen | +( | +Socket_t | +xSocket, | +
+ | + | BaseType_t | +xBacklog | +
+ | ) | ++ |
Request to put a socket in listen mode.
+[in] | xSocket | the socket to be put in listening mode. |
[in] | xBacklog | Maximum number of child sockets. |
BaseType_t FreeRTOS_shutdown | +( | +Socket_t | +xSocket, | +
+ | + | BaseType_t | +xHow | +
+ | ) | ++ |
Shutdown - This function will shut down the connection in both directions. However, it will first deliver all data queued for transmission, and also it will first wait to receive any missing packets from the peer.
+[in] | xSocket | The socket owning the connection. |
[in] | xHow | Not used. Just present to stick to Berkeley standard. |
TickType_t xTCPTimerCheck | +( | +BaseType_t | +xWillSleep | ) | ++ |
A TCP timer has expired, now check all TCP sockets for:
+[in] | xWillSleep | Whether the calling task is going to sleep. |
FreeRTOS_Socket_t * pxTCPSocketLookup | +( | +uint32_t | +ulLocalIP, | +
+ | + | UBaseType_t | +uxLocalPort, | +
+ | + | IPv46_Address_t | +xRemoteIP, | +
+ | + | UBaseType_t | +uxRemotePort | +
+ | ) | ++ |
As multiple sockets may be bound to the same local port number looking up a socket is a little more complex: Both a local port, and a remote port and IP address are being used to find a match. For a socket in listening mode, the remote port and IP address are both 0.
+[in] | ulLocalIP | Local IP address. Ignored for now. |
[in] | uxLocalPort | Local port number. |
[in] | xRemoteIP | Remote (peer) IP address. |
[in] | uxRemotePort | Remote (peer) port. |
const struct xSTREAM_BUFFER * FreeRTOS_get_rx_buf | +( | +ConstSocket_t | +xSocket | ) | ++ |
For the web server: borrow the circular Rx buffer for inspection. HTML driver wants to see if a sequence of 13/10/13/10 is available.
+[in] | xSocket | The socket whose Rx stream is to be returned. |
int32_t lTCPAddRxdata | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | size_t | +uxOffset, | +
+ | + | const uint8_t * | +pcData, | +
+ | + | uint32_t | +ulByteCount | +
+ | ) | ++ |
Add data to the RxStream. When uxOffset > 0, data has come in out-of-order and will be put in front of the head so it can not be popped by the user.
+[in] | pxSocket | The socket to whose RxStream data is to be added. |
[in] | uxOffset | Offset of the packet. |
[in] | pcData | The data to be added to the RxStream. |
[in] | ulByteCount | Number of bytes in the data. |
BaseType_t FreeRTOS_GetRemoteAddress | +( | +ConstSocket_t | +xSocket, | +
+ | + | struct freertos_sockaddr * | +pxAddress | +
+ | ) | ++ |
Function to get the remote IP-address and port number.
+[in] | xSocket | Socket owning the connection. |
[out] | pxAddress | The address pointer to which the address is to be added. |
BaseType_t FreeRTOS_maywrite | +( | +ConstSocket_t | +xSocket | ) | ++ |
Check the number of bytes that may be added to txStream.
+[in] | xSocket | The socket to be checked. |
BaseType_t FreeRTOS_tx_space | +( | +ConstSocket_t | +xSocket | ) | ++ |
Get the number of bytes that can be written in the Tx buffer of the given socket.
+[in] | xSocket | the socket to be checked. |
BaseType_t FreeRTOS_tx_size | +( | +ConstSocket_t | +xSocket | ) | ++ |
Returns the number of bytes stored in the Tx buffer.
+[in] | xSocket | The socket to be checked. |
BaseType_t FreeRTOS_issocketconnected | +( | +ConstSocket_t | +xSocket | ) | ++ |
Is the socket connected.
+[in] | xSocket | The socket being checked. |
BaseType_t FreeRTOS_mss | +( | +ConstSocket_t | +xSocket | ) | ++ |
Get the actual value of Maximum Segment Size ( MSS ) being used.
+[in] | xSocket | The socket whose MSS is to be returned. |
BaseType_t FreeRTOS_connstatus | +( | +ConstSocket_t | +xSocket | ) | ++ |
Get the connection status. The values correspond to the members of the enum 'eIPTCPState_t'.
+[in] | xSocket | Socket to get the connection status from. |
BaseType_t FreeRTOS_rx_size | +( | +ConstSocket_t | +xSocket | ) | ++ |
Returns the number of bytes which can be read from the RX stream buffer.
+[in] | xSocket | the socket to get the number of bytes from. |
BaseType_t xSocketValid | +( | +const ConstSocket_t | +xSocket | ) | ++ |
Check whether a given socket is valid or not. Validity is defined as the socket not being NULL and not being Invalid.
+[in] | xSocket | The socket to be checked. |
BaseType_t xSocketSetSocketID | +( | +const Socket_t | +xSocket, | +
+ | + | void * | +pvSocketID | +
+ | ) | ++ |
Set the value of the SocketID of a socket.
+[in] | xSocket | The socket whose ID should be set. |
[in] | pvSocketID | The new value for the SocketID. |
void * pvSocketGetSocketID | +( | +const ConstSocket_t | +xSocket | ) | ++ |
Retrieve the SocketID that is associated with a socket.
+[in] | xSocket | The socket whose ID should be returned. |
BaseType_t FreeRTOS_GetIPType | +( | +ConstSocket_t | +xSocket | ) | ++ |
Get the version of IP: either 'ipTYPE_IPv4' or 'ipTYPE_IPv6'.
+[in] | xSocket | The socket to be checked. |
+
|
+ +static | +
This internal function will check if a given TCP socket has had any select event, either READ, WRITE, or EXCEPT.
+[in] | pxSocket | The socket which needs to be checked. |
void vSocketSelect | +( | +const SocketSelect_t * | +pxSocketSet | ) | ++ |
This internal non-blocking function will check all sockets that belong to a select set. The events bits of each socket will be updated, and it will check if an ongoing select() call must be interrupted because of an event has occurred.
+[in] | pxSocketSet | The socket-set which is to be waited on for change. |
Provides the API for managing/creating the stream buffers in the FreeRTOS+TCP network stack. +More...
+#include <stdint.h>
#include <string.h>
#include "FreeRTOS.h"
#include "task.h"
#include "FreeRTOS_IP.h"
+Functions | |
size_t | uxStreamBufferSpace (const StreamBuffer_t *const pxBuffer, size_t uxLower, size_t uxUpper) |
Get the space between lower and upper value provided to the function. | |
size_t | uxStreamBufferDistance (const StreamBuffer_t *const pxBuffer, size_t uxLower, size_t uxUpper) |
Get the distance between lower and upper value provided to the function. | |
size_t | uxStreamBufferGetSpace (const StreamBuffer_t *const pxBuffer) |
Get the number of items which can be added to the buffer at the head before reaching the tail. | |
size_t | uxStreamBufferFrontSpace (const StreamBuffer_t *const pxBuffer) |
Get the distance between the pointer in free space and the tail. | |
size_t | uxStreamBufferGetSize (const StreamBuffer_t *const pxBuffer) |
Get the number of items which can be read from the tail before reaching the head. | |
size_t | uxStreamBufferMidSpace (const StreamBuffer_t *const pxBuffer) |
Get the space between the mid pointer and the head in the stream buffer. | |
void | vStreamBufferClear (StreamBuffer_t *const pxBuffer) |
Clear the stream buffer. | |
void | vStreamBufferMoveMid (StreamBuffer_t *const pxBuffer, const size_t uxCount) |
Move the mid pointer forward by given byte count. | |
BaseType_t | xStreamBufferLessThenEqual (const StreamBuffer_t *const pxBuffer, size_t uxLeft, size_t uxRight) |
Check whether the value in left is less than or equal to the value in right from the perspective of the circular stream buffer. | |
size_t | uxStreamBufferGetPtr (StreamBuffer_t *const pxBuffer, uint8_t **const ppucData) |
Get the pointer to data and the amount of data which can be read in one go. | |
size_t | uxStreamBufferAdd (StreamBuffer_t *const pxBuffer, size_t uxOffset, const uint8_t *const pucData, size_t uxByteCount) |
Adds data to a stream buffer. | |
size_t | uxStreamBufferGet (StreamBuffer_t *const pxBuffer, size_t uxOffset, uint8_t *const pucData, size_t uxMaxCount, BaseType_t xPeek) |
Read bytes from stream buffer. | |
Provides the API for managing/creating the stream buffers in the FreeRTOS+TCP network stack.
+size_t uxStreamBufferSpace | +( | +const StreamBuffer_t *const | +pxBuffer, | +
+ | + | size_t | +uxLower, | +
+ | + | size_t | +uxUpper | +
+ | ) | ++ |
Get the space between lower and upper value provided to the function.
+[in] | pxBuffer | The circular stream buffer. |
[in] | uxLower | The lower value. |
[in] | uxUpper | The upper value. |
size_t uxStreamBufferDistance | +( | +const StreamBuffer_t *const | +pxBuffer, | +
+ | + | size_t | +uxLower, | +
+ | + | size_t | +uxUpper | +
+ | ) | ++ |
Get the distance between lower and upper value provided to the function.
+[in] | pxBuffer | The circular stream buffer. |
[in] | uxLower | The lower value. |
[in] | uxUpper | The upper value. |
size_t uxStreamBufferGetSpace | +( | +const StreamBuffer_t *const | +pxBuffer | ) | ++ |
Get the number of items which can be added to the buffer at the head before reaching the tail.
+[in] | pxBuffer | The circular stream buffer. |
size_t uxStreamBufferFrontSpace | +( | +const StreamBuffer_t *const | +pxBuffer | ) | ++ |
Get the distance between the pointer in free space and the tail.
+[in] | pxBuffer | The circular stream buffer. |
size_t uxStreamBufferGetSize | +( | +const StreamBuffer_t *const | +pxBuffer | ) | ++ |
Get the number of items which can be read from the tail before reaching the head.
+[in] | pxBuffer | The circular stream buffer. |
size_t uxStreamBufferMidSpace | +( | +const StreamBuffer_t *const | +pxBuffer | ) | ++ |
Get the space between the mid pointer and the head in the stream buffer.
+[in] | pxBuffer | The circular stream buffer. |
void vStreamBufferClear | +( | +StreamBuffer_t *const | +pxBuffer | ) | ++ |
Clear the stream buffer.
+[in] | pxBuffer | The circular stream buffer. |
void vStreamBufferMoveMid | +( | +StreamBuffer_t *const | +pxBuffer, | +
+ | + | const size_t | +uxCount | +
+ | ) | ++ |
Move the mid pointer forward by given byte count.
+[in] | pxBuffer | The circular stream buffer. |
[in] | uxCount | The byte count by which the mid pointer is to be moved. |
BaseType_t xStreamBufferLessThenEqual | +( | +const StreamBuffer_t *const | +pxBuffer, | +
+ | + | size_t | +uxLeft, | +
+ | + | size_t | +uxRight | +
+ | ) | ++ |
Check whether the value in left is less than or equal to the value in right from the perspective of the circular stream buffer.
+[in] | pxBuffer | The circular stream buffer. |
[in] | uxLeft | The left pointer in the stream buffer. |
[in] | uxRight | The right value pointer in the stream buffer. |
size_t uxStreamBufferGetPtr | +( | +StreamBuffer_t *const | +pxBuffer, | +
+ | + | uint8_t **const | +ppucData | +
+ | ) | ++ |
Get the pointer to data and the amount of data which can be read in one go.
+[in] | pxBuffer | The circular stream buffer. |
[out] | ppucData | Pointer to the data pointer which will point to the data which can be read. |
size_t uxStreamBufferAdd | +( | +StreamBuffer_t *const | +pxBuffer, | +
+ | + | size_t | +uxOffset, | +
+ | + | const uint8_t *const | +pucData, | +
+ | + | size_t | +uxByteCount | +
+ | ) | ++ |
Adds data to a stream buffer.
+[in,out] | pxBuffer | The buffer to which the bytes will be added. |
[in] | uxOffset | If uxOffset > 0, data will be written at an offset from uxHead while uxHead will not be moved yet. |
[in] | pucData | A pointer to the data to be added. If 'pucData' equals NULL, the function is called to advance the 'Head' only. |
[in] | uxByteCount | The number of bytes to add. |
size_t uxStreamBufferGet | +( | +StreamBuffer_t *const | +pxBuffer, | +
+ | + | size_t | +uxOffset, | +
+ | + | uint8_t *const | +pucData, | +
+ | + | size_t | +uxMaxCount, | +
+ | + | BaseType_t | +xPeek | +
+ | ) | ++ |
Read bytes from stream buffer.
+[in] | pxBuffer | The buffer from which the bytes will be read. |
[in] | uxOffset | can be used to read data located at a certain offset from 'lTail'. |
[in,out] | pucData | If 'pucData' equals NULL, the function is called to advance 'lTail' only. |
[in] | uxMaxCount | The number of bytes to read. |
[in] | xPeek | if 'xPeek' is pdTRUE, or if 'uxOffset' is non-zero, the 'lTail' pointer will not be advanced. |
Module which handles the TCP connections for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_IP_Utils.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DHCP.h"
#include "NetworkInterface.h"
#include "NetworkBufferManagement.h"
#include "FreeRTOS_TCP_Reception.h"
#include "FreeRTOS_TCP_Transmission.h"
#include "FreeRTOS_TCP_State_Handling.h"
#include "FreeRTOS_TCP_Utils.h"
+Functions | |
static IPv46_Address_t | xGetSourceAddrFromBuffer (const uint8_t *const pucEthernetBuffer) |
IP frame agnostic helper to obtain the source IP Address from a buffer. | |
void | vSocketCloseNextTime (FreeRTOS_Socket_t *pxSocket) |
Close the socket another time. | |
void | vSocketListenNextTime (FreeRTOS_Socket_t *pxSocket) |
Postpone a call to FreeRTOS_listen() to avoid recursive calls. | |
BaseType_t | xTCPSocketCheck (FreeRTOS_Socket_t *pxSocket) |
As soon as a TCP socket timer expires, this function will be called (from xTCPTimerCheck). It can send a delayed ACK or new data. | |
void | prvTCPTouchSocket (struct xSOCKET *pxSocket) |
'Touch' the socket to keep it alive/updated. | |
static BaseType_t | vTCPRemoveTCPChild (const FreeRTOS_Socket_t *pxChildSocket) |
void | vTCPStateChange (FreeRTOS_Socket_t *pxSocket, enum eTCP_STATE eTCPState) |
Changing to a new state. Centralised here to do specific actions such as resetting the alive timer, calling the user's OnConnect handler to notify that a socket has got (dis)connected, and setting bit to unblock a call to FreeRTOS_select(). | |
TickType_t | prvTCPNextTimeout (struct xSOCKET *pxSocket) |
Calculate after how much time this socket needs to be checked again. | |
BaseType_t | xProcessReceivedTCPPacket (NetworkBufferDescriptor_t *pxDescriptor) |
Process the received TCP packet. | |
BaseType_t | xTCPCheckNewClient (FreeRTOS_Socket_t *pxSocket) |
In the API accept(), the user asks is there is a new client? As API's can not walk through the xBoundTCPSocketsList the IP-task will do this. | |
Module which handles the TCP connections for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes.
+Endianness: in this module all ports and IP addresses are stored in host byte-order, except fields in the IP-packets
+
+
|
+ +static | +
IP frame agnostic helper to obtain the source IP Address from a buffer.
+[in] | pucEthernetBuffer | The Ethernet buffer from which the source address will be retrieved. |
void vSocketCloseNextTime | +( | +FreeRTOS_Socket_t * | +pxSocket | ) | ++ |
Close the socket another time.
+[in] | pxSocket | The socket to be checked. |
void vSocketListenNextTime | +( | +FreeRTOS_Socket_t * | +pxSocket | ) | ++ |
Postpone a call to FreeRTOS_listen() to avoid recursive calls.
+[in] | pxSocket | The socket to be checked. |
BaseType_t xTCPSocketCheck | +( | +FreeRTOS_Socket_t * | +pxSocket | ) | ++ |
As soon as a TCP socket timer expires, this function will be called (from xTCPTimerCheck). It can send a delayed ACK or new data.
+[in] | pxSocket | socket to be checked. |
void prvTCPTouchSocket | +( | +struct xSOCKET * | +pxSocket | ) | ++ |
'Touch' the socket to keep it alive/updated.
+[in] | pxSocket | The socket to be updated. |
+
|
+ +static | +
< for server socket: child, for child socket: parent
+ +void vTCPStateChange | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | enum eTCP_STATE | +eTCPState | +
+ | ) | ++ |
Changing to a new state. Centralised here to do specific actions such as resetting the alive timer, calling the user's OnConnect handler to notify that a socket has got (dis)connected, and setting bit to unblock a call to FreeRTOS_select().
+[in] | pxSocket | The socket whose state we are trying to change. |
[in] | eTCPState | The state to which we want to change to. |
TickType_t prvTCPNextTimeout | +( | +struct xSOCKET * | +pxSocket | ) | ++ |
Calculate after how much time this socket needs to be checked again.
+[in] | pxSocket | The socket to be checked. |
BaseType_t xProcessReceivedTCPPacket | +( | +NetworkBufferDescriptor_t * | +pxDescriptor | ) | ++ |
Process the received TCP packet.
+[in] | pxDescriptor | The descriptor in which the TCP packet is held. |
BaseType_t xTCPCheckNewClient | +( | +FreeRTOS_Socket_t * | +pxSocket | ) | ++ |
In the API accept(), the user asks is there is a new client? As API's can not walk through the xBoundTCPSocketsList the IP-task will do this.
+[in] | pxSocket | The socket for which the bound socket list will be iterated. |
Module which handles the TCP connections for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DHCP.h"
#include "NetworkInterface.h"
#include "NetworkBufferManagement.h"
#include "FreeRTOS_TCP_Reception.h"
#include "FreeRTOS_TCP_Transmission.h"
#include "FreeRTOS_TCP_State_Handling.h"
#include "FreeRTOS_TCP_Utils.h"
Module which handles the TCP connections for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes.
+Endianness: in this module all ports and IP addresses are stored in host byte-order, except fields in the IP-packets
+Module which handles the TCP connections for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DHCP.h"
#include "NetworkInterface.h"
#include "NetworkBufferManagement.h"
#include "FreeRTOS_TCP_Reception.h"
#include "FreeRTOS_TCP_Transmission.h"
#include "FreeRTOS_TCP_State_Handling.h"
#include "FreeRTOS_TCP_Utils.h"
Module which handles the TCP connections for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes.
+Endianness: in this module all ports and IP addresses are stored in host byte-order, except fields in the IP-packets
+Module which processes the packet received from a socket for FreeRTOS+TCP. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DHCP.h"
#include "NetworkInterface.h"
#include "NetworkBufferManagement.h"
#include "FreeRTOS_TCP_Transmission.h"
#include "FreeRTOS_TCP_Reception.h"
+Functions | |
static int32_t | prvSingleStepTCPHeaderOptions (const uint8_t *const pucPtr, size_t uxTotalLength, FreeRTOS_Socket_t *const pxSocket, BaseType_t xHasSYNFlag) |
Identify and deal with a single TCP header option, advancing the pointer to the header. | |
static void | prvReadSackOption (const uint8_t *const pucPtr, size_t uxIndex, FreeRTOS_Socket_t *const pxSocket) |
Skip past TCP header options when doing Selective ACK, until there are no more options left. | |
BaseType_t | prvCheckOptions (FreeRTOS_Socket_t *pxSocket, const NetworkBufferDescriptor_t *pxNetworkBuffer) |
Parse the TCP option(s) received, if present. | |
BaseType_t | prvCheckRxData (const NetworkBufferDescriptor_t *pxNetworkBuffer, uint8_t **ppucRecvData) |
prvCheckRxData(): called from prvTCPHandleState(). The first thing that will be done is find the TCP payload data and check the length of this data. | |
BaseType_t | prvStoreRxData (FreeRTOS_Socket_t *pxSocket, const uint8_t *pucRecvData, NetworkBufferDescriptor_t *pxNetworkBuffer, uint32_t ulReceiveLength) |
prvStoreRxData(): called from prvTCPHandleState(). The second thing is to do is check if the payload data may be accepted. If so, they will be added to the reception queue. | |
Module which processes the packet received from a socket for FreeRTOS+TCP.
+Endianness: in this module all ports and IP addresses are stored in host byte-order, except fields in the IP-packets
+
+
|
+ +static | +
Identify and deal with a single TCP header option, advancing the pointer to the header.
+[in] | pucPtr | Pointer to the TCP packet options. |
[in] | uxTotalLength | Length of the TCP packet options. |
[in] | pxSocket | Socket handling the connection. |
[in] | xHasSYNFlag | Whether the header has SYN flag or not. |
+
|
+ +static | +
Skip past TCP header options when doing Selective ACK, until there are no more options left.
+[in] | pucPtr | Pointer to the TCP packet options. |
[in] | uxIndex | Index of options in the TCP packet options. |
[in] | pxSocket | Socket handling the TCP connection. |
BaseType_t prvCheckOptions | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | const NetworkBufferDescriptor_t * | +pxNetworkBuffer | +
+ | ) | ++ |
Parse the TCP option(s) received, if present.
+[in] | pxSocket | The socket handling the connection. |
[in] | pxNetworkBuffer | The network buffer containing the TCP packet. |
BaseType_t prvCheckRxData | +( | +const NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | uint8_t ** | +ppucRecvData | +
+ | ) | ++ |
prvCheckRxData(): called from prvTCPHandleState(). The first thing that will be done is find the TCP payload data and check the length of this data.
+[in] | pxNetworkBuffer | The network buffer holding the received data. |
[out] | ppucRecvData | It will point to first byte of the TCP payload. |
BaseType_t prvStoreRxData | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | const uint8_t * | +pucRecvData, | +
+ | + | NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | uint32_t | +ulReceiveLength | +
+ | ) | ++ |
prvStoreRxData(): called from prvTCPHandleState(). The second thing is to do is check if the payload data may be accepted. If so, they will be added to the reception queue.
+[in] | pxSocket | The socket owning the connection. |
[in] | pucRecvData | Pointer to received data. |
[in] | pxNetworkBuffer | The network buffer descriptor. |
[in] | ulReceiveLength | The length of the received data. |
Module which handles the TCP protocol state transition for FreeRTOS+TCP. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DHCP.h"
#include "NetworkInterface.h"
#include "NetworkBufferManagement.h"
#include "FreeRTOS_TCP_Reception.h"
#include "FreeRTOS_TCP_Transmission.h"
#include "FreeRTOS_TCP_State_Handling.h"
#include "FreeRTOS_TCP_Utils.h"
+Functions | |
static BaseType_t | prvTCPHandleFin (FreeRTOS_Socket_t *pxSocket, const NetworkBufferDescriptor_t *pxNetworkBuffer) |
prvTCPHandleFin() will be called to handle connection closure. The closure starts when either a FIN has been received and accepted, or when the socket has sent a FIN flag to the peer. Before being called, it has been checked that both reception and transmission are complete. | |
static BaseType_t | prvHandleSynReceived (FreeRTOS_Socket_t *pxSocket, const NetworkBufferDescriptor_t *pxNetworkBuffer, uint32_t ulReceiveLength, UBaseType_t uxOptionsLength) |
prvHandleSynReceived(): called from prvTCPHandleState(). Called from the states: eSYN_RECEIVED and eCONNECT_SYN. If the flags received are correct, the socket will move to eESTABLISHED. | |
static BaseType_t | prvHandleEstablished (FreeRTOS_Socket_t *pxSocket, NetworkBufferDescriptor_t **ppxNetworkBuffer, uint32_t ulReceiveLength, UBaseType_t uxOptionsLength) |
prvHandleEstablished(): called from prvTCPHandleState() Called if the status is eESTABLISHED. Data reception has been handled earlier. Here the ACK's from peer will be checked, and if a FIN is received, the code will check if it may be accepted, i.e. if all expected data has been completely received. | |
BaseType_t | prvTCPSocketIsActive (eIPTCPState_t eStatus) |
Check whether the socket is active or not. | |
BaseType_t | prvTCPHandleState (FreeRTOS_Socket_t *pxSocket, NetworkBufferDescriptor_t **ppxNetworkBuffer) |
Check incoming packets for valid data and handle the state of the TCP connection and respond according to the situation. | |
FreeRTOS_Socket_t * | prvHandleListen (FreeRTOS_Socket_t *pxSocket, NetworkBufferDescriptor_t *pxNetworkBuffer) |
Handle 'listen' event on the given socket. | |
BaseType_t | prvTCPSocketCopy (FreeRTOS_Socket_t *pxNewSocket, FreeRTOS_Socket_t *pxSocket) |
Duplicates a socket after a listening socket receives a connection and bind the new socket to the same port as the listening socket. Also, let the new socket inherit all properties from the listening socket. | |
Module which handles the TCP protocol state transition for FreeRTOS+TCP.
+Endianness: in this module all ports and IP addresses are stored in host byte-order, except fields in the IP-packets
+
+
|
+ +static | +
prvTCPHandleFin() will be called to handle connection closure. The closure starts when either a FIN has been received and accepted, or when the socket has sent a FIN flag to the peer. Before being called, it has been checked that both reception and transmission are complete.
+[in] | pxSocket | Socket owning the the connection. |
[in] | pxNetworkBuffer | The network buffer carrying the TCP packet. |
+
|
+ +static | +
prvHandleSynReceived(): called from prvTCPHandleState(). Called from the states: eSYN_RECEIVED and eCONNECT_SYN. If the flags received are correct, the socket will move to eESTABLISHED.
+[in] | pxSocket | The socket handling the connection. |
[in] | pxNetworkBuffer | The pointer to the network buffer carrying the packet. |
[in] | ulReceiveLength | Length in bytes of the data received. |
[in] | uxOptionsLength | Length of the TCP options in bytes. |
+
|
+ +static | +
prvHandleEstablished(): called from prvTCPHandleState() Called if the status is eESTABLISHED. Data reception has been handled earlier. Here the ACK's from peer will be checked, and if a FIN is received, the code will check if it may be accepted, i.e. if all expected data has been completely received.
+[in] | pxSocket | The socket owning the connection. |
[in,out] | ppxNetworkBuffer | Pointer to pointer to the network buffer. |
[in] | ulReceiveLength | The length of the received packet. |
[in] | uxOptionsLength | Length of TCP options. |
BaseType_t prvTCPSocketIsActive | +( | +eIPTCPState_t | +eStatus | ) | ++ |
Check whether the socket is active or not.
+[in] | eStatus | The status of the socket. |
BaseType_t prvTCPHandleState | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | NetworkBufferDescriptor_t ** | +ppxNetworkBuffer | +
+ | ) | ++ |
Check incoming packets for valid data and handle the state of the TCP connection and respond according to the situation.
+[in] | pxSocket | The socket whose connection state is being handled. |
[in] | ppxNetworkBuffer | The network buffer descriptor holding the packet received from the peer. |
prvCheckRxData() + prvStoreRxData() + prvSetOptions() + prvHandleSynReceived() + prvHandleEstablished() + prvSendData() +As these functions are declared static, and they're called from one location only, most compilers will inline them, thus avoiding a call and return.
FreeRTOS_Socket_t * prvHandleListen | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | NetworkBufferDescriptor_t * | +pxNetworkBuffer | +
+ | ) | ++ |
Handle 'listen' event on the given socket.
+[in] | pxSocket | The socket on which the listen occurred. |
[in] | pxNetworkBuffer | The network buffer carrying the packet. |
BaseType_t prvTCPSocketCopy | +( | +FreeRTOS_Socket_t * | +pxNewSocket, | +
+ | + | FreeRTOS_Socket_t * | +pxSocket | +
+ | ) | ++ |
Duplicates a socket after a listening socket receives a connection and bind the new socket to the same port as the listening socket. Also, let the new socket inherit all properties from the listening socket.
+[in] | pxNewSocket | Pointer to the new socket. |
[in] | pxSocket | Pointer to the socket being duplicated. |
Module which handles the TCP protocol state transition for FreeRTOS+TCP. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DHCP.h"
#include "NetworkInterface.h"
#include "NetworkBufferManagement.h"
#include "FreeRTOS_TCP_Reception.h"
#include "FreeRTOS_TCP_Transmission.h"
#include "FreeRTOS_TCP_State_Handling.h"
#include "FreeRTOS_TCP_Utils.h"
+Functions | |
FreeRTOS_Socket_t * | prvHandleListen_IPV4 (FreeRTOS_Socket_t *pxSocket, NetworkBufferDescriptor_t *pxNetworkBuffer) |
Handle 'listen' event on the given socket. | |
Module which handles the TCP protocol state transition for FreeRTOS+TCP.
+Endianness: in this module all ports and IP addresses are stored in host byte-order, except fields in the IP-packets
+FreeRTOS_Socket_t * prvHandleListen_IPV4 | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | NetworkBufferDescriptor_t * | +pxNetworkBuffer | +
+ | ) | ++ |
Handle 'listen' event on the given socket.
+[in] | pxSocket | The socket on which the listen occurred. |
[in] | pxNetworkBuffer | The network buffer carrying the packet. |
Module which handles the TCP protocol state transition for FreeRTOS+TCP. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DHCP.h"
#include "NetworkInterface.h"
#include "NetworkBufferManagement.h"
#include "FreeRTOS_TCP_Reception.h"
#include "FreeRTOS_TCP_Transmission.h"
#include "FreeRTOS_TCP_State_Handling.h"
#include "FreeRTOS_TCP_Utils.h"
+Functions | |
FreeRTOS_Socket_t * | prvHandleListen_IPV6 (FreeRTOS_Socket_t *pxSocket, NetworkBufferDescriptor_t *pxNetworkBuffer) |
Handle 'listen' event on the given socket. | |
Module which handles the TCP protocol state transition for FreeRTOS+TCP.
+Endianness: in this module all ports and IP addresses are stored in host byte-order, except fields in the IP-packets
+FreeRTOS_Socket_t * prvHandleListen_IPV6 | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | NetworkBufferDescriptor_t * | +pxNetworkBuffer | +
+ | ) | ++ |
Handle 'listen' event on the given socket.
+[in] | pxSocket | The socket on which the listen occurred. |
[in] | pxNetworkBuffer | The network buffer carrying the packet. |
Module which prepares the packet to be sent through a socket for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "NetworkInterface.h"
#include "NetworkBufferManagement.h"
#include "FreeRTOSIPConfigDefaults.h"
#include "FreeRTOS_TCP_IP.h"
#include "FreeRTOS_TCP_Reception.h"
#include "FreeRTOS_TCP_Transmission.h"
#include "FreeRTOS_TCP_State_Handling.h"
#include "FreeRTOS_TCP_Utils.h"
+Functions | |
static BaseType_t | prvTCPMakeSurePrepared (FreeRTOS_Socket_t *pxSocket) |
Check if the outgoing connection is already prepared, if not call prvTCPPrepareConnect() to continue the preparation. | |
static BaseType_t | prvTCPPrepareConnect (FreeRTOS_Socket_t *pxSocket) |
Resolve the MAC-address of the peer and initialise the first SYN packet. | |
int32_t | prvTCPSendPacket (FreeRTOS_Socket_t *pxSocket) |
prvTCPSendPacket() will be called when the socket time-out has been reached. | |
int32_t | prvTCPSendRepeated (FreeRTOS_Socket_t *pxSocket, NetworkBufferDescriptor_t **ppxNetworkBuffer) |
prvTCPSendRepeated will try to send a series of messages, as long as there is data to be sent and as long as the transmit window isn't full. | |
void | prvTCPReturnPacket (FreeRTOS_Socket_t *pxSocket, NetworkBufferDescriptor_t *pxDescriptor, uint32_t ulLen, BaseType_t xReleaseAfterSend) |
Return (or send) a packet to the peer. The data is stored in pxBuffer, which may either point to a real network buffer or to a TCP socket field called 'xTCP.xPacket'. A temporary xNetworkBuffer will be used to pass the data to the NIC. | |
void | prvTCPReturn_CheckTCPWindow (FreeRTOS_Socket_t *pxSocket, const NetworkBufferDescriptor_t *pxNetworkBuffer, size_t uxIPHeaderSize) |
Called by prvTCPReturnPacket(), this function will set the the window size on this side: 'xTCPHeader.usWindow'. | |
void | prvTCPReturn_SetSequenceNumber (FreeRTOS_Socket_t *pxSocket, const NetworkBufferDescriptor_t *pxNetworkBuffer, size_t uxIPHeaderSize, uint32_t ulLen) |
Called by prvTCPReturnPacket(), this function sets the sequence and ack numbers in the TCP-header. | |
BaseType_t | prvTCPCreateWindow (FreeRTOS_Socket_t *pxSocket) |
Create the TCP window for the given socket. | |
static uint8_t | prvWinScaleFactor (const FreeRTOS_Socket_t *pxSocket) |
Get the window scaling factor for the TCP connection. | |
UBaseType_t | prvSetSynAckOptions (FreeRTOS_Socket_t *pxSocket, TCPHeader_t *pxTCPHeader) |
When opening a TCP connection, while SYN's are being sent, the parties may communicate what MSS (Maximum Segment Size) they intend to use, whether Selective ACK's ( SACK ) are supported, and the size of the reception window ( WSOPT ). | |
NetworkBufferDescriptor_t * | prvTCPBufferResize (const FreeRTOS_Socket_t *pxSocket, NetworkBufferDescriptor_t *pxNetworkBuffer, int32_t lDataLen, UBaseType_t uxOptionsLength) |
Check if the size of a network buffer is big enough to hold the outgoing message. Allocate a new bigger network buffer when necessary. | |
void | prvTCPReturn_SetEndPoint (const FreeRTOS_Socket_t *pxSocket, NetworkBufferDescriptor_t *pxNetworkBuffer, size_t uxIPHeaderSize) |
Called by prvTCPReturnPacket(), this function makes sure that the network buffer has 'pxEndPoint' set properly. | |
int32_t | prvTCPPrepareSend (FreeRTOS_Socket_t *pxSocket, NetworkBufferDescriptor_t **ppxNetworkBuffer, UBaseType_t uxOptionsLength) |
Prepare an outgoing message, in case anything has to be sent. | |
void | prvTCPAddTxData (FreeRTOS_Socket_t *pxSocket) |
The API FreeRTOS_send() adds data to the TX stream. Add this data to the windowing system to it can be transmitted. | |
UBaseType_t | prvSetOptions (FreeRTOS_Socket_t *pxSocket, const NetworkBufferDescriptor_t *pxNetworkBuffer) |
Set the TCP options (if any) for the outgoing packet. | |
BaseType_t | prvSendData (FreeRTOS_Socket_t *pxSocket, NetworkBufferDescriptor_t **ppxNetworkBuffer, uint32_t ulReceiveLength, BaseType_t xByteCount) |
Called from prvTCPHandleState(). There is data to be sent. If ipconfigUSE_TCP_WIN is defined, and if only an ACK must be sent, it will be checked if it would better be postponed for efficiency. | |
BaseType_t | prvTCPSendSpecialPacketHelper (NetworkBufferDescriptor_t *pxNetworkBuffer, uint8_t ucTCPFlags) |
Common code for sending a TCP protocol control packet (i.e. no options, no payload, just flags). | |
BaseType_t | prvTCPSendChallengeAck (NetworkBufferDescriptor_t *pxNetworkBuffer) |
A "challenge ACK" is as per https://tools.ietf.org/html/rfc5961#section-3.2, case #3. In summary, an RST was received with a sequence number that is unexpected but still within the window. | |
BaseType_t | prvTCPSendReset (NetworkBufferDescriptor_t *pxNetworkBuffer) |
Send a RST (Reset) to peer in case the packet cannot be handled. | |
Module which prepares the packet to be sent through a socket for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes.
+Endianness: in this module all ports and IP addresses are stored in host byte-order, except fields in the IP-packets
+
+
|
+ +static | +
Check if the outgoing connection is already prepared, if not call prvTCPPrepareConnect() to continue the preparation.
+[in] | pxSocket | The socket that wants to connect. |
+
|
+ +static | +
Resolve the MAC-address of the peer and initialise the first SYN packet.
+[in] | pxSocket | The socket owning the TCP connection. The first packet shall be created in this socket. |
int32_t prvTCPSendPacket | +( | +FreeRTOS_Socket_t * | +pxSocket | ) | ++ |
prvTCPSendPacket() will be called when the socket time-out has been reached.
+[in] | pxSocket | The socket owning the connection. |
int32_t prvTCPSendRepeated | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | NetworkBufferDescriptor_t ** | +ppxNetworkBuffer | +
+ | ) | ++ |
prvTCPSendRepeated will try to send a series of messages, as long as there is data to be sent and as long as the transmit window isn't full.
+[in] | pxSocket | The socket owning the connection. |
[in,out] | ppxNetworkBuffer | Pointer to pointer to the network buffer. |
void prvTCPReturnPacket | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | NetworkBufferDescriptor_t * | +pxDescriptor, | +
+ | + | uint32_t | +ulLen, | +
+ | + | BaseType_t | +xReleaseAfterSend | +
+ | ) | ++ |
Return (or send) a packet to the peer. The data is stored in pxBuffer, which may either point to a real network buffer or to a TCP socket field called 'xTCP.xPacket'. A temporary xNetworkBuffer will be used to pass the data to the NIC.
+[in] | pxSocket | The socket owning the connection. |
[in] | pxDescriptor | The network buffer descriptor carrying the packet. |
[in] | ulLen | Length of the packet being sent. |
[in] | xReleaseAfterSend | pdTRUE if the ownership of the descriptor is transferred to the network interface. |
void prvTCPReturn_CheckTCPWindow | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | const NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | size_t | +uxIPHeaderSize | +
+ | ) | ++ |
Called by prvTCPReturnPacket(), this function will set the the window size on this side: 'xTCPHeader.usWindow'.
+[in] | pxSocket | The socket on which the packet is being sent. |
[in] | pxNetworkBuffer | The network buffer carrying the outgoing message. |
[in] | uxIPHeaderSize | The size of the IP-header, which depends on the IP-type. |
void prvTCPReturn_SetSequenceNumber | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | const NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | size_t | +uxIPHeaderSize, | +
+ | + | uint32_t | +ulLen | +
+ | ) | ++ |
Called by prvTCPReturnPacket(), this function sets the sequence and ack numbers in the TCP-header.
+[in] | pxSocket | The socket on which the packet is being sent. |
[in] | pxNetworkBuffer | The network buffer carrying the outgoing message. |
[in] | uxIPHeaderSize | The size of the IP-header, which depends on the IP-type. |
[in] | ulLen | The size of the packet minus the size of the Ethernet header. |
BaseType_t prvTCPCreateWindow | +( | +FreeRTOS_Socket_t * | +pxSocket | ) | ++ |
Create the TCP window for the given socket.
+[in] | pxSocket | The socket for which the window is being created. |
+
|
+ +static | +
Get the window scaling factor for the TCP connection.
+[in] | pxSocket | The socket owning the TCP connection. |
UBaseType_t prvSetSynAckOptions | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | TCPHeader_t * | +pxTCPHeader | +
+ | ) | ++ |
When opening a TCP connection, while SYN's are being sent, the parties may communicate what MSS (Maximum Segment Size) they intend to use, whether Selective ACK's ( SACK ) are supported, and the size of the reception window ( WSOPT ).
+[in] | pxSocket | The socket being used for communication. It is used to set the MSS. |
[in,out] | pxTCPHeader | The TCP packet header being used in the SYN transmission. The MSS and corresponding options shall be set in this header itself. |
NetworkBufferDescriptor_t * prvTCPBufferResize | +( | +const FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | int32_t | +lDataLen, | +
+ | + | UBaseType_t | +uxOptionsLength | +
+ | ) | ++ |
Check if the size of a network buffer is big enough to hold the outgoing message. Allocate a new bigger network buffer when necessary.
+[in] | pxSocket | Socket whose buffer is being resized. |
[in] | pxNetworkBuffer | The network buffer whose size is being increased. |
[in] | lDataLen | Length of the data to be put in the buffer. |
[in] | uxOptionsLength | Length of options. |
void prvTCPReturn_SetEndPoint | +( | +const FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | size_t | +uxIPHeaderSize | +
+ | ) | ++ |
Called by prvTCPReturnPacket(), this function makes sure that the network buffer has 'pxEndPoint' set properly.
+[in] | pxSocket | The socket on which the packet is being sent. |
[in] | pxNetworkBuffer | The network buffer carrying the outgoing message. |
[in] | uxIPHeaderSize | The size of the IP-header, which depends on the IP-type. |
int32_t prvTCPPrepareSend | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | NetworkBufferDescriptor_t ** | +ppxNetworkBuffer, | +
+ | + | UBaseType_t | +uxOptionsLength | +
+ | ) | ++ |
Prepare an outgoing message, in case anything has to be sent.
+[in] | pxSocket | The socket owning the connection. |
[in,out] | ppxNetworkBuffer | Pointer to the pointer to the network buffer. |
[in] | uxOptionsLength | The length of the TCP options. |
void prvTCPAddTxData | +( | +FreeRTOS_Socket_t * | +pxSocket | ) | ++ |
The API FreeRTOS_send() adds data to the TX stream. Add this data to the windowing system to it can be transmitted.
+[in] | pxSocket | The socket owning the connection. |
UBaseType_t prvSetOptions | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | const NetworkBufferDescriptor_t * | +pxNetworkBuffer | +
+ | ) | ++ |
Set the TCP options (if any) for the outgoing packet.
+[in] | pxSocket | The socket owning the connection. |
[in] | pxNetworkBuffer | The network buffer holding the packet. |
BaseType_t prvSendData | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | NetworkBufferDescriptor_t ** | +ppxNetworkBuffer, | +
+ | + | uint32_t | +ulReceiveLength, | +
+ | + | BaseType_t | +xByteCount | +
+ | ) | ++ |
Called from prvTCPHandleState(). There is data to be sent. If ipconfigUSE_TCP_WIN is defined, and if only an ACK must be sent, it will be checked if it would better be postponed for efficiency.
+[in] | pxSocket | The socket owning the TCP connection. |
[in] | ppxNetworkBuffer | Pointer to pointer to the network buffer. |
[in] | ulReceiveLength | The length of the received buffer. |
[in] | xByteCount | Length of the data to be sent. |
BaseType_t prvTCPSendSpecialPacketHelper | +( | +NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | uint8_t | +ucTCPFlags | +
+ | ) | ++ |
Common code for sending a TCP protocol control packet (i.e. no options, no payload, just flags).
+[in] | pxNetworkBuffer | The network buffer received from the peer. |
[in] | ucTCPFlags | The flags to determine what kind of packet this is. |
BaseType_t prvTCPSendChallengeAck | +( | +NetworkBufferDescriptor_t * | +pxNetworkBuffer | ) | ++ |
A "challenge ACK" is as per https://tools.ietf.org/html/rfc5961#section-3.2, case #3. In summary, an RST was received with a sequence number that is unexpected but still within the window.
+[in] | pxNetworkBuffer | The network buffer descriptor with the packet. |
BaseType_t prvTCPSendReset | +( | +NetworkBufferDescriptor_t * | +pxNetworkBuffer | ) | ++ |
Send a RST (Reset) to peer in case the packet cannot be handled.
+[in] | pxNetworkBuffer | The network buffer descriptor with the packet. |
Module which prepares the packet to be sent through a socket for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "NetworkInterface.h"
#include "NetworkBufferManagement.h"
#include "FreeRTOS_ARP.h"
#include "FreeRTOSIPConfigDefaults.h"
#include "FreeRTOS_TCP_IP.h"
#include "FreeRTOS_TCP_Reception.h"
#include "FreeRTOS_TCP_Transmission.h"
#include "FreeRTOS_TCP_State_Handling.h"
#include "FreeRTOS_TCP_Utils.h"
+Functions | |
void | prvTCPReturnPacket_IPV4 (FreeRTOS_Socket_t *pxSocket, NetworkBufferDescriptor_t *pxDescriptor, uint32_t ulLen, BaseType_t xReleaseAfterSend) |
Return (or send) a packet to the peer. The data is stored in pxBuffer, which may either point to a real network buffer or to a TCP socket field called 'xTCP.xPacket'. A temporary xNetworkBuffer will be used to pass the data to the NIC. | |
BaseType_t | prvTCPPrepareConnect_IPV4 (FreeRTOS_Socket_t *pxSocket) |
Let ARP look-up the MAC-address of the peer and initialise the first SYN packet. | |
BaseType_t | prvTCPSendSpecialPktHelper_IPV4 (NetworkBufferDescriptor_t *pxNetworkBuffer, uint8_t ucTCPFlags) |
Common code for sending a TCP protocol control packet (i.e. no options, no payload, just flags). | |
Module which prepares the packet to be sent through a socket for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes.
+Endianness: in this module all ports and IP addresses are stored in host byte-order, except fields in the IP-packets
+void prvTCPReturnPacket_IPV4 | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | NetworkBufferDescriptor_t * | +pxDescriptor, | +
+ | + | uint32_t | +ulLen, | +
+ | + | BaseType_t | +xReleaseAfterSend | +
+ | ) | ++ |
Return (or send) a packet to the peer. The data is stored in pxBuffer, which may either point to a real network buffer or to a TCP socket field called 'xTCP.xPacket'. A temporary xNetworkBuffer will be used to pass the data to the NIC.
+[in] | pxSocket | The socket owning the connection. |
[in] | pxDescriptor | The network buffer descriptor carrying the packet. |
[in] | ulLen | Length of the packet being sent. |
[in] | xReleaseAfterSend | pdTRUE if the ownership of the descriptor is transferred to the network interface. |
BaseType_t prvTCPPrepareConnect_IPV4 | +( | +FreeRTOS_Socket_t * | +pxSocket | ) | ++ |
Let ARP look-up the MAC-address of the peer and initialise the first SYN packet.
+[in] | pxSocket | The socket owning the TCP connection. The first packet shall be created in this socket. |
BaseType_t prvTCPSendSpecialPktHelper_IPV4 | +( | +NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | uint8_t | +ucTCPFlags | +
+ | ) | ++ |
Common code for sending a TCP protocol control packet (i.e. no options, no payload, just flags).
+[in] | pxNetworkBuffer | The network buffer received from the peer. |
[in] | ucTCPFlags | The flags to determine what kind of packet this is. |
Module which prepares the packet to be sent through a socket for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "NetworkInterface.h"
#include "NetworkBufferManagement.h"
#include "FreeRTOSIPConfigDefaults.h"
#include "FreeRTOS_ND.h"
#include "FreeRTOS_TCP_IP.h"
#include "FreeRTOS_TCP_Reception.h"
#include "FreeRTOS_TCP_Transmission.h"
#include "FreeRTOS_TCP_State_Handling.h"
#include "FreeRTOS_TCP_Utils.h"
+Functions | |
void | prvTCPReturnPacket_IPV6 (FreeRTOS_Socket_t *pxSocket, NetworkBufferDescriptor_t *pxDescriptor, uint32_t ulLen, BaseType_t xReleaseAfterSend) |
Return (or send) a packet to the peer. The data is stored in pxBuffer, which may either point to a real network buffer or to a TCP socket field called 'xTCP.xPacket'. A temporary xNetworkBuffer will be used to pass the data to the NIC. | |
BaseType_t | prvTCPPrepareConnect_IPV6 (FreeRTOS_Socket_t *pxSocket) |
Let ND look-up the MAC-address of the peer and initialise the first SYN packet. | |
BaseType_t | prvTCPSendSpecialPktHelper_IPV6 (NetworkBufferDescriptor_t *pxNetworkBuffer, uint8_t ucTCPFlags) |
Common code for sending a TCP protocol control packet (i.e. no options, no payload, just flags). | |
Module which prepares the packet to be sent through a socket for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes.
+Endianness: in this module all ports and IP addresses are stored in host byte-order, except fields in the IP-packets
+void prvTCPReturnPacket_IPV6 | +( | +FreeRTOS_Socket_t * | +pxSocket, | +
+ | + | NetworkBufferDescriptor_t * | +pxDescriptor, | +
+ | + | uint32_t | +ulLen, | +
+ | + | BaseType_t | +xReleaseAfterSend | +
+ | ) | ++ |
Return (or send) a packet to the peer. The data is stored in pxBuffer, which may either point to a real network buffer or to a TCP socket field called 'xTCP.xPacket'. A temporary xNetworkBuffer will be used to pass the data to the NIC.
+[in] | pxSocket | The socket owning the connection. |
[in] | pxDescriptor | The network buffer descriptor carrying the packet. |
[in] | ulLen | Length of the packet being sent. |
[in] | xReleaseAfterSend | pdTRUE if the ownership of the descriptor is transferred to the network interface. |
BaseType_t prvTCPPrepareConnect_IPV6 | +( | +FreeRTOS_Socket_t * | +pxSocket | ) | ++ |
Let ND look-up the MAC-address of the peer and initialise the first SYN packet.
+[in] | pxSocket | The socket owning the TCP connection. The first packet shall be created in this socket. |
BaseType_t prvTCPSendSpecialPktHelper_IPV6 | +( | +NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | uint8_t | +ucTCPFlags | +
+ | ) | ++ |
Common code for sending a TCP protocol control packet (i.e. no options, no payload, just flags).
+[in] | pxNetworkBuffer | The network buffer received from the peer. |
[in] | ucTCPFlags | The flags to determine what kind of packet this is. |
Module contains utility functions used by FreeRTOS+TCP module. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_Routing.h"
#include "FreeRTOS_TCP_Utils.h"
+Functions | |
void | prvSocketSetMSS (FreeRTOS_Socket_t *pxSocket) |
Set the MSS (Maximum segment size) associated with the given socket. | |
Module contains utility functions used by FreeRTOS+TCP module.
+Endianness: in this module all ports and IP addresses are stored in host byte-order, except fields in the IP-packets
+void prvSocketSetMSS | +( | +FreeRTOS_Socket_t * | +pxSocket | ) | ++ |
Set the MSS (Maximum segment size) associated with the given socket.
+[in] | pxSocket | The socket whose MSS is to be set. |
Module contains utility functions used by FreeRTOS+TCP module. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_TCP_Utils.h"
+Functions | |
void | prvSocketSetMSS_IPV4 (FreeRTOS_Socket_t *pxSocket) |
Set the MSS (Maximum segment size) associated with the given socket. | |
Module contains utility functions used by FreeRTOS+TCP module.
+Endianness: in this module all ports and IP addresses are stored in host byte-order, except fields in the IP-packets
+void prvSocketSetMSS_IPV4 | +( | +FreeRTOS_Socket_t * | +pxSocket | ) | ++ |
Set the MSS (Maximum segment size) associated with the given socket.
+[in] | pxSocket | The socket whose MSS is to be set. |
Module contains utility functions used by FreeRTOS+TCP module. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_TCP_Utils.h"
+Functions | |
void | prvSocketSetMSS_IPV6 (FreeRTOS_Socket_t *pxSocket) |
Set the MSS (Maximum segment size) associated with the given socket. | |
Module contains utility functions used by FreeRTOS+TCP module.
+Endianness: in this module all ports and IP addresses are stored in host byte-order, except fields in the IP-packets
+void prvSocketSetMSS_IPV6 | +( | +FreeRTOS_Socket_t * | +pxSocket | ) | ++ |
Set the MSS (Maximum segment size) associated with the given socket.
+[in] | pxSocket | The socket whose MSS is to be set. |
Module which handles the TCP windowing schemes for FreeRTOS+TCP. Many functions have two versions - one for FreeRTOS+TCP (full) and one for FreeRTOS+TCP (lite). +More...
+#include <stdint.h>
#include "FreeRTOS.h"
#include "task.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
+Macros | |
#define | winSRTT_INCREMENT_NEW 2 |
#define | winSRTT_INCREMENT_CURRENT 6 |
#define | winSRTT_DECREMENT_NEW 1 |
#define | winSRTT_DECREMENT_CURRENT 7 |
#define | winSRTT_CAP_mS ( ipconfigTCP_SRTT_MINIMUM_VALUE_MS ) |
+#define | xTCPWindowRxNew(pxWindow, ulSequenceNumber, lCount) xTCPWindowNew( pxWindow, ulSequenceNumber, lCount, pdTRUE ) |
Create a new Rx window. | |
+#define | xTCPWindowTxNew(pxWindow, ulSequenceNumber, lCount) xTCPWindowNew( pxWindow, ulSequenceNumber, lCount, pdFALSE ) |
Create a new Tx window. | |
+#define | OPTION_CODE_SINGLE_SACK ( 0x0101050aU ) |
The code to send a single Selective ACK (SACK): NOP (0x01), NOP (0x01), SACK (0x05), LEN (0x0a), followed by a lower and a higher sequence number, where LEN is 2 + 2*4 = 10 bytes. | |
+#define | DUPLICATE_ACKS_BEFORE_FAST_RETRANSMIT ( 3U ) |
Normal retransmission: A packet will be retransmitted after a Retransmit Time-Out (RTO). Fast retransmission: When 3 packets with a higher sequence number have been acknowledged by the peer, it is very unlikely a current packet will ever arrive. It will be retransmitted far before the RTO. | |
+#define | MAX_TRANSMIT_COUNT_USING_LARGE_WINDOW ( 4U ) |
If there have been several retransmissions (4), decrease the size of the transmission window to at most 2 times MSS. | |
+Functions | |
static void | vListInsertGeneric (List_t *const pxList, ListItem_t *const pxNewListItem, MiniListItem_t *pxWhere) |
Insert a new list item into a list. | |
static BaseType_t | prvCreateSectors (void) |
Creates a pool of 'ipconfigTCP_WIN_SEG_COUNT' sector buffers. Should be called once only. | |
static TCPSegment_t * | xTCPWindowRxFind (const TCPWindow_t *pxWindow, uint32_t ulSequenceNumber) |
Find a segment with a given sequence number in the list of received segments. | |
static TCPSegment_t * | xTCPWindowNew (TCPWindow_t *pxWindow, uint32_t ulSequenceNumber, int32_t lCount, BaseType_t xIsForRx) |
Allocate a new segment object, either for transmission or reception. | |
static TCPSegment_t * | xTCPWindowGetHead (const List_t *pxList) |
Remove the head item of a list (generic function). | |
static TCPSegment_t * | xTCPWindowPeekHead (const List_t *pxList) |
Return the head item of a list (generic function). | |
static void | vTCPWindowFree (TCPSegment_t *pxSegment) |
Release a segment object, return it to the list of available segment holders. | |
static TCPSegment_t * | xTCPWindowRxConfirm (const TCPWindow_t *pxWindow, uint32_t ulSequenceNumber, uint32_t ulLength) |
A expected segment has been received, see if there is overlap with earlier segments. | |
static int32_t | lTCPIncrementTxPosition (int32_t lPosition, int32_t lMax, int32_t lCount) |
Increment the position in a circular buffer of size 'lMax'. | |
static BaseType_t | prvTCPWindowTxHasSpace (TCPWindow_t const *pxWindow, uint32_t ulWindowSize) |
Find out if the peer is able to receive more data. | |
static uint32_t | prvTCPWindowTxCheckAck (TCPWindow_t *pxWindow, uint32_t ulFirst, uint32_t ulLast) |
An acknowledgement or a selective ACK (SACK) was received. See if some outstanding data may be removed from the transmission queue(s). All TX segments for which ( ( ulSequenceNumber >= ulFirst ) && ( ulSequenceNumber < ulLast ) in a contiguous block. Note that the segments are stored in xTxSegments in a strict sequential order. | |
static uint32_t | prvTCPWindowFastRetransmit (TCPWindow_t *pxWindow, uint32_t ulFirst) |
See if there are segments that need a fast retransmission. | |
static portINLINE BaseType_t | xSequenceLessThanOrEqual (uint32_t a, uint32_t b) |
Check if a <= b. | |
BaseType_t | xSequenceLessThan (uint32_t a, uint32_t b) |
Check if a < b. | |
BaseType_t | xSequenceGreaterThan (uint32_t a, uint32_t b) |
Check if a > b. | |
static portINLINE BaseType_t | xSequenceGreaterThanOrEqual (uint32_t a, uint32_t b) |
Test if a>=b. This function is required since the sequence numbers can roll over. | |
static portINLINE void | vListInsertFifo (List_t *const pxList, ListItem_t *const pxNewListItem) |
Insert the given item in the list in FIFO manner. | |
static portINLINE void | vTCPTimerSet (TCPTimer_t *pxTimer) |
Set the timer's "born" time. | |
static portINLINE uint32_t | ulTimerGetAge (const TCPTimer_t *pxTimer) |
Get the timer age in milliseconds. | |
BaseType_t | xTCPWindowRxEmpty (const TCPWindow_t *pxWindow) |
See if the peer has more packets for this node, before allowing to shut down the connection. | |
void | vTCPWindowDestroy (TCPWindow_t const *pxWindow) |
Return all segment descriptor to the poll of descriptors, before deleting a socket. | |
BaseType_t | xTCPWindowCreate (TCPWindow_t *pxWindow, uint32_t ulRxWindowLength, uint32_t ulTxWindowLength, uint32_t ulAckNumber, uint32_t ulSequenceNumber, uint32_t ulMSS) |
Create a window for TCP. | |
void | vTCPWindowInit (TCPWindow_t *pxWindow, uint32_t ulAckNumber, uint32_t ulSequenceNumber, uint32_t ulMSS) |
Initialise a TCP window. | |
+void | vTCPSegmentCleanup (void) |
Free the space occupied by the pool of segment descriptors, normally never used. | |
static void | prvTCPWindowRx_ExpectedRX (TCPWindow_t *pxWindow, uint32_t ulLength) |
Data has been received with the correct ( expected ) sequence number. It can be added to the RX stream buffer. | |
static int32_t | prvTCPWindowRx_UnexpectedRX (TCPWindow_t *pxWindow, uint32_t ulSequenceNumber, uint32_t ulLength) |
Data has been received with a non-expected sequence number. This function will check if the RX data can be accepted. | |
int32_t | lTCPWindowRxCheck (TCPWindow_t *pxWindow, uint32_t ulSequenceNumber, uint32_t ulLength, uint32_t ulSpace, uint32_t *pulSkipCount) |
Check what to do with a new incoming packet: store or ignore. | |
static int32_t | prvTCPWindowTxAdd_FrontSegment (TCPWindow_t *pxWindow, TCPSegment_t *pxSegment, int32_t lBytesLeft) |
Adding data to a segment that was already in the TX queue. It will be filled-up to a maximum of MSS ( maximum segment size ). | |
int32_t | lTCPWindowTxAdd (TCPWindow_t *pxWindow, uint32_t ulLength, int32_t lPosition, int32_t lMax) |
Will add data to be transmitted to the front of the segment fifo. | |
BaseType_t | xTCPWindowTxDone (const TCPWindow_t *pxWindow) |
Returns true if there are no more outstanding TX segments. | |
BaseType_t | xTCPWindowTxHasData (TCPWindow_t const *pxWindow, uint32_t ulWindowSize, TickType_t *pulDelay) |
Returns true if there is TX data that can be sent right now. | |
static TCPSegment_t * | pxTCPWindowTx_GetWaitQueue (const TCPWindow_t *pxWindow) |
Three type of queues are used for transmission: priority, waiting, and the normal TX queue of unsent data. Message in the waiting queue will be sent when their timer has expired. | |
static TCPSegment_t * | pxTCPWindowTx_GetTXQueue (TCPWindow_t *pxWindow, uint32_t ulWindowSize) |
See if there is a transmission in the normal TX queue. It is the first time these data are being sent. After sending they will move the waiting queue. | |
uint32_t | ulTCPWindowTxGet (TCPWindow_t *pxWindow, uint32_t ulWindowSize, int32_t *plPosition) |
Get data that can be transmitted right now. There are three types of outstanding segments: Priority queue, Waiting queue, Normal TX queue. | |
static void | prvTCPWindowTxCheckAck_CalcSRTT (TCPWindow_t *pxWindow, const TCPSegment_t *pxSegment) |
Data has been sent, and an ACK has been received. Make an estimate of the round-trip time, and calculate the new timeout for transmissions. More explanation in a comment here below. | |
uint32_t | ulTCPWindowTxAck (TCPWindow_t *pxWindow, uint32_t ulSequenceNumber) |
Receive a normal ACK. | |
uint32_t | ulTCPWindowTxSack (TCPWindow_t *pxWindow, uint32_t ulFirst, uint32_t ulLast) |
Receive a SACK option. | |
+Variables | |
static TCPSegment_t * | xTCPSegments = NULL |
_static List_t | xSegmentList |
+BaseType_t | xTCPWindowLoggingLevel = 0 |
Logging verbosity level. | |
Module which handles the TCP windowing schemes for FreeRTOS+TCP. Many functions have two versions - one for FreeRTOS+TCP (full) and one for FreeRTOS+TCP (lite).
+In this module all ports and IP addresses and sequence numbers are being stored in host byte-order.
+#define winSRTT_INCREMENT_NEW 2 | +
New increment for the smoothed RTT.
+ +#define winSRTT_INCREMENT_CURRENT 6 | +
Current increment for the smoothed RTT.
+ +#define winSRTT_DECREMENT_NEW 1 | +
New decrement for the smoothed RTT.
+ +#define winSRTT_DECREMENT_CURRENT 7 | +
Current decrement for the smoothed RTT.
+ +#define winSRTT_CAP_mS ( ipconfigTCP_SRTT_MINIMUM_VALUE_MS ) | +
Cap in milliseconds.
+ +
+
|
+ +static | +
Insert a new list item into a list.
+[in] | pxList | The list in which the item is to be inserted. |
[in] | pxNewListItem | The item to be inserted. |
[in] | pxWhere | Where should the item be inserted. |
+
|
+ +static | +
Creates a pool of 'ipconfigTCP_WIN_SEG_COUNT' sector buffers. Should be called once only.
+
+
|
+ +static | +
Find a segment with a given sequence number in the list of received segments.
+[in] | pxWindow | The descriptor of the TCP sliding windows. |
[in] | ulSequenceNumber | the sequence number to look-up |
+
|
+ +static | +
Allocate a new segment object, either for transmission or reception.
+[in] | pxWindow | The descriptor of the TCP sliding windows. |
[in] | ulSequenceNumber | The sequence number. |
[in] | lCount | The number of bytes stored in this segment. |
[in] | xIsForRx | True when this is a reception segment. |
+
|
+ +static | +
Remove the head item of a list (generic function).
+[in] | pxList | The list of segment descriptors. |
+
|
+ +static | +
Return the head item of a list (generic function).
+[in] | pxList | The list of segment descriptors. |
+
|
+ +static | +
Release a segment object, return it to the list of available segment holders.
+[in] | pxSegment | The segment descriptor that must be freed. |
+
|
+ +static | +
A expected segment has been received, see if there is overlap with earlier segments.
+[in] | pxWindow | The descriptor of the TCP sliding windows. |
[in] | ulSequenceNumber | The sequence number of the segment that was received. |
[in] | ulLength | The number of bytes that were received. |
+
|
+ +static | +
Increment the position in a circular buffer of size 'lMax'.
+[in] | lPosition | The current index in the buffer. |
[in] | lMax | The total number of items in this buffer. |
[in] | lCount | The number of bytes that must be advanced. |
+
|
+ +static | +
Find out if the peer is able to receive more data.
+[in] | pxWindow | The descriptor of the TCP sliding windows. |
[in] | ulWindowSize | The number of bytes in this segment. |
+
|
+ +static | +
An acknowledgement or a selective ACK (SACK) was received. See if some outstanding data may be removed from the transmission queue(s). All TX segments for which ( ( ulSequenceNumber >= ulFirst ) && ( ulSequenceNumber < ulLast ) in a contiguous block. Note that the segments are stored in xTxSegments in a strict sequential order.
+[in] | pxWindow | The TCP-window object of the current connection. |
[in] | ulFirst | The sequence number of the first byte that was acknowledged. |
[in] | ulLast | The sequence number of the last byte ( minus one ) that was acknowledged. |
+
|
+ +static | +
See if there are segments that need a fast retransmission.
+[in] | pxWindow | The descriptor of the TCP sliding windows. |
[in] | ulFirst | The sequence number of the first segment that must be checked. |
+
|
+ +static | +
Check if a <= b.
+[in] | a | The value on the left-hand side. |
[in] | b | The value on the right-hand side. |
BaseType_t xSequenceLessThan | +( | +uint32_t | +a, | +
+ | + | uint32_t | +b | +
+ | ) | ++ |
Check if a < b.
+[in] | a | The value on the left-hand side. |
[in] | b | The value on the right-hand side. |
BaseType_t xSequenceGreaterThan | +( | +uint32_t | +a, | +
+ | + | uint32_t | +b | +
+ | ) | ++ |
Check if a > b.
+[in] | a | The value on the left-hand side. |
[in] | b | The value on the right-hand side. |
+
|
+ +static | +
Test if a>=b. This function is required since the sequence numbers can roll over.
+[in] | a | The first sequence number. |
[in] | b | The second sequence number. |
+
|
+ +static | +
Insert the given item in the list in FIFO manner.
+[in] | pxList | The list in which the item is to inserted. |
[in] | pxNewListItem | The item to be inserted. |
+
|
+ +static | +
Set the timer's "born" time.
+[in] | pxTimer | The TCP timer. |
+
|
+ +static | +
Get the timer age in milliseconds.
+[in] | pxTimer | The timer whose age is to be fetched. |
BaseType_t xTCPWindowRxEmpty | +( | +const TCPWindow_t * | +pxWindow | ) | ++ |
See if the peer has more packets for this node, before allowing to shut down the connection.
+[in] | pxWindow | The descriptor of the TCP sliding windows. |
void vTCPWindowDestroy | +( | +TCPWindow_t const * | +pxWindow | ) | ++ |
Return all segment descriptor to the poll of descriptors, before deleting a socket.
+[in] | pxWindow | The descriptor of the TCP sliding windows. |
BaseType_t xTCPWindowCreate | +( | +TCPWindow_t * | +pxWindow, | +
+ | + | uint32_t | +ulRxWindowLength, | +
+ | + | uint32_t | +ulTxWindowLength, | +
+ | + | uint32_t | +ulAckNumber, | +
+ | + | uint32_t | +ulSequenceNumber, | +
+ | + | uint32_t | +ulMSS | +
+ | ) | ++ |
Create a window for TCP.
+[in] | pxWindow | The window to be created. |
[in] | ulRxWindowLength | The length of the receive window. |
[in] | ulTxWindowLength | The length of the transmit window. |
[in] | ulAckNumber | The first ACK number. |
[in] | ulSequenceNumber | The first sequence number. |
[in] | ulMSS | The MSS of the connection. |
void vTCPWindowInit | +( | +TCPWindow_t * | +pxWindow, | +
+ | + | uint32_t | +ulAckNumber, | +
+ | + | uint32_t | +ulSequenceNumber, | +
+ | + | uint32_t | +ulMSS | +
+ | ) | ++ |
Initialise a TCP window.
+[in] | pxWindow | The window to be initialised. |
[in] | ulAckNumber | The number of the first ACK. |
[in] | ulSequenceNumber | The first sequence number. |
[in] | ulMSS | The MSS of the connection. |
+
|
+ +static | +
Data has been received with the correct ( expected ) sequence number. It can be added to the RX stream buffer.
+[in] | pxWindow | The TCP sliding window data of the socket. |
[in] | ulLength | The number of bytes that can be added. |
+
|
+ +static | +
Data has been received with a non-expected sequence number. This function will check if the RX data can be accepted.
+[in] | pxWindow | The TCP sliding window data of the socket. |
[in] | ulSequenceNumber | The sequence number at which the data should be placed. |
[in] | ulLength | The number of bytes that can be added. |
int32_t lTCPWindowRxCheck | +( | +TCPWindow_t * | +pxWindow, | +
+ | + | uint32_t | +ulSequenceNumber, | +
+ | + | uint32_t | +ulLength, | +
+ | + | uint32_t | +ulSpace, | +
+ | + | uint32_t * | +pulSkipCount | +
+ | ) | ++ |
Check what to do with a new incoming packet: store or ignore.
+[in] | pxWindow | The descriptor of the TCP sliding windows. |
[in] | ulSequenceNumber | The sequence number of the packet received. |
[in] | ulLength | The number of bytes received. |
[in] | ulSpace | The available space in the RX stream buffer. |
[out] | pulSkipCount | the number of bytes to skip in the receive buffer. |
+
|
+ +static | +
Adding data to a segment that was already in the TX queue. It will be filled-up to a maximum of MSS ( maximum segment size ).
+[in] | pxWindow | The descriptor of the TCP sliding windows. |
[in] | pxSegment | The TX segment with the highest sequence number, i.e. the "front segment". |
[in] | lBytesLeft | The number of bytes that must be added. |
int32_t lTCPWindowTxAdd | +( | +TCPWindow_t * | +pxWindow, | +
+ | + | uint32_t | +ulLength, | +
+ | + | int32_t | +lPosition, | +
+ | + | int32_t | +lMax | +
+ | ) | ++ |
Will add data to be transmitted to the front of the segment fifo.
+[in] | pxWindow | The descriptor of the TCP sliding windows. |
[in] | ulLength | The number of bytes that will be sent. |
[in] | lPosition | The index in the TX stream buffer. |
[in] | lMax | The size of the ( circular ) TX stream buffer. |
BaseType_t xTCPWindowTxDone | +( | +const TCPWindow_t * | +pxWindow | ) | ++ |
Returns true if there are no more outstanding TX segments.
+[in] | pxWindow | The descriptor of the TCP sliding windows. |
BaseType_t xTCPWindowTxHasData | +( | +TCPWindow_t const * | +pxWindow, | +
+ | + | uint32_t | +ulWindowSize, | +
+ | + | TickType_t * | +pulDelay | +
+ | ) | ++ |
Returns true if there is TX data that can be sent right now.
+[in] | pxWindow | The descriptor of the TCP sliding windows. |
[in] | ulWindowSize | The current size of the sliding RX window of the peer. |
[out] | pulDelay | The delay before the packet may be sent. |
+
|
+ +static | +
Three type of queues are used for transmission: priority, waiting, and the normal TX queue of unsent data. Message in the waiting queue will be sent when their timer has expired.
+[in] | pxWindow | The descriptor of the TCP sliding windows. |
+
|
+ +static | +
See if there is a transmission in the normal TX queue. It is the first time these data are being sent. After sending they will move the waiting queue.
+[in] | pxWindow | The descriptor of the TCP sliding windows. |
[in] | ulWindowSize | The available space that the peer has in his reception window. |
uint32_t ulTCPWindowTxGet | +( | +TCPWindow_t * | +pxWindow, | +
+ | + | uint32_t | +ulWindowSize, | +
+ | + | int32_t * | +plPosition | +
+ | ) | ++ |
Get data that can be transmitted right now. There are three types of outstanding segments: Priority queue, Waiting queue, Normal TX queue.
+[in] | pxWindow | The descriptor of the TCP sliding windows. |
[in] | ulWindowSize | The current size of the sliding RX window of the peer. |
[out] | plPosition | The index within the TX stream buffer of the first byte to be sent. |
+
|
+ +static | +
Data has been sent, and an ACK has been received. Make an estimate of the round-trip time, and calculate the new timeout for transmissions. More explanation in a comment here below.
+[in] | pxWindow | The descriptor of the TCP sliding windows. |
[in] | pxSegment | The segment that was just acknowledged. |
uint32_t ulTCPWindowTxAck | +( | +TCPWindow_t * | +pxWindow, | +
+ | + | uint32_t | +ulSequenceNumber | +
+ | ) | ++ |
Receive a normal ACK.
+[in] | pxWindow | Window in which a data is receive. |
[in] | ulSequenceNumber | The sequence number of the ACK. |
uint32_t ulTCPWindowTxSack | +( | +TCPWindow_t * | +pxWindow, | +
+ | + | uint32_t | +ulFirst, | +
+ | + | uint32_t | +ulLast | +
+ | ) | ++ |
Receive a SACK option.
+[in] | pxWindow | Window in which the data is received. |
[in] | ulFirst | Index of starting position of options. |
[in] | ulLast | Index of end position of the options. |
+
|
+ +static | +
< TCP segment pool.
+ +_static List_t xSegmentList | +
< List of free TCP segments.
+ +Module which handles TCP when windowing is disabled. +More...
+#include <stdint.h>
#include "FreeRTOS.h"
#include "task.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
Module which handles TCP when windowing is disabled.
+In this module all ports and IP addresses and sequence numbers are being stored in host byte-order.
+This file has the source code for the UDP-IP functionality of the FreeRTOS+TCP network stack. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "event_groups.h"
#include "list.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DNS.h"
#include "FreeRTOS_DHCP.h"
#include "FreeRTOS_IP_Utils.h"
#include "NetworkInterface.h"
#include "NetworkBufferManagement.h"
+Functions | |
void | vProcessGeneratedUDPPacket (NetworkBufferDescriptor_t *const pxNetworkBuffer) |
Process the generated UDP packet and do other checks before sending the packet such as cache check and address resolution. | |
BaseType_t | xProcessReceivedUDPPacket (NetworkBufferDescriptor_t *pxNetworkBuffer, uint16_t usPort, BaseType_t *pxIsWaitingForResolution) |
Process the received UDP packet. | |
This file has the source code for the UDP-IP functionality of the FreeRTOS+TCP network stack.
+void vProcessGeneratedUDPPacket | +( | +NetworkBufferDescriptor_t *const | +pxNetworkBuffer | ) | ++ |
Process the generated UDP packet and do other checks before sending the packet such as cache check and address resolution.
+[in] | pxNetworkBuffer | The network buffer carrying the packet. |
BaseType_t xProcessReceivedUDPPacket | +( | +NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | uint16_t | +usPort, | +
+ | + | BaseType_t * | +pxIsWaitingForResolution | +
+ | ) | ++ |
Process the received UDP packet.
+[in] | pxNetworkBuffer | The network buffer carrying the UDP packet. |
[in] | usPort | The port number on which this packet was received. |
[out] | pxIsWaitingForResolution | If the packet is awaiting resolution, this pointer will be set to pdTRUE. pdFALSE otherwise. |
This file has the source code for the UDP-IP functionality of the FreeRTOS+TCP network stack. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "event_groups.h"
#include "list.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_ARP.h"
#include "FreeRTOS_DNS.h"
#include "FreeRTOS_DHCP.h"
#include "FreeRTOS_IP_Utils.h"
#include "NetworkInterface.h"
#include "NetworkBufferManagement.h"
+Functions | |
void | vProcessGeneratedUDPPacket_IPv4 (NetworkBufferDescriptor_t *const pxNetworkBuffer) |
Process the generated UDP packet and do other checks before sending the packet such as ARP cache check and address resolution. | |
BaseType_t | xProcessReceivedUDPPacket_IPv4 (NetworkBufferDescriptor_t *pxNetworkBuffer, uint16_t usPort, BaseType_t *pxIsWaitingForARPResolution) |
Process the received UDP packet. | |
This file has the source code for the UDP-IP functionality of the FreeRTOS+TCP network stack.
+void vProcessGeneratedUDPPacket_IPv4 | +( | +NetworkBufferDescriptor_t *const | +pxNetworkBuffer | ) | ++ |
Process the generated UDP packet and do other checks before sending the packet such as ARP cache check and address resolution.
+[in] | pxNetworkBuffer | The network buffer carrying the packet. |
BaseType_t xProcessReceivedUDPPacket_IPv4 | +( | +NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | uint16_t | +usPort, | +
+ | + | BaseType_t * | +pxIsWaitingForARPResolution | +
+ | ) | ++ |
Process the received UDP packet.
+[in] | pxNetworkBuffer | The network buffer carrying the UDP packet. |
[in] | usPort | The port number on which this packet was received. |
[out] | pxIsWaitingForARPResolution | If the packet is awaiting ARP resolution, this pointer will be set to pdTRUE. pdFALSE otherwise. |
This file has the source code for the UDP-IP functionality of the FreeRTOS+TCP network stack. +More...
+#include <stdint.h>
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "event_groups.h"
#include "list.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DNS.h"
#include "FreeRTOS_DHCP.h"
#include "FreeRTOS_ND.h"
#include "FreeRTOS_IP_Utils.h"
#include "NetworkInterface.h"
#include "NetworkBufferManagement.h"
+Functions | |
static NetworkEndPoint_t * | pxGetEndpoint (BaseType_t xIPType, BaseType_t xIsGlobal) |
Get the first end point of the type (IPv4/IPv6) from the list the list of end points. | |
static eResolutionLookupResult_t | prvStartLookup (NetworkBufferDescriptor_t *const pxNetworkBuffer, BaseType_t *pxLostBuffer) |
This function is called in case the IP-address was not found, i.e. in the cache 'eResolutionCacheMiss' was returned. A Neighbour solicitation will be emitted. | |
void | vProcessGeneratedUDPPacket_IPv6 (NetworkBufferDescriptor_t *const pxNetworkBuffer) |
Process the generated UDP packet and do other checks before sending the packet such as ND cache check and address resolution. | |
BaseType_t | xProcessReceivedUDPPacket_IPv6 (NetworkBufferDescriptor_t *pxNetworkBuffer, uint16_t usPort, BaseType_t *pxIsWaitingForNDResolution) |
Process the received UDP packet. | |
This file has the source code for the UDP-IP functionality of the FreeRTOS+TCP network stack.
+
+
|
+ +static | +
Get the first end point of the type (IPv4/IPv6) from the list the list of end points.
+[in] | xIPType | IP type (ipTYPE_IPv6/ipTYPE_IPv4) |
[in] | xIsGlobal | when pdTRUE, an endpoint with a global address must be returned. When pdFALSE, a local-link endpoint is returned. This only applies to IPv6 endpoints. |
+
|
+ +static | +
This function is called in case the IP-address was not found, i.e. in the cache 'eResolutionCacheMiss' was returned. A Neighbour solicitation will be emitted.
+[in] | pxNetworkBuffer | The network buffer carrying the UDP or ICMP packet. |
[out] | pxLostBuffer | The pointee will be set to true in case the network packet got released ( the ownership was taken ). |
void vProcessGeneratedUDPPacket_IPv6 | +( | +NetworkBufferDescriptor_t *const | +pxNetworkBuffer | ) | ++ |
Process the generated UDP packet and do other checks before sending the packet such as ND cache check and address resolution.
+[in] | pxNetworkBuffer | The network buffer carrying the packet. |
BaseType_t xProcessReceivedUDPPacket_IPv6 | +( | +NetworkBufferDescriptor_t * | +pxNetworkBuffer, | +
+ | + | uint16_t | +usPort, | +
+ | + | BaseType_t * | +pxIsWaitingForNDResolution | +
+ | ) | ++ |
Process the received UDP packet.
+[in] | pxNetworkBuffer | The network buffer carrying the UDP packet. |
[in] | usPort | The port number on which this packet was received. |
[out] | pxIsWaitingForNDResolution | If the packet is awaiting ND resolution, this pointer will be set to pdTRUE. pdFALSE otherwise. |
Cstruct | A DNS query consists of a header, as described in 'struct xDNSMessage' It is followed by 1 or more queries, each one consisting of a name and a tail, with two fields: type and class |
CuIntPtr | Uintptr_t is an unsigned integer type that is capable of storing a data pointer. Therefore it is safe to convert from a void pointer to a uintptr_t, using a union |
CxIPv6_Couple | A util struct to list the IPv6 IP types, prefix and type bit mask |
CxUnion32_t | |
CxUnionPtr_t |
+Files | |
file | FreeRTOS_ARP.c |
Implements the Address Resolution Protocol for the FreeRTOS+TCP network stack. | |
file | FreeRTOS_BitConfig.c |
Some functions that help when analysing a binary stream of information. It offers an alternative to using packet structs with unaligned data members. | |
file | FreeRTOS_DHCP.c |
Implements the Dynamic Host Configuration Protocol for the FreeRTOS+TCP network stack. | |
file | FreeRTOS_DHCPv6.c |
A DHCPv6 client. | |
file | FreeRTOS_DNS.c |
Implements the Domain Name System for the FreeRTOS+TCP network stack. | |
file | FreeRTOS_DNS_Cache.c |
File that handles the DNS caching option. | |
file | FreeRTOS_DNS_Callback.c |
File that handles the DNS Callback option. | |
file | FreeRTOS_DNS_Networking.c |
Implements the Domain Name System Networking for the FreeRTOS+TCP network stack. | |
file | FreeRTOS_DNS_Parser.c |
Implements the DNS message parser. | |
file | FreeRTOS_ICMP.c |
Implements the Internet Control Message Protocol for the FreeRTOS+TCP network stack. | |
file | FreeRTOS_IP.c |
Implements the basic functionality for the FreeRTOS+TCP network stack. | |
file | FreeRTOS_IP_Timers.c |
Implements the Internet Control Message Protocol for the FreeRTOS+TCP network stack. | |
file | FreeRTOS_IP_Utils.c |
Implements the basic functionality for the FreeRTOS+TCP network stack. | |
file | FreeRTOS_IPv4.c |
Implements the basic functionality for the FreeRTOS+TCP network stack. | |
file | FreeRTOS_IPv4_Sockets.c |
Implements the Sockets API based on Berkeley sockets for the FreeRTOS+TCP network stack. Sockets are used by the application processes to interact with the IP-task which in turn interacts with the hardware. | |
file | FreeRTOS_IPv4_Utils.c |
Implements the basic functionality for the FreeRTOS+TCP network stack functions for IPv4. | |
file | FreeRTOS_IPv6.c |
Implements the basic functionality for the FreeRTOS+TCP network stack. | |
file | FreeRTOS_IPv6_Sockets.c |
Implements the Sockets API based on Berkeley sockets for the FreeRTOS+TCP network stack. Sockets are used by the application processes to interact with the IP-task which in turn interacts with the hardware. | |
file | FreeRTOS_IPv6_Utils.c |
Implements the basic functionality for the FreeRTOS+TCP network stack functions for IPv6. | |
file | FreeRTOS_ND.c |
Implements a few functions that handle Neighbour Discovery and other ICMPv6 messages. | |
file | FreeRTOS_RA.c |
A client implementation of Router advertisement protocol. | |
file | FreeRTOS_Routing.c |
Implements endpoint interfaces functions and utilities. | |
file | FreeRTOS_Sockets.c |
Implements the Sockets API based on Berkeley sockets for the FreeRTOS+TCP network stack. Sockets are used by the application processes to interact with the IP-task which in turn interacts with the hardware. | |
file | FreeRTOS_Stream_Buffer.c |
Provides the API for managing/creating the stream buffers in the FreeRTOS+TCP network stack. | |
file | FreeRTOS_TCP_IP.c |
Module which handles the TCP connections for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes. | |
file | FreeRTOS_TCP_IP_IPv4.c |
Module which handles the TCP connections for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes. | |
file | FreeRTOS_TCP_IP_IPv6.c |
Module which handles the TCP connections for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes. | |
file | FreeRTOS_TCP_Reception.c |
Module which processes the packet received from a socket for FreeRTOS+TCP. | |
file | FreeRTOS_TCP_State_Handling.c |
Module which handles the TCP protocol state transition for FreeRTOS+TCP. | |
file | FreeRTOS_TCP_State_Handling_IPv4.c |
Module which handles the TCP protocol state transition for FreeRTOS+TCP. | |
file | FreeRTOS_TCP_State_Handling_IPv6.c |
Module which handles the TCP protocol state transition for FreeRTOS+TCP. | |
file | FreeRTOS_TCP_Transmission.c |
Module which prepares the packet to be sent through a socket for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes. | |
file | FreeRTOS_TCP_Transmission_IPv4.c |
Module which prepares the packet to be sent through a socket for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes. | |
file | FreeRTOS_TCP_Transmission_IPv6.c |
Module which prepares the packet to be sent through a socket for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes. | |
file | FreeRTOS_TCP_Utils.c |
Module contains utility functions used by FreeRTOS+TCP module. | |
file | FreeRTOS_TCP_Utils_IPv4.c |
Module contains utility functions used by FreeRTOS+TCP module. | |
file | FreeRTOS_TCP_Utils_IPv6.c |
Module contains utility functions used by FreeRTOS+TCP module. | |
file | FreeRTOS_TCP_WIN.c |
Module which handles the TCP windowing schemes for FreeRTOS+TCP. Many functions have two versions - one for FreeRTOS+TCP (full) and one for FreeRTOS+TCP (lite). | |
file | FreeRTOS_Tiny_TCP.c |
Module which handles TCP when windowing is disabled. | |
file | FreeRTOS_UDP_IP.c |
This file has the source code for the UDP-IP functionality of the FreeRTOS+TCP network stack. | |
file | FreeRTOS_UDP_IPv4.c |
This file has the source code for the UDP-IP functionality of the FreeRTOS+TCP network stack. | |
file | FreeRTOS_UDP_IPv6.c |
This file has the source code for the UDP-IP functionality of the FreeRTOS+TCP network stack. | |
▼ source | |
FreeRTOS_ARP.c | Implements the Address Resolution Protocol for the FreeRTOS+TCP network stack |
FreeRTOS_BitConfig.c | Some functions that help when analysing a binary stream of information. It offers an alternative to using packet structs with unaligned data members |
FreeRTOS_DHCP.c | Implements the Dynamic Host Configuration Protocol for the FreeRTOS+TCP network stack |
FreeRTOS_DHCPv6.c | A DHCPv6 client |
FreeRTOS_DNS.c | Implements the Domain Name System for the FreeRTOS+TCP network stack |
FreeRTOS_DNS_Cache.c | File that handles the DNS caching option |
FreeRTOS_DNS_Callback.c | File that handles the DNS Callback option |
FreeRTOS_DNS_Networking.c | Implements the Domain Name System Networking for the FreeRTOS+TCP network stack |
FreeRTOS_DNS_Parser.c | Implements the DNS message parser |
FreeRTOS_ICMP.c | Implements the Internet Control Message Protocol for the FreeRTOS+TCP network stack |
FreeRTOS_IP.c | Implements the basic functionality for the FreeRTOS+TCP network stack |
FreeRTOS_IP_Timers.c | Implements the Internet Control Message Protocol for the FreeRTOS+TCP network stack |
FreeRTOS_IP_Utils.c | Implements the basic functionality for the FreeRTOS+TCP network stack |
FreeRTOS_IPv4.c | Implements the basic functionality for the FreeRTOS+TCP network stack |
FreeRTOS_IPv4_Sockets.c | Implements the Sockets API based on Berkeley sockets for the FreeRTOS+TCP network stack. Sockets are used by the application processes to interact with the IP-task which in turn interacts with the hardware |
FreeRTOS_IPv4_Utils.c | Implements the basic functionality for the FreeRTOS+TCP network stack functions for IPv4 |
FreeRTOS_IPv6.c | Implements the basic functionality for the FreeRTOS+TCP network stack |
FreeRTOS_IPv6_Sockets.c | Implements the Sockets API based on Berkeley sockets for the FreeRTOS+TCP network stack. Sockets are used by the application processes to interact with the IP-task which in turn interacts with the hardware |
FreeRTOS_IPv6_Utils.c | Implements the basic functionality for the FreeRTOS+TCP network stack functions for IPv6 |
FreeRTOS_ND.c | Implements a few functions that handle Neighbour Discovery and other ICMPv6 messages |
FreeRTOS_RA.c | A client implementation of Router advertisement protocol |
FreeRTOS_Routing.c | Implements endpoint interfaces functions and utilities |
FreeRTOS_Sockets.c | Implements the Sockets API based on Berkeley sockets for the FreeRTOS+TCP network stack. Sockets are used by the application processes to interact with the IP-task which in turn interacts with the hardware |
FreeRTOS_Stream_Buffer.c | Provides the API for managing/creating the stream buffers in the FreeRTOS+TCP network stack |
FreeRTOS_TCP_IP.c | Module which handles the TCP connections for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes |
FreeRTOS_TCP_IP_IPv4.c | Module which handles the TCP connections for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes |
FreeRTOS_TCP_IP_IPv6.c | Module which handles the TCP connections for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes |
FreeRTOS_TCP_Reception.c | Module which processes the packet received from a socket for FreeRTOS+TCP |
FreeRTOS_TCP_State_Handling.c | Module which handles the TCP protocol state transition for FreeRTOS+TCP |
FreeRTOS_TCP_State_Handling_IPv4.c | Module which handles the TCP protocol state transition for FreeRTOS+TCP |
FreeRTOS_TCP_State_Handling_IPv6.c | Module which handles the TCP protocol state transition for FreeRTOS+TCP |
FreeRTOS_TCP_Transmission.c | Module which prepares the packet to be sent through a socket for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes |
FreeRTOS_TCP_Transmission_IPv4.c | Module which prepares the packet to be sent through a socket for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes |
FreeRTOS_TCP_Transmission_IPv6.c | Module which prepares the packet to be sent through a socket for FreeRTOS+TCP. It depends on FreeRTOS_TCP_WIN.c, which handles the TCP windowing schemes |
FreeRTOS_TCP_Utils.c | Module contains utility functions used by FreeRTOS+TCP module |
FreeRTOS_TCP_Utils_IPv4.c | Module contains utility functions used by FreeRTOS+TCP module |
FreeRTOS_TCP_Utils_IPv6.c | Module contains utility functions used by FreeRTOS+TCP module |
FreeRTOS_TCP_WIN.c | Module which handles the TCP windowing schemes for FreeRTOS+TCP. Many functions have two versions - one for FreeRTOS+TCP (full) and one for FreeRTOS+TCP (lite) |
FreeRTOS_Tiny_TCP.c | Module which handles TCP when windowing is disabled |
FreeRTOS_UDP_IP.c | This file has the source code for the UDP-IP functionality of the FreeRTOS+TCP network stack |
FreeRTOS_UDP_IPv4.c | This file has the source code for the UDP-IP functionality of the FreeRTOS+TCP network stack |
FreeRTOS_UDP_IPv6.c | This file has the source code for the UDP-IP functionality of the FreeRTOS+TCP network stack |