1 /* $Id: package.cpp,v 1.19 2007-05-09 21:23:09 adam Exp $
2 Copyright (c) 2005-2007, Index Data.
4 This file is part of Metaproxy.
6 Metaproxy is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
11 Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with Metaproxy; see the file LICENSE. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #include "package.hpp"
27 namespace mp = metaproxy_1;
29 mp::Package::Package()
34 mp::Package::~Package()
39 mp::Package::Package(mp::Session &session, const mp::Origin &origin)
40 : m_session(session), m_origin(origin),
46 mp::Package & mp::Package::copy_filter(const Package &p)
49 m_route_pos = p.m_route_pos->clone();
54 void mp::Package::move()
58 const filter::Base *next_filter = m_route_pos->move(0);
60 next_filter->process(*this);
64 void mp::Package::move(std::string route)
68 const char *r_cstr = route.length() ? route.c_str() : 0;
69 const filter::Base *next_filter = m_route_pos->move(r_cstr);
71 next_filter->process(*this);
76 mp::Session & mp::Package::session()
81 mp::Origin mp::Package::origin() const
86 mp::Origin & mp::Package::origin()
91 mp::Package & mp::Package::origin(const Origin & origin)
97 mp::Package & mp::Package::router(const mp::Router &router)
99 m_route_pos = router.createpos();
103 yazpp_1::GDU &mp::Package::request()
105 return m_request_gdu;
109 yazpp_1::GDU &mp::Package::response()
111 return m_response_gdu;
114 mp::Session mp::Package::session() const
119 std::ostream& std::operator<<(std::ostream& os, mp::Package& p)
121 os << p.origin() << " ";
122 os << p.session().id();
130 * indent-tabs-mode: nil
131 * c-file-style: "stroustrup"
133 * vim: shiftwidth=4 tabstop=8 expandtab