HTP 0.5
Functions
htp_connection_parser.c File Reference
#include "htp_config_auto.h"
#include "htp_private.h"

Functions

void htp_connp_clear_error (htp_connp_t *connp)
 
void htp_connp_req_close (htp_connp_t *connp, const htp_time_t *timestamp)
 
void htp_connp_close (htp_connp_t *connp, const htp_time_t *timestamp)
 
htp_connp_thtp_connp_create (htp_cfg_t *cfg)
 
void htp_connp_destroy (htp_connp_t *connp)
 
void htp_connp_destroy_all (htp_connp_t *connp)
 
htp_conn_thtp_connp_get_connection (const htp_connp_t *connp)
 
htp_tx_thtp_connp_get_in_tx (const htp_connp_t *connp)
 
htp_log_thtp_connp_get_last_error (const htp_connp_t *connp)
 
htp_tx_thtp_connp_get_out_tx (const htp_connp_t *connp)
 
void * htp_connp_get_user_data (const htp_connp_t *connp)
 
void htp_connp_in_reset (htp_connp_t *connp)
 
void htp_connp_open (htp_connp_t *connp, const char *client_addr, int client_port, const char *server_addr, int server_port, htp_time_t *timestamp)
 
void htp_connp_set_user_data (htp_connp_t *connp, const void *user_data)
 
htp_tx_thtp_connp_tx_create (htp_connp_t *connp)
 
void htp_connp_tx_remove (htp_connp_t *connp, htp_tx_t *tx)
 

Detailed Description

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

Function Documentation

◆ htp_connp_clear_error()

void htp_connp_clear_error ( htp_connp_t * connp)

Clears the most recent error, if any.

Parameters
[in]connp

◆ htp_connp_close()

void htp_connp_close ( htp_connp_t * connp,
const htp_time_t * timestamp )

Closes the connection associated with the supplied parser.

Parameters
[in]connp
[in]timestampOptional.

◆ htp_connp_create()

htp_connp_t * htp_connp_create ( htp_cfg_t * cfg)

Creates a new connection parser using the provided configuration. Because the configuration structure is used directly, in a multithreaded environment you are not allowed to change the structure, ever. If you have a need to change configuration on per-connection basis, make a copy of the configuration structure to go along with every connection parser.

Parameters
[in]cfg
Returns
New connection parser instance, or NULL on error.

◆ htp_connp_destroy()

void htp_connp_destroy ( htp_connp_t * connp)

Destroys the connection parser and its data structures, leaving all the data (connection, transactions, etc) intact.

Parameters
[in]connp

◆ htp_connp_destroy_all()

void htp_connp_destroy_all ( htp_connp_t * connp)

Destroys the connection parser, its data structures, as well as the connection and its transactions.

Parameters
[in]connp

◆ htp_connp_get_connection()

htp_conn_t * htp_connp_get_connection ( const htp_connp_t * connp)

Returns the connection associated with the connection parser.

Parameters
[in]connp
Returns
htp_conn_t instance, or NULL if one is not available.

◆ htp_connp_get_in_tx()

htp_tx_t * htp_connp_get_in_tx ( const htp_connp_t * connp)

Retrieves the pointer to the active inbound transaction. In connection parsing mode there can be many open transactions, and up to 2 active transactions at any one time. This is due to HTTP pipelining. Can be NULL.

Parameters
[in]connp
Returns
Active inbound transaction, or NULL if there isn't one.

◆ htp_connp_get_last_error()

htp_log_t * htp_connp_get_last_error ( const htp_connp_t * connp)

Returns the last error that occurred with this connection parser. Do note, however, that the value in this field will only be valid immediately after an error condition, but it is not guaranteed to remain valid if the parser is invoked again.

Parameters
[in]connp
Returns
A pointer to an htp_log_t instance if there is an error, or NULL if there isn't.

◆ htp_connp_get_out_tx()

htp_tx_t * htp_connp_get_out_tx ( const htp_connp_t * connp)

Retrieves the pointer to the active outbound transaction. In connection parsing mode there can be many open transactions, and up to 2 active transactions at any one time. This is due to HTTP pipelining. Can be NULL.

Parameters
[in]connp
Returns
Active outbound transaction, or NULL if there isn't one.

◆ htp_connp_get_user_data()

void * htp_connp_get_user_data ( const htp_connp_t * connp)

Retrieve the user data associated with this connection parser.

Parameters
[in]connp
Returns
User data, or NULL if there isn't any.

◆ htp_connp_in_reset()

void htp_connp_in_reset ( htp_connp_t * connp)

This function is most likely not used and/or not needed.

Parameters
[in]connp

◆ htp_connp_open()

void htp_connp_open ( htp_connp_t * connp,
const char * client_addr,
int client_port,
const char * server_addr,
int server_port,
htp_time_t * timestamp )

Opens connection.

Parameters
[in]connp
[in]client_addrClient address
[in]client_portClient port
[in]server_addrServer address
[in]server_portServer port
[in]timestampOptional.

◆ htp_connp_req_close()

void htp_connp_req_close ( htp_connp_t * connp,
const htp_time_t * timestamp )

◆ htp_connp_set_user_data()

void htp_connp_set_user_data ( htp_connp_t * connp,
const void * user_data )

Associate user data with the supplied parser.

Parameters
[in]connp
[in]user_data

◆ htp_connp_tx_create()

htp_tx_t * htp_connp_tx_create ( htp_connp_t * connp)

Create a new transaction using the connection parser provided.

Parameters
[in]connp
Returns
Transaction instance on success, NULL on failure.

◆ htp_connp_tx_remove()

void htp_connp_tx_remove ( htp_connp_t * connp,
htp_tx_t * tx )

Removes references to the supplied transaction.

Parameters
[in]connp
[in]tx