Kea  2.3.5-git
http_header.h
Go to the documentation of this file.
1 // Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef HTTP_HEADER_H
8 #define HTTP_HEADER_H
9 
10 #include <boost/shared_ptr.hpp>
11 #include <string>
12 
13 namespace isc {
14 namespace http {
15 
20 class HttpHeader {
21 public:
22 
27  explicit HttpHeader(const std::string& header_name,
28  const std::string& header_value = "");
29 
31  std::string getName() const {
32  return (header_name_);
33  }
34 
36  std::string getValue() const {
37  return (header_value_);
38  }
39 
43  uint64_t getUint64Value() const;
44 
46  std::string getLowerCaseName() const;
47 
49  std::string getLowerCaseValue() const;
50 
56  bool isValueEqual(const std::string& v) const;
57 
58 private:
59 
60  std::string header_name_;
61  std::string header_value_;
62 };
63 
65 typedef boost::shared_ptr<HttpHeader> HttpHeaderPtr;
66 
68 class HostHttpHeader : public HttpHeader {
69 public:
70 
75  explicit HostHttpHeader(const std::string& header_value = "")
76  : HttpHeader("Host", header_value) {
77  }
78 };
79 
81 typedef boost::shared_ptr<HostHttpHeader> HostHttpHeaderPtr;
82 
83 } // end of namespace isc::http
84 } // end of namespace isc
85 
86 #endif // HTTP_HEADER_H
boost::shared_ptr< HttpHeader > HttpHeaderPtr
Pointer to the HttpHeader class.
Definition: http_header.h:65
Represents HTTP Host header.
Definition: http_header.h:68
HostHttpHeader(const std::string &header_value="")
Constructor.
Definition: http_header.h:75
boost::shared_ptr< HostHttpHeader > HostHttpHeaderPtr
Pointer to the HTTP host header.
Definition: http_header.h:81
std::string getValue() const
Returns header value.
Definition: http_header.h:36
HttpHeader(const std::string &header_name, const std::string &header_value="")
Constructor.
Definition: http_header.cc:17
std::string getLowerCaseName() const
Returns lower case header name.
Definition: http_header.cc:34
bool isValueEqual(const std::string &v) const
Case insensitive comparison of header value.
Definition: http_header.cc:48
Defines the logger used by the top-level component of kea-lfc.
uint64_t getUint64Value() const
Returns header value as unsigned integer.
Definition: http_header.cc:23
std::string getLowerCaseValue() const
Returns lower case header value.
Definition: http_header.cc:41
Represents HTTP header including a header name and value.
Definition: http_header.h:20
std::string getName() const
Returns header name.
Definition: http_header.h:31