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