coreHTTP  v1.0.0
HTTP/1.1 Client Library
Porting Guide

Guide for porting the HTTP client library to a new platform.

To use the HTTP client library, a platform must implement the following components:

  1. Configuration Macros
  2. Transport Interface

Configuration Macros

Settings that can be set as macros in the config header core_http_config.h, or passed in as compiler options.

Note
If the custom configuration header core_http_config.h is not provided, then the HTTP_DO_NOT_USE_CUSTOM_CONFIG macro must be defined.
See also
Configurations

The following macros can be configured for this library:

In addition, the following logging macros are used throughout this library:

Transport Interface

The HTTP client library relies on transport interface callbacks that must be implemented in order to send and receive packets on a network.

See also
The Transport Interface documentation for more information.

The transport interface API used by the HTTP client is defined in transport_interface.h. A port must implement functions corresponding to the following functions pointers:

The above two functions take in a pointer to a NetworkContext_t, the type name of a struct NetworkContext. The NetworkContext struct must also be defined by the user's implementation, and ought to contain any information necessary to send and receive data with the TransportSend_t and TransportRecv_t implementations, respectively:

struct NetworkContext {
// Fields necessary for the transport implementations, e.g. a TCP socket descriptor.
};
NetworkContext_t
struct NetworkContext NetworkContext_t
The NetworkContext is an incomplete type. An implementation of this interface must define struct Netw...
Definition: transport_interface.h:155
TransportSend_t
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:185
TransportRecv_t
int32_t(* TransportRecv_t)(NetworkContext_t *pNetworkContext, void *pBuffer, size_t bytesToRecv)
Transport interface for receiving data on the network.
Definition: transport_interface.h:169