GPL v2.
[metaproxy-moved-to-github.git] / src / package.hpp
1 /* $Id: package.hpp,v 1.27 2007-05-09 21:23:09 adam Exp $
2    Copyright (c) 2005-2007, Index Data.
3
4 This file is part of Metaproxy.
5
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
9 version.
10
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
14 for more details.
15
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
19 02111-1307, USA.
20  */
21
22 #ifndef YP2_PACKAGE_HPP
23 #define YP2_PACKAGE_HPP
24
25 #include <iosfwd>
26
27 #include <yazpp/gdu.h>
28
29 #include "router.hpp"
30 #include "filter.hpp"
31 #include "session.hpp"
32 #include "origin.hpp"
33
34 namespace metaproxy_1 {
35     class Package;
36 }
37
38
39 namespace std 
40 {
41     std::ostream& operator<<(std::ostream& os, metaproxy_1::Package& p);
42 }
43
44 namespace metaproxy_1 {
45
46     class Package {
47     public:
48         Package();
49
50         ~Package();
51         
52         Package(metaproxy_1::Session &session, 
53                 const metaproxy_1::Origin &origin);
54
55         /// shallow copy constructor which only copies the filter chain info
56         Package & copy_filter(const Package &p);
57
58         /// send Package to it's next Filter defined in Router
59         void move();
60
61         /// send Package to other route
62         void move(std::string route);
63         
64         /// access session - left val in assignment
65         metaproxy_1::Session & session();
66         
67         /// get function - right val in assignment
68         Origin origin() const;
69         
70         /// set function - left val in assignment
71         Origin & origin();
72         
73         /// set function - can be chained
74         Package & origin(const Origin & origin);
75
76         /// set function - can be chained
77         Package & router(const Router &router);
78
79         yazpp_1::GDU &request();
80
81         yazpp_1::GDU &response();
82                 
83         /// get function - right val in assignment
84         Session session() const;
85         
86     private:
87         Session m_session;
88         Origin m_origin;
89
90         RoutePos *m_route_pos;
91
92         //int m_data;
93         
94         yazpp_1::GDU m_request_gdu;
95         yazpp_1::GDU m_response_gdu;
96     };
97 }
98
99
100
101 #endif
102 /*
103  * Local variables:
104  * c-basic-offset: 4
105  * indent-tabs-mode: nil
106  * c-file-style: "stroustrup"
107  * End:
108  * vim: shiftwidth=4 tabstop=8 expandtab
109  */