FreeRTOS:
HTTPS Client
HTTPS Client v1.0.0 library
|
Return to main page ↑ |
Common definitions for the HTTPS Client unit tests. More...
#include "iot_config.h"
#include <string.h>
#include "iot_init.h"
#include "private/iot_https_internal.h"
#include "iot_test_access_https.h"
#include "aws_clientcredential.h"
#include "aws_clientcredential_keys.h"
#include "unity_fixture.h"
Go to the source code of this file.
Macros | |
#define | HTTPS_TEST_PORT ( ( uint16_t ) 443 ) |
Test TLS TCP port. | |
#define | HTTPS_TEST_ADDRESS "www.amazon.com " |
Test address to share among the tests. | |
#define | HTTPS_TEST_PATH "/path.txt" |
Test path to share among the tests. | |
#define | HTTPS_TEST_ALPN_PROTOCOL "http/1.1" |
Test HTTP/1.1 protocol to share among the tests. | |
#define | HTTPS_TEST_ROOT_CA |
Baltimore Cybertrust root CA to share among the tests. More... | |
#define | HTTPS_TEST_CONN_USER_BUFFER_SIZE ( sizeof( _httpsConnection_t ) ) |
The size of the connection user buffer to use among the tests. | |
#define | HTTPS_TEST_REQ_USER_BUFFER_SIZE ( 512 ) |
The size of the request user buffer to use among the tests. | |
#define | HTTPS_TEST_RESP_USER_BUFFER_SIZE ( sizeof( _httpsResponse_t ) + 128 ) |
The size of the response user buffer to use among the tests. More... | |
#define | HTTPS_TEST_RESP_BODY_BUFFER_SIZE ( 256 ) |
The size of the response body buffer to use among the tests. | |
#define | HTTPS_TEST_RESPONSE_MESSAGE_LENGTH ( 1024 ) |
The maximum length of the HTTP response message buffer shared among the test. More... | |
#define | HTTPS_TEST_RESP_HEADER_BUFFER_LENGTH ( HTTPS_TEST_RESP_USER_BUFFER_SIZE - sizeof( _httpsResponse_t ) ) |
The length of the response header buffer shared among the tests. | |
#define | HTTPS_TEST_REQUEST_BODY |
Test HTTP request body to share among the tests. More... | |
#define | HTTPS_TEST_REQUEST_BODY_LENGTH ( sizeof( HTTPS_TEST_REQUEST_BODY ) - 1 ) |
The length of the test HTTP request body. | |
#define | HTTPS_TEST_SMALL_RESPONSE |
A small test HTTPS response to share among the tests. More... | |
#define | HTTPS_TEST_SMALL_RESPONSE_LENGTH ( sizeof( HTTPS_TEST_SMALL_RESPONSE ) - 1 ) |
The length of the small test HTTP response. | |
#define | HTTPS_TEST_CHUNKED_RESPONSE |
Test HTTP chunked response message to share among the tests. More... | |
#define | HTTPS_TEST_CHUNKED_RESPONSE_BODY_LENGTH ( 0xB + 0xC + 3 ) |
The length of the test chunked HTTP response body. | |
Functions | |
static IotNetworkError_t | _networkCreateSuccess (void *pConnectionInfo, void *pCredentialInfo, void **pConnection) |
Network Abstraction create function that succeeds. | |
static IotNetworkError_t | _setReceiveCallbackSuccess (void *pConnection, IotNetworkReceiveCallback_t receiveCallback, void *pContext) |
Network Abstraction setReceiveCallback that succeeds. | |
static IotHttpsConnectionHandle_t | _getConnHandle (void) |
Get a valid connected state intialized connection handle using _pConnUserBuffer and _connInfo. | |
static IotHttpsRequestHandle_t | _getReqHandle (IotHttpsRequestInfo_t *pReqInfo) |
Get a valid request handle with the input pReqInfo. | |
static IotHttpsResponseHandle_t | _getRespHandle (IotHttpsResponseInfo_t *pRespInfo, IotHttpsRequestHandle_t reqHandle) |
Get a valid response handle using _pRespUserBuffer, and respInfoGET. | |
static IotNetworkError_t | _networkCloseSuccess (void *pConnection) |
Network Abstraction close function that succeeds. | |
static IotNetworkError_t | _networkDestroySuccess (void *pConnection) |
Network abstraction destroy function that succeeds. | |
static size_t | _networkReceiveSuccess (void *pConnection, uint8_t *pBuffer, size_t bytesRequested) |
Network abstraction receive function that succeeds. | |
void | _generateHttpResponseMessage (int headerLength, int bodyLength) |
Generate an test HTTP response message with the specified header length and the specified body length. More... | |
void | _verifyHttpResponseBody (int bodyLength, uint8_t *pBody, int startIndex) |
Test verify the response body in pBody up to bodyLength. More... | |
Variables | |
uint8_t | _pConnUserBuffer [HTTPS_TEST_CONN_USER_BUFFER_SIZE] |
HTTPS Client connection user buffer to share among the tests. More... | |
uint8_t | _pRespBodyBuffer [HTTPS_TEST_RESP_BODY_BUFFER_SIZE] |
HTTPS Response body buffer to share among the tests. More... | |
uint8_t | _pRespMessageBuffer [HTTPS_TEST_RESPONSE_MESSAGE_LENGTH] |
An HTTP response message to share among the tests. More... | |
uint8_t | _pReqUserBuffer [HTTPS_TEST_REQ_USER_BUFFER_SIZE] |
HTTPS Request user buffer to share among the tests. More... | |
uint8_t | _pRespUserBuffer [HTTPS_TEST_RESP_USER_BUFFER_SIZE] |
HTTPS Response user buffer to share among the tests. More... | |
static uint32_t | _nextRespMessageBufferByteToReceive = 0 |
The current place in _pRespMessageBuffer to receive the next byte. More... | |
static IotNetworkInterface_t | _networkInterface = { 0 } |
An IotNetworkInterface_t to share among the tests. | |
static IotHttpsConnectionInfo_t | _connInfo |
A IotHttpsConnectionInfo_t to share among the tests. More... | |
Common definitions for the HTTPS Client unit tests.
#define HTTPS_TEST_ROOT_CA |
Baltimore Cybertrust root CA to share among the tests.
#define HTTPS_TEST_RESP_USER_BUFFER_SIZE ( sizeof( _httpsResponse_t ) + 128 ) |
The size of the response user buffer to use among the tests.
The header space comes after the response context, hence the addition to the response context.
#define HTTPS_TEST_RESPONSE_MESSAGE_LENGTH ( 1024 ) |
The maximum length of the HTTP response message buffer shared among the test.
The buffer of this length is used to test a few scenarios where the headers or body are found in either the header buffer or body buffer and need to be copied over appropriately.
#define HTTPS_TEST_REQUEST_BODY |
Test HTTP request body to share among the tests.
#define HTTPS_TEST_SMALL_RESPONSE |
A small test HTTPS response to share among the tests.
#define HTTPS_TEST_CHUNKED_RESPONSE |
Test HTTP chunked response message to share among the tests.
void _generateHttpResponseMessage | ( | int | headerLength, |
int | bodyLength | ||
) |
Generate an test HTTP response message with the specified header length and the specified body length.
This generates the test HTTP response message into _pRespMessageBuffer. _pRespMessageBuffer must be zeroed out before calling this routine. The length of _pRespMessageBuffer must not exceed headerLength + bodyLength. The headerLength is the length of the raw HTTP headers includes delimiters like ": " and "\r\n". The length of headerLength must be greater than: "HTTP/1.1 200 OK\r\nContent-Length: <bodyLengthStr>\r\nheader0: value0\r\n\r\n" in order to generate meaningful header data.
void _verifyHttpResponseBody | ( | int | bodyLength, |
uint8_t * | pBody, | ||
int | startIndex | ||
) |
Test verify the response body in pBody up to bodyLength.
This will verify that 'a' through 'z' (then repeated) are written properly.
|
extern |
HTTPS Client connection user buffer to share among the tests.
This variable is extern to save memory. This is acceptable as the HTTPS Client unit tests run sequentially. The user buffers are always overwritten each utilizing test, so data left over affecting other tests is not a concern.
|
extern |
HTTPS Response body buffer to share among the tests.
This variable is extern to save memory. This is acceptable as the HTTPS Client unit tests run sequentially. The user buffers are always overwritten each utilizing test, so data left over affecting other tests is not a concern.
|
extern |
An HTTP response message to share among the tests.
This variable is extern to save memory. This is acceptable as the HTTPS Client unit tests run sequentially. The user buffers are always overwritten each utilizing test, so data left over affecting other tests is not a concern.
|
extern |
HTTPS Request user buffer to share among the tests.
This variable is extern to save memory. This is acceptable as the HTTPS Client unit tests run sequentially. The user buffers are always overwritten each utilizing test, so data left over affecting other tests is not a concern.
|
extern |
HTTPS Response user buffer to share among the tests.
This variable is extern to save memory. This is acceptable as the HTTPS Client unit tests run sequentially. The user buffers are always overwritten each utilizing test, so data left over affecting other tests is not a concern.
|
static |
The current place in _pRespMessageBuffer to receive the next byte.
This is used to mimic receiving the HTTP response message from the network during testing.
|
static |
A IotHttpsConnectionInfo_t to share among the tests.