13 #include <boost/shared_ptr.hpp>
191 return (error_message_);
212 void postBuffer(
const void* buf,
const size_t buf_size);
219 using StateModel::runModel;
222 virtual void defineEvents();
225 virtual void verifyEvents();
228 virtual void defineStates();
236 void feedFailure(
const std::string& error_msg);
241 virtual void onModelFailure(
const std::string& explanation);
257 char getNextFromBuffer();
272 void invalidEventError(
const std::string& handler_name,
273 const unsigned int event);
281 bool popNextFromBuffer(
char& next);
288 void receiveStartHandler();
291 void whiteSpaceBeforeJSONHandler();
294 void eolCommentBeforeJSONHandler();
297 void startCommentBeforeJSONHandler();
300 void cCommentBeforeJSONHandler();
303 void stopCommentBeforeJSONHandler();
306 void innerJSONHandler();
309 void stringJSONHandler();
312 void escapeJSONHandler();
315 void eolCommentHandler();
318 void startCommentHandler();
321 void cCommentHandler();
324 void stopCommentHandler();
327 void endJSONHandler();
332 std::vector<char> buffer_;
338 std::string error_message_;
342 uint64_t open_scopes_;
351 #endif // JSON_FEED_H
static const int DATA_READ_OK_EVT
Chunk of data successfully read and parsed.
JSONFeedError(const char *file, size_t line, const char *what)
void postBuffer(const void *buf, const size_t buf_size)
Receives additional data read from a data stream.
static const int START_COMMENT_BEFORE_JSON_ST
Starting one of the comments beginning with a slash before actual JSON.
Implements a finite state machine.
static const int FEED_FAILED_EVT
Invalid syntax detected.
static const int EOL_COMMENT_BEFORE_JSON_ST
Skipping an end-of-line comment before actual JSON.
static const int WHITESPACE_BEFORE_JSON_ST
Skipping whitespaces before actual JSON.
static const int FEED_OK_ST
Found opening and closing brace or square bracket.
static const int RECEIVE_START_ST
State indicating a beginning of a feed.
boost::shared_ptr< Element > ElementPtr
static const int MORE_DATA_PROVIDED_EVT
New data provided and parsing should continue.
A generic exception thrown upon an error in the JSONFeed.
std::string getProcessedText() const
Returns the text parsed into the buffer.
boost::shared_ptr< JSONFeed > JSONFeedPtr
Pointer to the JSONFeed.
static const int STRING_JSON_ST
Parsing JSON string.
static const int INNER_JSON_ST
Parsing JSON.
static const int NEED_MORE_DATA_EVT
Unable to proceed with parsing until new data is provided.
static const int ESCAPE_JSON_ST
JSON escape next character.
bool needData() const
Checks if the model needs additional data to continue.
static const int FEED_OK_EVT
Found opening brace and the matching closing brace.
static const int SM_DERIVED_EVENT_MIN
Value at which custom events in a derived class should begin.
static const int SM_DERIVED_STATE_MIN
Value at which custom states in a derived class should begin.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
static const int C_COMMENT_BEFORE_JSON_ST
Skipping a C style comment before actual JSON.
static const int START_COMMENT_ST
Starting one of the comments beginning with a slash.
State model for asynchronous read of data in JSON format.
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-dhcp-ddns.
std::string getErrorMessage() const
Returns error string when data processing has failed.
boost::shared_ptr< const JSONFeed > ConstJSONFeedPtr
Pointer to the const JSONFeed.
static const int STOP_COMMENT_BEFORE_JSON_ST
Stopping a C style comment before actual JSON.
static const int C_COMMENT_ST
Skipping a C style comment.
static const int JSON_END_ST
Found last closing brace or square bracket.
bool feedOk() const
Checks if the data have been successfully processed.
static const int STOP_COMMENT_ST
Stopping a C style comment.
data::ElementPtr toElement() const
Returns processed data as a structure of isc::data::Element objects.
This file defines the class StateModel.
static const int EOL_COMMENT_ST
Skipping an end-of-line comment.
static const int JSON_START_ST
Found first opening brace or square bracket.
void poll()
Runs the model as long as data is available.
void initModel()
Initializes state model.
static const int FEED_FAILED_ST
Invalid syntax detected.