1 //
2 // Copyright (c) ZeroC, Inc. All rights reserved.
3 //
4 
5 #ifndef ICE_TCP_ENDPOINT_I_H
6 #define ICE_TCP_ENDPOINT_I_H
7 
8 #include <IceUtil/Config.h>
9 #include <Ice/IPEndpointI.h>
10 #include <Ice/EndpointFactory.h>
11 #include <Ice/Network.h> // for IceIternal::Address
12 
13 namespace IceInternal
14 {
15 
16 class TcpEndpointI : public IPEndpointI
17 {
18 public:
19 
20     TcpEndpointI(const ProtocolInstancePtr&, const std::string&, Ice::Int, const Address&, Ice::Int, const std::string&,
21                  bool);
22     TcpEndpointI(const ProtocolInstancePtr&);
23     TcpEndpointI(const ProtocolInstancePtr&, Ice::InputStream*);
24 
25     virtual void streamWriteImpl(Ice::OutputStream*) const;
26 
27     virtual Ice::EndpointInfoPtr getInfo() const ICE_NOEXCEPT;
28 
29     virtual Ice::Int timeout() const;
30     virtual EndpointIPtr timeout(Ice::Int) const;
31     virtual bool compress() const;
32     virtual EndpointIPtr compress(bool) const;
33     virtual bool datagram() const;
34 
35     virtual TransceiverPtr transceiver() const;
36     virtual AcceptorPtr acceptor(const std::string&) const;
37     virtual std::string options() const;
38 
39 #ifdef ICE_CPP11_MAPPING
40     virtual bool operator==(const Ice::Endpoint&) const;
41     virtual bool operator<(const Ice::Endpoint&) const;
42 #else
43     virtual bool operator==(const Ice::LocalObject&) const;
44     virtual bool operator<(const Ice::LocalObject&) const;
45 #endif
46     TcpEndpointIPtr endpoint(const TcpAcceptorPtr&) const;
47 
48     using IPEndpointI::connectionId;
49 
50 protected:
51 
52     virtual void hashInit(Ice::Int&) const;
53     virtual void fillEndpointInfo(Ice::IPEndpointInfo*) const;
54     virtual bool checkOption(const std::string&, const std::string&, const std::string&);
55 
56     virtual ConnectorPtr createConnector(const Address&, const NetworkProxyPtr&) const;
57     virtual IPEndpointIPtr createEndpoint(const std::string&, int, const std::string&) const;
58 
59 private:
60 
61     //
62     // All members are const, because endpoints are immutable.
63     //
64     const Ice::Int _timeout;
65     const bool _compress;
66 };
67 
68 class TcpEndpointFactory : public EndpointFactory
69 {
70 public:
71 
72     TcpEndpointFactory(const ProtocolInstancePtr&);
73     virtual ~TcpEndpointFactory();
74 
75     virtual Ice::Short type() const;
76     virtual std::string protocol() const;
77     virtual EndpointIPtr create(std::vector<std::string>&, bool) const;
78     virtual EndpointIPtr read(Ice::InputStream*) const;
79     virtual void destroy();
80 
81     virtual EndpointFactoryPtr clone(const ProtocolInstancePtr&) const;
82 
83 private:
84 
85     ProtocolInstancePtr _instance;
86 };
87 
88 }
89 
90 #endif
91