summaryrefslogtreecommitdiff
path: root/js/src/Ice/Protocol.d.ts
blob: 9f5f1e63b5e17ce4b990554fa7951d4f5c56e6ad (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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//

declare module "ice"
{
    namespace Ice
    {
        const Encoding_1_0:EncodingVersion;
        const Encoding_1_1:EncodingVersion;

        const Protocol_1_0:ProtocolVersion;

        class Protocol
        {
            //
            // Size of the Ice protocol header
            //
            // Magic number (4 bytes)
            // Protocol version major (Byte)
            // Protocol version minor (Byte)
            // Encoding version major (Byte)
            // Encoding version minor (Byte)
            // Message type (Byte)
            // Compression status (Byte)
            // Message size (Int)
            //
            static readonly headerSize:number;

            //
            // The magic number at the front of each message ['I', 'c', 'e', 'P']
            //
            static readonly magic:Uint8Array;

            //
            // The current Ice protocol and encoding version
            //
            static readonly protocolMajor:number;
            static readonly protocolMinor:number;
            static readonly protocolEncodingMajor:number;
            static readonly protocolEncodingMinor:number;

            static readonly encodingMajor:number;
            static readonly encodingMinor:number;

            //
            // The Ice protocol message types
            //
            static readonly requestMsg:number;
            static readonly requestBatchMsg:number;
            static readonly replyMsg:number;
            static readonly validateConnectionMsg:number;
            static readonly closeConnectionMsg:number;

            //
            // Reply status
            //
            static readonly replyOK:number;
            static readonly replyUserException:number;
            static readonly replyObjectNotExist:number;
            static readonly replyFacetNotExist:number;
            static readonly replyOperationNotExist:number;
            static readonly replyUnknownLocalException:number;
            static readonly replyUnknownUserException:number;
            static readonly replyUnknownException:number;

            static readonly requestHdr:Uint8Array;

            static readonly requestBatchHdr:Uint8Array;

            static readonly replyHdr:Uint8Array;

            static readonly currentProtocol:ProtocolVersion;
            static readonly currentProtocolEncoding:EncodingVersion;

            static currentEncoding:EncodingVersion;

            static checkSupportedProtocol(v:ProtocolVersion):void;
            static checkSupportedProtocolEncoding(v:EncodingVersion):void;
            static checkSupportedEncoding(version:EncodingVersion):void;

            //
            // Either return the given protocol if not compatible, or the greatest
            // supported protocol otherwise.
            //
            static getCompatibleProtocol(version:ProtocolVersion):ProtocolVersion;

            //
            // Either return the given encoding if not compatible, or the greatest
            // supported encoding otherwise.
            //
            static getCompatibleEncoding(version:EncodingVersion):EncodingVersion;

            static isSupported(version:ProtocolVersion, supported:ProtocolVersion):boolean;
            static isSupported(version:EncodingVersion, supported:EncodingVersion):boolean;

            static readonly OPTIONAL_END_MARKER:number;
            static readonly FLAG_HAS_TYPE_ID_STRING:number;
            static readonly FLAG_HAS_TYPE_ID_INDEX:number;
            static readonly FLAG_HAS_TYPE_ID_COMPACT:number;
            static readonly FLAG_HAS_OPTIONAL_MEMBERS:number;
            static readonly FLAG_HAS_INDIRECTION_TABLE:number;
            static readonly FLAG_HAS_SLICE_SIZE:number;
            static readonly FLAG_IS_LAST_SLICE:number;
        }

        /**
        * Converts a string to a protocol version.
        *
        * @param version The string to convert.
        *
        * @return The converted protocol version.
        **/
        function stringToProtocolVersion(version:string):ProtocolVersion;

        /**
        * Converts a string to an encoding version.
        *
        * @param version The string to convert.
        *
        * @return The converted object identity.
        **/
        function stringToEncodingVersion(version:string):EncodingVersion;

        /**
        * Converts a protocol version to a string.
        *
        * @param v The protocol version to convert.
        *
        * @return The converted string.
        **/
        function protocolVersionToString(version:ProtocolVersion):string;

        /**
         * Converts an encoding version to a string.
         *
         * @param v The encoding version to convert.
         *
         * @return The converted string.
         **/
        function encodingVersionToString(version:EncodingVersion):string;
    }
}