summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ProtocolInstance.cpp
blob: c0f84c3268278c79b1202b1634bd95c5e118eab4 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// **********************************************************************
//
// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

#include <Ice/ProtocolInstance.h>
#include <Ice/Instance.h>
#include <Ice/Initialize.h>
#include <Ice/IPEndpointI.h>
#include <Ice/DefaultsAndOverrides.h>
#include <Ice/TraceLevels.h>

using namespace std;
using namespace Ice;
using namespace IceInternal;

IceUtil::Shared* IceInternal::upCast(ProtocolInstance* p) { return p; }

IceInternal::ProtocolInstance::ProtocolInstance(const CommunicatorPtr& com, Short type, const string& protocol,
                                                 bool secure) :
    _instance(getInstance(com)),
    _traceLevel(_instance->traceLevels()->network),
    _traceCategory(_instance->traceLevels()->networkCat),
    _properties(_instance->initializationData().properties),
    _protocol(protocol),
    _type(type),
    _secure(secure)
{
}

IceInternal::ProtocolInstance::ProtocolInstance(const InstancePtr& instance, Short type, const string& protocol,
                                                bool secure) :
    _instance(instance),
    _traceLevel(_instance->traceLevels()->network),
    _traceCategory(_instance->traceLevels()->networkCat),
    _properties(_instance->initializationData().properties),
    _protocol(protocol),
    _type(type),
    _secure(secure)
{
}

bool
IceInternal::ProtocolInstance::preferIPv6() const
{
    return _instance->preferIPv6();
}

ProtocolSupport
IceInternal::ProtocolInstance::protocolSupport() const
{
    return _instance->protocolSupport();
}

const string&
IceInternal::ProtocolInstance::defaultHost() const
{
    return _instance->defaultsAndOverrides()->defaultHost;
}

const Address&
IceInternal::ProtocolInstance::defaultSourceAddress() const
{
    return _instance->defaultsAndOverrides()->defaultSourceAddress;
}

const EncodingVersion&
IceInternal::ProtocolInstance::defaultEncoding() const
{
    return _instance->defaultsAndOverrides()->defaultEncoding;
}

int
IceInternal::ProtocolInstance::defaultTimeout() const
{
    return _instance->defaultsAndOverrides()->defaultTimeout;
}

NetworkProxyPtr
IceInternal::ProtocolInstance::networkProxy() const
{
    return _instance->networkProxy();
}

size_t
IceInternal::ProtocolInstance::messageSizeMax() const
{
    return _instance->messageSizeMax();
}

void
IceInternal::ProtocolInstance::resolve(const string& host, int port, EndpointSelectionType type,
                                       const IPEndpointIPtr& endpt, const EndpointI_connectorsPtr& cb) const
{
    _instance->endpointHostResolver()->resolve(host, port, type, endpt, cb);
}