summaryrefslogtreecommitdiff
path: root/cs/src/Ice/ProtocolInstance.cs
blob: b8034db40366dde48f7a8e54d36f7737c582d687 (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// **********************************************************************
//
// Copyright (c) 2003-2015 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.
//
// **********************************************************************

namespace IceInternal
{
    using System.Net;
    using System.Collections.Generic;

    public class ProtocolInstance
    {
        public ProtocolInstance(Ice.Communicator communicator, short type, string protocol)
        {
            instance_ = Util.getInstance(communicator);
            traceLevel_ = instance_.traceLevels().network;
            traceCategory_ = instance_.traceLevels().networkCat;
            logger_ = instance_.initializationData().logger;
            properties_ = instance_.initializationData().properties;
            type_ = type;
            protocol_ = protocol;
        }

        public ProtocolInstance(Instance instance, short type, string protocol)
        {
            instance_ = instance;
            traceLevel_ = instance_.traceLevels().network;
            traceCategory_ = instance_.traceLevels().networkCat;
            logger_ = instance_.initializationData().logger;
            properties_ = instance_.initializationData().properties;
            type_ = type;
            protocol_ = protocol;
        }

        public int traceLevel()
        {
            return traceLevel_;
        }

        public string traceCategory()
        {
            return traceCategory_;
        }

        public Ice.Logger logger()
        {
            return logger_;
        }

        public string protocol()
        {
            return protocol_;
        }

        public short type()
        {
            return type_;
        }

        public Ice.Properties properties()
        {
            return properties_;
        }

        public bool preferIPv6()
        {
            return instance_.preferIPv6();
        }

        public int protocolSupport()
        {
            return instance_.protocolSupport();
        }

        public string defaultHost()
        {
            return instance_.defaultsAndOverrides().defaultHost;
        }

        public EndPoint defaultSourceAddress()
        {
            return instance_.defaultsAndOverrides().defaultSourceAddress;
        }

        public Ice.EncodingVersion defaultEncoding()
        {
            return instance_.defaultsAndOverrides().defaultEncoding;
        }

        public int defaultTimeout()
        {
            return instance_.defaultsAndOverrides().defaultTimeout;
        }

        public NetworkProxy networkProxy()
        {
            return instance_.networkProxy();
        }

        public int messageSizeMax()
        {
            return instance_.messageSizeMax();
        }

#if !SILVERLIGHT
        public void resolve(string host, int port, Ice.EndpointSelectionType type, IPEndpointI endpt,
                            EndpointI_connectors callback)
        {
            instance_.endpointHostResolver().resolve(host, port, type, endpt, callback);
        }
#endif

        protected Instance instance_;
        protected int traceLevel_;
        protected string traceCategory_;
        protected Ice.Logger logger_;
        protected Ice.Properties properties_;
        protected string protocol_;
        protected short type_;
    }

}