17#include <boost/shared_ptr.hpp>
43 timestamp_format_(
"%Y-%m-%d %H:%M:%S %Z"),
44 parameters_(parameters) {
97 virtual void writeln(
const std::string& text,
const std::string& addr) = 0;
114 virtual struct timespec
now() const;
139 virtual std::string
getNowString(
const std::string& format)
const;
153 static std::string
getTimeString(
const struct timespec& time,
const std::string& format);
178 static std::string
vectorHexDump(
const std::vector<uint8_t>& bytes,
179 const std::string& delimiter =
":");
186 static std::string
vectorDump(
const std::vector<uint8_t>& bytes);
197 return (request_expression_);
209 return (response_expression_);
225 return (timestamp_format_);
234 return (parameters_);
243 parameters_ = parameters;
264 std::string timestamp_format_;
274typedef std::map<ManagerID, std::pair<isc::db::DatabaseConnection::ParameterMap, LegalLogMgrPtr>>
LegalLogMgrPool;
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
std::map< std::string, std::string > ParameterMap
Database configuration parameter map.
Thrown if a LegalLogMgr encounters an error.
LegalLogMgrError(const char *file, size_t line, const char *what)
LegalLogMgr abstract class.
isc::dhcp::ExpressionPtr getResponseFormatExpression()
Gets response extended format expression for custom logging.
virtual struct tm currentTimeInfo() const
Returns the current local date and time.
void setRequestFormatExpression(const std::string &extended_format)
Sets request extended format expression for custom logging.
virtual bool isUnusable()
Flag which indicates if the forensic log backend has at least one unusable connection.
static void parseFile(const isc::data::ConstElementPtr ¶meters, isc::db::DatabaseConnection::ParameterMap &map)
Parse file specification.
static std::string vectorHexDump(const std::vector< uint8_t > &bytes, const std::string &delimiter=":")
Creates a string of hex digit pairs from a vector of bytes.
virtual void setParameters(isc::db::DatabaseConnection::ParameterMap parameters)
Sets backend parameters.
virtual std::string getType() const =0
Return backend type.
virtual ~LegalLogMgr()=default
Destructor.
std::string getTimestampFormat()
Gets the timestamp format used for logging.
static void parseDatabase(const isc::data::ConstElementPtr ¶meters, isc::db::DatabaseConnection::ParameterMap &map)
Parse database specification.
void setResponseFormatExpression(const std::string &extended_format)
Sets response extended format expression for custom logging.
virtual void writeln(const std::string &text, const std::string &addr)=0
Appends a string to the store with a timestamp and address.
static std::string genDurationString(const uint32_t secs)
Translates seconds into a text string of days, hours, minutes and seconds.
virtual struct timespec now() const
Returns the current system time.
static std::string getTimeString(const struct timespec &time, const std::string &format)
Returns a time as string.
virtual void close()=0
Closes the store.
virtual isc::db::DatabaseConnection::ParameterMap getParameters() const
Return backend parameters.
static std::string vectorDump(const std::vector< uint8_t > &bytes)
Creates a string from a vector of printable bytes.
LegalLogMgr(const isc::db::DatabaseConnection::ParameterMap parameters)
Constructor.
isc::dhcp::ExpressionPtr getRequestFormatExpression()
Gets request extended format expression for custom logging.
static void parseConfig(const isc::data::ConstElementPtr ¶meters, isc::db::DatabaseConnection::ParameterMap &map)
Parse database specification.
void setTimestampFormat(const std::string ×tamp_format)
Sets the timestamp format used for logging.
static void parseExtraParameters(const isc::data::ConstElementPtr ¶meters, isc::db::DatabaseConnection::ParameterMap &map)
Parse extra parameters which are not related to backend connection.
virtual void open()=0
Opens the store.
virtual std::string getNowString() const
Returns the current date and time as string.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< LegalLogMgr > LegalLogMgrPtr
Defines a smart pointer to a LegalLogMgr.
const string actionToVerb(Action action)
Translates an Action into its corresponding verb.
boost::shared_ptr< Expression > ExpressionPtr
std::map< ManagerID, std::pair< isc::db::DatabaseConnection::ParameterMap, LegalLogMgrPtr > > LegalLogMgrPool
LegalLogMgr pool.
uint64_t ManagerID
Manger ID used by hook libraries to retrieve respective LegalLogMgr instance.
Action
Describe what kind of event is being logged.
Defines the logger used by the top-level component of kea-lfc.