-## $Id: Makefile.am,v 1.18 2005-10-14 11:18:59 adam Exp $
+## $Id: Makefile.am,v 1.19 2005-10-15 11:02:08 adam Exp $
MAINTAINERCLEANFILES = Makefile.in config.in config.hpp
lib_LTLIBRARIES = libyp2.la
libyp2_la_LDFLAGS = -version-info 0:0:0
-libyp2_la_SOURCES = filter_frontend_net.cpp filter_frontend_net.hpp \
+libyp2_la_SOURCES = \
session.cpp session.hpp package.hpp filter.hpp router.hpp \
- thread_pool_observer.cpp thread_pool_observer.hpp
+ thread_pool_observer.cpp thread_pool_observer.hpp \
+ filter_frontend_net.cpp filter_frontend_net.hpp \
+ filter_log.cpp filter_log.hpp
# Rules for programs..
#include "config.hpp"
#include "filter_frontend_net.hpp"
+#include "filter_log.hpp"
#include "router.hpp"
#include "session.hpp"
yp2::RouterChain router;
- // put in frontend first
+ // put frontend filter in router
yp2::FilterFrontendNet filter_front;
filter_front.ports() = ports;
}
router.rule(filter_front);
- // put in a backend
+ // put log filter in router
+ yp2::FilterLog filter_log;
+ router.rule(filter_log);
+
+ // put backend init filter in router
FilterInit filter_init;
router.rule(filter_init);
--- /dev/null
+
+
+#include "config.hpp"
+
+#include "filter.hpp"
+#include "router.hpp"
+#include "package.hpp"
+
+#include "filter_log.hpp"
+
+#include <yaz/zgdu.h>
+#include <yaz/log.h>
+
+#include <iostream>
+
+yp2::FilterLog::FilterLog() {}
+
+void yp2::FilterLog::process(Package &package) const {
+
+ Z_GDU *gdu;
+
+ gdu = package.request().get();
+ if (gdu)
+ {
+ ODR odr = odr_createmem(ODR_PRINT);
+ z_GDU(odr, &gdu, 0, 0);
+ odr_destroy(odr);
+ }
+ package.move();
+
+ gdu = package.response().get();
+ if (gdu)
+ {
+ ODR odr = odr_createmem(ODR_PRINT);
+ z_GDU(odr, &gdu, 0, 0);
+ odr_destroy(odr);
+ }
+}
+
+
--- /dev/null
+
+#ifndef FILTER_LOG_HPP
+#define FILTER_LOG_HPP
+
+#include <stdexcept>
+#include <vector>
+
+#include "filter.hpp"
+
+namespace yp2 {
+ class FilterLog : public yp2::Filter {
+ public:
+ FilterLog::FilterLog();
+ void process(yp2::Package & package) const;
+ };
+}
+
+#endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */