Data transfer over HTTP routines. More...
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "ota.h"
#include "ota_private.h"
#include "ota_http_private.h"
Functions | |
OtaErr_t | initFileTransfer_Http (OtaAgentContext_t *pAgentCtx) |
Initialize file transfer over HTTP. More... | |
OtaErr_t | requestDataBlock_Http (OtaAgentContext_t *pAgentCtx) |
Request File block over HTTP. More... | |
OtaErr_t | decodeFileBlock_Http (const uint8_t *pMessageBuffer, size_t messageSize, int32_t *pFileId, int32_t *pBlockId, int32_t *pBlockSize, uint8_t **pPayload, size_t *pPayloadSize) |
Stub for decoding the file block. More... | |
OtaErr_t | cleanupData_Http (const OtaAgentContext_t *pAgentCtx) |
Cleanup related to OTA data plane over HTTP. More... | |
const char * | OTA_HTTP_strerror (OtaHttpStatus_t status) |
Status to string conversion for OTA HTTP interface status. More... | |
Variables | |
static uint32_t | currBlock |
Track the current block for HTTP requests. | |
Data transfer over HTTP routines.
OtaErr_t initFileTransfer_Http | ( | OtaAgentContext_t * | pAgentCtx | ) |
Initialize file transfer over HTTP.
This function initializes the file transfer after the OTA job is parsed and accepted by initializing the http component with pre-signed url.
[in] | pAgentCtx | The OTA agent context. |
OtaErr_t requestDataBlock_Http | ( | OtaAgentContext_t * | pAgentCtx | ) |
Request File block over HTTP.
This function is used for requesting a file block over HTTP using the file context.
[in] | pAgentCtx | The OTA agent context. |
OtaErr_t decodeFileBlock_Http | ( | const uint8_t * | pMessageBuffer, |
size_t | messageSize, | ||
int32_t * | pFileId, | ||
int32_t * | pBlockId, | ||
int32_t * | pBlockSize, | ||
uint8_t ** | pPayload, | ||
size_t * | pPayloadSize | ||
) |
Stub for decoding the file block.
File block received over HTTP does not require decoding, only increment the number of blocks received.
[in] | pMessageBuffer | The message to be decoded. |
[in] | messageSize | The size of the message in bytes. |
[out] | pFileId | The server file ID. |
[out] | pBlockId | The file block ID. |
[out] | pBlockSize | The file block size. |
[out] | pPayload | The payload. |
[out] | pPayloadSize | The payload size. |
OtaErr_t cleanupData_Http | ( | const OtaAgentContext_t * | pAgentCtx | ) |
Cleanup related to OTA data plane over HTTP.
This function performs cleanup by resetting the number of blocks received and deinit the http component.
[in] | pAgentCtx | The OTA agent context. |
const char* OTA_HTTP_strerror | ( | OtaHttpStatus_t | status | ) |
Status to string conversion for OTA HTTP interface status.
[in] | status | The status to convert to a string. |