summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/NetworkProxy.h
blob: 22714afbccd356a9cd93885cd7f11e2508f7ada9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//

#ifndef ICE_NETWORK_PROXY_H
#define ICE_NETWORK_PROXY_H

#include <Ice/Network.h>
#include <Ice/Buffer.h>

namespace IceInternal
{

class ICE_API NetworkProxy : public virtual IceUtil::Shared
{
public:

    virtual ~NetworkProxy();

    //
    // Write the connection request on the connection established
    // with the network proxy server. This is called right after
    // the connection establishment succeeds.
    //
    virtual void beginWrite(const Address&, Buffer&) = 0;
    virtual SocketOperation endWrite(Buffer&) = 0;

    //
    // Once the connection request has been sent, this is called
    // to prepare and read the response from the proxy server.
    //
    virtual void beginRead(Buffer&) = 0;
    virtual SocketOperation endRead(Buffer&) = 0;

    //
    // This is called when the response from the proxy has been
    // read. The proxy should copy the extra read data (if any) in the
    // given byte vector.
    //
    virtual void finish(Buffer&, Buffer&) = 0;

    //
    // If the proxy host needs to be resolved, this should return
    // a new NetworkProxy containing the IP address of the proxy.
    // This is called from the endpoint host resolver thread, so
    // it's safe if this this method blocks.
    //
    virtual NetworkProxyPtr resolveHost(ProtocolSupport) const = 0;

    //
    // Returns the IP address of the network proxy. This method
    // must not block. It's only called on a network proxy object
    // returned by resolveHost().
    //
    virtual Address getAddress() const = 0;

    //
    // Returns the name of the proxy, used for tracing purposes.
    //
    virtual std::string getName() const = 0;

    //
    // Returns the protocols supported by the proxy.
    //
    virtual ProtocolSupport getProtocolSupport() const = 0;
};

NetworkProxyPtr createNetworkProxy(const Ice::PropertiesPtr&, ProtocolSupport);

}

#endif