X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Fpackage.hpp;h=69fbcb77084d0f38aef649478b35418157d3d862;hb=6afc47267f76271433a958b94b2f534dd347c18e;hp=85bcb4525ea9615895c9baf891930f05731b2d03;hpb=b87d59a4add20f61400cfb77a9256dd26c243fb7;p=metaproxy-moved-to-github.git diff --git a/src/package.hpp b/src/package.hpp index 85bcb45..69fbcb7 100644 --- a/src/package.hpp +++ b/src/package.hpp @@ -1,33 +1,44 @@ -/* $Id: package.hpp,v 1.13 2006-01-09 13:53:13 adam Exp $ - Copyright (c) 2005, Index Data. +/* This file is part of Metaproxy. + Copyright (C) 2005-2010 Index Data -%LICENSE% - */ +Metaproxy is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #ifndef YP2_PACKAGE_HPP #define YP2_PACKAGE_HPP -#include -#include -#include +#include + +#include #include "router.hpp" #include "filter.hpp" #include "session.hpp" +#include "origin.hpp" -namespace yp2 { - - class Origin { - enum origin_t { - API, - UNIX, - TCPIP - } type; - std::string address; // UNIX+TCPIP - int port; // TCPIP only - public: - Origin() : type(API) {}; - }; +namespace metaproxy_1 { + class Package; +} + + +namespace std +{ + std::ostream& operator<<(std::ostream& os, metaproxy_1::Package& p); +} + +namespace metaproxy_1 { class Package { public: @@ -35,24 +46,20 @@ namespace yp2 { ~Package(); - Package(yp2::Session &session, yp2::Origin &origin); + Package(metaproxy_1::Session &session, + const metaproxy_1::Origin &origin); + /// shallow copy constructor which only copies the filter chain info Package & copy_filter(const Package &p); /// send Package to it's next Filter defined in Router void move(); - - /// access session - left val in assignment - yp2::Session & session(); - - /// get function - right val in assignment - int data() const; - /// set function - left val in assignment - int & data(); + /// send Package to other route + void move(std::string route); - /// set function - can be chained - Package & data(const int & data); + /// access session - left val in assignment + metaproxy_1::Session & session(); /// get function - right val in assignment Origin origin() const; @@ -63,6 +70,7 @@ namespace yp2 { /// set function - can be chained Package & origin(const Origin & origin); + /// set function - can be chained Package & router(const Router &router); yazpp_1::GDU &request(); @@ -78,19 +86,22 @@ namespace yp2 { RoutePos *m_route_pos; - int m_data; + //int m_data; yazpp_1::GDU m_request_gdu; yazpp_1::GDU m_response_gdu; }; } + + #endif /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil - * c-file-style: "stroustrup" * End: * vim: shiftwidth=4 tabstop=8 expandtab */ +