15 : direction_(direction), required_versions_(),
16 http_version_(
HttpVersion::HTTP_10()), required_headers_(),
17 created_(false), finalized_(false), headers_() {
38 const std::string& header_value) {
64 auto header_it =
headers_.find(hdr.getLowerCaseName());
66 return (header_it->second);
70 " not found in the request");
75 return (
getHeader(header_name)->getValue());
81 return (
getHeader(header_name)->getUint64Value());
83 }
catch (
const std::exception& ex) {
93 " message because the HttpMessage::create() must be"
94 " called first. This is a programmatic error");
102 " message because the HttpMessage::finalize() must be"
103 " called first. This is a programmatic error");
int version()
returns Kea hooks version.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Generic exception thrown by HttpMessage class.
HttpHeaderMap headers_
Parsed HTTP headers.
void requireHeaderValue(const std::string &header_name, const std::string &header_value)
Specifies a required value of a header in the message.
bool requiresBody() const
Checks if the body is required for the HTTP message.
HttpVersion http_version_
HTTP version numbers.
HttpVersion getHttpVersion() const
Returns HTTP version number (major and minor).
uint64_t getHeaderValueAsUint64(const std::string &header_name) const
Returns a value of the specified HTTP header as number.
void checkFinalized() const
Checks if the finalize was called.
void checkCreated() const
Checks if the create was called.
bool created_
Flag indicating whether create was called.
HttpMessage(const Direction &direction)
Constructor.
std::set< HttpVersion > required_versions_
Set of required HTTP versions.
virtual ~HttpMessage()
Destructor.
std::string getHeaderValue(const std::string &header_name) const
Returns a value of the specified HTTP header.
HttpHeaderPtr getHeader(const std::string &header_name) const
Returns object encapsulating HTTP header.
Direction
Specifies the direction of the HTTP message.
void requireHeader(const std::string &header_name)
Specifies a required HTTP header for the HTTP message.
bool finalized_
Flag indicating whether finalize was called.
void requireHttpVersion(const HttpVersion &version)
Specifies HTTP version allowed.
HttpHeaderMap required_headers_
Map holding required HTTP headers.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< HttpHeader > HttpHeaderPtr
Pointer to the HttpHeader class.
Defines the logger used by the top-level component of kea-lfc.