coreHTTP v3.1.1
HTTP/1.1 Client Library
 
Loading...
Searching...
No Matches
transport_interface.h
Go to the documentation of this file.
1/*
2 * coreHTTP v3.1.1
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
189/* @[define_networkcontext] */
190struct NetworkContext;
191typedef struct NetworkContext NetworkContext_t;
192/* @[define_networkcontext] */
193
217/* @[define_transportrecv] */
218typedef int32_t ( * TransportRecv_t )( NetworkContext_t * pNetworkContext,
219 void * pBuffer,
220 size_t bytesToRecv );
221/* @[define_transportrecv] */
222
239/* @[define_transportsend] */
240typedef int32_t ( * TransportSend_t )( NetworkContext_t * pNetworkContext,
241 const void * pBuffer,
242 size_t bytesToSend );
243/* @[define_transportsend] */
244
248typedef struct TransportOutVector
249{
253 const void * iov_base;
254
258 size_t iov_len;
260
287/* @[define_transportwritev] */
288typedef int32_t ( * TransportWritev_t )( NetworkContext_t * pNetworkContext,
289 TransportOutVector_t * pIoVec,
290 size_t ioVecCount );
291/* @[define_transportwritev] */
292
297/* @[define_transportinterface] */
298typedef struct TransportInterface
299{
305/* @[define_transportinterface] */
306
307/* *INDENT-OFF* */
308#ifdef __cplusplus
309 }
310#endif
311/* *INDENT-ON* */
312
313#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:218
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:240
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:288
struct NetworkContext NetworkContext_t
The NetworkContext is an incomplete type. An implementation of this interface must define struct Netw...
Definition: transport_interface.h:191
The transport layer interface.
Definition: transport_interface.h:299
TransportSend_t send
Definition: transport_interface.h:301
TransportRecv_t recv
Definition: transport_interface.h:300
TransportWritev_t writev
Definition: transport_interface.h:302
NetworkContext_t * pNetworkContext
Definition: transport_interface.h:303
Transport vector structure for sending multiple messages.
Definition: transport_interface.h:249
const void * iov_base
Base address of data.
Definition: transport_interface.h:253
size_t iov_len
Length of data in buffer.
Definition: transport_interface.h:258