1 /* This file is part of Metaproxy.
2 Copyright (C) 2005-2011 Index Data
4 Metaproxy is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef YP2_PACKAGE_HPP
20 #define YP2_PACKAGE_HPP
24 #include <yazpp/gdu.h>
28 #include "session.hpp"
31 namespace metaproxy_1 {
38 std::ostream& operator<<(std::ostream& os, const metaproxy_1::Package& p);
41 namespace metaproxy_1 {
49 Package(metaproxy_1::Session &session,
50 const metaproxy_1::Origin &origin);
52 /// copy constructor which copies route pos + logger
53 Package & copy_filter(const Package &p);
55 /// copy constructor which only copies the filter chain info
56 void copy_route(const Package &p);
58 /// send Package to it's next Filter defined in Router
61 /// send Package to other route
62 void move(std::string route);
64 /// access session - left val in assignment
65 metaproxy_1::Session & session();
67 /// get function - right val in assignment
68 Origin origin() const;
70 /// set function - left val in assignment
73 /// set function - can be chained
74 Package & router(const Router &router);
76 yazpp_1::GDU &request();
78 yazpp_1::GDU &response();
80 /// get function - right val in assignment
81 Session session() const;
83 void log(const char *module, int level, const char *fmt, ...);
84 void log_write(const char *buf, size_t sz);
85 void log_enable(void);
86 void log_reset(std::string &res);
89 typedef boost::shared_ptr<PackageLogger> PackageLoggerPtr;
95 RoutePos *m_route_pos;
97 PackageLoggerPtr p_logger;
99 yazpp_1::GDU m_request_gdu;
100 yazpp_1::GDU m_response_gdu;
108 * c-file-style: "Stroustrup"
109 * indent-tabs-mode: nil
111 * vim: shiftwidth=4 tabstop=8 expandtab