Callback function pointer types of the HTTP Client library.
More...
|
typedef uint32_t(* | HTTPClient_GetCurrentTimeFunc_t) (void) |
| Application provided function to query the current time in milliseconds.
|
|
typedef int32_t(* | TransportRecv_t) (NetworkContext_t *pNetworkContext, void *pBuffer, size_t bytesToRecv) |
| Transport interface for receiving data on the network.
|
|
typedef int32_t(* | TransportSend_t) (NetworkContext_t *pNetworkContext, const void *pBuffer, size_t bytesToSend) |
| Transport interface for sending data over the network.
|
|
typedef int32_t(* | TransportWritev_t) (NetworkContext_t *pNetworkContext, TransportOutVector_t *pIoVec, size_t ioVecCount) |
| Transport interface function for "vectored" / scatter-gather based writes. This function is expected to iterate over the list of vectors pIoVec having ioVecCount entries containing portions of one MQTT message at a maximum. If the proper functionality is available, then the data in the list should be copied to the underlying TCP buffer before flushing the buffer. Implementing it in this fashion will lead to sending of fewer TCP packets for all the values in the list.
|
|
Callback function pointer types of the HTTP Client library.
◆ HTTPClient_GetCurrentTimeFunc_t
typedef uint32_t(* HTTPClient_GetCurrentTimeFunc_t) (void) |
Application provided function to query the current time in milliseconds.
- Returns
- The current time in milliseconds.
◆ TransportRecv_t
typedef int32_t(* TransportRecv_t) (NetworkContext_t *pNetworkContext, void *pBuffer, size_t bytesToRecv) |
Transport interface for receiving data on the network.
- Note
- It is HIGHLY RECOMMENDED that the transport receive implementation does NOT block. coreMQTT will continue to call the transport interface if it receives a partial packet until it accumulates enough data to get the complete MQTT packet.
- Parameters
-
[in] | pNetworkContext | Implementation-defined network context. |
[in] | pBuffer | Buffer to receive the data into. |
[in] | bytesToRecv | Number of bytes requested from the network. |
- Returns
- The number of bytes received or a negative value to indicate error.
- Note
- If no data is available on the network to read and no error has occurred, zero MUST be the return value. A zero return value SHOULD represent that the read operation can be retried by calling the API function. Zero MUST NOT be returned if a network disconnection has occurred.
◆ TransportSend_t
typedef int32_t(* TransportSend_t) (NetworkContext_t *pNetworkContext, const void *pBuffer, size_t bytesToSend) |
Transport interface for sending data over the network.
- Parameters
-
[in] | pNetworkContext | Implementation-defined network context. |
[in] | pBuffer | Buffer containing the bytes to send over the network stack. |
[in] | bytesToSend | Number of bytes to send over the network. |
- Returns
- The number of bytes sent or a negative value to indicate error.
- Note
- If no data is transmitted over the network due to a full TX buffer and no network error has occurred, this MUST return zero as the return value. A zero return value SHOULD represent that the send operation can be retried by calling the API function. Zero MUST NOT be returned if a network disconnection has occurred.
◆ TransportWritev_t
Transport interface function for "vectored" / scatter-gather based writes. This function is expected to iterate over the list of vectors pIoVec having ioVecCount entries containing portions of one MQTT message at a maximum. If the proper functionality is available, then the data in the list should be copied to the underlying TCP buffer before flushing the buffer. Implementing it in this fashion will lead to sending of fewer TCP packets for all the values in the list.
- Note
- If the proper write functionality is not present for a given device/IP-stack, then there is no strict requirement to implement write. Only the send and recv interfaces must be defined for the application to work properly.
- Parameters
-
[in] | pNetworkContext | Implementation-defined network context. |
[in] | pIoVec | An array of TransportIoVector_t structs. |
[in] | ioVecCount | Number of TransportIoVector_t in pIoVec. |
- Returns
- The number of bytes written or a negative value to indicate error.
- Note
- If no data is written to the buffer due to the buffer being full this MUST return zero as the return value. A zero return value SHOULD represent that the write operation can be retried by calling the API function. Zero MUST NOT be returned if a network disconnection has occurred.