htp_request.c File Reference

#include "htp_config_auto.h"
#include "htp_private.h"

Defines

#define IN_TEST_NEXT_BYTE_OR_RETURN(X)
#define IN_PEEK_NEXT(X)
#define IN_NEXT_BYTE(X)
#define IN_NEXT_BYTE_OR_RETURN(X)
#define IN_COPY_BYTE_OR_RETURN(X)

Functions

htp_status_t htp_connp_req_receiver_finalize_clear (htp_connp_t *connp)
htp_status_t htp_connp_REQ_CONNECT_CHECK (htp_connp_t *connp)
htp_status_t htp_connp_REQ_CONNECT_PROBE_DATA (htp_connp_t *connp)
htp_status_t htp_connp_REQ_CONNECT_WAIT_RESPONSE (htp_connp_t *connp)
htp_status_t htp_connp_REQ_BODY_CHUNKED_DATA_END (htp_connp_t *connp)
htp_status_t htp_connp_REQ_BODY_CHUNKED_DATA (htp_connp_t *connp)
htp_status_t htp_connp_REQ_BODY_CHUNKED_LENGTH (htp_connp_t *connp)
htp_status_t htp_connp_REQ_BODY_IDENTITY (htp_connp_t *connp)
htp_status_t htp_connp_REQ_BODY_DETERMINE (htp_connp_t *connp)
htp_status_t htp_connp_REQ_HEADERS (htp_connp_t *connp)
htp_status_t htp_connp_REQ_PROTOCOL (htp_connp_t *connp)
htp_status_t htp_connp_REQ_LINE_complete (htp_connp_t *connp)
htp_status_t htp_connp_REQ_LINE (htp_connp_t *connp)
htp_status_t htp_connp_REQ_FINALIZE (htp_connp_t *connp)
htp_status_t htp_connp_REQ_IGNORE_DATA_AFTER_HTTP_0_9 (htp_connp_t *connp)
htp_status_t htp_connp_REQ_IDLE (htp_connp_t *connp)
size_t htp_connp_req_data_consumed (htp_connp_t *connp)
int htp_connp_req_data (htp_connp_t *connp, const htp_time_t *timestamp, const void *data, size_t len)

Detailed Description

Author:
Ivan Ristic <ivanr@webkreator.com>

Define Documentation

#define IN_COPY_BYTE_OR_RETURN (  ) 
Value:
if ((X)->in_current_read_offset < (X)->in_current_len) { \
    (X)->in_next_byte = (X)->in_current_data[(X)->in_current_read_offset]; \
    (X)->in_current_read_offset++; \
    (X)->in_stream_offset++; \
} else { \
    return HTP_DATA_BUFFER; \
}
#define IN_NEXT_BYTE (  ) 
Value:
if ((X)->in_current_read_offset < (X)->in_current_len) { \
    (X)->in_next_byte = (X)->in_current_data[(X)->in_current_read_offset]; \
    (X)->in_current_read_offset++; \
    (X)->in_current_consume_offset++; \
    (X)->in_stream_offset++; \
} else { \
    (X)->in_next_byte = -1; \
}
#define IN_NEXT_BYTE_OR_RETURN (  ) 
Value:
if ((X)->in_current_read_offset < (X)->in_current_len) { \
    (X)->in_next_byte = (X)->in_current_data[(X)->in_current_read_offset]; \
    (X)->in_current_read_offset++; \
    (X)->in_current_consume_offset++; \
    (X)->in_stream_offset++; \
} else { \
    return HTP_DATA; \
}
#define IN_PEEK_NEXT (  ) 
Value:
if ((X)->in_current_read_offset >= (X)->in_current_len) { \
    (X)->in_next_byte = -1; \
} else { \
    (X)->in_next_byte = (X)->in_current_data[(X)->in_current_read_offset]; \
}
#define IN_TEST_NEXT_BYTE_OR_RETURN (  ) 
Value:
if ((X)->in_current_read_offset >= (X)->in_current_len) { \
    return HTP_DATA; \
}

Function Documentation

htp_status_t htp_connp_REQ_BODY_CHUNKED_DATA ( htp_connp_t connp  ) 

Processes a chunk of data.

Parameters:
[in] connp 
Returns:
HTP_OK on state change, HTP_ERROR on error, or HTP_DATA when more data is needed.
htp_status_t htp_connp_REQ_BODY_CHUNKED_DATA_END ( htp_connp_t connp  ) 

Consumes bytes until the end of the current line.

Parameters:
[in] connp 
Returns:
HTP_OK on state change, HTP_ERROR on error, or HTP_DATA when more data is needed.
htp_status_t htp_connp_REQ_BODY_CHUNKED_LENGTH ( htp_connp_t connp  ) 

Extracts chunk length.

Parameters:
[in] connp 
Returns:
HTP_OK on state change, HTP_ERROR on error, or HTP_DATA when more data is needed.
htp_status_t htp_connp_REQ_BODY_DETERMINE ( htp_connp_t connp  ) 

Determines presence (and encoding) of a request body.

Parameters:
[in] connp 
Returns:
HTP_OK on state change, HTP_ERROR on error, or HTP_DATA when more data is needed.
htp_status_t htp_connp_REQ_BODY_IDENTITY ( htp_connp_t connp  ) 

Processes identity request body.

Parameters:
[in] connp 
Returns:
HTP_OK on state change, HTP_ERROR on error, or HTP_DATA when more data is needed.
htp_status_t htp_connp_REQ_CONNECT_CHECK ( htp_connp_t connp  ) 

Performs a check for a CONNECT transaction to decide whether inbound parsing needs to be suspended.

Parameters:
[in] connp 
Returns:
HTP_OK if the request does not use CONNECT, HTP_DATA_OTHER if inbound parsing needs to be suspended until we hear from the other side
htp_status_t htp_connp_REQ_CONNECT_PROBE_DATA ( htp_connp_t connp  ) 

Determines whether inbound parsing needs to continue or stop. In case the data appears to be plain text HTTP, we try to continue.

Parameters:
[in] connp 
Returns:
HTP_OK if the parser can resume parsing, HTP_DATA_BUFFER if we need more data.
htp_status_t htp_connp_REQ_CONNECT_WAIT_RESPONSE ( htp_connp_t connp  ) 

Determines whether inbound parsing, which was suspended after encountering a CONNECT transaction, can proceed (after receiving the response).

Parameters:
[in] connp 
Returns:
HTP_OK if the parser can resume parsing, HTP_DATA_OTHER if it needs to continue waiting.
int htp_connp_req_data ( htp_connp_t connp,
const htp_time_t timestamp,
const void *  data,
size_t  len 
)
Parameters:
[in] connp 
[in] timestamp 
[in] data 
[in] len 
Returns:
HTP_STREAM_DATA, HTP_STREAM_ERROR or STEAM_STATE_DATA_OTHER (see QUICK_START). HTP_STREAM_CLOSED and HTP_STREAM_TUNNEL are also possible.
size_t htp_connp_req_data_consumed ( htp_connp_t connp  ) 

Returns how many bytes from the current data chunks were consumed so far.

Parameters:
[in] connp 
Returns:
The number of bytes consumed.
htp_status_t htp_connp_REQ_FINALIZE ( htp_connp_t connp  ) 
htp_status_t htp_connp_REQ_HEADERS ( htp_connp_t connp  ) 

Parses request headers.

Parameters:
[in] connp 
Returns:
HTP_OK on state change, HTP_ERROR on error, or HTP_DATA when more data is needed.
htp_status_t htp_connp_REQ_IDLE ( htp_connp_t connp  ) 

The idle state is where the parser will end up after a transaction is processed. If there is more data available, a new request will be started.

Parameters:
[in] connp 
Returns:
HTP_OK on state change, HTP_ERROR on error, or HTP_DATA when more data is needed.
htp_status_t htp_connp_REQ_IGNORE_DATA_AFTER_HTTP_0_9 ( htp_connp_t connp  ) 
htp_status_t htp_connp_REQ_LINE ( htp_connp_t connp  ) 

Parses request line.

Parameters:
[in] connp 
Returns:
HTP_OK on state change, HTP_ERROR on error, or HTP_DATA when more data is needed.
htp_status_t htp_connp_REQ_LINE_complete ( htp_connp_t connp  ) 

Parse the request line.

Parameters:
[in] connp 
Returns:
HTP_OK on succesful parse, HTP_ERROR on error.
htp_status_t htp_connp_REQ_PROTOCOL ( htp_connp_t connp  ) 

Determines request protocol.

Parameters:
[in] connp 
Returns:
HTP_OK on state change, HTP_ERROR on error, or HTP_DATA when more data is needed.
htp_status_t htp_connp_req_receiver_finalize_clear ( htp_connp_t connp  ) 

Finalizes an existing data receiver hook by sending any outstanding data to it. The hook is then removed so that it receives no more data.

Parameters:
[in] connp 
Returns:
HTP_OK, or a value returned from a callback.

Generated on 15 Jul 2018 for HTP by  doxygen 1.6.1