Kea 2.7.6
cfg_http_header.h
Go to the documentation of this file.
1// Copyright (C) 2024 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 CFG_HTTP_HEADER_H
8#define CFG_HTTP_HEADER_H
9
10#include <cc/cfg_to_element.h>
11#include <cc/data.h>
12#include <cc/user_context.h>
13#include <http/request.h>
14#include <http/response.h>
15
16namespace isc {
17namespace http {
18
25public:
27 std::string name_;
28
30 std::string value_;
31
36 CfgHttpHeader(const std::string& name, const std::string& value)
37 : name_(name), value_(value) {
38 }
39
43 virtual isc::data::ElementPtr toElement() const;
44};
45
47typedef std::vector<CfgHttpHeader> CfgHttpHeaders;
48
54template<typename HTTP_MSG>
55void copyHttpHeaders(const CfgHttpHeaders& headers, const HTTP_MSG& message) {
56 for (auto const& header : headers) {
57 message.context()->headers_.
58 push_back(HttpHeaderContext(header.name_, header.value_));
59 }
60}
61
67
74
75} // namespace http
76} // namespace isc
77
78#endif
Config HTTP header.
virtual isc::data::ElementPtr toElement() const
Unparses config HTTP header.
std::string name_
Header name.
std::string value_
Header value.
CfgHttpHeader(const std::string &name, const std::string &value)
Constructor.
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
void copyHttpHeaders(const CfgHttpHeaders &headers, const HTTP_MSG &message)
Copy config HTTP headers to message.
ElementPtr CfgHttpHeaderstoElement(const CfgHttpHeaders &headers)
Unparse config HTTP headers.
CfgHttpHeaders parseCfgHttpHeaders(const ConstElementPtr &config)
Parse config HTTP headers.
std::vector< CfgHttpHeader > CfgHttpHeaders
Collection of config HTTP headers.
Defines the logger used by the top-level component of kea-lfc.
Abstract class for configuration Cfg_* classes.
Base class for user context.