TCPIP_HTTP_NET_ConnectionStringFind Function

C

uint16_t TCPIP_HTTP_NET_ConnectionStringFind(
    TCPIP_HTTP_NET_CONN_HANDLE connHandle, 
    const char* str, 
    uint16_t startOffs, 
    uint16_t searchLen
);

Description

This function searches for an ASCIIZ string in the RX buffer of the connection. It does the search by performing a peek operation in the RX buffer, (i.e., the RX data in the buffer is not consumed and it is available for further read operations). It works for both encrypted and unencrypted connections.

Preconditions

connHandle - a valid HTTP connection.

Parameters

ParametersDescription
connHandleHTTP connection handle.
str0 terminated ASCII string to search for.
startOffsOffset in the RX buffer to start the search from.
searchLenIf !0, it is the length of buffer to search into (starting from startOffs). If 0, the whole buffer is searched.

Returns

  • If string was found - A zero-indexed position in the RX buffer of the string occurence.

  • 0xFFFF - Search array not found.

Remarks

This function currently performs the search by doing a whole buffer peek into one single operation. Note that the search will fail if there's more data in the TCP socket than could be read at once.