- // scope for locking Ostream
- {
- boost::mutex::scoped_lock scoped_lock(m_p->m_log_mutex);
- std::cout << receive_time << " " << m_p->m_msg;
- std::cout << " request id=" << package.session().id();
- std::cout << " close="
- << (package.session().is_closed() ? "yes" : "no")
- << "\n";
- gdu = package.request().get();
- if (gdu)
- {
- yp2::odr odr(ODR_PRINT);
- z_GDU(odr, &gdu, 0, 0);
+
+// static initialization
+std::list<yf::Log::Impl::LFilePtr> yf::Log::Impl::filter_log_files;
+
+
+yf::Log::Impl::Impl(const std::string &x)
+ : m_msg_config(x),
+ m_access(true),
+ m_user_access(false),
+ m_req_apdu(false),
+ m_res_apdu(false),
+ m_req_session(false),
+ m_res_session(false),
+ m_init_options(false),
+ m_time_format("%H:%M:%S-%d/%m")
+{
+ openfile("");
+}
+
+
+yf::Log::Impl::~Impl()
+{
+}
+
+
+void yf::Log::Impl::configure(const xmlNode *ptr)
+{
+ for (ptr = ptr->children; ptr; ptr = ptr->next)
+ {
+ if (ptr->type != XML_ELEMENT_NODE)
+ continue;
+ if (!strcmp((const char *) ptr->name, "message"))
+ m_msg_config = mp::xml::get_text(ptr);
+ else if (!strcmp((const char *) ptr->name, "filename"))
+ {
+ std::string fname = mp::xml::get_text(ptr);
+ openfile(fname);
+ }
+ else if (!strcmp((const char *) ptr->name, "time-format"))
+ {
+ m_time_format = mp::xml::get_text(ptr);
+ }
+ else if (!strcmp((const char *) ptr->name, "category"))
+ {
+ const struct _xmlAttr *attr;
+ for (attr = ptr->properties; attr; attr = attr->next)
+ {
+ if (!strcmp((const char *) attr->name, "access"))
+ m_access = mp::xml::get_bool(attr->children, true);
+ else if (!strcmp((const char *) attr->name, "user-access"))
+ m_user_access = mp::xml::get_bool(attr->children, true);
+ else if (!strcmp((const char *) attr->name, "request-apdu"))
+ m_req_apdu = mp::xml::get_bool(attr->children, true);
+ else if (!strcmp((const char *) attr->name, "response-apdu"))
+ m_res_apdu = mp::xml::get_bool(attr->children, true);
+ else if (!strcmp((const char *) attr->name, "apdu"))
+ {
+ m_req_apdu = mp::xml::get_bool(attr->children, true);
+ m_res_apdu = m_req_apdu;
+ }
+ else if (!strcmp((const char *) attr->name,
+ "request-session"))
+ m_req_session =
+ mp::xml::get_bool(attr->children, true);
+ else if (!strcmp((const char *) attr->name,
+ "response-session"))
+ m_res_session =
+ mp::xml::get_bool(attr->children, true);
+ else if (!strcmp((const char *) attr->name,
+ "session"))
+ {
+ m_req_session =
+ mp::xml::get_bool(attr->children, true);
+ m_res_session = m_req_session;
+ }
+ else if (!strcmp((const char *) attr->name,
+ "init-options"))
+ m_init_options =
+ mp::xml::get_bool(attr->children, true);
+ else if (!strcmp((const char *) attr->name,
+ "init-options"))
+ m_init_options =
+ mp::xml::get_bool(attr->children, true);
+ else
+ throw mp::filter::FilterException(
+ "Bad attribute " + std::string((const char *)
+ attr->name));
+ }
+ }
+ else
+ {
+ throw mp::filter::FilterException("Bad element "
+ + std::string((const char *)
+ ptr->name));