-/* $Id: package.hpp,v 1.14 2006-01-11 11:51:50 adam Exp $
- Copyright (c) 2005, Index Data.
+/* $Id: package.hpp,v 1.24 2006-09-26 11:37:08 marc Exp $
+ Copyright (c) 2005-2006, Index Data.
-%LICENSE%
+ See the LICENSE file for details
*/
#ifndef YP2_PACKAGE_HPP
#define YP2_PACKAGE_HPP
-#include <iostream>
+#include <iosfwd>
#include <stdexcept>
-#include <yaz++/gdu.h>
+#include <yazpp/gdu.h>
#include "router.hpp"
#include "filter.hpp"
#include "session.hpp"
-namespace yp2 {
+namespace metaproxy_1
+{
+ class Origin;
+ 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
- int port; // TCPIP only
+ unsigned long origin_id;
+ std::string m_server_host;
+ unsigned int m_server_port;
public:
- Origin() : type(API) {};
+ 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 {
~Package();
- Package(yp2::Session &session, yp2::Origin &origin);
+ Package(metaproxy_1::Session &session,
+ const metaproxy_1::Origin &origin);
Package & copy_filter(const Package &p);
void move(std::string route);
/// 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();
-
- /// set function - can be chained
- Package & data(const int & data);
+ metaproxy_1::Session & session();
/// get function - right val in assignment
Origin origin() const;
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: