119 const std::string& header_value);
134 virtual void create() = 0;
150 virtual void reset() = 0;
181 virtual std::string
getBody()
const = 0;
187 virtual std::string
toString()
const = 0;
225 const std::set<T>& element_set)
const {
226 return (element_set.empty() || element_set.count(element) > 0);
265 #endif // HTTP_MESSAGE_H
boost::shared_ptr< HttpHeader > HttpHeaderPtr
Pointer to the HttpHeader class.
bool isFinalized() const
Checks if the message has been successfully finalized.
virtual void create()=0
Reads parsed message from the context, validates the message and stores parsed information.
Direction getDirection() const
Returns HTTP message direction.
Generic exception thrown by HttpMessage class.
std::string getHeaderValue(const std::string &header_name) const
Returns a value of the specified HTTP header.
bool finalized_
Flag indicating whether finalize was called.
Direction direction_
Message direction (inbound or outbound).
void requireHttpVersion(const HttpVersion &version)
Specifies HTTP version allowed.
HttpHeaderPtr getHeader(const std::string &header_name) const
Returns object encapsulating HTTP header.
void setDirection(const Direction &direction)
Sets direction for the HTTP message.
virtual ~HttpMessage()
Destructor.
bool created_
Flag indicating whether create was called.
HttpHeaderMap required_headers_
Map holding required HTTP headers.
Base class for HttpRequest and HttpResponse.
Direction
Specifies the direction of the HTTP message.
HttpVersion getHttpVersion() const
Returns HTTP version number (major and minor).
HttpMessageError(const char *file, size_t line, const char *what)
int version()
returns Kea hooks version.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
std::map< std::string, HttpHeaderPtr > HttpHeaderMap
Map of HTTP headers indexed by lower case header names.
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-dhcp-ddns.
void checkFinalized() const
Checks if the finalize was called.
virtual void finalize()=0
Complete parsing HTTP message or creating an HTTP outbound message.
virtual void reset()=0
Reset the state of the object.
HttpVersion http_version_
HTTP version numbers.
std::set< HttpVersion > required_versions_
Set of required HTTP versions.
virtual std::string getBody() const =0
Returns HTTP message body as string.
virtual std::string toString() const =0
Returns HTTP message as text.
void requireHeader(const std::string &header_name)
Specifies a required HTTP header for the HTTP message.
HttpHeaderMap headers_
Parsed HTTP headers.
void checkCreated() const
Checks if the create was called.
bool inRequiredSet(const T &element, const std::set< T > &element_set) const
Checks if the set is empty or the specified element belongs to this set.
void requireHeaderValue(const std::string &header_name, const std::string &header_value)
Specifies a required value of a header in the message.
uint64_t getHeaderValueAsUint64(const std::string &header_name) const
Returns a value of the specified HTTP header as number.
HttpMessage(const Direction &direction)
Constructor.
bool requiresBody() const
Checks if the body is required for the HTTP message.