Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / ACE / apps / JAWS2 / HTTPU / http_headers.h
blob839df6d7ff58f8314ebf4ff84ae116a7a8d33aa2
1 // by James Hu
2 // Borrowed from HTTP_Headers.*, which appears to be irrelevent now anyway.
4 #ifndef HTTPU_HTTP_HEADERS_H
5 #define HTTPU_HTTP_HEADERS_H
7 #include "ace/RB_Tree.h"
8 #include "ace/Null_Mutex.h"
10 #if !defined (ACE_LACKS_PRAGMA_ONCE)
11 # pragma once
12 #endif /* ACE_LACKS_PRAGMA_ONCE */
14 #include "ace/Singleton.h"
16 #include "JAWS/Parse_Headers.h"
17 #include "HTTPU/http_export.h"
19 // A header file on HP-UX defines SERVER
20 #if defined (SERVER)
21 #undef SERVER
22 #endif /* SERVER */
24 class HTTP_Headers;
26 class HTTPU_Export HTTP_Hdr_Node
28 // Constructor should be passed literal strings.
29 friend class HTTP_HCodes;
31 public:
32 operator int (void) const;
33 operator const char * (void) const;
34 const char * format (void) const;
36 private:
37 HTTP_Hdr_Node (const char *token, const char *format);
39 private:
40 int index_;
41 const char *token_;
42 const char *format_;
46 class HTTP_HCodes;
48 class HTTPU_Export HTTP_Header_Nodes : public ACE_RB_Tree<int, const HTTP_Hdr_Node *, ACE_Less_Than<int>, ACE_Null_Mutex>
50 friend class HTTP_HCodes;
51 friend class HTTP_Hdr_Node;
53 public:
54 HTTP_Header_Nodes (void);
56 private:
57 int num_header_strings_;
60 typedef ACE_Singleton<HTTP_Header_Nodes, ACE_SYNCH_MUTEX>
61 HTTP_Header_Nodes_Singleton;
63 class HTTPU_Export HTTP_HCodes
65 public:
66 HTTP_HCodes (void);
68 enum {
69 REPLACE_HEADER = 1, // Remove any existing header that matches first
70 APPEND_HEADER = 2, // Unconditionally append the header
71 INSERT_HEADER = 4, // Insert header if one does not already exist
72 APPENDTO_HEADER = 8 // Concatenate data to existing header value
75 static HTTP_Hdr_Node HTTP;
76 static HTTP_Hdr_Node ACCEPT;
77 static HTTP_Hdr_Node ACCEPTCHARSET;
78 static HTTP_Hdr_Node ACCEPTENCODING;
79 static HTTP_Hdr_Node ACCEPTLANGUAGE;
80 static HTTP_Hdr_Node ACCEPTRANGES;
81 static HTTP_Hdr_Node AGE;
82 static HTTP_Hdr_Node ALLOW;
83 static HTTP_Hdr_Node AUTHORIZATION;
84 static HTTP_Hdr_Node CACHECONTROL;
85 static HTTP_Hdr_Node CONNECTION;
86 static HTTP_Hdr_Node CONTENTENCODING;
87 static HTTP_Hdr_Node CONTENTLENGTH;
88 static HTTP_Hdr_Node CONTENTLOCATION;
89 static HTTP_Hdr_Node CONTENTMD5;
90 static HTTP_Hdr_Node CONTENTRANGE;
91 static HTTP_Hdr_Node CONTENTTYPE;
92 static HTTP_Hdr_Node DATE;
93 static HTTP_Hdr_Node ETAG;
94 static HTTP_Hdr_Node EXPECT;
95 static HTTP_Hdr_Node EXPIRES;
96 static HTTP_Hdr_Node FROM;
97 static HTTP_Hdr_Node HOST;
98 static HTTP_Hdr_Node IFMATCH;
99 static HTTP_Hdr_Node IFMODIFIEDSINCE;
100 static HTTP_Hdr_Node IFNONEMATCH;
101 static HTTP_Hdr_Node IFRANGE;
102 static HTTP_Hdr_Node IFUNMODIFIEDSINCE;
103 static HTTP_Hdr_Node LASTMODIFIED;
104 static HTTP_Hdr_Node LOCATION;
105 static HTTP_Hdr_Node MAXFORWARDS;
106 static HTTP_Hdr_Node PRAGMA;
107 static HTTP_Hdr_Node PROXYAUTHENTICATE;
108 static HTTP_Hdr_Node PROXYAUTHORIZATION;
109 static HTTP_Hdr_Node RANGE;
110 static HTTP_Hdr_Node REFERER;
111 static HTTP_Hdr_Node RETRYAFTER;
112 static HTTP_Hdr_Node SERVER;
113 static HTTP_Hdr_Node TE;
114 static HTTP_Hdr_Node TRAILER;
115 static HTTP_Hdr_Node TRANSFERENCODING;
116 static HTTP_Hdr_Node UPGRADE;
117 static HTTP_Hdr_Node USERAGENT;
118 static HTTP_Hdr_Node VARY;
119 static HTTP_Hdr_Node VIA;
120 static HTTP_Hdr_Node WARNING;
121 static HTTP_Hdr_Node WWWAUTHENTICATE;
122 static HTTP_Hdr_Node GET;
123 static HTTP_Hdr_Node HEAD;
124 static HTTP_Hdr_Node POST;
125 static HTTP_Hdr_Node PUT;
126 static HTTP_Hdr_Node QUIT;
127 static HTTP_Hdr_Node DUNNO;
128 static HTTP_Hdr_Node META;
129 static HTTP_Hdr_Node A;
130 static HTTP_Hdr_Node SCRIPT;
131 static HTTP_Hdr_Node APPLET;
133 static const int &NUM_HEADER_STRINGS;
135 protected:
137 const HTTP_Hdr_Node &hcode (int type) const;
139 protected:
141 HTTP_Header_Nodes *header_nodes_;
144 class HTTPU_Export HTTP_Headers : public JAWS_Header_Info, public HTTP_HCodes
146 public:
147 const char *header( int name ) const;
148 const char *value( int name );
149 const char *value_next( int name );
150 void value_reset ( void );
152 public:
153 HTTP_Headers (void);
155 const char *header_token (int name) const;
156 const char *header_strings (int name) const;
161 #if defined (ACE_HAS_INLINED_OSCALLS)
162 # if defined (ACE_INLINE)
163 # undef ACE_INLINE
164 # endif /* ACE_INLINE */
165 # define ACE_INLINE inline
166 # include "HTTPU/http_headers.inl"
167 # endif /* ACE_HAS_INLINED_OSCALLS */
169 #endif /* !defined (HTTPU_HTTP_HEADERS_HPP) */