 |
Kea
1.5.0
|
Go to the documentation of this file.
13 #include <boost/lexical_cast.hpp>
21 : ctx_(NO_KEYWORD), trace_scanning_(false), trace_parsing_(false)
33 return (parseCommon());
38 FILE* f = fopen(filename.c_str(),
"r");
43 return (parseCommon());
47 Parser6Context::parseCommon() {
51 parser.set_debug_level(trace_parsing_);
53 int res = parser.parse();
93 const std::string& file = *loc.begin.filename;
94 const uint32_t line = loc.begin.line;
95 const uint32_t pos = loc.begin.column;
107 "missing parameter '" << name <<
"' ("
108 <<
stack_.back()->getPosition() <<
") ["
110 << open_loc <<
" and " << close_loc <<
"]");
117 cstack_.push_back(
ctx_);
125 if (cstack_.empty()) {
126 fatal(
"unbalanced syntactic context");
129 ctx_ = cstack_.back();
138 return (
"__no keyword__");
146 return (
"interfaces-config");
148 return (
"lease-database");
150 return (
"hosts-database");
152 return (
"database-type");
154 return (
"mac-sources");
156 return (
"host-reservation-identifiers");
158 return (
"hooks-libraries");
162 return (
"reservation-mode");
164 return (
"option-def");
166 return (
"option-data");
168 return (
"client-classes");
170 return (
"expired-leases-processing");
172 return (
"server-id");
174 return (
"duid-type");
176 return (
"control-socket");
178 return (
"dhcp-queue-control");
184 return (
"reservations");
190 return (
"output-options");
192 return (
"dhcp-ddns");
194 return (
"ncr-protocol");
196 return (
"ncr-format");
198 return (
"replace-client-name");
200 return (
"shared-networks");
202 return (
"sanity-checks");
204 return (
"config-control");
206 return (
"config-database");
208 return (
"__unknown__");
@ RESERVATIONS
Used while parsing Dhcp6/reservations structures.
Parser6Context()
Default constructor.
@ OPTION_DATA
Used while parsing Dhcp6/option-data, Dhcp6/subnet6/option-data or anywhere option-data is present (c...
@ SHARED_NETWORK
Used while parsing shared-networks structures.
@ CONFIG_DATABASE
Used while parsing config-control/config-databases.
@ CONTROL_SOCKET
Used while parsing Dhcp6/control-socket structures.
@ PD_POOLS
Used while parsing Dhcp6/subnet6/pd-pools structures.
const std::string contextName()
Get the syntactic context name.
@ DATABASE_TYPE
Used while parsing Dhcp6/*-database/type.
@ RELAY
Used while parsing Dhcp6/subnet6/relay structures.
void scanFileBegin(FILE *f, const std::string &filename, ParserType type)
Method called before scanning starts on a file.
ParserContext
Defines syntactic contexts for lexical tie-ins.
void scanStringBegin(const std::string &str, ParserType type)
Method called before scanning starts on a string.
@ NCR_PROTOCOL
Used while parsing Dhcp6/dhcp-ddns/ncr-protocol.
@ OUTPUT_OPTIONS
Used while parsing Logging/loggers/output_options structures.
void require(const std::string &name, isc::data::Element::Position open_loc, isc::data::Element::Position close_loc)
Check if a required parameter is present.
ParserType
Defines currently supported scopes.
virtual ~Parser6Context()
destructor
@ HOST_RESERVATION_IDENTIFIERS
Used while parsing Dhcp6/host-reservation-identifiers.
Defines the logger used by the top-level component of kea-dhcp-ddns.
@ REPLACE_CLIENT_NAME
Used while parsing Dhcp6/dhcp-ddns/replace-client-name.
@ CONFIG_CONTROL
Used while parsing Dhcp4/config-control.
void error(const isc::dhcp::location &loc, const std::string &what)
Error handler.
std::vector< isc::data::ElementPtr > stack_
JSON elements being parsed.
isc::data::ElementPtr parseFile(const std::string &filename, ParserType parser_type)
Run the parser on the file specified.
@ DUID_TYPE
Used while parsing Dhcp6/server-id/type structures.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
@ RESERVATION_MODE
Used while parsing Dhcp6/reservation-mode.
Represents the position of the data element within a configuration string.
@ SERVER_ID
Used while parsing Dhcp6/server-id structures.
void enter(const ParserContext &ctx)
Enter a new syntactic context.
@ DHCP_DDNS
Used while parsing Dhcp6/dhcp-ddns.
isc::data::ElementPtr parseString(const std::string &str, ParserType parser_type)
Run the parser on the string specified.
@ HOSTS_DATABASE
Used while parsing Dhcp6/hosts-database[s] structures.
void leave()
Leave a syntactic context.
ParserContext ctx_
Current syntactic context.
@ OPTION_DEF
Used while parsing Dhcp6/option-def structures.
void scanEnd()
Method called after the last tokens are scanned.
@ NCR_FORMAT
Used while parsing Dhcp6/dhcp-ddns/ncr-format.
@ MAC_SOURCES
Used while parsing Dhcp6/mac-sources structures.
@ DHCP_QUEUE_CONTROL
Used while parsing Dhcp4/dhcp-queue-control structures.
@ LOGGERS
Used while parsing Logging/loggers structures.
isc::data::Element::Position loc2pos(isc::dhcp::location &loc)
Converts bison's position to one understandable by isc::data::Element.
@ HOOKS_LIBRARIES
Used while parsing Dhcp6/hooks-libraries.
@ CLIENT_CLASSES
Used while parsing Dhcp6/client-classes structures.
@ SUBNET6
Used while parsing Dhcp6/Subnet6 structures.
static void fatal(const std::string &what)
Fatal error handler.
@ LOGGING
Used while parsing content of Logging.
@ CONFIG
Used while parsing content of Dhcp6.
boost::shared_ptr< Element > ElementPtr
@ INTERFACES_CONFIG
Used while parsing Dhcp6/interfaces structures.
Evaluation error exception raised when trying to parse.
boost::shared_ptr< const Element > ConstElementPtr
@ NO_KEYWORD
This one is used in pure JSON mode.
@ LEASE_DATABASE
Used while parsing Dhcp6/lease-database structures.
@ EXPIRED_LEASES_PROCESSING
Used while parsing Dhcp6/expired-leases-processing.
@ SANITY_CHECKS
Sanity checks.
@ POOLS
Used while parsing Dhcp6/subnet6/pools structures.