bitz-server  0.1.6
response_header.h
1 /*
2  * C++ ICAP library
3  * Copyright (C) 2012 Uditha Atukorala
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19 
20 #ifndef ICAP_RESPONSE_HEADER_H
21 #define ICAP_RESPONSE_HEADER_H
22 
23 #include "header.h"
24 
25 
26 namespace icap {
27 
28  class ResponseHeader : public Header {
29  public:
30 
31  enum status_t {
32  CONTINUE = 100,
33  OK = 200,
34  NO_CONTENT = 204,
35  BAD_REQUEST = 400,
36  NOT_FOUND = 404,
37  NOT_ALLOWED = 405,
38  REQ_TIMEOUT = 408,
39  SERVER_ERROR = 500,
40  NOT_IMPLEMENTED = 501,
41  BAD_GATEWAY = 502,
42  SERVICE_OVERLOADED = 503,
43  NOT_SUPPORTED = 505
44  };
45 
46  struct response_t {
47  std::string protocol;
48  status_t status;
49  };
50 
51  ResponseHeader( status_t status );
52  virtual ~ResponseHeader();
53 
58  const std::string &protocol() const throw();
59 
64  const status_t &status() const throw();
65 
66  private:
67  response_t _response;
68 
69  void update_timestamp() throw();
70  void generate_istag() throw();
71  void init_defaults() throw();
72 
73  };
74 
75 } /* end of namespace icap */
76 
77 #endif /* !ICAP_RESPONSE_HEADER_H */
78 
Definition: response_header.h:46
const status_t & status() const
Definition: response_header.cpp:49
Definition: response_header.h:28
Definition: common.h:26
const std::string & protocol() const
Definition: response_header.cpp:44
Definition: header.h:33