~ubuntu-branches/ubuntu/raring/libhtp/raring

« back to all changes in this revision

Viewing changes to htp/htp.h

  • Committer: Bazaar Package Importer
  • Author(s): Pierre Chifflier
  • Date: 2011-05-23 21:54:41 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110523215441-z2acyhztzpxo6h0p
Tags: 0.2.5-1
* Imported Upstream version 0.2.5
* Bump Standards Version to 3.9.2
* Do not ship .la files (Closes: #621654)

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 
42
42
// -- Defines -------------------------------------------------------------------------------------
43
43
 
44
 
#define HTP_BASE_VERSION_TEXT   "0.2.3"
 
44
#define HTP_BASE_VERSION_TEXT   "0.2.5"
45
45
 
46
46
#define HTP_ERROR              -1
47
47
#define HTP_OK                  0
290
290
     *  a header can end up being longer than the line limit.
291
291
     */
292
292
    size_t field_limit_hard;
293
 
 
 
293
    
294
294
    /** Soft field limit length. If this limit is reached the parser will issue
295
295
     *  a warning but continue to run.
296
296
     */
297
 
    size_t field_limit_soft;
 
297
    size_t field_limit_soft;              
298
298
 
299
299
    /** Log level, which will be used when deciding whether to store or
300
300
     *  ignore the messages issued by the parser.
301
301
     */
302
 
    int log_level;
 
302
    int log_level;   
303
303
 
304
304
    /**
305
305
     * Server personality ID.
318
318
    /** The function used for response header parsing. Depends on the personality. */
319
319
    int (*process_response_header)(htp_connp_t *connp);
320
320
 
321
 
 
 
321
    
322
322
    // Path handling
323
323
 
324
324
    /** Should we treat backslash characters as path segment separators? */
325
325
    int path_backslash_separators;
326
 
 
 
326
    
327
327
    /** Should we treat paths as case insensitive? */
328
328
    int path_case_insensitive;
329
329
 
365
365
    unsigned char path_replacement_char;
366
366
 
367
367
    /** How will the server handle UCS-2 characters? */
368
 
    int path_unicode_mapping;
 
368
    int path_unicode_mapping;      
369
369
 
370
370
    /** XXX Unused */
371
371
    int path_utf8_overlong_handling;
387
387
    /** Request line hook, invoked after a request line has been parsed. */
388
388
    htp_hook_t *hook_request_line;
389
389
 
 
390
    /** Request URI normalization hook, for overriding default normalization of URI. */
 
391
    htp_hook_t *hook_request_uri_normalize;
 
392
 
390
393
    /** Request headers hook, invoked after all request headers are seen. */
391
394
    htp_hook_t *hook_request_headers;
392
395
 
458
461
    list_t *transactions;
459
462
 
460
463
    /** Log messages associated with this connection. */
461
 
    list_t *messages;
 
464
    list_t *messages;   
462
465
 
463
466
    /** Parsing flags: PIPELINED_CONNECTION. */
464
 
    unsigned int flags;
 
467
    unsigned int flags;   
465
468
 
466
469
    /** When was this connection opened? */
467
470
    htp_time_t open_timestamp;
468
471
 
469
472
    /** When was this connection closed? */
470
473
    htp_time_t close_timestamp;
471
 
 
 
474
    
472
475
    /** Inbound data counter. */
473
476
    size_t in_data_counter;
474
477
 
484
487
 
485
488
struct htp_connp_t {
486
489
    // General fields
487
 
 
 
490
    
488
491
    /** Current parser configuration structure. */
489
492
    htp_cfg_t *cfg;
490
493
 
498
501
    htp_conn_t *conn;
499
502
 
500
503
    /** Opaque user data associated with this parser. */
501
 
    void *user_data;
 
504
    void *user_data;   
502
505
 
503
506
    /** On parser failure, this field will contain the error information. Do note, however,
504
507
     *  that the value in this field will only be valid immediately after an error condition,
545
548
    size_t in_line_size;
546
549
 
547
550
    /** Lenght of the current request line. */
548
 
    size_t in_line_len;
 
551
    size_t in_line_len;    
549
552
 
550
553
    /** Ongoing inbound transaction. */
551
 
    htp_tx_t *in_tx;
 
554
    htp_tx_t *in_tx;   
552
555
 
553
556
    /** The request header line currently being processed. */
554
557
    htp_header_line_t *in_header_line;
616
619
    size_t out_line_size;
617
620
 
618
621
    /** Lenght of the current response line. */
619
 
    size_t out_line_len;
620
 
 
 
622
    size_t out_line_len;       
 
623
        
621
624
    /** Ongoing outbound transaction */
622
625
    htp_tx_t *out_tx;
623
626
 
701
704
 
702
705
    /** Parsing flags: HTP_FIELD_INVALID_NOT_FATAL, HTP_FIELD_INVALID_FATAL, HTP_FIELD_LONG */
703
706
    unsigned int flags;
704
 
 
 
707
    
705
708
    /** Header that uses this line. */
706
709
    htp_header_t *header;
707
710
};
711
714
    bstr *name;
712
715
 
713
716
    /** Header value. */
714
 
    bstr *value;
 
717
    bstr *value;   
715
718
 
716
719
    /** Parsing flags: HTP_FIELD_INVALID_NOT_FATAL, HTP_FIELD_FOLDED, HTP_FIELD_REPEATED */
717
720
    unsigned int flags;
735
738
 
736
739
    /** The user data associated with this transaction. */
737
740
    void *user_data;
738
 
 
 
741
    
739
742
    // Request
740
743
    unsigned int request_ignored_lines;
741
744
 
773
776
    int request_protocol_number;
774
777
 
775
778
    /** Is this request using a short-style HTTP/0.9 request? */
776
 
    int protocol_is_simple;
 
779
    int protocol_is_simple;   
777
780
 
778
781
    /** This structure holds a parsed request_uri, with the missing information
779
782
     *  added (e.g., adding port number from the TCP information) and the fields
817
820
     *  request that uses PUT (in which case this field will be equal to the
818
821
     *  entity length field). This field will be zero in all other cases.
819
822
     */
820
 
    size_t request_filedata_len;
 
823
    size_t request_filedata_len;        
821
824
 
822
825
    /** Original request header lines. This list stores instances of htp_header_line_t. */
823
826
    list_t *request_header_lines;
873
876
    bstr *response_message;
874
877
 
875
878
    /** Have we seen the server respond with a 100 response? */
876
 
    int seen_100continue;
 
879
    int seen_100continue;   
877
880
 
878
881
    /** Original response header lines. */
879
882
    list_t *response_header_lines;
899
902
    int response_transfer_coding;
900
903
 
901
904
    /** Compression; currently COMPRESSION_NONE or COMPRESSION_GZIP. */
902
 
    int response_content_encoding;
903
 
 
 
905
    int response_content_encoding;   
 
906
    
904
907
    // Common
905
908
 
906
909
    /** Parsing flags: HTP_INVALID_CHUNKING, HTP_INVALID_FOLDING,
963
966
 
964
967
htp_cfg_t *htp_config_copy(htp_cfg_t *cfg);
965
968
htp_cfg_t *htp_config_create();
966
 
      void htp_config_destroy(htp_cfg_t *cfg);
 
969
      void htp_config_destroy(htp_cfg_t *cfg); 
967
970
 
968
971
void htp_config_register_transaction_start(htp_cfg_t *cfg, int (*callback_fn)(htp_connp_t *));
969
972
void htp_config_register_request_line(htp_cfg_t *cfg, int (*callback_fn)(htp_connp_t *));
 
973
void htp_config_register_request_uri_normalize(htp_cfg_t *cfg, int (*callback_fn)(htp_connp_t *));
970
974
void htp_config_register_request_headers(htp_cfg_t *cfg, int (*callback_fn)(htp_connp_t *));
971
975
void htp_config_register_request_body_data(htp_cfg_t *cfg, int (*callback_fn)(htp_tx_data_t *));
972
976
void htp_config_register_request_trailer(htp_cfg_t *cfg, int (*callback_fn)(htp_connp_t *));