19#include <boost/algorithm/string/split.hpp>
20#include <boost/algorithm/string/classification.hpp>
26namespace flex_option {
154 return (option_config_map_);
169 template <
typename PktType>
171 PktType query, PktType response) {
178 switch (opt_cfg->getAction()) {
193 std::vector<std::string> split_vec =
195 opt = def->optionFactory(universe, opt_cfg->getCode(),
198 buffer.assign(value.begin(), value.end());
204 response->addOption(opt);
215 response->delOption(opt_cfg->getCode());
216 opt = response->getOption(opt_cfg->getCode());
220 std::vector<std::string> split_vec =
222 opt = def->optionFactory(universe, opt_cfg->getCode(),
225 buffer.assign(value.begin(), value.end());
231 response->addOption(opt);
245 response->delOption(opt_cfg->getCode());
246 opt = response->getOption(opt_cfg->getCode());
259 void logAction(
Action action, uint16_t code,
const std::string& value)
const;
266 return (option_config_map_);
Universe
defines option universe DHCPv4 or DHCPv6
virtual ~OptionConfig()
Destructor.
void setExpr(const isc::dhcp::ExpressionPtr &expr)
Set match expression.
const isc::dhcp::ExpressionPtr & getExpr() const
Get match expression.
uint16_t getCode() const
Return option code.
OptionConfig(uint16_t code, isc::dhcp::OptionDefinitionPtr def)
Constructor.
Action getAction() const
Return action.
isc::dhcp::OptionDefinitionPtr getOptionDef() const
Return option definition.
void setText(const std::string &text)
Set textual expression.
void setAction(Action action)
Set action.
const std::string & getText() const
Get textual expression.
Flex Option implementation.
void configure(isc::data::ConstElementPtr options)
Configure the Flex Option implementation.
const OptionConfigMap & getOptionConfigMap() const
Get the option config map.
boost::shared_ptr< OptionConfig > OptionConfigPtr
The type of shared pointers to option config.
~FlexOptionImpl()
Destructor.
void process(isc::dhcp::Option::Universe universe, PktType query, PktType response)
Process a query / response pair.
OptionConfigMap & getMutableOptionConfigMap()
Get a mutable reference to the option config map.
void logAction(Action action, uint16_t code, const std::string &value) const
Log the action.
FlexOptionImpl()
Constructor.
std::map< uint16_t, OptionConfigPtr > OptionConfigMap
The type of the option config map.
boost::shared_ptr< const Element > ConstElementPtr
std::string evaluateString(const Expression &expr, Pkt &pkt)
boost::shared_ptr< OptionDefinition > OptionDefinitionPtr
Pointer to option definition object.
boost::shared_ptr< Expression > ExpressionPtr
bool evaluateBool(const Expression &expr, Pkt &pkt)
Evaluate a RPN expression for a v4 or v6 packet and return a true or false decision.
std::vector< uint8_t > OptionBuffer
buffer types used in DHCP code.
boost::shared_ptr< Option > OptionPtr
boost::shared_ptr< FlexOptionImpl > FlexOptionImplPtr
The type of shared pointers to Flex Option implementations.
vector< string > tokens(const std::string &text, const std::string &delim, bool escape)
Split String into Tokens.
Defines the logger used by the top-level component of kea-lfc.