mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2025-06-26 11:42:57 +08:00
Support multiple transports in the same compilation unit (#434)
By removing the definition of the NetworkContext struct in the header file, we allow the application to define it. This allows an application writer to use multiple transports in the same compilation unit. That way, multiple .c files do not have to be created for each transport.
This commit is contained in:

committed by
GitHub

parent
a9fd30af94
commit
73b0d1b259
@ -202,6 +202,14 @@ typedef struct PublishPackets
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Each compilation unit must define the NetworkContext struct. */
|
||||
struct NetworkContext
|
||||
{
|
||||
TlsTransportParams_t * pParams;
|
||||
};
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Global entry time into the application to use as a reference timestamp
|
||||
* in the #prvGetTimeMs function. #prvGetTimeMs will always return the difference
|
||||
@ -583,9 +591,8 @@ BaseType_t xEstablishMqttSession( MQTTContext_t * pxMqttContext,
|
||||
configASSERT( pxMqttContext != NULL );
|
||||
configASSERT( pxNetworkContext != NULL );
|
||||
|
||||
/* Initialize the mqtt context and network context. */
|
||||
/* Initialize the mqtt context. */
|
||||
( void ) memset( pxMqttContext, 0U, sizeof( MQTTContext_t ) );
|
||||
( void ) memset( pxNetworkContext, 0U, sizeof( NetworkContext_t ) );
|
||||
|
||||
if( prvConnectToServerWithBackoffRetries( pxNetworkContext ) != TLS_TRANSPORT_SUCCESS )
|
||||
{
|
||||
|
Reference in New Issue
Block a user