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