TCPIP_HTTP_NET_ConnectionPostNameRead Function

C

TCPIP_HTTP_NET_READ_STATUS TCPIP_HTTP_NET_ConnectionPostNameRead(
    TCPIP_HTTP_NET_CONN_HANDLE connHandle, 
    uint8_t* cData, 
    uint16_t wLen
);

Description

This function reads a name from a URL encoded string in the network transport buffer. This function is meant to be called from a template_ConnectionPostExecute() callback to facilitate easier parsing of incoming data. This function also prevents buffer overflows by forcing the programmer to indicate how many bytes are expected. At least two extra bytes are needed in cData over the maximum length of data expected to be read.

This function will read until the next '=' character, which indicates the end of a name parameter. It assumes that the front of the buffer is the beginning of the name parameter to be read.

This function properly updates pHttpCon->byteCount by decrementing it by the number of bytes read. It also removes the delimiting '=' from the buffer.

Preconditions

The front of the network transport buffer is the beginning of a name parameter, and the rest of the network transport buffer contains a URL-encoded string with a name parameter terminated by a '=' character.

Parameters

ParametersDescription
connHandleHTTP connection handle.
cDataWhere to store the name once it is read.
wLenHow many bytes can be written to cData.

Returns

  • TCPIP_HTTP_NET_READ_OK - Name was successfully read.

  • TCPIP_HTTP_NET_READ_TRUNCTATED - Entire name could not fit in the buffer, so the value was truncated and data has been lost.

  • TCPIP_HTTP_NET_READ_INCOMPLETE - Entire name was not ypet in the buffer, so call this function again later to retrieve.

Remarks

None.