UNPKG

34.7 kBJavaScriptView Raw
1/**
2 * @fileoverview
3 * @enhanceable
4 * @suppress {messageConventions} JS Compiler reports an error if a variable or
5 * field starts with 'MSG_' and isn't a translatable message.
6 * @public
7 */
8// GENERATED CODE -- DO NOT EDIT!
9
10var jspb = require('google-protobuf');
11var goog = jspb;
12var global = Function('return this')();
13
14goog.exportSymbol('proto.protocol.Endpoint', null, global);
15goog.exportSymbol('proto.protocol.FindNeighbours', null, global);
16goog.exportSymbol('proto.protocol.Neighbours', null, global);
17goog.exportSymbol('proto.protocol.PingMessage', null, global);
18goog.exportSymbol('proto.protocol.PongMessage', null, global);
19
20/**
21 * Generated by JsPbCodeGenerator.
22 * @param {Array=} opt_data Optional initial data array, typically from a
23 * server response, or constructed directly in Javascript. The array is used
24 * in place and becomes part of the constructed object. It is not cloned.
25 * If no data is provided, the constructed object will be empty, but still
26 * valid.
27 * @extends {jspb.Message}
28 * @constructor
29 */
30proto.protocol.Endpoint = function(opt_data) {
31 jspb.Message.initialize(this, opt_data, 0, -1, null, null);
32};
33goog.inherits(proto.protocol.Endpoint, jspb.Message);
34if (goog.DEBUG && !COMPILED) {
35 proto.protocol.Endpoint.displayName = 'proto.protocol.Endpoint';
36}
37
38
39if (jspb.Message.GENERATE_TO_OBJECT) {
40/**
41 * Creates an object representation of this proto suitable for use in Soy templates.
42 * Field names that are reserved in JavaScript and will be renamed to pb_name.
43 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
44 * For the list of reserved names please see:
45 * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
46 * @param {boolean=} opt_includeInstance Whether to include the JSPB instance
47 * for transitional soy proto support: http://goto/soy-param-migration
48 * @return {!Object}
49 */
50proto.protocol.Endpoint.prototype.toObject = function(opt_includeInstance) {
51 return proto.protocol.Endpoint.toObject(opt_includeInstance, this);
52};
53
54
55/**
56 * Static version of the {@see toObject} method.
57 * @param {boolean|undefined} includeInstance Whether to include the JSPB
58 * instance for transitional soy proto support:
59 * http://goto/soy-param-migration
60 * @param {!proto.protocol.Endpoint} msg The msg instance to transform.
61 * @return {!Object}
62 * @suppress {unusedLocalVariables} f is only used for nested messages
63 */
64proto.protocol.Endpoint.toObject = function(includeInstance, msg) {
65 var f, obj = {
66 address: msg.getAddress_asB64(),
67 port: jspb.Message.getFieldWithDefault(msg, 2, 0),
68 nodeid: msg.getNodeid_asB64()
69 };
70
71 if (includeInstance) {
72 obj.$jspbMessageInstance = msg;
73 }
74 return obj;
75};
76}
77
78
79/**
80 * Deserializes binary data (in protobuf wire format).
81 * @param {jspb.ByteSource} bytes The bytes to deserialize.
82 * @return {!proto.protocol.Endpoint}
83 */
84proto.protocol.Endpoint.deserializeBinary = function(bytes) {
85 var reader = new jspb.BinaryReader(bytes);
86 var msg = new proto.protocol.Endpoint;
87 return proto.protocol.Endpoint.deserializeBinaryFromReader(msg, reader);
88};
89
90
91/**
92 * Deserializes binary data (in protobuf wire format) from the
93 * given reader into the given message object.
94 * @param {!proto.protocol.Endpoint} msg The message object to deserialize into.
95 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
96 * @return {!proto.protocol.Endpoint}
97 */
98proto.protocol.Endpoint.deserializeBinaryFromReader = function(msg, reader) {
99 while (reader.nextField()) {
100 if (reader.isEndGroup()) {
101 break;
102 }
103 var field = reader.getFieldNumber();
104 switch (field) {
105 case 1:
106 var value = /** @type {!Uint8Array} */ (reader.readBytes());
107 msg.setAddress(value);
108 break;
109 case 2:
110 var value = /** @type {number} */ (reader.readInt32());
111 msg.setPort(value);
112 break;
113 case 3:
114 var value = /** @type {!Uint8Array} */ (reader.readBytes());
115 msg.setNodeid(value);
116 break;
117 default:
118 reader.skipField();
119 break;
120 }
121 }
122 return msg;
123};
124
125
126/**
127 * Serializes the message to binary data (in protobuf wire format).
128 * @return {!Uint8Array}
129 */
130proto.protocol.Endpoint.prototype.serializeBinary = function() {
131 var writer = new jspb.BinaryWriter();
132 proto.protocol.Endpoint.serializeBinaryToWriter(this, writer);
133 return writer.getResultBuffer();
134};
135
136
137/**
138 * Serializes the given message to binary data (in protobuf wire
139 * format), writing to the given BinaryWriter.
140 * @param {!proto.protocol.Endpoint} message
141 * @param {!jspb.BinaryWriter} writer
142 * @suppress {unusedLocalVariables} f is only used for nested messages
143 */
144proto.protocol.Endpoint.serializeBinaryToWriter = function(message, writer) {
145 var f = undefined;
146 f = message.getAddress_asU8();
147 if (f.length > 0) {
148 writer.writeBytes(
149 1,
150 f
151 );
152 }
153 f = message.getPort();
154 if (f !== 0) {
155 writer.writeInt32(
156 2,
157 f
158 );
159 }
160 f = message.getNodeid_asU8();
161 if (f.length > 0) {
162 writer.writeBytes(
163 3,
164 f
165 );
166 }
167};
168
169
170/**
171 * optional bytes address = 1;
172 * @return {!(string|Uint8Array)}
173 */
174proto.protocol.Endpoint.prototype.getAddress = function() {
175 return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
176};
177
178
179/**
180 * optional bytes address = 1;
181 * This is a type-conversion wrapper around `getAddress()`
182 * @return {string}
183 */
184proto.protocol.Endpoint.prototype.getAddress_asB64 = function() {
185 return /** @type {string} */ (jspb.Message.bytesAsB64(
186 this.getAddress()));
187};
188
189
190/**
191 * optional bytes address = 1;
192 * Note that Uint8Array is not supported on all browsers.
193 * @see http://caniuse.com/Uint8Array
194 * This is a type-conversion wrapper around `getAddress()`
195 * @return {!Uint8Array}
196 */
197proto.protocol.Endpoint.prototype.getAddress_asU8 = function() {
198 return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
199 this.getAddress()));
200};
201
202
203/** @param {!(string|Uint8Array)} value */
204proto.protocol.Endpoint.prototype.setAddress = function(value) {
205 jspb.Message.setProto3BytesField(this, 1, value);
206};
207
208
209/**
210 * optional int32 port = 2;
211 * @return {number}
212 */
213proto.protocol.Endpoint.prototype.getPort = function() {
214 return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
215};
216
217
218/** @param {number} value */
219proto.protocol.Endpoint.prototype.setPort = function(value) {
220 jspb.Message.setProto3IntField(this, 2, value);
221};
222
223
224/**
225 * optional bytes nodeId = 3;
226 * @return {!(string|Uint8Array)}
227 */
228proto.protocol.Endpoint.prototype.getNodeid = function() {
229 return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
230};
231
232
233/**
234 * optional bytes nodeId = 3;
235 * This is a type-conversion wrapper around `getNodeid()`
236 * @return {string}
237 */
238proto.protocol.Endpoint.prototype.getNodeid_asB64 = function() {
239 return /** @type {string} */ (jspb.Message.bytesAsB64(
240 this.getNodeid()));
241};
242
243
244/**
245 * optional bytes nodeId = 3;
246 * Note that Uint8Array is not supported on all browsers.
247 * @see http://caniuse.com/Uint8Array
248 * This is a type-conversion wrapper around `getNodeid()`
249 * @return {!Uint8Array}
250 */
251proto.protocol.Endpoint.prototype.getNodeid_asU8 = function() {
252 return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
253 this.getNodeid()));
254};
255
256
257/** @param {!(string|Uint8Array)} value */
258proto.protocol.Endpoint.prototype.setNodeid = function(value) {
259 jspb.Message.setProto3BytesField(this, 3, value);
260};
261
262
263
264/**
265 * Generated by JsPbCodeGenerator.
266 * @param {Array=} opt_data Optional initial data array, typically from a
267 * server response, or constructed directly in Javascript. The array is used
268 * in place and becomes part of the constructed object. It is not cloned.
269 * If no data is provided, the constructed object will be empty, but still
270 * valid.
271 * @extends {jspb.Message}
272 * @constructor
273 */
274proto.protocol.PingMessage = function(opt_data) {
275 jspb.Message.initialize(this, opt_data, 0, -1, null, null);
276};
277goog.inherits(proto.protocol.PingMessage, jspb.Message);
278if (goog.DEBUG && !COMPILED) {
279 proto.protocol.PingMessage.displayName = 'proto.protocol.PingMessage';
280}
281
282
283if (jspb.Message.GENERATE_TO_OBJECT) {
284/**
285 * Creates an object representation of this proto suitable for use in Soy templates.
286 * Field names that are reserved in JavaScript and will be renamed to pb_name.
287 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
288 * For the list of reserved names please see:
289 * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
290 * @param {boolean=} opt_includeInstance Whether to include the JSPB instance
291 * for transitional soy proto support: http://goto/soy-param-migration
292 * @return {!Object}
293 */
294proto.protocol.PingMessage.prototype.toObject = function(opt_includeInstance) {
295 return proto.protocol.PingMessage.toObject(opt_includeInstance, this);
296};
297
298
299/**
300 * Static version of the {@see toObject} method.
301 * @param {boolean|undefined} includeInstance Whether to include the JSPB
302 * instance for transitional soy proto support:
303 * http://goto/soy-param-migration
304 * @param {!proto.protocol.PingMessage} msg The msg instance to transform.
305 * @return {!Object}
306 * @suppress {unusedLocalVariables} f is only used for nested messages
307 */
308proto.protocol.PingMessage.toObject = function(includeInstance, msg) {
309 var f, obj = {
310 from: (f = msg.getFrom()) && proto.protocol.Endpoint.toObject(includeInstance, f),
311 to: (f = msg.getTo()) && proto.protocol.Endpoint.toObject(includeInstance, f),
312 version: jspb.Message.getFieldWithDefault(msg, 3, 0),
313 timestamp: jspb.Message.getFieldWithDefault(msg, 4, 0)
314 };
315
316 if (includeInstance) {
317 obj.$jspbMessageInstance = msg;
318 }
319 return obj;
320};
321}
322
323
324/**
325 * Deserializes binary data (in protobuf wire format).
326 * @param {jspb.ByteSource} bytes The bytes to deserialize.
327 * @return {!proto.protocol.PingMessage}
328 */
329proto.protocol.PingMessage.deserializeBinary = function(bytes) {
330 var reader = new jspb.BinaryReader(bytes);
331 var msg = new proto.protocol.PingMessage;
332 return proto.protocol.PingMessage.deserializeBinaryFromReader(msg, reader);
333};
334
335
336/**
337 * Deserializes binary data (in protobuf wire format) from the
338 * given reader into the given message object.
339 * @param {!proto.protocol.PingMessage} msg The message object to deserialize into.
340 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
341 * @return {!proto.protocol.PingMessage}
342 */
343proto.protocol.PingMessage.deserializeBinaryFromReader = function(msg, reader) {
344 while (reader.nextField()) {
345 if (reader.isEndGroup()) {
346 break;
347 }
348 var field = reader.getFieldNumber();
349 switch (field) {
350 case 1:
351 var value = new proto.protocol.Endpoint;
352 reader.readMessage(value,proto.protocol.Endpoint.deserializeBinaryFromReader);
353 msg.setFrom(value);
354 break;
355 case 2:
356 var value = new proto.protocol.Endpoint;
357 reader.readMessage(value,proto.protocol.Endpoint.deserializeBinaryFromReader);
358 msg.setTo(value);
359 break;
360 case 3:
361 var value = /** @type {number} */ (reader.readInt32());
362 msg.setVersion(value);
363 break;
364 case 4:
365 var value = /** @type {number} */ (reader.readInt64());
366 msg.setTimestamp(value);
367 break;
368 default:
369 reader.skipField();
370 break;
371 }
372 }
373 return msg;
374};
375
376
377/**
378 * Serializes the message to binary data (in protobuf wire format).
379 * @return {!Uint8Array}
380 */
381proto.protocol.PingMessage.prototype.serializeBinary = function() {
382 var writer = new jspb.BinaryWriter();
383 proto.protocol.PingMessage.serializeBinaryToWriter(this, writer);
384 return writer.getResultBuffer();
385};
386
387
388/**
389 * Serializes the given message to binary data (in protobuf wire
390 * format), writing to the given BinaryWriter.
391 * @param {!proto.protocol.PingMessage} message
392 * @param {!jspb.BinaryWriter} writer
393 * @suppress {unusedLocalVariables} f is only used for nested messages
394 */
395proto.protocol.PingMessage.serializeBinaryToWriter = function(message, writer) {
396 var f = undefined;
397 f = message.getFrom();
398 if (f != null) {
399 writer.writeMessage(
400 1,
401 f,
402 proto.protocol.Endpoint.serializeBinaryToWriter
403 );
404 }
405 f = message.getTo();
406 if (f != null) {
407 writer.writeMessage(
408 2,
409 f,
410 proto.protocol.Endpoint.serializeBinaryToWriter
411 );
412 }
413 f = message.getVersion();
414 if (f !== 0) {
415 writer.writeInt32(
416 3,
417 f
418 );
419 }
420 f = message.getTimestamp();
421 if (f !== 0) {
422 writer.writeInt64(
423 4,
424 f
425 );
426 }
427};
428
429
430/**
431 * optional Endpoint from = 1;
432 * @return {?proto.protocol.Endpoint}
433 */
434proto.protocol.PingMessage.prototype.getFrom = function() {
435 return /** @type{?proto.protocol.Endpoint} */ (
436 jspb.Message.getWrapperField(this, proto.protocol.Endpoint, 1));
437};
438
439
440/** @param {?proto.protocol.Endpoint|undefined} value */
441proto.protocol.PingMessage.prototype.setFrom = function(value) {
442 jspb.Message.setWrapperField(this, 1, value);
443};
444
445
446proto.protocol.PingMessage.prototype.clearFrom = function() {
447 this.setFrom(undefined);
448};
449
450
451/**
452 * Returns whether this field is set.
453 * @return {!boolean}
454 */
455proto.protocol.PingMessage.prototype.hasFrom = function() {
456 return jspb.Message.getField(this, 1) != null;
457};
458
459
460/**
461 * optional Endpoint to = 2;
462 * @return {?proto.protocol.Endpoint}
463 */
464proto.protocol.PingMessage.prototype.getTo = function() {
465 return /** @type{?proto.protocol.Endpoint} */ (
466 jspb.Message.getWrapperField(this, proto.protocol.Endpoint, 2));
467};
468
469
470/** @param {?proto.protocol.Endpoint|undefined} value */
471proto.protocol.PingMessage.prototype.setTo = function(value) {
472 jspb.Message.setWrapperField(this, 2, value);
473};
474
475
476proto.protocol.PingMessage.prototype.clearTo = function() {
477 this.setTo(undefined);
478};
479
480
481/**
482 * Returns whether this field is set.
483 * @return {!boolean}
484 */
485proto.protocol.PingMessage.prototype.hasTo = function() {
486 return jspb.Message.getField(this, 2) != null;
487};
488
489
490/**
491 * optional int32 version = 3;
492 * @return {number}
493 */
494proto.protocol.PingMessage.prototype.getVersion = function() {
495 return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
496};
497
498
499/** @param {number} value */
500proto.protocol.PingMessage.prototype.setVersion = function(value) {
501 jspb.Message.setProto3IntField(this, 3, value);
502};
503
504
505/**
506 * optional int64 timestamp = 4;
507 * @return {number}
508 */
509proto.protocol.PingMessage.prototype.getTimestamp = function() {
510 return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
511};
512
513
514/** @param {number} value */
515proto.protocol.PingMessage.prototype.setTimestamp = function(value) {
516 jspb.Message.setProto3IntField(this, 4, value);
517};
518
519
520
521/**
522 * Generated by JsPbCodeGenerator.
523 * @param {Array=} opt_data Optional initial data array, typically from a
524 * server response, or constructed directly in Javascript. The array is used
525 * in place and becomes part of the constructed object. It is not cloned.
526 * If no data is provided, the constructed object will be empty, but still
527 * valid.
528 * @extends {jspb.Message}
529 * @constructor
530 */
531proto.protocol.PongMessage = function(opt_data) {
532 jspb.Message.initialize(this, opt_data, 0, -1, null, null);
533};
534goog.inherits(proto.protocol.PongMessage, jspb.Message);
535if (goog.DEBUG && !COMPILED) {
536 proto.protocol.PongMessage.displayName = 'proto.protocol.PongMessage';
537}
538
539
540if (jspb.Message.GENERATE_TO_OBJECT) {
541/**
542 * Creates an object representation of this proto suitable for use in Soy templates.
543 * Field names that are reserved in JavaScript and will be renamed to pb_name.
544 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
545 * For the list of reserved names please see:
546 * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
547 * @param {boolean=} opt_includeInstance Whether to include the JSPB instance
548 * for transitional soy proto support: http://goto/soy-param-migration
549 * @return {!Object}
550 */
551proto.protocol.PongMessage.prototype.toObject = function(opt_includeInstance) {
552 return proto.protocol.PongMessage.toObject(opt_includeInstance, this);
553};
554
555
556/**
557 * Static version of the {@see toObject} method.
558 * @param {boolean|undefined} includeInstance Whether to include the JSPB
559 * instance for transitional soy proto support:
560 * http://goto/soy-param-migration
561 * @param {!proto.protocol.PongMessage} msg The msg instance to transform.
562 * @return {!Object}
563 * @suppress {unusedLocalVariables} f is only used for nested messages
564 */
565proto.protocol.PongMessage.toObject = function(includeInstance, msg) {
566 var f, obj = {
567 from: (f = msg.getFrom()) && proto.protocol.Endpoint.toObject(includeInstance, f),
568 echo: jspb.Message.getFieldWithDefault(msg, 2, 0),
569 timestamp: jspb.Message.getFieldWithDefault(msg, 3, 0)
570 };
571
572 if (includeInstance) {
573 obj.$jspbMessageInstance = msg;
574 }
575 return obj;
576};
577}
578
579
580/**
581 * Deserializes binary data (in protobuf wire format).
582 * @param {jspb.ByteSource} bytes The bytes to deserialize.
583 * @return {!proto.protocol.PongMessage}
584 */
585proto.protocol.PongMessage.deserializeBinary = function(bytes) {
586 var reader = new jspb.BinaryReader(bytes);
587 var msg = new proto.protocol.PongMessage;
588 return proto.protocol.PongMessage.deserializeBinaryFromReader(msg, reader);
589};
590
591
592/**
593 * Deserializes binary data (in protobuf wire format) from the
594 * given reader into the given message object.
595 * @param {!proto.protocol.PongMessage} msg The message object to deserialize into.
596 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
597 * @return {!proto.protocol.PongMessage}
598 */
599proto.protocol.PongMessage.deserializeBinaryFromReader = function(msg, reader) {
600 while (reader.nextField()) {
601 if (reader.isEndGroup()) {
602 break;
603 }
604 var field = reader.getFieldNumber();
605 switch (field) {
606 case 1:
607 var value = new proto.protocol.Endpoint;
608 reader.readMessage(value,proto.protocol.Endpoint.deserializeBinaryFromReader);
609 msg.setFrom(value);
610 break;
611 case 2:
612 var value = /** @type {number} */ (reader.readInt32());
613 msg.setEcho(value);
614 break;
615 case 3:
616 var value = /** @type {number} */ (reader.readInt64());
617 msg.setTimestamp(value);
618 break;
619 default:
620 reader.skipField();
621 break;
622 }
623 }
624 return msg;
625};
626
627
628/**
629 * Serializes the message to binary data (in protobuf wire format).
630 * @return {!Uint8Array}
631 */
632proto.protocol.PongMessage.prototype.serializeBinary = function() {
633 var writer = new jspb.BinaryWriter();
634 proto.protocol.PongMessage.serializeBinaryToWriter(this, writer);
635 return writer.getResultBuffer();
636};
637
638
639/**
640 * Serializes the given message to binary data (in protobuf wire
641 * format), writing to the given BinaryWriter.
642 * @param {!proto.protocol.PongMessage} message
643 * @param {!jspb.BinaryWriter} writer
644 * @suppress {unusedLocalVariables} f is only used for nested messages
645 */
646proto.protocol.PongMessage.serializeBinaryToWriter = function(message, writer) {
647 var f = undefined;
648 f = message.getFrom();
649 if (f != null) {
650 writer.writeMessage(
651 1,
652 f,
653 proto.protocol.Endpoint.serializeBinaryToWriter
654 );
655 }
656 f = message.getEcho();
657 if (f !== 0) {
658 writer.writeInt32(
659 2,
660 f
661 );
662 }
663 f = message.getTimestamp();
664 if (f !== 0) {
665 writer.writeInt64(
666 3,
667 f
668 );
669 }
670};
671
672
673/**
674 * optional Endpoint from = 1;
675 * @return {?proto.protocol.Endpoint}
676 */
677proto.protocol.PongMessage.prototype.getFrom = function() {
678 return /** @type{?proto.protocol.Endpoint} */ (
679 jspb.Message.getWrapperField(this, proto.protocol.Endpoint, 1));
680};
681
682
683/** @param {?proto.protocol.Endpoint|undefined} value */
684proto.protocol.PongMessage.prototype.setFrom = function(value) {
685 jspb.Message.setWrapperField(this, 1, value);
686};
687
688
689proto.protocol.PongMessage.prototype.clearFrom = function() {
690 this.setFrom(undefined);
691};
692
693
694/**
695 * Returns whether this field is set.
696 * @return {!boolean}
697 */
698proto.protocol.PongMessage.prototype.hasFrom = function() {
699 return jspb.Message.getField(this, 1) != null;
700};
701
702
703/**
704 * optional int32 echo = 2;
705 * @return {number}
706 */
707proto.protocol.PongMessage.prototype.getEcho = function() {
708 return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
709};
710
711
712/** @param {number} value */
713proto.protocol.PongMessage.prototype.setEcho = function(value) {
714 jspb.Message.setProto3IntField(this, 2, value);
715};
716
717
718/**
719 * optional int64 timestamp = 3;
720 * @return {number}
721 */
722proto.protocol.PongMessage.prototype.getTimestamp = function() {
723 return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
724};
725
726
727/** @param {number} value */
728proto.protocol.PongMessage.prototype.setTimestamp = function(value) {
729 jspb.Message.setProto3IntField(this, 3, value);
730};
731
732
733
734/**
735 * Generated by JsPbCodeGenerator.
736 * @param {Array=} opt_data Optional initial data array, typically from a
737 * server response, or constructed directly in Javascript. The array is used
738 * in place and becomes part of the constructed object. It is not cloned.
739 * If no data is provided, the constructed object will be empty, but still
740 * valid.
741 * @extends {jspb.Message}
742 * @constructor
743 */
744proto.protocol.FindNeighbours = function(opt_data) {
745 jspb.Message.initialize(this, opt_data, 0, -1, null, null);
746};
747goog.inherits(proto.protocol.FindNeighbours, jspb.Message);
748if (goog.DEBUG && !COMPILED) {
749 proto.protocol.FindNeighbours.displayName = 'proto.protocol.FindNeighbours';
750}
751
752
753if (jspb.Message.GENERATE_TO_OBJECT) {
754/**
755 * Creates an object representation of this proto suitable for use in Soy templates.
756 * Field names that are reserved in JavaScript and will be renamed to pb_name.
757 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
758 * For the list of reserved names please see:
759 * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
760 * @param {boolean=} opt_includeInstance Whether to include the JSPB instance
761 * for transitional soy proto support: http://goto/soy-param-migration
762 * @return {!Object}
763 */
764proto.protocol.FindNeighbours.prototype.toObject = function(opt_includeInstance) {
765 return proto.protocol.FindNeighbours.toObject(opt_includeInstance, this);
766};
767
768
769/**
770 * Static version of the {@see toObject} method.
771 * @param {boolean|undefined} includeInstance Whether to include the JSPB
772 * instance for transitional soy proto support:
773 * http://goto/soy-param-migration
774 * @param {!proto.protocol.FindNeighbours} msg The msg instance to transform.
775 * @return {!Object}
776 * @suppress {unusedLocalVariables} f is only used for nested messages
777 */
778proto.protocol.FindNeighbours.toObject = function(includeInstance, msg) {
779 var f, obj = {
780 from: (f = msg.getFrom()) && proto.protocol.Endpoint.toObject(includeInstance, f),
781 targetid: msg.getTargetid_asB64(),
782 timestamp: jspb.Message.getFieldWithDefault(msg, 3, 0)
783 };
784
785 if (includeInstance) {
786 obj.$jspbMessageInstance = msg;
787 }
788 return obj;
789};
790}
791
792
793/**
794 * Deserializes binary data (in protobuf wire format).
795 * @param {jspb.ByteSource} bytes The bytes to deserialize.
796 * @return {!proto.protocol.FindNeighbours}
797 */
798proto.protocol.FindNeighbours.deserializeBinary = function(bytes) {
799 var reader = new jspb.BinaryReader(bytes);
800 var msg = new proto.protocol.FindNeighbours;
801 return proto.protocol.FindNeighbours.deserializeBinaryFromReader(msg, reader);
802};
803
804
805/**
806 * Deserializes binary data (in protobuf wire format) from the
807 * given reader into the given message object.
808 * @param {!proto.protocol.FindNeighbours} msg The message object to deserialize into.
809 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
810 * @return {!proto.protocol.FindNeighbours}
811 */
812proto.protocol.FindNeighbours.deserializeBinaryFromReader = function(msg, reader) {
813 while (reader.nextField()) {
814 if (reader.isEndGroup()) {
815 break;
816 }
817 var field = reader.getFieldNumber();
818 switch (field) {
819 case 1:
820 var value = new proto.protocol.Endpoint;
821 reader.readMessage(value,proto.protocol.Endpoint.deserializeBinaryFromReader);
822 msg.setFrom(value);
823 break;
824 case 2:
825 var value = /** @type {!Uint8Array} */ (reader.readBytes());
826 msg.setTargetid(value);
827 break;
828 case 3:
829 var value = /** @type {number} */ (reader.readInt64());
830 msg.setTimestamp(value);
831 break;
832 default:
833 reader.skipField();
834 break;
835 }
836 }
837 return msg;
838};
839
840
841/**
842 * Serializes the message to binary data (in protobuf wire format).
843 * @return {!Uint8Array}
844 */
845proto.protocol.FindNeighbours.prototype.serializeBinary = function() {
846 var writer = new jspb.BinaryWriter();
847 proto.protocol.FindNeighbours.serializeBinaryToWriter(this, writer);
848 return writer.getResultBuffer();
849};
850
851
852/**
853 * Serializes the given message to binary data (in protobuf wire
854 * format), writing to the given BinaryWriter.
855 * @param {!proto.protocol.FindNeighbours} message
856 * @param {!jspb.BinaryWriter} writer
857 * @suppress {unusedLocalVariables} f is only used for nested messages
858 */
859proto.protocol.FindNeighbours.serializeBinaryToWriter = function(message, writer) {
860 var f = undefined;
861 f = message.getFrom();
862 if (f != null) {
863 writer.writeMessage(
864 1,
865 f,
866 proto.protocol.Endpoint.serializeBinaryToWriter
867 );
868 }
869 f = message.getTargetid_asU8();
870 if (f.length > 0) {
871 writer.writeBytes(
872 2,
873 f
874 );
875 }
876 f = message.getTimestamp();
877 if (f !== 0) {
878 writer.writeInt64(
879 3,
880 f
881 );
882 }
883};
884
885
886/**
887 * optional Endpoint from = 1;
888 * @return {?proto.protocol.Endpoint}
889 */
890proto.protocol.FindNeighbours.prototype.getFrom = function() {
891 return /** @type{?proto.protocol.Endpoint} */ (
892 jspb.Message.getWrapperField(this, proto.protocol.Endpoint, 1));
893};
894
895
896/** @param {?proto.protocol.Endpoint|undefined} value */
897proto.protocol.FindNeighbours.prototype.setFrom = function(value) {
898 jspb.Message.setWrapperField(this, 1, value);
899};
900
901
902proto.protocol.FindNeighbours.prototype.clearFrom = function() {
903 this.setFrom(undefined);
904};
905
906
907/**
908 * Returns whether this field is set.
909 * @return {!boolean}
910 */
911proto.protocol.FindNeighbours.prototype.hasFrom = function() {
912 return jspb.Message.getField(this, 1) != null;
913};
914
915
916/**
917 * optional bytes targetId = 2;
918 * @return {!(string|Uint8Array)}
919 */
920proto.protocol.FindNeighbours.prototype.getTargetid = function() {
921 return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
922};
923
924
925/**
926 * optional bytes targetId = 2;
927 * This is a type-conversion wrapper around `getTargetid()`
928 * @return {string}
929 */
930proto.protocol.FindNeighbours.prototype.getTargetid_asB64 = function() {
931 return /** @type {string} */ (jspb.Message.bytesAsB64(
932 this.getTargetid()));
933};
934
935
936/**
937 * optional bytes targetId = 2;
938 * Note that Uint8Array is not supported on all browsers.
939 * @see http://caniuse.com/Uint8Array
940 * This is a type-conversion wrapper around `getTargetid()`
941 * @return {!Uint8Array}
942 */
943proto.protocol.FindNeighbours.prototype.getTargetid_asU8 = function() {
944 return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
945 this.getTargetid()));
946};
947
948
949/** @param {!(string|Uint8Array)} value */
950proto.protocol.FindNeighbours.prototype.setTargetid = function(value) {
951 jspb.Message.setProto3BytesField(this, 2, value);
952};
953
954
955/**
956 * optional int64 timestamp = 3;
957 * @return {number}
958 */
959proto.protocol.FindNeighbours.prototype.getTimestamp = function() {
960 return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
961};
962
963
964/** @param {number} value */
965proto.protocol.FindNeighbours.prototype.setTimestamp = function(value) {
966 jspb.Message.setProto3IntField(this, 3, value);
967};
968
969
970
971/**
972 * Generated by JsPbCodeGenerator.
973 * @param {Array=} opt_data Optional initial data array, typically from a
974 * server response, or constructed directly in Javascript. The array is used
975 * in place and becomes part of the constructed object. It is not cloned.
976 * If no data is provided, the constructed object will be empty, but still
977 * valid.
978 * @extends {jspb.Message}
979 * @constructor
980 */
981proto.protocol.Neighbours = function(opt_data) {
982 jspb.Message.initialize(this, opt_data, 0, -1, proto.protocol.Neighbours.repeatedFields_, null);
983};
984goog.inherits(proto.protocol.Neighbours, jspb.Message);
985if (goog.DEBUG && !COMPILED) {
986 proto.protocol.Neighbours.displayName = 'proto.protocol.Neighbours';
987}
988/**
989 * List of repeated fields within this message type.
990 * @private {!Array<number>}
991 * @const
992 */
993proto.protocol.Neighbours.repeatedFields_ = [2];
994
995
996
997if (jspb.Message.GENERATE_TO_OBJECT) {
998/**
999 * Creates an object representation of this proto suitable for use in Soy templates.
1000 * Field names that are reserved in JavaScript and will be renamed to pb_name.
1001 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
1002 * For the list of reserved names please see:
1003 * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
1004 * @param {boolean=} opt_includeInstance Whether to include the JSPB instance
1005 * for transitional soy proto support: http://goto/soy-param-migration
1006 * @return {!Object}
1007 */
1008proto.protocol.Neighbours.prototype.toObject = function(opt_includeInstance) {
1009 return proto.protocol.Neighbours.toObject(opt_includeInstance, this);
1010};
1011
1012
1013/**
1014 * Static version of the {@see toObject} method.
1015 * @param {boolean|undefined} includeInstance Whether to include the JSPB
1016 * instance for transitional soy proto support:
1017 * http://goto/soy-param-migration
1018 * @param {!proto.protocol.Neighbours} msg The msg instance to transform.
1019 * @return {!Object}
1020 * @suppress {unusedLocalVariables} f is only used for nested messages
1021 */
1022proto.protocol.Neighbours.toObject = function(includeInstance, msg) {
1023 var f, obj = {
1024 from: (f = msg.getFrom()) && proto.protocol.Endpoint.toObject(includeInstance, f),
1025 neighboursList: jspb.Message.toObjectList(msg.getNeighboursList(),
1026 proto.protocol.Endpoint.toObject, includeInstance),
1027 timestamp: jspb.Message.getFieldWithDefault(msg, 3, 0)
1028 };
1029
1030 if (includeInstance) {
1031 obj.$jspbMessageInstance = msg;
1032 }
1033 return obj;
1034};
1035}
1036
1037
1038/**
1039 * Deserializes binary data (in protobuf wire format).
1040 * @param {jspb.ByteSource} bytes The bytes to deserialize.
1041 * @return {!proto.protocol.Neighbours}
1042 */
1043proto.protocol.Neighbours.deserializeBinary = function(bytes) {
1044 var reader = new jspb.BinaryReader(bytes);
1045 var msg = new proto.protocol.Neighbours;
1046 return proto.protocol.Neighbours.deserializeBinaryFromReader(msg, reader);
1047};
1048
1049
1050/**
1051 * Deserializes binary data (in protobuf wire format) from the
1052 * given reader into the given message object.
1053 * @param {!proto.protocol.Neighbours} msg The message object to deserialize into.
1054 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
1055 * @return {!proto.protocol.Neighbours}
1056 */
1057proto.protocol.Neighbours.deserializeBinaryFromReader = function(msg, reader) {
1058 while (reader.nextField()) {
1059 if (reader.isEndGroup()) {
1060 break;
1061 }
1062 var field = reader.getFieldNumber();
1063 switch (field) {
1064 case 1:
1065 var value = new proto.protocol.Endpoint;
1066 reader.readMessage(value,proto.protocol.Endpoint.deserializeBinaryFromReader);
1067 msg.setFrom(value);
1068 break;
1069 case 2:
1070 var value = new proto.protocol.Endpoint;
1071 reader.readMessage(value,proto.protocol.Endpoint.deserializeBinaryFromReader);
1072 msg.addNeighbours(value);
1073 break;
1074 case 3:
1075 var value = /** @type {number} */ (reader.readInt64());
1076 msg.setTimestamp(value);
1077 break;
1078 default:
1079 reader.skipField();
1080 break;
1081 }
1082 }
1083 return msg;
1084};
1085
1086
1087/**
1088 * Serializes the message to binary data (in protobuf wire format).
1089 * @return {!Uint8Array}
1090 */
1091proto.protocol.Neighbours.prototype.serializeBinary = function() {
1092 var writer = new jspb.BinaryWriter();
1093 proto.protocol.Neighbours.serializeBinaryToWriter(this, writer);
1094 return writer.getResultBuffer();
1095};
1096
1097
1098/**
1099 * Serializes the given message to binary data (in protobuf wire
1100 * format), writing to the given BinaryWriter.
1101 * @param {!proto.protocol.Neighbours} message
1102 * @param {!jspb.BinaryWriter} writer
1103 * @suppress {unusedLocalVariables} f is only used for nested messages
1104 */
1105proto.protocol.Neighbours.serializeBinaryToWriter = function(message, writer) {
1106 var f = undefined;
1107 f = message.getFrom();
1108 if (f != null) {
1109 writer.writeMessage(
1110 1,
1111 f,
1112 proto.protocol.Endpoint.serializeBinaryToWriter
1113 );
1114 }
1115 f = message.getNeighboursList();
1116 if (f.length > 0) {
1117 writer.writeRepeatedMessage(
1118 2,
1119 f,
1120 proto.protocol.Endpoint.serializeBinaryToWriter
1121 );
1122 }
1123 f = message.getTimestamp();
1124 if (f !== 0) {
1125 writer.writeInt64(
1126 3,
1127 f
1128 );
1129 }
1130};
1131
1132
1133/**
1134 * optional Endpoint from = 1;
1135 * @return {?proto.protocol.Endpoint}
1136 */
1137proto.protocol.Neighbours.prototype.getFrom = function() {
1138 return /** @type{?proto.protocol.Endpoint} */ (
1139 jspb.Message.getWrapperField(this, proto.protocol.Endpoint, 1));
1140};
1141
1142
1143/** @param {?proto.protocol.Endpoint|undefined} value */
1144proto.protocol.Neighbours.prototype.setFrom = function(value) {
1145 jspb.Message.setWrapperField(this, 1, value);
1146};
1147
1148
1149proto.protocol.Neighbours.prototype.clearFrom = function() {
1150 this.setFrom(undefined);
1151};
1152
1153
1154/**
1155 * Returns whether this field is set.
1156 * @return {!boolean}
1157 */
1158proto.protocol.Neighbours.prototype.hasFrom = function() {
1159 return jspb.Message.getField(this, 1) != null;
1160};
1161
1162
1163/**
1164 * repeated Endpoint neighbours = 2;
1165 * @return {!Array.<!proto.protocol.Endpoint>}
1166 */
1167proto.protocol.Neighbours.prototype.getNeighboursList = function() {
1168 return /** @type{!Array.<!proto.protocol.Endpoint>} */ (
1169 jspb.Message.getRepeatedWrapperField(this, proto.protocol.Endpoint, 2));
1170};
1171
1172
1173/** @param {!Array.<!proto.protocol.Endpoint>} value */
1174proto.protocol.Neighbours.prototype.setNeighboursList = function(value) {
1175 jspb.Message.setRepeatedWrapperField(this, 2, value);
1176};
1177
1178
1179/**
1180 * @param {!proto.protocol.Endpoint=} opt_value
1181 * @param {number=} opt_index
1182 * @return {!proto.protocol.Endpoint}
1183 */
1184proto.protocol.Neighbours.prototype.addNeighbours = function(opt_value, opt_index) {
1185 return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.protocol.Endpoint, opt_index);
1186};
1187
1188
1189proto.protocol.Neighbours.prototype.clearNeighboursList = function() {
1190 this.setNeighboursList([]);
1191};
1192
1193
1194/**
1195 * optional int64 timestamp = 3;
1196 * @return {number}
1197 */
1198proto.protocol.Neighbours.prototype.getTimestamp = function() {
1199 return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
1200};
1201
1202
1203/** @param {number} value */
1204proto.protocol.Neighbours.prototype.setTimestamp = function(value) {
1205 jspb.Message.setProto3IntField(this, 3, value);
1206};
1207
1208
1209goog.object.extend(exports, proto.protocol);