Use =default for skeleton copy constructor
[ACE_TAO.git] / ACE / apps / JAWS2 / JAWS / Parse_Headers.h
blob3178681a22c695d92b52b1c6dbed04b9f72aaf25
1 /* -*- c++ -*- */
2 #ifndef JAWS_PARSE_HEADERS_H
3 #define JAWS_PARSE_HEADERS_H
5 #include "JAWS/Export.h"
6 #include "ace/Singleton.h"
8 #if !defined (ACE_LACKS_PRAGMA_ONCE)
9 # pragma once
10 #endif /* ACE_LACKS_PRAGMA_ONCE */
12 #include "ace/Message_Block.h"
13 #include "ace/Synch_Traits.h"
15 #include "Headers.h"
17 class JAWS_Export JAWS_Header_Info
19 public:
20 JAWS_Header_Info ();
21 ~JAWS_Header_Info ();
23 int end_of_line () const;
24 void end_of_line (int flag);
26 const char *last_header_name () const;
28 int last_header_length () const;
29 void last_header_length (int len);
31 const JAWS_Header_Data * last_header_data () const;
33 char *header_buf ();
35 void append_last_header_value (char c);
36 int append_last_header_value ();
37 void append_last_header_value (const char *begin, const char *end);
38 void reduce_last_header_value ();
40 void create_next_header_value (char *ht);
41 // This will insert last_header_data into the table if it is not
42 // null. Then, it will create a new header_data node and populate
43 // it. If ht is null, last_header_data is not inserted.
45 void finish_last_header_value ();
46 // This will insert last_header_data into the table if it is not
47 // null.
49 int end_of_headers () const;
50 void end_of_headers (int flag);
52 int status () const;
53 void status (int s);
55 JAWS_Headers *table ();
57 enum STATUS_CODE
59 STATUS_CODE_OK = 0,
60 STATUS_CODE_NO_MEMORY,
61 STATUS_CODE_TOO_LONG
64 enum
66 MAX_HEADER_LENGTH = 8192
68 // Note that RFC 822 does not mention the maximum length of a header
69 // line. So in theory, there is no maximum length.
70 // In Apache, they assume that each header line should not exceed
71 // 8K. Who am I to disagree?
73 void dump ();
75 private:
76 int end_of_headers_;
77 int end_of_line_;
79 JAWS_Header_Data *last_header_data_;
81 int last_header_length_;
82 int status_;
84 char header_buf_[MAX_HEADER_LENGTH];
85 JAWS_Headers table_;
88 class JAWS_Export JAWS_Parse_Headers
90 public:
91 int parse_headers (JAWS_Header_Info *info, ACE_Message_Block &mb);
92 // Return 0 means need more data, and call it again.
93 // Return 1 means all done or error.
95 int parse_header_name (JAWS_Header_Info *info, ACE_Message_Block &mb);
96 // Return 0 means reiterate on remaining input.
97 // Return 1 means input has ended (either because it ended
98 // prematurely, or that there are no more headers).
100 int parse_header_value (JAWS_Header_Info *info, ACE_Message_Block &mb);
101 // Return 0 means reiterate on remaining input.
102 // Return 1 means input has ended or that an error has occurred.
104 char * skipset (const char *set, char *start, char *end);
105 // Scans from start to end for characters that match skip set.
106 // Returns pointer to first location between start and end of a
107 // character that is in the skip set.
109 char * skipcset (const char *set, char *start, char *end);
110 // Scans from start to end for characters that match skip set.
111 // Returns pointer to first location between start and end of a
112 // character that is *not* in the skip set.
115 typedef ACE_Singleton<JAWS_Parse_Headers, ACE_SYNCH_MUTEX> JAWS_Parse_Headers_Singleton;
117 #endif /* !defined (JAWS_PARSE_HEADERS_H) */