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
16
namespace
isc
{
17
namespace
http {
18
24
class
CfgHttpHeader
:
public
isc::data::UserContext
,
public
isc::data::CfgToElement
{
25
public
:
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
47
typedef
std::vector<CfgHttpHeader>
CfgHttpHeaders
;
48
54
template
<
typename
HTTP_MSG>
55
void
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
66
isc::data::ElementPtr
CfgHttpHeaderstoElement
(
const
CfgHttpHeaders
& headers);
67
73
CfgHttpHeaders
parseCfgHttpHeaders
(
const
isc::data::ConstElementPtr
& config);
74
75
}
// namespace http
76
}
// namespace isc
77
78
#endif
cfg_to_element.h
isc::http::CfgHttpHeader
Config HTTP header.
Definition
cfg_http_header.h:24
isc::http::CfgHttpHeader::toElement
virtual isc::data::ElementPtr toElement() const
Unparses config HTTP header.
Definition
cfg_http_header.cc:21
isc::http::CfgHttpHeader::name_
std::string name_
Header name.
Definition
cfg_http_header.h:27
isc::http::CfgHttpHeader::value_
std::string value_
Header value.
Definition
cfg_http_header.h:30
isc::http::CfgHttpHeader::CfgHttpHeader
CfgHttpHeader(const std::string &name, const std::string &value)
Constructor.
Definition
cfg_http_header.h:36
data.h
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition
data.h:29
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition
data.h:28
isc::http::copyHttpHeaders
void copyHttpHeaders(const CfgHttpHeaders &headers, const HTTP_MSG &message)
Copy config HTTP headers to message.
Definition
cfg_http_header.h:55
isc::http::CfgHttpHeaderstoElement
ElementPtr CfgHttpHeaderstoElement(const CfgHttpHeaders &headers)
Unparse config HTTP headers.
Definition
cfg_http_header.cc:30
isc::http::parseCfgHttpHeaders
CfgHttpHeaders parseCfgHttpHeaders(const ConstElementPtr &config)
Parse config HTTP headers.
Definition
cfg_http_header.cc:81
isc::http::CfgHttpHeaders
std::vector< CfgHttpHeader > CfgHttpHeaders
Collection of config HTTP headers.
Definition
cfg_http_header.h:47
isc
Defines the logger used by the top-level component of kea-lfc.
Definition
agent_parser.cc:148
request.h
response.h
isc::data::CfgToElement
Abstract class for configuration Cfg_* classes.
Definition
cfg_to_element.h:29
isc::data::UserContext
Base class for user context.
Definition
user_context.h:22
isc::http::HttpHeaderContext
HTTP header context.
Definition
header_context.h:19
user_context.h
src
lib
http
cfg_http_header.h
Generated on Tue Dec 24 2024 13:23:56 for Kea by
1.12.0