coreMQTT v2.0.0
MQTT 3.1.1 Client Library
transport_interface.h
Go to the documentation of this file.
1/*
2 * coreMQTT v2.0.0
3 * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 * this software and associated documentation files (the "Software"), to deal in
7 * the Software without restriction, including without limitation the rights to
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 * the Software, and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 */
22
28#ifndef TRANSPORT_INTERFACE_H_
29#define TRANSPORT_INTERFACE_H_
30
31#include <stdint.h>
32#include <stddef.h>
33
34/* *INDENT-OFF* */
35#ifdef __cplusplus
36 extern "C" {
37#endif
38/* *INDENT-ON* */
39
187/* @[define_networkcontext] */
188struct NetworkContext;
189typedef struct NetworkContext NetworkContext_t;
190/* @[define_networkcontext] */
191
218/* @[define_transportrecv] */
219typedef int32_t ( * TransportRecv_t )( NetworkContext_t * pNetworkContext,
220 void * pBuffer,
221 size_t bytesToRecv );
222/* @[define_transportrecv] */
223
240/* @[define_transportsend] */
241typedef int32_t ( * TransportSend_t )( NetworkContext_t * pNetworkContext,
242 const void * pBuffer,
243 size_t bytesToSend );
244/* @[define_transportsend] */
245
249typedef struct TransportOutVector
250{
254 const void * iov_base;
255
259 size_t iov_len;
261
288/* @[define_transportwritev] */
289typedef int32_t ( * TransportWritev_t )( NetworkContext_t * pNetworkContext,
290 TransportOutVector_t * pIoVec,
291 size_t ioVecCount );
292/* @[define_transportwritev] */
293
298/* @[define_transportinterface] */
299typedef struct TransportInterface
300{
306/* @[define_transportinterface] */
307
308/* *INDENT-OFF* */
309#ifdef __cplusplus
310 }
311#endif
312/* *INDENT-ON* */
313
314#endif /* ifndef TRANSPORT_INTERFACE_H_ */
int32_t(* TransportRecv_t)(NetworkContext_t *pNetworkContext, void *pBuffer, size_t bytesToRecv)
Transport interface for receiving data on the network.
Definition: transport_interface.h:219
int32_t(* TransportSend_t)(NetworkContext_t *pNetworkContext, const void *pBuffer, size_t bytesToSend)
Transport interface for sending data over the network.
Definition: transport_interface.h:241
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 ...
Definition: transport_interface.h:289
struct NetworkContext NetworkContext_t
The NetworkContext is an incomplete type. An implementation of this interface must define struct Netw...
Definition: transport_interface.h:189
The transport layer interface.
Definition: transport_interface.h:300
TransportSend_t send
Definition: transport_interface.h:302
TransportRecv_t recv
Definition: transport_interface.h:301
TransportWritev_t writev
Definition: transport_interface.h:303
NetworkContext_t * pNetworkContext
Definition: transport_interface.h:304
Transport vector structure for sending multiple messages.
Definition: transport_interface.h:250
const void * iov_base
Base address of data.
Definition: transport_interface.h:254
size_t iov_len
Length of data in buffer.
Definition: transport_interface.h:259