/* Retrieves the current state of a given TCP connection to a host. */
uint8_t TCP_GetConnectionState(const uint16_t Port, const IP_Address_t *RemoteAddress, const uint16_t RemotePort)
/* Retrieves the current state of a given TCP connection to a host. */
uint8_t TCP_GetConnectionState(const uint16_t Port, const IP_Address_t *RemoteAddress, const uint16_t RemotePort)
{
	for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++)
	{
		if ((ConnectionStateTable[CSTableEntry].Port == Port) &&
		     IP_COMPARE(&ConnectionStateTable[CSTableEntry].RemoteAddress, RemoteAddress) &&
			 ConnectionStateTable[CSTableEntry].RemotePort == RemotePort)
		{
			return ConnectionStateTable[CSTableEntry].State;
		}
	}
	return TCP_Connection_Closed;
}