-## $Id: Makefile.am,v 1.54 2006-09-13 10:43:24 marc Exp $
+## $Id: Makefile.am,v 1.55 2006-09-26 13:02:50 marc Exp $
MAINTAINERCLEANFILES = Makefile.in config.in config.hpp
filter_virt_db.cpp filter_virt_db.hpp \
filter_z3950_client.cpp filter_z3950_client.hpp \
gduutil.cpp gduutil.hpp \
- origin.cpp package.cpp package.hpp \
+ origin.cpp origin.hpp \
+ package.cpp package.hpp \
pipe.cpp pipe.hpp \
plainfile.cpp \
router.hpp router_chain.hpp router_chain.cpp \
-/* $Id: origin.cpp,v 1.2 2006-09-26 11:37:08 marc Exp $
+/* $Id: origin.cpp,v 1.3 2006-09-26 13:02:50 marc Exp $
Copyright (c) 2005-2006, Index Data.
See the LICENSE file for details
*/
-#include "config.hpp"
-#include "package.hpp"
+//#include "config.hpp"
+#include "origin.hpp"
#include <iostream>
mp::Origin::Origin(std::string server_host,
unsigned int server_port)
- : type(API), address(""), origin_id(0),
+ : m_type(API), m_address(""), m_origin_id(0),
m_server_host(server_host), m_server_port(server_port)
{
}
void mp::Origin::set_tcpip_address(std::string addr, unsigned long s)
{
- address = addr;
- origin_id = s;
- type = TCPIP;
+ m_type = TCPIP;
+ m_address = addr;
+ m_origin_id = s;
}
std::ostream& std::operator<<(std::ostream& os, mp::Origin& o)
{
- if (o.address != "")
- os << o.address;
+ if (o.m_address != "")
+ os << o.m_address;
else
os << "0";
- os << ":" << o.origin_id;
+ os << ":" << o.m_origin_id;
return os;
}
-/* $Id: package.hpp,v 1.24 2006-09-26 11:37:08 marc Exp $
+/* $Id: package.hpp,v 1.25 2006-09-26 13:02:50 marc Exp $
Copyright (c) 2005-2006, Index Data.
See the LICENSE file for details
#define YP2_PACKAGE_HPP
#include <iosfwd>
-#include <stdexcept>
+
#include <yazpp/gdu.h>
#include "router.hpp"
#include "filter.hpp"
#include "session.hpp"
+#include "origin.hpp"
-namespace metaproxy_1
-{
- class Origin;
+namespace metaproxy_1 {
class Package;
}
namespace std
{
- std::ostream& operator<<(std::ostream& os, metaproxy_1::Origin& o);
std::ostream& operator<<(std::ostream& os, metaproxy_1::Package& p);
}
namespace metaproxy_1 {
-
- class Origin {
- friend std::ostream&
- std::operator<<(std::ostream& os, metaproxy_1::Origin& o);
-
- enum origin_t {
- API,
- UNIX,
- TCPIP
- } type;
- std::string address; // UNIX+TCPIP
- unsigned long origin_id;
- std::string m_server_host;
- unsigned int m_server_port;
- public:
- Origin(std::string server_host = "", unsigned int server_port = 0);
-
- /// get function - right val in assignment
- std::string server_host() const;
-
- /// get function - right val in assignment
- unsigned int server_port() const;
-
- void set_tcpip_address(std::string addr, unsigned long id);
- };
class Package {
public:
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
/// set function - can be chained
Package & origin(const Origin & origin);
+ /// set function - can be chained
Package & router(const Router &router);
yazpp_1::GDU &request();