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
20 #include <metaproxy/package.hpp>
24 namespace mp = metaproxy_1;
26 mp::Package::Package()
31 mp::Package::~Package()
36 mp::Package::Package(mp::Session &session, const mp::Origin &origin)
37 : m_session(session), m_origin(origin),
43 mp::Package & mp::Package::copy_filter(const Package &p)
46 m_route_pos = p.m_route_pos->clone();
51 void mp::Package::move()
55 const filter::Base *next_filter = m_route_pos->move(0);
57 next_filter->process(*this);
61 void mp::Package::move(std::string route)
65 const char *r_cstr = route.length() ? route.c_str() : 0;
66 const filter::Base *next_filter = m_route_pos->move(r_cstr);
68 next_filter->process(*this);
73 mp::Session & mp::Package::session()
78 mp::Origin mp::Package::origin() const
83 mp::Origin & mp::Package::origin()
88 mp::Package & mp::Package::origin(const Origin & origin)
94 mp::Package & mp::Package::router(const mp::Router &router)
96 m_route_pos = router.createpos();
100 yazpp_1::GDU &mp::Package::request()
102 return m_request_gdu;
106 yazpp_1::GDU &mp::Package::response()
108 return m_response_gdu;
111 mp::Session mp::Package::session() const
116 std::ostream& std::operator<<(std::ostream& os, mp::Package& p)
118 os << p.origin() << " ";
119 os << p.session().id();
127 * c-file-style: "Stroustrup"
128 * indent-tabs-mode: nil
130 * vim: shiftwidth=4 tabstop=8 expandtab