HTP  0.5
Macros | Functions
htp_response.c File Reference
#include "htp_config_auto.h"
#include "htp_private.h"

Macros

#define OUT_TEST_NEXT_BYTE_OR_RETURN(X)
 
#define OUT_PEEK_NEXT(X)
 
#define OUT_NEXT_BYTE(X)
 
#define OUT_NEXT_BYTE_OR_RETURN(X)
 
#define OUT_COPY_BYTE_OR_RETURN(X)
 
#define REQUEST_URI_NOT_SEEN   "/libhtp::request_uri_not_seen"
 

Functions

htp_status_t htp_connp_res_receiver_finalize_clear (htp_connp_t *connp)
 
htp_status_t htp_connp_RES_BODY_CHUNKED_DATA_END (htp_connp_t *connp)
 
htp_status_t htp_connp_RES_BODY_CHUNKED_DATA (htp_connp_t *connp)
 
htp_status_t htp_connp_RES_BODY_CHUNKED_LENGTH (htp_connp_t *connp)
 
htp_status_t htp_connp_RES_BODY_IDENTITY_CL_KNOWN (htp_connp_t *connp)
 
htp_status_t htp_connp_RES_BODY_IDENTITY_STREAM_CLOSE (htp_connp_t *connp)
 
htp_status_t htp_connp_RES_BODY_DETERMINE (htp_connp_t *connp)
 
htp_status_t htp_connp_RES_HEADERS (htp_connp_t *connp)
 
htp_status_t htp_connp_RES_LINE (htp_connp_t *connp)
 
size_t htp_connp_res_data_consumed (htp_connp_t *connp)
 
htp_status_t htp_connp_RES_FINALIZE (htp_connp_t *connp)
 
htp_status_t htp_connp_RES_IDLE (htp_connp_t *connp)
 
int htp_connp_res_data (htp_connp_t *connp, const htp_time_t *timestamp, const void *data, size_t len)
 

Detailed Description

Author
Ivan Ristic ivanr.nosp@m.@web.nosp@m.kreat.nosp@m.or.c.nosp@m.om

Macro Definition Documentation

#define OUT_COPY_BYTE_OR_RETURN (   X)
Value:
if ((X)->out_current_read_offset < (X)->out_current_len) { \
(X)->out_next_byte = (X)->out_current_data[(X)->out_current_read_offset]; \
(X)->out_current_read_offset++; \
(X)->out_stream_offset++; \
} else { \
return HTP_DATA_BUFFER; \
}
#define HTP_DATA_BUFFER
Definition: htp_core.h:112
#define OUT_NEXT_BYTE (   X)
Value:
if ((X)->out_current_read_offset < (X)->out_current_len) { \
(X)->out_next_byte = (X)->out_current_data[(X)->out_current_read_offset]; \
(X)->out_current_read_offset++; \
(X)->out_current_consume_offset++; \
(X)->out_stream_offset++; \
} else { \
(X)->out_next_byte = -1; \
}
#define OUT_NEXT_BYTE_OR_RETURN (   X)
Value:
if ((X)->out_current_read_offset < (X)->out_current_len) { \
(X)->out_next_byte = (X)->out_current_data[(X)->out_current_read_offset]; \
(X)->out_current_read_offset++; \
(X)->out_current_consume_offset++; \
(X)->out_stream_offset++; \
} else { \
return HTP_DATA; \
}
#define HTP_DATA
Definition: htp_core.h:87
#define OUT_PEEK_NEXT (   X)
Value:
if ((X)->out_current_read_offset >= (X)->out_current_len) { \
(X)->out_next_byte = -1; \
} else { \
(X)->out_next_byte = (X)->out_current_data[(X)->out_current_read_offset]; \
}
#define OUT_TEST_NEXT_BYTE_OR_RETURN (   X)
Value:
if ((X)->out_current_read_offset >= (X)->out_current_len) { \
return HTP_DATA; \
}
#define HTP_DATA
Definition: htp_core.h:87
#define REQUEST_URI_NOT_SEEN   "/libhtp::request_uri_not_seen"

Function Documentation

htp_status_t htp_connp_RES_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_RES_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_RES_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_RES_BODY_DETERMINE ( htp_connp_t connp)

Determines presence (and encoding) of a response 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_RES_BODY_IDENTITY_CL_KNOWN ( htp_connp_t connp)

Processes an identity response body of known 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_RES_BODY_IDENTITY_STREAM_CLOSE ( htp_connp_t connp)

Processes identity response body of unknown length. In this case, we assume the response body consumes all data until the end of the stream.

Parameters
[in]connp
Returns
HTP_OK on state change, HTP_ERROR on error, or HTP_DATA when more data is needed.
int htp_connp_res_data ( htp_connp_t connp,
const htp_time_t timestamp,
const void *  data,
size_t  len 
)

Process a chunk of outbound (server or response) data.

Parameters
[in]connp
[in]timestampOptional.
[in]data
[in]len
Returns
HTP_OK on state change, HTP_ERROR on error, or HTP_DATA when more data is needed
size_t htp_connp_res_data_consumed ( htp_connp_t connp)

Returns the number of bytes consumed from the most recent outbound data chunk. Normally, an invocation of htp_connp_res_data() will consume all data from the supplied buffer, but there are circumstances where only partial consumption is possible. In such cases HTP_STREAM_DATA_OTHER will be returned. Consumed bytes are no longer necessary, but the remainder of the buffer will be need to be saved for later.

Parameters
[in]connp
Returns
The number of bytes consumed from the last data chunk sent for outbound processing.
htp_status_t htp_connp_RES_FINALIZE ( htp_connp_t connp)
htp_status_t htp_connp_RES_HEADERS ( htp_connp_t connp)

Parses response 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_RES_IDLE ( htp_connp_t connp)

The response idle state will initialize response processing, as well as finalize each transactions after we are done with it.

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_RES_LINE ( htp_connp_t connp)

Parses response 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_res_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.