00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00039 #ifndef HTP_CONFIG_H
00040 #define HTP_CONFIG_H
00041
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045
00046 #include "htp.h"
00047
00051 enum htp_decoder_ctx_t {
00053 HTP_DECODER_DEFAULTS = 0,
00054
00056 HTP_DECODER_URLENCODED = 1,
00057
00059 HTP_DECODER_URL_PATH = 2
00060 };
00061
00065 enum htp_server_personality_t {
00070 HTP_SERVER_MINIMAL = 0,
00071
00073 HTP_SERVER_GENERIC = 1,
00074
00076 HTP_SERVER_IDS = 2,
00077
00079 HTP_SERVER_IIS_4_0 = 3,
00080
00082 HTP_SERVER_IIS_5_0 = 4,
00083
00085 HTP_SERVER_IIS_5_1 = 5,
00086
00088 HTP_SERVER_IIS_6_0 = 6,
00089
00091 HTP_SERVER_IIS_7_0 = 7,
00092
00093
00094 HTP_SERVER_IIS_7_5 = 8,
00095
00096
00097 HTP_SERVER_APACHE_2 = 9
00098 };
00099
00103 enum htp_unwanted_t {
00104
00106 HTP_UNWANTED_IGNORE = 0,
00107
00109 HTP_UNWANTED_400 = 400,
00110
00112 HTP_UNWANTED_404 = 404
00113 };
00114
00118 enum htp_url_encoding_handling_t {
00120 HTP_URL_DECODE_PRESERVE_PERCENT = 0,
00121
00123 HTP_URL_DECODE_REMOVE_PERCENT = 1,
00124
00126 HTP_URL_DECODE_PROCESS_INVALID = 2
00127 };
00128
00136 htp_cfg_t *htp_config_create(void);
00137
00149 htp_cfg_t *htp_config_copy(htp_cfg_t *cfg);
00150
00156 void htp_config_destroy(htp_cfg_t *cfg);
00157
00164 void *htp_config_get_user_data(htp_cfg_t *cfg);
00165
00173 void htp_config_register_log(htp_cfg_t *cfg, int (*callback_fn)(htp_log_t *));
00174
00181 void htp_config_register_multipart_parser(htp_cfg_t *cfg);
00182
00190 void htp_config_register_request_start(htp_cfg_t *cfg, int (*callback_fn)(htp_tx_t *));
00191
00198 void htp_config_register_request_body_data(htp_cfg_t *cfg, int (*callback_fn)(htp_tx_data_t *));
00199
00206 void htp_config_register_request_complete(htp_cfg_t *cfg, int (*callback_fn)(htp_tx_t *));
00207
00214 void htp_config_register_request_file_data(htp_cfg_t *cfg, int (*callback_fn)(htp_file_data_t *));
00215
00222 void htp_config_register_request_header_data(htp_cfg_t *cfg, int (*callback_fn)(htp_tx_data_t *));
00223
00230 void htp_config_register_request_headers(htp_cfg_t *cfg, int (*callback_fn)(htp_tx_t *));
00231
00238 void htp_config_register_request_line(htp_cfg_t *cfg, int (*callback_fn)(htp_tx_t *));
00239
00246 void htp_config_register_request_uri_normalize(htp_cfg_t *cfg, int (*callback_fn)(htp_tx_t *));
00247
00254 void htp_config_register_request_trailer(htp_cfg_t *cfg, int (*callback_fn)(htp_tx_t *));
00255
00262 void htp_config_register_request_trailer_data(htp_cfg_t *cfg, int (*callback_fn)(htp_tx_data_t *d));
00263
00270 void htp_config_register_response_body_data(htp_cfg_t *cfg, int (*callback_fn)(htp_tx_data_t *));
00271
00278 void htp_config_register_response_complete(htp_cfg_t *cfg, int (*callback_fn)(htp_tx_t *));
00279
00286 void htp_config_register_response_header_data(htp_cfg_t *cfg, int (*callback_fn)(htp_tx_data_t *));
00287
00294 void htp_config_register_response_headers(htp_cfg_t *cfg, int (*callback_fn)(htp_tx_t *));
00295
00302 void htp_config_register_response_line(htp_cfg_t *cfg, int (*callback_fn)(htp_tx_t *));
00303
00310 void htp_config_register_response_start(htp_cfg_t *cfg, int (*callback_fn)(htp_tx_t *));
00311
00318 void htp_config_register_response_trailer(htp_cfg_t *cfg, int (*callback_fn)(htp_tx_t *));
00319
00326 void htp_config_register_response_trailer_data(htp_cfg_t *cfg, int (*callback_fn)(htp_tx_data_t *d));
00327
00334 void htp_config_register_transaction_complete(htp_cfg_t *cfg, int (*callback_fn)(htp_tx_t *));
00335
00342 void htp_config_register_urlencoded_parser(htp_cfg_t *cfg);
00343
00353 void htp_config_set_backslash_convert_slashes(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, int enabled);
00354
00367 void htp_config_set_bestfit_map(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, void *map);
00368
00378 void htp_config_set_bestfit_replacement_byte(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, int replacement_byte);
00379
00387 void htp_config_set_control_chars_unwanted(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, enum htp_unwanted_t unwanted);
00388
00398 void htp_config_set_convert_lowercase(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, int enabled);
00399
00416 htp_status_t htp_config_set_extract_request_files(htp_cfg_t *cfg, int extract_files, int limit);
00417
00427 void htp_config_set_field_limits(htp_cfg_t *cfg, size_t soft_limit, size_t hard_limit);
00428
00435 void htp_config_set_log_level(htp_cfg_t *cfg, enum htp_log_level_t log_level);
00436
00446 void htp_config_set_nul_encoded_terminates(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, int enabled);
00447
00455 void htp_config_set_nul_encoded_unwanted(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, enum htp_unwanted_t unwanted);
00456
00464 void htp_config_set_nul_raw_terminates(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, int enabled);
00465
00475 void htp_config_set_nul_raw_unwanted(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, enum htp_unwanted_t unwanted);
00476
00483 void htp_config_set_parse_request_auth(htp_cfg_t *cfg, int parse_request_auth);
00484
00491 void htp_config_set_parse_request_cookies(htp_cfg_t *cfg, int parse_request_cookies);
00492
00504 void htp_config_set_path_separators_compress(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, int enabled);
00505
00517 void htp_config_set_path_separators_decode(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, int enabled);
00518
00526 void htp_config_set_path_separators_encoded_unwanted(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, enum htp_unwanted_t unwanted);
00527
00537 void htp_config_set_plusspace_decode(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, int enabled);
00538
00545 void htp_config_set_response_decompression(htp_cfg_t *cfg, int enabled);
00546
00554 htp_status_t htp_config_set_server_personality(htp_cfg_t *cfg, enum htp_server_personality_t personality);
00555
00563 void htp_config_set_tmpdir(htp_cfg_t *cfg, char *tmpdir);
00564
00573 void htp_config_set_tx_auto_destroy(htp_cfg_t *cfg, int tx_auto_destroy);
00574
00581 void htp_config_set_user_data(htp_cfg_t *cfg, void *user_data);
00582
00591 void htp_config_set_u_encoding_decode(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, int enabled);
00592
00600 void htp_config_set_u_encoding_unwanted(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, enum htp_unwanted_t unwanted);
00601
00609 void htp_config_set_url_encoding_invalid_handling(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, enum htp_url_encoding_handling_t handling);
00610
00618 void htp_config_set_url_encoding_invalid_unwanted(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, enum htp_unwanted_t unwanted);
00619
00628 void htp_config_set_utf8_convert_bestfit(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, int enabled);
00629
00639 void htp_config_set_utf8_invalid_unwanted(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, enum htp_unwanted_t unwanted);
00640
00648 void htp_config_set_requestline_leading_whitespace_unwanted(htp_cfg_t *cfg, enum htp_decoder_ctx_t ctx, enum htp_unwanted_t unwanted);
00649
00656 void htp_config_set_response_decompression_layer_limit(htp_cfg_t *cfg, int limit);
00657
00658 #ifdef __cplusplus
00659 }
00660 #endif
00661
00662 #endif
00663