summaryrefslogtreecommitdiff
path: root/js/src/Ice/ProtocolInstance.js
blob: e401646c828706bb6feda7b3e1a73b59c21268cb (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
// **********************************************************************
//
// Copyright (c) 2003-present ZeroC, Inc. All rights reserved.
//
// **********************************************************************

const Ice = require("../Ice/ModuleRegistry").Ice;

//
// NOTE: the protocol instance class is a bit different from other
// language mappinps since it also provides the secure property for
// the tranport. Since we don't support SSL but still want to be able
// to parse SSL endpoints, we simply re-use the TCP endpoint with a
// different protocol instance to support SSL endpoints.
//
// If SSL endpoints attributes were to diverge from TCP endpoints or
// if we want to support SSL, we'd have to change this and instead, do
// like in other mappings: have a separate implementation for the SSL
// endpoint and suppress the secure member of the protocol instance
// class bellow.
//
class ProtocolInstance
{
    constructor(instance, type, protocol, secure)
    {
        this._instance = instance;
        this._traceLevel = instance.traceLevels().network;
        this._traceCategory = instance.traceLevels().networkCat;
        this._logger = instance.initializationData().logger;
        this._properties = instance.initializationData().properties;
        this._type = type;
        this._protocol = protocol;
        this._secure = secure;
    }

    traceLevel()
    {
        return this._traceLevel;
    }

    traceCategory()
    {
        return this._traceCategory;
    }

    logger()
    {
        return this._logger;
    }

    protocol()
    {
        return this._protocol;
    }

    type()
    {
        return this._type;
    }

    secure()
    {
        return this._secure;
    }

    properties()
    {
        return this._properties;
    }

    defaultHost()
    {
        return this._instance.defaultsAndOverrides().defaultHost;
    }

    defaultSourceAddress()
    {
        return this._instance.defaultsAndOverrides().defaultSourceAddress;
    }

    defaultEncoding()
    {
        return this._instance.defaultsAndOverrides().defaultEncoding;
    }

    defaultTimeout()
    {
        return this._instance.defaultsAndOverrides().defaultTimeout;
    }

    messageSizeMax()
    {
        return this._instance.messageSizeMax();
    }
}

Ice.ProtocolInstance = ProtocolInstance;
module.exports.Ice = Ice;