Rename Transport Implementation and minor fixes (#145)

* Rename transport interface files

* Rename plaintext transport functions

* Address comments

* Add socket send timeout

* Set socket options after connection
This commit is contained in:
Muneeb Ahmed
2020-07-15 14:59:31 -07:00
committed by GitHub
parent 0e789d21d5
commit e3c8583d60
10 changed files with 79 additions and 66 deletions

View File

@@ -88,8 +88,8 @@ static const uint8_t ucDNSServerAddress[ 4 ] = { configDNS_SERVER_ADDR0, configD
* name of the constant, or pdFALSE to not log using the method indicated by the
* name of the constant. Options include to standard out (xLogToStdout), to a disk
* file (xLogToFile), and to a UDP port (xLogToUDP). If xLogToUDP is set to pdTRUE
* then UDP messages are sent to the IP address configured as the echo server
* address (see the configECHO_SERVER_ADDR0 definitions in FreeRTOSConfig.h) and
* then UDP messages are sent to the IP address configured as the UDP logging server
* address (see the configUDP_LOGGING_ADDR0 definitions in FreeRTOSConfig.h) and
* the port number set by configPRINT_PORT in FreeRTOSConfig.h. */
const BaseType_t xLogToStdout = pdTRUE, xLogToFile = pdFALSE, xLogToUDP = pdFALSE;
@@ -232,7 +232,7 @@ static void prvMiscInitialisation( void )
time_t xTimeNow;
uint32_t ulLoggingIPAddress;
ulLoggingIPAddress = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0, configECHO_SERVER_ADDR1, configECHO_SERVER_ADDR2, configECHO_SERVER_ADDR3 );
ulLoggingIPAddress = FreeRTOS_inet_addr_quick( configUDP_LOGGING_ADDR0, configUDP_LOGGING_ADDR1, configUDP_LOGGING_ADDR2, configUDP_LOGGING_ADDR3 );
vLoggingInit( xLogToStdout, xLogToFile, xLogToUDP, ulLoggingIPAddress, configPRINT_PORT );
/*

View File

@@ -139,12 +139,11 @@
* used. */
#define configNETWORK_INTERFACE_TO_USE 1L
/* The address of an echo server is only left in this project as it doubles as
* the address to which logging is sent should UDP logging be enabled. */
#define configECHO_SERVER_ADDR0 192
#define configECHO_SERVER_ADDR1 168
#define configECHO_SERVER_ADDR2 0
#define configECHO_SERVER_ADDR3 11
/* The address to which logging is sent should UDP logging be enabled. */
#define configUDP_LOGGING_ADDR0 192
#define configUDP_LOGGING_ADDR1 168
#define configUDP_LOGGING_ADDR2 0
#define configUDP_LOGGING_ADDR3 11
/* Default MAC address configuration. The demo creates a virtual network
* connection that uses this MAC address by accessing the raw Ethernet/WiFi data

View File

@@ -58,7 +58,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\..\Source\FreeRTOS-Plus-Trace\Include;..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include;..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\BufferManagement;..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\Compiler\MSVC;..\..\common\logging-stack;..\common\WinPCap;..\..\..\..\..\FreeRTOS\Source\include;..\..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW;..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\platform;..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\standard\mqtt\include;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\..\..\Source\FreeRTOS-Plus-Trace\Include;..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include;..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\BufferManagement;..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\Compiler\MSVC;..\..\common\logging-stack;..\common\WinPCap;..\..\..\..\..\FreeRTOS\Source\include;..\..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW;..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\platform\include;..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\standard\mqtt\include;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -195,4 +195,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@@ -58,7 +58,7 @@
#include "mqtt.h"
/* Transport interface include. */
#include "transport_interface_freertos.h"
#include "plaintext_freertos.h"
/*-----------------------------------------------------------*/
@@ -297,6 +297,7 @@ static void prvMQTTDemoTask( void * pvParameters )
NetworkContext_t xNetworkContext = { 0 };
MQTTContext_t xMQTTContext;
MQTTStatus_t xMQTTStatus;
BaseType_t xNetworkStatus;
/* Remove compiler warnings about unused parameters. */
( void ) pvParameters;
@@ -311,10 +312,12 @@ static void prvMQTTDemoTask( void * pvParameters )
* the MQTT broker as specified in democonfigMQTT_BROKER_ENDPOINT and
* democonfigMQTT_BROKER_PORT at the top of this file. */
LogInfo( ( "Create a TCP connection to %s.\r\n", democonfigMQTT_BROKER_ENDPOINT ) );
Transport_FreeRTOS_Connect( &xNetworkContext,
democonfigMQTT_BROKER_ENDPOINT,
democonfigMQTT_BROKER_PORT,
TRANSPORT_SEND_RECV_TIMEOUT_MS );
xNetworkStatus = Plaintext_FreeRTOS_Connect( &xNetworkContext,
democonfigMQTT_BROKER_ENDPOINT,
democonfigMQTT_BROKER_PORT,
TRANSPORT_SEND_RECV_TIMEOUT_MS,
TRANSPORT_SEND_RECV_TIMEOUT_MS );
configASSERT( xNetworkStatus == 0 );
/* Sends an MQTT Connect packet over the already connected TCP socket,
* and waits for connection acknowledgment (CONNACK) packet. */
@@ -330,7 +333,7 @@ static void prvMQTTDemoTask( void * pvParameters )
* will expect all the messages it sends to the broker to be sent back to it
* from the broker. This demo uses QOS0 in Subscribe, therefore, the Publish
* messages received from the broker will have QOS0. */
LogInfo( ( "Attempt to subscribed to the MQTT topic %s.\r\n", mqttexampleTOPIC ) );
LogInfo( ( "Attempt to subscribe to the MQTT topic %s.\r\n", mqttexampleTOPIC ) );
prvMQTTSubscribeToTopic( &xMQTTContext );
/* Process incoming packet from the broker. After sending the subscribe, the
@@ -378,7 +381,7 @@ static void prvMQTTDemoTask( void * pvParameters )
MQTT_Disconnect( &xMQTTContext );
/* Close the network connection. */
Transport_FreeRTOS_Disconnect( &xNetworkContext );
Plaintext_FreeRTOS_Disconnect( &xNetworkContext );
/* Wait for some time between two iterations to ensure that we do not
* bombard the public test mosquitto broker. */
@@ -395,7 +398,6 @@ static void prvCreateMQTTConnectionWithBroker( MQTTContext_t * pxMQTTContext,
{
MQTTStatus_t xResult;
MQTTConnectInfo_t xConnectInfo;
uint16_t usPacketId;
bool xSessionPresent;
TransportInterface_t xTransport;
MQTTApplicationCallbacks_t xCallbacks;
@@ -407,8 +409,8 @@ static void prvCreateMQTTConnectionWithBroker( MQTTContext_t * pxMQTTContext,
/* Fill in Transport Interface send and receive function pointers. */
xTransport.pNetworkContext = pxNetworkContext;
xTransport.send = Transport_FreeRTOS_send;
xTransport.recv = Transport_FreeRTOS_recv;
xTransport.send = Plaintext_FreeRTOS_send;
xTransport.recv = Plaintext_FreeRTOS_recv;
/* Application callbacks for receiving incoming published and incoming acks
* from MQTT library. */
@@ -475,8 +477,6 @@ static void prvMQTTSubscribeToTopic( MQTTContext_t * pxMQTTContext )
/* Get a unique packet id. */
usSubscribePacketIdentifier = MQTT_GetPacketId( pxMQTTContext );
/* Make sure the packet id obtained is valid. */
configASSERT( usSubscribePacketIdentifier != 0 );
/* Send SUBSCRIBE packet. */
xResult = MQTT_Subscribe( pxMQTTContext,
@@ -521,7 +521,6 @@ static void prvMQTTUnsubscribeFromTopic( MQTTContext_t * pxMQTTContext )
{
MQTTStatus_t xResult;
MQTTSubscribeInfo_t xMQTTSubscription[ 1 ];
BaseType_t xStatus;
/* Some fields not used by this demo so start with everything at 0. */
memset( ( void * ) &xMQTTSubscription, 0x00, sizeof( xMQTTSubscription ) );
@@ -609,6 +608,9 @@ static void prvEventCallback( MQTTContext_t * pxMQTTContext,
uint16_t usPacketIdentifier,
MQTTPublishInfo_t * pxPublishInfo )
{
/* The MQTT context is not used for this demo. */
( void ) pxMQTTContext;
if( ( pxPacketInfo->type & 0xF0U ) == MQTT_PACKET_TYPE_PUBLISH )
{
prvMQTTProcessIncomingPublish( pxPublishInfo );

View File

@@ -139,12 +139,11 @@
* used. */
#define configNETWORK_INTERFACE_TO_USE 1L
/* The address of an echo server is only left in this project as it doubles as
* the address to which logging is sent should UDP logging be enabled. */
#define configECHO_SERVER_ADDR0 192
#define configECHO_SERVER_ADDR1 168
#define configECHO_SERVER_ADDR2 0
#define configECHO_SERVER_ADDR3 11
/* The address to which logging is sent should UDP logging be enabled. */
#define configUDP_LOGGING_ADDR0 192
#define configUDP_LOGGING_ADDR1 168
#define configUDP_LOGGING_ADDR2 0
#define configUDP_LOGGING_ADDR3 11
/* Default MAC address configuration. The demo creates a virtual network
* connection that uses this MAC address by accessing the raw Ethernet/WiFi data

View File

@@ -58,7 +58,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\..\Source\FreeRTOS-Plus-Trace\Include;..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include;..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\BufferManagement;..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\Compiler\MSVC;..\..\common\logging-stack;..\common\WinPCap;..\..\..\..\..\FreeRTOS\Source\include;..\..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW;..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\standard\mqtt\include;..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\platform;..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\abstractions\platform\freertos;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\..\..\Source\FreeRTOS-Plus-Trace\Include;..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include;..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\BufferManagement;..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\Compiler\MSVC;..\..\common\logging-stack;..\common\WinPCap;..\..\..\..\..\FreeRTOS\Source\include;..\..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW;..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\standard\mqtt\include;..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\platform\include;..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\platform\freertos\transport\include;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -157,7 +157,7 @@
<ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\FreeRTOS_UDP_IP.c" />
<ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\BufferManagement\BufferAllocation_2.c" />
<ClCompile Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\portable\NetworkInterface\WinPCap\NetworkInterface.c" />
<ClCompile Include="..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\abstractions\platform\freertos\transport_interface_freertos.c" />
<ClCompile Include="..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\platform\freertos\transport\src\plaintext_freertos.c" />
<ClCompile Include="..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\standard\mqtt\src\mqtt_lightweight.c" />
<ClCompile Include="..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\standard\mqtt\src\mqtt_state.c" />
<ClCompile Include="..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\standard\mqtt\src\mqtt.c" />
@@ -189,8 +189,8 @@
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\IPTraceMacroDefaults.h" />
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\NetworkBufferManagement.h" />
<ClInclude Include="..\..\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP\include\NetworkInterface.h" />
<ClInclude Include="..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\abstractions\platform\freertos\transport_interface_freertos.h" />
<ClInclude Include="..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\platform\transport_interface.h" />
<ClInclude Include="..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\platform\freertos\transport\include\plaintext_freertos.h" />
<ClInclude Include="..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\platform\include\transport_interface.h" />
<ClInclude Include="..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\standard\mqtt\include\mqtt_lightweight.h" />
<ClInclude Include="..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\standard\mqtt\include\mqtt_state.h" />
<ClInclude Include="..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\standard\mqtt\include\mqtt.h" />

View File

@@ -120,7 +120,7 @@
<ClCompile Include="..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\standard\mqtt\src\mqtt.c">
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\mqtt\src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\abstractions\platform\freertos\transport_interface_freertos.c">
<ClCompile Include="..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\platform\freertos\transport\src\plaintext_freertos.c">
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform</Filter>
</ClCompile>
</ItemGroup>
@@ -207,10 +207,10 @@
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\standard\mqtt\include</Filter>
</ClInclude>
<ClInclude Include="mqtt_config.h" />
<ClInclude Include="..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\abstractions\platform\freertos\transport_interface_freertos.h">
<ClInclude Include="..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\platform\freertos\transport\include\plaintext_freertos.h">
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\platform\transport_interface.h">
<ClInclude Include="..\..\..\..\Source\FreeRTOS-IoT-Libraries-LTS-Beta2\c_sdk\platform\include\transport_interface.h">
<Filter>FreeRTOS+\FreeRTOS IoT Libraries\platform</Filter>
</ClInclude>
</ItemGroup>

View File

@@ -72,17 +72,18 @@ struct NetworkContext
*
* @return Non-zero value on error, 0 on success.
*/
BaseType_t Transport_FreeRTOS_Connect( NetworkContext_t * pNetworkContext,
BaseType_t Plaintext_FreeRTOS_Connect( NetworkContext_t * pNetworkContext,
const char * pHostName,
uint16_t port,
uint32_t receiveTimeoutMs );
uint32_t receiveTimeoutMs,
uint32_t sendTimeoutMs );
/**
* @brief Gracefully disconnect an established TCP connection.
*
* @param[in] pNetworkContext Network context containing the TCP socket handle.
*/
void Transport_FreeRTOS_Disconnect( const NetworkContext_t * pNetworkContext );
void Plaintext_FreeRTOS_Disconnect( const NetworkContext_t * pNetworkContext );
/**
* @brief Receives data from an established TCP connection.
@@ -95,7 +96,7 @@ void Transport_FreeRTOS_Disconnect( const NetworkContext_t * pNetworkContext );
* @return Number of bytes received if successful; 0 if the socket times out;
* Negative value on error.
*/
int32_t Transport_FreeRTOS_recv( NetworkContext_t * pNetworkContext,
int32_t Plaintext_FreeRTOS_recv( NetworkContext_t * pNetworkContext,
void * pBuffer,
size_t bytesToRecv );
@@ -109,7 +110,7 @@ int32_t Transport_FreeRTOS_recv( NetworkContext_t * pNetworkContext,
*
* @return Number of bytes sent on success; else a negative value.
*/
int32_t Transport_FreeRTOS_send( NetworkContext_t * pNetworkContext,
int32_t Plaintext_FreeRTOS_send( NetworkContext_t * pNetworkContext,
const void * pBuffer,
size_t bytesToSend );

View File

@@ -32,22 +32,26 @@
#include "FreeRTOS_Sockets.h"
/* Transport interface include. */
#include "transport_interface_freertos.h"
#include "plaintext_freertos.h"
/* Maximum number of times to call FreeRTOS_recv when initiating a graceful shutdown. */
#ifndef TRANSPORT_FREERTOS_SHUTDOWN_LOOPS
#define TRANSPORT_FREERTOS_SHUTDOWN_LOOPS ( 3 )
#endif
BaseType_t Transport_FreeRTOS_Connect( NetworkContext_t * pNetworkContext,
/* A negative error code indicating a network failure. */
#define TRANSPORT_FREERTOS_NETWORK_ERROR ( -1 )
BaseType_t Plaintext_FreeRTOS_Connect( NetworkContext_t * pNetworkContext,
const char * pHostName,
uint16_t port,
uint32_t receiveTimeoutMs )
uint32_t receiveTimeoutMs,
uint32_t sendTimeoutMs )
{
Socket_t tcpSocket = FREERTOS_INVALID_SOCKET;
BaseType_t socketStatus = 0;
struct freertos_sockaddr serverAddress = { 0 };
TickType_t receiveTimeout = pdMS_TO_TICKS( receiveTimeoutMs );
TickType_t transportTimeout = 0;
/* Create a new TCP socket. */
tcpSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_STREAM, FREERTOS_IPPROTO_TCP );
@@ -55,12 +59,13 @@ BaseType_t Transport_FreeRTOS_Connect( NetworkContext_t * pNetworkContext,
if( tcpSocket == FREERTOS_INVALID_SOCKET )
{
LogError( ( "Failed to create new socket." ) );
socketStatus = -1;
socketStatus = TRANSPORT_FREERTOS_NETWORK_ERROR;
}
if( socketStatus == 0 )
else
{
/* Establish connection. */
LogDebug( ( "Created new TCP socket." ) );
/* Connection parameters. */
serverAddress.sin_family = FREERTOS_AF_INET;
serverAddress.sin_port = FreeRTOS_htons( port );
serverAddress.sin_addr = FreeRTOS_gethostbyname( pHostName );
@@ -70,34 +75,41 @@ BaseType_t Transport_FreeRTOS_Connect( NetworkContext_t * pNetworkContext,
if( serverAddress.sin_addr == 0 )
{
LogError( ( "Failed to resolve %s.", pHostName ) );
socketStatus = -1;
socketStatus = TRANSPORT_FREERTOS_NETWORK_ERROR;
}
}
if( socketStatus == 0 )
{
/* Establish connection. */
LogDebug( ( "Creating TCP Connection to %s.", pHostName ) );
socketStatus = FreeRTOS_connect( tcpSocket, &serverAddress, sizeof( serverAddress ) );
if( socketStatus != 0 )
{
LogError( ( "Failed to connect to %s. FreeRTOS_connect returned with status=%d.",
pHostName,
socketStatus ) );
LogError( ( "Failed to establish TCP Connection: ReturnCode=%d.", socketStatus ) );
}
}
if( socketStatus == 0 )
{
socketStatus = FreeRTOS_setsockopt( tcpSocket,
0,
FREERTOS_SO_RCVTIMEO,
&receiveTimeout,
sizeof( TickType_t ) );
/* Set socket receive timeout. */
transportTimeout = pdMS_TO_TICKS( receiveTimeoutMs );
/* Setting the receive block time cannot fail. */
( void ) FreeRTOS_setsockopt( tcpSocket,
0,
FREERTOS_SO_RCVTIMEO,
&transportTimeout,
sizeof( TickType_t ) );
if( socketStatus != 0 )
{
LogError( ( "Failed to set socket receive timeout." ) );
}
/* Set socket send timeout. */
transportTimeout = pdMS_TO_TICKS( sendTimeoutMs );
/* Setting the send block time cannot fail. */
( void ) FreeRTOS_setsockopt( tcpSocket,
0,
FREERTOS_SO_SNDTIMEO,
&transportTimeout,
sizeof( TickType_t ) );
}
/* Clean up on failure. */
@@ -118,7 +130,7 @@ BaseType_t Transport_FreeRTOS_Connect( NetworkContext_t * pNetworkContext,
return socketStatus;
}
void Transport_FreeRTOS_Disconnect( const NetworkContext_t * pNetworkContext )
void Plaintext_FreeRTOS_Disconnect( const NetworkContext_t * pNetworkContext )
{
BaseType_t waitForShutdownLoopCount = 0;
uint8_t pDummyBuffer[ 2 ];
@@ -144,7 +156,7 @@ void Transport_FreeRTOS_Disconnect( const NetworkContext_t * pNetworkContext )
}
}
int32_t Transport_FreeRTOS_recv( NetworkContext_t * pNetworkContext,
int32_t Plaintext_FreeRTOS_recv( NetworkContext_t * pNetworkContext,
void * pBuffer,
size_t bytesToRecv )
{
@@ -155,7 +167,7 @@ int32_t Transport_FreeRTOS_recv( NetworkContext_t * pNetworkContext,
return socketStatus;
}
int32_t Transport_FreeRTOS_send( NetworkContext_t * pNetworkContext,
int32_t Plaintext_FreeRTOS_send( NetworkContext_t * pNetworkContext,
const void * pBuffer,
size_t bytesToSend )
{