//********************************************************************* //-------------------- TCP Configuration -------------------- //********************************************************************* //Maximum number of times a connection be retried before closing it down. #define TCP_MAX_RETRY_COUNTS (3) //TCP Timeout value to begin with. #define TCP_START_TIMEOUT_VAL ((TICK)TICK_SECOND * (TICK)60) //Define ports #define TCP_LOCAL_PORT_START_NUMBER (1024) #define TCP_LOCAL_PORT_END_NUMBER (5000) //When defined, the code will be compiled for optimal speed. If not defined, code is defined for smallest size. #define TCP_SPEED_OPTIMIZE
#include "net\ip.h"
#include "net\tick.h"
|
|
|
|
|
|
|
|
Returns the maximum size the TCP data is allowed to be. This value should never be execeed when writting data to the TCP transmit buffer before calling TCPFlush(). For slip: = MAC_TX_BUFFER_SIZE - sizeof(IP_HEADER) - sizeof(TCP_HEADER) = MAC_TX_BUFFER_SIZE - 20 - 20 = MAC_TX_BUFFER_SIZE - 40 For RTL MAC = MAC_TX_BUFFER_SIZE - SIZEOF_MAC_HEADER - sizeof(IP_HEADER) - sizeof(TCP_HEADER) = MAC_TX_BUFFER_SIZE - 14 - 20 - 20 = MAC_TX_BUFFER_SIZE - 54 |
|
|
|
|
|
|
|
|
Maximum number of times a connection be retried before closing it down. |
|
|
TCP Timeout value to begin with. |
|
|
|
|
|
|
|
|
Socket info. Union is used to create anonymous structure members. |
|
|
A TCP socket. Is a number from 0-255 that identifies a TCP socket
|
|
|
TCP States as defined by rfc793 |
|
|
||||||||||||
|
By default this function is not included in source. You must define STACK_CLIENT_MODE to be able to use this function.
|
|
|
Discard any data contained in the given socket's receive buffer.
|
|
|
A disconnect request is sent for given socket.
|
|
|
All and any data associated with this socket is marked as ready for transmission.
|
|
||||||||||||
|
This function reads the next byte from the current TCP packet. Reads a single byte from the given socket into the given byte pointer
|
|
||||||||||||||||
|
Read the requested number of bytes from the given socket into the given buffer.
|
|
|
Returns a pointer to the SOCKET_INFO structure for the given socket.
|
|
|
Initialize all socket info. This function is called only one during lifetime of the application. |
|
|
A socket is said to be connected if it is not in LISTEN and CLOSED mode. Socket may be in SYN_RCVD or FIN_WAIT_1 and may contain socket data.
|
|
|
A socket is said to be "Get" ready when it has already received some data. Sometime, a socket may be closed, but it still may contain data. Thus in order to ensure reuse of a socket, caller must make sure that it reads a socket, if it is ready. This function also checks that the given socket is valid, is not equal to INVALID_SOCKET for example
|
|
|
Each socket maintains only one transmit buffer. Hence until a data packet is acknowledeged by remote node, socket will not be ready for next transmission. All control transmission such as Connect, Disconnect do not consume/reserve any transmit buffer. This function will check:
|
|
|
|
|
||||||||||||||||
|
Performs TCP tasks.
|
|
||||||||||||
|
Write the given byte to the given socket's transmit buffer. The data is NOT sent yet, and the TCPFlush() function must be called to send all data contained in the transmit buffer.
|
|
||||||||||||||||
|
Given number of data bytes from the given array are put into the given socket's transmit buffer. The data is NOT sent yet, and the TCPFlush() function must be called to send all data contained in the transmit buffer. If there is not enough space in the transmit buffer for all the data, the contents of the transmit buffer will be sent, and this function will return the actual amount of bytes that were sent. In this case, it is VERY IMPORTANT to call the TCPIsPutReady() function again before calling the TCPPut() or TCPPutArray() functions! This will however only happen if the transmit buffer fills up. The transmit buffer for TCP data is = (MAC_TX_BUFFER_SIZE - 54), which is usually 970 bytes. If writing less then this to the transmit buffer before calling TCPFlush(), then this function will always return the requested number of bytes!
|
|
|
Each socket FSM is executed for any timeout situation.
|
|
|
These are all the sockets supported by this TCP. |
1.4.5