-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrpc_service_ptl.js
314 lines (289 loc) · 12.7 KB
/
rpc_service_ptl.js
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
"use strict";
var $protobuf = require("protobufjs/minimal");
// Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
// Exported root namespace
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
$root.rpc_service_ptl = (function() {
/**
* Namespace rpc_service_ptl.
* @exports rpc_service_ptl
* @namespace
*/
var rpc_service_ptl = {};
rpc_service_ptl.rpc_base_ptl = (function() {
/**
* Properties of a rpc_base_ptl.
* @memberof rpc_service_ptl
* @interface Irpc_base_ptl
* @property {string|null} [message] rpc_base_ptl message
* @property {rpc_service_ptl.rpc_base_ptl.calltype|null} [call] rpc_base_ptl call
* @property {number|null} [session] rpc_base_ptl session
* @property {Uint8Array|null} [payload] rpc_base_ptl payload
*/
/**
* Constructs a new rpc_base_ptl.
* @memberof rpc_service_ptl
* @classdesc Represents a rpc_base_ptl.
* @implements Irpc_base_ptl
* @constructor
* @param {rpc_service_ptl.Irpc_base_ptl=} [properties] Properties to set
*/
function rpc_base_ptl(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* rpc_base_ptl message.
* @member {string} message
* @memberof rpc_service_ptl.rpc_base_ptl
* @instance
*/
rpc_base_ptl.prototype.message = "";
/**
* rpc_base_ptl call.
* @member {rpc_service_ptl.rpc_base_ptl.calltype} call
* @memberof rpc_service_ptl.rpc_base_ptl
* @instance
*/
rpc_base_ptl.prototype.call = 0;
/**
* rpc_base_ptl session.
* @member {number} session
* @memberof rpc_service_ptl.rpc_base_ptl
* @instance
*/
rpc_base_ptl.prototype.session = 0;
/**
* rpc_base_ptl payload.
* @member {Uint8Array} payload
* @memberof rpc_service_ptl.rpc_base_ptl
* @instance
*/
rpc_base_ptl.prototype.payload = $util.newBuffer([]);
/**
* Creates a new rpc_base_ptl instance using the specified properties.
* @function create
* @memberof rpc_service_ptl.rpc_base_ptl
* @static
* @param {rpc_service_ptl.Irpc_base_ptl=} [properties] Properties to set
* @returns {rpc_service_ptl.rpc_base_ptl} rpc_base_ptl instance
*/
rpc_base_ptl.create = function create(properties) {
return new rpc_base_ptl(properties);
};
/**
* Encodes the specified rpc_base_ptl message. Does not implicitly {@link rpc_service_ptl.rpc_base_ptl.verify|verify} messages.
* @function encode
* @memberof rpc_service_ptl.rpc_base_ptl
* @static
* @param {rpc_service_ptl.Irpc_base_ptl} message rpc_base_ptl message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
rpc_base_ptl.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.message != null && message.hasOwnProperty("message"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.message);
if (message.call != null && message.hasOwnProperty("call"))
writer.uint32(/* id 2, wireType 0 =*/16).int32(message.call);
if (message.session != null && message.hasOwnProperty("session"))
writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.session);
if (message.payload != null && message.hasOwnProperty("payload"))
writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.payload);
return writer;
};
/**
* Encodes the specified rpc_base_ptl message, length delimited. Does not implicitly {@link rpc_service_ptl.rpc_base_ptl.verify|verify} messages.
* @function encodeDelimited
* @memberof rpc_service_ptl.rpc_base_ptl
* @static
* @param {rpc_service_ptl.Irpc_base_ptl} message rpc_base_ptl message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
rpc_base_ptl.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a rpc_base_ptl message from the specified reader or buffer.
* @function decode
* @memberof rpc_service_ptl.rpc_base_ptl
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {rpc_service_ptl.rpc_base_ptl} rpc_base_ptl
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
rpc_base_ptl.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.rpc_service_ptl.rpc_base_ptl();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.message = reader.string();
break;
case 2:
message.call = reader.int32();
break;
case 3:
message.session = reader.uint32();
break;
case 4:
message.payload = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a rpc_base_ptl message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof rpc_service_ptl.rpc_base_ptl
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {rpc_service_ptl.rpc_base_ptl} rpc_base_ptl
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
rpc_base_ptl.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a rpc_base_ptl message.
* @function verify
* @memberof rpc_service_ptl.rpc_base_ptl
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
rpc_base_ptl.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.message != null && message.hasOwnProperty("message"))
if (!$util.isString(message.message))
return "message: string expected";
if (message.call != null && message.hasOwnProperty("call"))
switch (message.call) {
default:
return "call: enum value expected";
case 0:
case 1:
break;
}
if (message.session != null && message.hasOwnProperty("session"))
if (!$util.isInteger(message.session))
return "session: integer expected";
if (message.payload != null && message.hasOwnProperty("payload"))
if (!(message.payload && typeof message.payload.length === "number" || $util.isString(message.payload)))
return "payload: buffer expected";
return null;
};
/**
* Creates a rpc_base_ptl message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof rpc_service_ptl.rpc_base_ptl
* @static
* @param {Object.<string,*>} object Plain object
* @returns {rpc_service_ptl.rpc_base_ptl} rpc_base_ptl
*/
rpc_base_ptl.fromObject = function fromObject(object) {
if (object instanceof $root.rpc_service_ptl.rpc_base_ptl)
return object;
var message = new $root.rpc_service_ptl.rpc_base_ptl();
if (object.message != null)
message.message = String(object.message);
switch (object.call) {
case "caller":
case 0:
message.call = 0;
break;
case "callee":
case 1:
message.call = 1;
break;
}
if (object.session != null)
message.session = object.session >>> 0;
if (object.payload != null)
if (typeof object.payload === "string")
$util.base64.decode(object.payload, message.payload = $util.newBuffer($util.base64.length(object.payload)), 0);
else if (object.payload.length)
message.payload = object.payload;
return message;
};
/**
* Creates a plain object from a rpc_base_ptl message. Also converts values to other types if specified.
* @function toObject
* @memberof rpc_service_ptl.rpc_base_ptl
* @static
* @param {rpc_service_ptl.rpc_base_ptl} message rpc_base_ptl
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
rpc_base_ptl.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.message = "";
object.call = options.enums === String ? "caller" : 0;
object.session = 0;
if (options.bytes === String)
object.payload = "";
else {
object.payload = [];
if (options.bytes !== Array)
object.payload = $util.newBuffer(object.payload);
}
}
if (message.message != null && message.hasOwnProperty("message"))
object.message = message.message;
if (message.call != null && message.hasOwnProperty("call"))
object.call = options.enums === String ? $root.rpc_service_ptl.rpc_base_ptl.calltype[message.call] : message.call;
if (message.session != null && message.hasOwnProperty("session"))
object.session = message.session;
if (message.payload != null && message.hasOwnProperty("payload"))
object.payload = options.bytes === String ? $util.base64.encode(message.payload, 0, message.payload.length) : options.bytes === Array ? Array.prototype.slice.call(message.payload) : message.payload;
return object;
};
/**
* Converts this rpc_base_ptl to JSON.
* @function toJSON
* @memberof rpc_service_ptl.rpc_base_ptl
* @instance
* @returns {Object.<string,*>} JSON object
*/
rpc_base_ptl.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* calltype enum.
* @name rpc_service_ptl.rpc_base_ptl.calltype
* @enum {string}
* @property {number} caller=0 caller value
* @property {number} callee=1 callee value
*/
rpc_base_ptl.calltype = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "caller"] = 0;
values[valuesById[1] = "callee"] = 1;
return values;
})();
return rpc_base_ptl;
})();
return rpc_service_ptl;
})();
module.exports = $root;