Fawkes API  Fawkes Development Version
ProtobufPeerInterface.cpp
1 
2 /***************************************************************************
3  * ProtobufPeerInterface.cpp - Fawkes BlackBoard Interface - ProtobufPeerInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2017 Victor MatarĂ©
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #include <interfaces/ProtobufPeerInterface.h>
25 
26 #include <core/exceptions/software.h>
27 
28 #include <map>
29 #include <string>
30 #include <cstring>
31 #include <cstdlib>
32 
33 namespace fawkes {
34 
35 /** @class ProtobufPeerInterface <interfaces/ProtobufPeerInterface.h>
36  * ProtobufPeerInterface Fawkes BlackBoard Interface.
37  * Current peers maintained by the protoboard plugin
38  * @ingroup FawkesInterfaces
39  */
40 
41 
42 
43 /** Constructor */
44 ProtobufPeerInterface::ProtobufPeerInterface() : Interface()
45 {
46  data_size = sizeof(ProtobufPeerInterface_data_t);
47  data_ptr = malloc(data_size);
48  data = (ProtobufPeerInterface_data_t *)data_ptr;
49  data_ts = (interface_data_ts_t *)data_ptr;
50  memset(data_ptr, 0, data_size);
51  add_fieldinfo(IFT_INT64, "peers", 16, &data->peers);
52  add_messageinfo("CreatePeerMessage");
53  add_messageinfo("CreatePeerLocalMessage");
54  add_messageinfo("CreatePeerCryptoMessage");
55  add_messageinfo("CreatePeerLocalCryptoMessage");
56  unsigned char tmp_hash[] = {0x58, 0xc8, 0xa0, 0x57, 0x5c, 0x89, 0x32, 0xeb, 0x5a, 0xf0, 0x75, 0xbc, 0x6d, 0x15, 0xb3, 0x90};
57  set_hash(tmp_hash);
58 }
59 
60 /** Destructor */
61 ProtobufPeerInterface::~ProtobufPeerInterface()
62 {
63  free(data_ptr);
64 }
65 /* Methods */
66 /** Get peers value.
67  * Currently active peers
68  * @return peers value
69  */
70 int64_t *
72 {
73  return data->peers;
74 }
75 
76 /** Get peers value at given index.
77  * Currently active peers
78  * @param index index of value
79  * @return peers value
80  * @exception Exception thrown if index is out of bounds
81  */
82 int64_t
83 ProtobufPeerInterface::peers(unsigned int index) const
84 {
85  if (index > 15) {
86  throw Exception("Index value %u out of bounds (0..15)", index);
87  }
88  return data->peers[index];
89 }
90 
91 /** Get maximum length of peers value.
92  * @return length of peers value, can be length of the array or number of
93  * maximum number of characters for a string
94  */
95 size_t
97 {
98  return 16;
99 }
100 
101 /** Set peers value.
102  * Currently active peers
103  * @param new_peers new peers value
104  */
105 void
106 ProtobufPeerInterface::set_peers(const int64_t * new_peers)
107 {
108  data_changed |= change_field(data->peers, new_peers);
109 }
110 
111 /** Set peers value at given index.
112  * Currently active peers
113  * @param new_peers new peers value
114  * @param index index for of the value
115  */
116 void
117 ProtobufPeerInterface::set_peers(unsigned int index, const int64_t new_peers)
118 {
119  data_changed |= change_field(data->peers, index, new_peers);
120 }
121 /* =========== message create =========== */
122 Message *
124 {
125  if ( strncmp("CreatePeerMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
126  return new CreatePeerMessage();
127  } else if ( strncmp("CreatePeerLocalMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
128  return new CreatePeerLocalMessage();
129  } else if ( strncmp("CreatePeerCryptoMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
130  return new CreatePeerCryptoMessage();
131  } else if ( strncmp("CreatePeerLocalCryptoMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
132  return new CreatePeerLocalCryptoMessage();
133  } else {
134  throw UnknownTypeException("The given type '%s' does not match any known "
135  "message type for this interface type.", type);
136  }
137 }
138 
139 
140 /** Copy values from other interface.
141  * @param other other interface to copy values from
142  */
143 void
145 {
146  const ProtobufPeerInterface *oi = dynamic_cast<const ProtobufPeerInterface *>(other);
147  if (oi == NULL) {
148  throw TypeMismatchException("Can only copy values from interface of same type (%s vs. %s)",
149  type(), other->type());
150  }
151  memcpy(data, oi->data, sizeof(ProtobufPeerInterface_data_t));
152 }
153 
154 const char *
155 ProtobufPeerInterface::enum_tostring(const char *enumtype, int val) const
156 {
157  throw UnknownTypeException("Unknown enum type %s", enumtype);
158 }
159 
160 /* =========== messages =========== */
161 /** @class ProtobufPeerInterface::CreatePeerMessage <interfaces/ProtobufPeerInterface.h>
162  * CreatePeerMessage Fawkes BlackBoard Interface Message.
163  *
164 
165  */
166 
167 
168 /** Constructor with initial values.
169  * @param ini_address initial value for address
170  * @param ini_port initial value for port
171  */
172 ProtobufPeerInterface::CreatePeerMessage::CreatePeerMessage(const char * ini_address, const int32_t ini_port) : Message("CreatePeerMessage")
173 {
174  data_size = sizeof(CreatePeerMessage_data_t);
175  data_ptr = malloc(data_size);
176  memset(data_ptr, 0, data_size);
177  data = (CreatePeerMessage_data_t *)data_ptr;
179  strncpy(data->address, ini_address, 255-1);
180  data->address[255-1] = 0;
181  data->port = ini_port;
182  add_fieldinfo(IFT_STRING, "address", 255, data->address);
183  add_fieldinfo(IFT_INT32, "port", 1, &data->port);
184 }
185 /** Constructor */
187 {
188  data_size = sizeof(CreatePeerMessage_data_t);
189  data_ptr = malloc(data_size);
190  memset(data_ptr, 0, data_size);
191  data = (CreatePeerMessage_data_t *)data_ptr;
193  add_fieldinfo(IFT_STRING, "address", 255, data->address);
194  add_fieldinfo(IFT_INT32, "port", 1, &data->port);
195 }
196 
197 /** Destructor */
199 {
200  free(data_ptr);
201 }
202 
203 /** Copy constructor.
204  * @param m message to copy from
205  */
207 {
208  data_size = m->data_size;
209  data_ptr = malloc(data_size);
210  memcpy(data_ptr, m->data_ptr, data_size);
211  data = (CreatePeerMessage_data_t *)data_ptr;
213 }
214 
215 /* Methods */
216 /** Get address value.
217  * IP address or host name
218  * @return address value
219  */
220 char *
222 {
223  return data->address;
224 }
225 
226 /** Get maximum length of address value.
227  * @return length of address value, can be length of the array or number of
228  * maximum number of characters for a string
229  */
230 size_t
232 {
233  return 255;
234 }
235 
236 /** Set address value.
237  * IP address or host name
238  * @param new_address new address value
239  */
240 void
242 {
243  change_field(data->address, new_address);
244 }
245 
246 /** Get port value.
247  * Port to send to/receive on
248  * @return port value
249  */
250 int32_t
252 {
253  return data->port;
254 }
255 
256 /** Get maximum length of port value.
257  * @return length of port value, can be length of the array or number of
258  * maximum number of characters for a string
259  */
260 size_t
262 {
263  return 1;
264 }
265 
266 /** Set port value.
267  * Port to send to/receive on
268  * @param new_port new port value
269  */
270 void
272 {
273  change_field(data->port, new_port);
274 }
275 
276 /** Clone this message.
277  * Produces a message of the same type as this message and copies the
278  * data to the new message.
279  * @return clone of this message
280  */
281 Message *
283 {
285 }
286 /** @class ProtobufPeerInterface::CreatePeerLocalMessage <interfaces/ProtobufPeerInterface.h>
287  * CreatePeerLocalMessage Fawkes BlackBoard Interface Message.
288  *
289 
290  */
291 
292 
293 /** Constructor with initial values.
294  * @param ini_address initial value for address
295  * @param ini_send_to_port initial value for send_to_port
296  * @param ini_recv_on_port initial value for recv_on_port
297  */
298 ProtobufPeerInterface::CreatePeerLocalMessage::CreatePeerLocalMessage(const char * ini_address, const int32_t ini_send_to_port, const int32_t ini_recv_on_port) : Message("CreatePeerLocalMessage")
299 {
300  data_size = sizeof(CreatePeerLocalMessage_data_t);
301  data_ptr = malloc(data_size);
302  memset(data_ptr, 0, data_size);
303  data = (CreatePeerLocalMessage_data_t *)data_ptr;
305  strncpy(data->address, ini_address, 255-1);
306  data->address[255-1] = 0;
307  data->send_to_port = ini_send_to_port;
308  data->recv_on_port = ini_recv_on_port;
309  add_fieldinfo(IFT_STRING, "address", 255, data->address);
310  add_fieldinfo(IFT_INT32, "send_to_port", 1, &data->send_to_port);
311  add_fieldinfo(IFT_INT32, "recv_on_port", 1, &data->recv_on_port);
312 }
313 /** Constructor */
315 {
316  data_size = sizeof(CreatePeerLocalMessage_data_t);
317  data_ptr = malloc(data_size);
318  memset(data_ptr, 0, data_size);
319  data = (CreatePeerLocalMessage_data_t *)data_ptr;
321  add_fieldinfo(IFT_STRING, "address", 255, data->address);
322  add_fieldinfo(IFT_INT32, "send_to_port", 1, &data->send_to_port);
323  add_fieldinfo(IFT_INT32, "recv_on_port", 1, &data->recv_on_port);
324 }
325 
326 /** Destructor */
328 {
329  free(data_ptr);
330 }
331 
332 /** Copy constructor.
333  * @param m message to copy from
334  */
336 {
337  data_size = m->data_size;
338  data_ptr = malloc(data_size);
339  memcpy(data_ptr, m->data_ptr, data_size);
340  data = (CreatePeerLocalMessage_data_t *)data_ptr;
342 }
343 
344 /* Methods */
345 /** Get address value.
346  * IP address or host name
347  * @return address value
348  */
349 char *
351 {
352  return data->address;
353 }
354 
355 /** Get maximum length of address value.
356  * @return length of address value, can be length of the array or number of
357  * maximum number of characters for a string
358  */
359 size_t
361 {
362  return 255;
363 }
364 
365 /** Set address value.
366  * IP address or host name
367  * @param new_address new address value
368  */
369 void
371 {
372  change_field(data->address, new_address);
373 }
374 
375 /** Get send_to_port value.
376  * Port to send to
377  * @return send_to_port value
378  */
379 int32_t
381 {
382  return data->send_to_port;
383 }
384 
385 /** Get maximum length of send_to_port value.
386  * @return length of send_to_port value, can be length of the array or number of
387  * maximum number of characters for a string
388  */
389 size_t
391 {
392  return 1;
393 }
394 
395 /** Set send_to_port value.
396  * Port to send to
397  * @param new_send_to_port new send_to_port value
398  */
399 void
401 {
402  change_field(data->send_to_port, new_send_to_port);
403 }
404 
405 /** Get recv_on_port value.
406  * Port to receive on
407  * @return recv_on_port value
408  */
409 int32_t
411 {
412  return data->recv_on_port;
413 }
414 
415 /** Get maximum length of recv_on_port value.
416  * @return length of recv_on_port value, can be length of the array or number of
417  * maximum number of characters for a string
418  */
419 size_t
421 {
422  return 1;
423 }
424 
425 /** Set recv_on_port value.
426  * Port to receive on
427  * @param new_recv_on_port new recv_on_port value
428  */
429 void
431 {
432  change_field(data->recv_on_port, new_recv_on_port);
433 }
434 
435 /** Clone this message.
436  * Produces a message of the same type as this message and copies the
437  * data to the new message.
438  * @return clone of this message
439  */
440 Message *
442 {
444 }
445 /** @class ProtobufPeerInterface::CreatePeerCryptoMessage <interfaces/ProtobufPeerInterface.h>
446  * CreatePeerCryptoMessage Fawkes BlackBoard Interface Message.
447  *
448 
449  */
450 
451 
452 /** Constructor with initial values.
453  * @param ini_address initial value for address
454  * @param ini_port initial value for port
455  * @param ini_crypto_key initial value for crypto_key
456  * @param ini_cipher initial value for cipher
457  */
458 ProtobufPeerInterface::CreatePeerCryptoMessage::CreatePeerCryptoMessage(const char * ini_address, const int32_t ini_port, const char * ini_crypto_key, const char * ini_cipher) : Message("CreatePeerCryptoMessage")
459 {
460  data_size = sizeof(CreatePeerCryptoMessage_data_t);
461  data_ptr = malloc(data_size);
462  memset(data_ptr, 0, data_size);
463  data = (CreatePeerCryptoMessage_data_t *)data_ptr;
465  strncpy(data->address, ini_address, 255-1);
466  data->address[255-1] = 0;
467  data->port = ini_port;
468  strncpy(data->crypto_key, ini_crypto_key, 1024-1);
469  data->crypto_key[1024-1] = 0;
470  strncpy(data->cipher, ini_cipher, 255-1);
471  data->cipher[255-1] = 0;
472  add_fieldinfo(IFT_STRING, "address", 255, data->address);
473  add_fieldinfo(IFT_INT32, "port", 1, &data->port);
474  add_fieldinfo(IFT_STRING, "crypto_key", 1024, data->crypto_key);
475  add_fieldinfo(IFT_STRING, "cipher", 255, data->cipher);
476 }
477 /** Constructor */
479 {
480  data_size = sizeof(CreatePeerCryptoMessage_data_t);
481  data_ptr = malloc(data_size);
482  memset(data_ptr, 0, data_size);
483  data = (CreatePeerCryptoMessage_data_t *)data_ptr;
485  add_fieldinfo(IFT_STRING, "address", 255, data->address);
486  add_fieldinfo(IFT_INT32, "port", 1, &data->port);
487  add_fieldinfo(IFT_STRING, "crypto_key", 1024, data->crypto_key);
488  add_fieldinfo(IFT_STRING, "cipher", 255, data->cipher);
489 }
490 
491 /** Destructor */
493 {
494  free(data_ptr);
495 }
496 
497 /** Copy constructor.
498  * @param m message to copy from
499  */
501 {
502  data_size = m->data_size;
503  data_ptr = malloc(data_size);
504  memcpy(data_ptr, m->data_ptr, data_size);
505  data = (CreatePeerCryptoMessage_data_t *)data_ptr;
507 }
508 
509 /* Methods */
510 /** Get address value.
511  * IP address or host name
512  * @return address value
513  */
514 char *
516 {
517  return data->address;
518 }
519 
520 /** Get maximum length of address value.
521  * @return length of address value, can be length of the array or number of
522  * maximum number of characters for a string
523  */
524 size_t
526 {
527  return 255;
528 }
529 
530 /** Set address value.
531  * IP address or host name
532  * @param new_address new address value
533  */
534 void
536 {
537  change_field(data->address, new_address);
538 }
539 
540 /** Get port value.
541  * Port to send to/receive on
542  * @return port value
543  */
544 int32_t
546 {
547  return data->port;
548 }
549 
550 /** Get maximum length of port value.
551  * @return length of port value, can be length of the array or number of
552  * maximum number of characters for a string
553  */
554 size_t
556 {
557  return 1;
558 }
559 
560 /** Set port value.
561  * Port to send to/receive on
562  * @param new_port new port value
563  */
564 void
566 {
567  change_field(data->port, new_port);
568 }
569 
570 /** Get crypto_key value.
571  * Crypto key
572  * @return crypto_key value
573  */
574 char *
576 {
577  return data->crypto_key;
578 }
579 
580 /** Get maximum length of crypto_key value.
581  * @return length of crypto_key value, can be length of the array or number of
582  * maximum number of characters for a string
583  */
584 size_t
586 {
587  return 1024;
588 }
589 
590 /** Set crypto_key value.
591  * Crypto key
592  * @param new_crypto_key new crypto_key value
593  */
594 void
596 {
597  change_field(data->crypto_key, new_crypto_key);
598 }
599 
600 /** Get cipher value.
601  * Cipher name
602  * @return cipher value
603  */
604 char *
606 {
607  return data->cipher;
608 }
609 
610 /** Get maximum length of cipher value.
611  * @return length of cipher value, can be length of the array or number of
612  * maximum number of characters for a string
613  */
614 size_t
616 {
617  return 255;
618 }
619 
620 /** Set cipher value.
621  * Cipher name
622  * @param new_cipher new cipher value
623  */
624 void
626 {
627  change_field(data->cipher, new_cipher);
628 }
629 
630 /** Clone this message.
631  * Produces a message of the same type as this message and copies the
632  * data to the new message.
633  * @return clone of this message
634  */
635 Message *
637 {
639 }
640 /** @class ProtobufPeerInterface::CreatePeerLocalCryptoMessage <interfaces/ProtobufPeerInterface.h>
641  * CreatePeerLocalCryptoMessage Fawkes BlackBoard Interface Message.
642  *
643 
644  */
645 
646 
647 /** Constructor with initial values.
648  * @param ini_address initial value for address
649  * @param ini_send_to_port initial value for send_to_port
650  * @param ini_recv_on_port initial value for recv_on_port
651  * @param ini_crypto_key initial value for crypto_key
652  * @param ini_cipher initial value for cipher
653  */
654 ProtobufPeerInterface::CreatePeerLocalCryptoMessage::CreatePeerLocalCryptoMessage(const char * ini_address, const int32_t ini_send_to_port, const int32_t ini_recv_on_port, const char * ini_crypto_key, const char * ini_cipher) : Message("CreatePeerLocalCryptoMessage")
655 {
656  data_size = sizeof(CreatePeerLocalCryptoMessage_data_t);
657  data_ptr = malloc(data_size);
658  memset(data_ptr, 0, data_size);
659  data = (CreatePeerLocalCryptoMessage_data_t *)data_ptr;
661  strncpy(data->address, ini_address, 255-1);
662  data->address[255-1] = 0;
663  data->send_to_port = ini_send_to_port;
664  data->recv_on_port = ini_recv_on_port;
665  strncpy(data->crypto_key, ini_crypto_key, 1024-1);
666  data->crypto_key[1024-1] = 0;
667  strncpy(data->cipher, ini_cipher, 255-1);
668  data->cipher[255-1] = 0;
669  add_fieldinfo(IFT_STRING, "address", 255, data->address);
670  add_fieldinfo(IFT_INT32, "send_to_port", 1, &data->send_to_port);
671  add_fieldinfo(IFT_INT32, "recv_on_port", 1, &data->recv_on_port);
672  add_fieldinfo(IFT_STRING, "crypto_key", 1024, data->crypto_key);
673  add_fieldinfo(IFT_STRING, "cipher", 255, data->cipher);
674 }
675 /** Constructor */
677 {
678  data_size = sizeof(CreatePeerLocalCryptoMessage_data_t);
679  data_ptr = malloc(data_size);
680  memset(data_ptr, 0, data_size);
681  data = (CreatePeerLocalCryptoMessage_data_t *)data_ptr;
683  add_fieldinfo(IFT_STRING, "address", 255, data->address);
684  add_fieldinfo(IFT_INT32, "send_to_port", 1, &data->send_to_port);
685  add_fieldinfo(IFT_INT32, "recv_on_port", 1, &data->recv_on_port);
686  add_fieldinfo(IFT_STRING, "crypto_key", 1024, data->crypto_key);
687  add_fieldinfo(IFT_STRING, "cipher", 255, data->cipher);
688 }
689 
690 /** Destructor */
692 {
693  free(data_ptr);
694 }
695 
696 /** Copy constructor.
697  * @param m message to copy from
698  */
700 {
701  data_size = m->data_size;
702  data_ptr = malloc(data_size);
703  memcpy(data_ptr, m->data_ptr, data_size);
704  data = (CreatePeerLocalCryptoMessage_data_t *)data_ptr;
706 }
707 
708 /* Methods */
709 /** Get address value.
710  * IP address or host name
711  * @return address value
712  */
713 char *
715 {
716  return data->address;
717 }
718 
719 /** Get maximum length of address value.
720  * @return length of address value, can be length of the array or number of
721  * maximum number of characters for a string
722  */
723 size_t
725 {
726  return 255;
727 }
728 
729 /** Set address value.
730  * IP address or host name
731  * @param new_address new address value
732  */
733 void
735 {
736  change_field(data->address, new_address);
737 }
738 
739 /** Get send_to_port value.
740  * Port to send to
741  * @return send_to_port value
742  */
743 int32_t
745 {
746  return data->send_to_port;
747 }
748 
749 /** Get maximum length of send_to_port value.
750  * @return length of send_to_port value, can be length of the array or number of
751  * maximum number of characters for a string
752  */
753 size_t
755 {
756  return 1;
757 }
758 
759 /** Set send_to_port value.
760  * Port to send to
761  * @param new_send_to_port new send_to_port value
762  */
763 void
765 {
766  change_field(data->send_to_port, new_send_to_port);
767 }
768 
769 /** Get recv_on_port value.
770  * Port to receive on
771  * @return recv_on_port value
772  */
773 int32_t
775 {
776  return data->recv_on_port;
777 }
778 
779 /** Get maximum length of recv_on_port value.
780  * @return length of recv_on_port value, can be length of the array or number of
781  * maximum number of characters for a string
782  */
783 size_t
785 {
786  return 1;
787 }
788 
789 /** Set recv_on_port value.
790  * Port to receive on
791  * @param new_recv_on_port new recv_on_port value
792  */
793 void
795 {
796  change_field(data->recv_on_port, new_recv_on_port);
797 }
798 
799 /** Get crypto_key value.
800  * Crypto key
801  * @return crypto_key value
802  */
803 char *
805 {
806  return data->crypto_key;
807 }
808 
809 /** Get maximum length of crypto_key value.
810  * @return length of crypto_key value, can be length of the array or number of
811  * maximum number of characters for a string
812  */
813 size_t
815 {
816  return 1024;
817 }
818 
819 /** Set crypto_key value.
820  * Crypto key
821  * @param new_crypto_key new crypto_key value
822  */
823 void
825 {
826  change_field(data->crypto_key, new_crypto_key);
827 }
828 
829 /** Get cipher value.
830  * Cipher name
831  * @return cipher value
832  */
833 char *
835 {
836  return data->cipher;
837 }
838 
839 /** Get maximum length of cipher value.
840  * @return length of cipher value, can be length of the array or number of
841  * maximum number of characters for a string
842  */
843 size_t
845 {
846  return 255;
847 }
848 
849 /** Set cipher value.
850  * Cipher name
851  * @param new_cipher new cipher value
852  */
853 void
855 {
856  change_field(data->cipher, new_cipher);
857 }
858 
859 /** Clone this message.
860  * Produces a message of the same type as this message and copies the
861  * data to the new message.
862  * @return clone of this message
863  */
864 Message *
866 {
868 }
869 /** Check if message is valid and can be enqueued.
870  * @param message Message to check
871  * @return true if the message is valid, false otherwise.
872  */
873 bool
875 {
876  const CreatePeerMessage *m0 = dynamic_cast<const CreatePeerMessage *>(message);
877  if ( m0 != NULL ) {
878  return true;
879  }
880  const CreatePeerLocalMessage *m1 = dynamic_cast<const CreatePeerLocalMessage *>(message);
881  if ( m1 != NULL ) {
882  return true;
883  }
884  const CreatePeerCryptoMessage *m2 = dynamic_cast<const CreatePeerCryptoMessage *>(message);
885  if ( m2 != NULL ) {
886  return true;
887  }
888  const CreatePeerLocalCryptoMessage *m3 = dynamic_cast<const CreatePeerLocalCryptoMessage *>(message);
889  if ( m3 != NULL ) {
890  return true;
891  }
892  return false;
893 }
894 
895 /// @cond INTERNALS
896 EXPORT_INTERFACE(ProtobufPeerInterface)
897 /// @endcond
898 
899 
900 } // end namespace fawkes
fawkes::ProtobufPeerInterface::CreatePeerCryptoMessage::set_cipher
void set_cipher(const char *new_cipher)
Set cipher value.
Definition: ProtobufPeerInterface.cpp:625
fawkes::Interface::data_ptr
void * data_ptr
Pointer to local memory storage.
Definition: interface.h:224
fawkes::ProtobufPeerInterface::CreatePeerCryptoMessage::crypto_key
char * crypto_key() const
Get crypto_key value.
Definition: ProtobufPeerInterface.cpp:575
fawkes::ProtobufPeerInterface::CreatePeerMessage::CreatePeerMessage
CreatePeerMessage()
Constructor.
Definition: ProtobufPeerInterface.cpp:186
fawkes::ProtobufPeerInterface::CreatePeerMessage::maxlenof_address
size_t maxlenof_address() const
Get maximum length of address value.
Definition: ProtobufPeerInterface.cpp:231
fawkes::ProtobufPeerInterface::CreatePeerLocalMessage::set_address
void set_address(const char *new_address)
Set address value.
Definition: ProtobufPeerInterface.cpp:370
fawkes::ProtobufPeerInterface::CreatePeerLocalCryptoMessage::clone
virtual Message * clone() const
Clone this message.
Definition: ProtobufPeerInterface.cpp:865
fawkes::ProtobufPeerInterface::CreatePeerLocalMessage::CreatePeerLocalMessage
CreatePeerLocalMessage()
Constructor.
Definition: ProtobufPeerInterface.cpp:314
fawkes::Message
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:45
fawkes::ProtobufPeerInterface::CreatePeerCryptoMessage::clone
virtual Message * clone() const
Clone this message.
Definition: ProtobufPeerInterface.cpp:636
fawkes::ProtobufPeerInterface::CreatePeerCryptoMessage::maxlenof_port
size_t maxlenof_port() const
Get maximum length of port value.
Definition: ProtobufPeerInterface.cpp:555
fawkes::ProtobufPeerInterface::CreatePeerCryptoMessage::cipher
char * cipher() const
Get cipher value.
Definition: ProtobufPeerInterface.cpp:605
fawkes::Message::data_ptr
void * data_ptr
Pointer to memory that contains local data.
Definition: message.h:128
fawkes::Message::data_ts
message_data_ts_t * data_ts
data timestamp aliasing pointer
Definition: message.h:138
fawkes::ProtobufPeerInterface::CreatePeerCryptoMessage::maxlenof_address
size_t maxlenof_address() const
Get maximum length of address value.
Definition: ProtobufPeerInterface.cpp:525
fawkes::ProtobufPeerInterface::CreatePeerLocalCryptoMessage::maxlenof_address
size_t maxlenof_address() const
Get maximum length of address value.
Definition: ProtobufPeerInterface.cpp:724
fawkes::ProtobufPeerInterface::CreatePeerLocalCryptoMessage::recv_on_port
int32_t recv_on_port() const
Get recv_on_port value.
Definition: ProtobufPeerInterface.cpp:774
fawkes::ProtobufPeerInterface::CreatePeerLocalMessage::address
char * address() const
Get address value.
Definition: ProtobufPeerInterface.cpp:350
fawkes::ProtobufPeerInterface::copy_values
virtual void copy_values(const Interface *other)
Copy values from other interface.
Definition: ProtobufPeerInterface.cpp:144
fawkes::ProtobufPeerInterface::set_peers
void set_peers(unsigned int index, const int64_t new_peers)
Set peers value at given index.
Definition: ProtobufPeerInterface.cpp:117
fawkes::ProtobufPeerInterface::create_message
virtual Message * create_message(const char *type) const
Create message based on type name.
Definition: ProtobufPeerInterface.cpp:123
fawkes::ProtobufPeerInterface::CreatePeerLocalCryptoMessage::send_to_port
int32_t send_to_port() const
Get send_to_port value.
Definition: ProtobufPeerInterface.cpp:744
fawkes::Interface::type
const char * type() const
Get type of interface.
Definition: interface.cpp:643
fawkes::ProtobufPeerInterface::CreatePeerLocalMessage::set_recv_on_port
void set_recv_on_port(const int32_t new_recv_on_port)
Set recv_on_port value.
Definition: ProtobufPeerInterface.cpp:430
fawkes::ProtobufPeerInterface::CreatePeerCryptoMessage::CreatePeerCryptoMessage
CreatePeerCryptoMessage()
Constructor.
Definition: ProtobufPeerInterface.cpp:478
fawkes::Interface::add_fieldinfo
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0, const interface_enum_map_t *enum_map=0)
Add an entry to the field info list.
Definition: interface.cpp:336
fawkes::Interface::data_ts
interface_data_ts_t * data_ts
Pointer to data casted to timestamp struct.
Definition: interface.h:228
fawkes::ProtobufPeerInterface::CreatePeerCryptoMessage::address
char * address() const
Get address value.
Definition: ProtobufPeerInterface.cpp:515
fawkes::ProtobufPeerInterface::CreatePeerLocalCryptoMessage::maxlenof_recv_on_port
size_t maxlenof_recv_on_port() const
Get maximum length of recv_on_port value.
Definition: ProtobufPeerInterface.cpp:784
fawkes::Message::message_data_ts_t
Timestamp data, must be present and first entries for each interface data structs!...
Definition: message.h:134
fawkes::ProtobufPeerInterface::CreatePeerLocalCryptoMessage::~CreatePeerLocalCryptoMessage
~CreatePeerLocalCryptoMessage()
Destructor.
Definition: ProtobufPeerInterface.cpp:691
fawkes::ProtobufPeerInterface::CreatePeerLocalCryptoMessage::set_crypto_key
void set_crypto_key(const char *new_crypto_key)
Set crypto_key value.
Definition: ProtobufPeerInterface.cpp:824
fawkes::ProtobufPeerInterface::CreatePeerLocalMessage::clone
virtual Message * clone() const
Clone this message.
Definition: ProtobufPeerInterface.cpp:441
fawkes::TypeMismatchException
Type mismatch.
Definition: software.h:44
fawkes::ProtobufPeerInterface::peers
int64_t * peers() const
Get peers value.
Definition: ProtobufPeerInterface.cpp:71
fawkes::Interface::data_changed
bool data_changed
Indicator if data has changed.
Definition: interface.h:226
fawkes::ProtobufPeerInterface::CreatePeerMessage
CreatePeerMessage Fawkes BlackBoard Interface Message.
Definition: ProtobufPeerInterface.h:54
fawkes::ProtobufPeerInterface::CreatePeerLocalMessage::send_to_port
int32_t send_to_port() const
Get send_to_port value.
Definition: ProtobufPeerInterface.cpp:380
fawkes::ProtobufPeerInterface::CreatePeerLocalCryptoMessage::cipher
char * cipher() const
Get cipher value.
Definition: ProtobufPeerInterface.cpp:834
fawkes::ProtobufPeerInterface
ProtobufPeerInterface Fawkes BlackBoard Interface.
Definition: ProtobufPeerInterface.h:34
fawkes::ProtobufPeerInterface::CreatePeerMessage::set_address
void set_address(const char *new_address)
Set address value.
Definition: ProtobufPeerInterface.cpp:241
fawkes::IFT_INT32
@ IFT_INT32
32 bit integer field
Definition: types.h:42
fawkes::ProtobufPeerInterface::CreatePeerLocalCryptoMessage::CreatePeerLocalCryptoMessage
CreatePeerLocalCryptoMessage()
Constructor.
Definition: ProtobufPeerInterface.cpp:676
fawkes::UnknownTypeException
Unknown type.
Definition: software.h:50
fawkes::ProtobufPeerInterface::CreatePeerLocalCryptoMessage::maxlenof_crypto_key
size_t maxlenof_crypto_key() const
Get maximum length of crypto_key value.
Definition: ProtobufPeerInterface.cpp:814
fawkes::ProtobufPeerInterface::CreatePeerLocalMessage::maxlenof_send_to_port
size_t maxlenof_send_to_port() const
Get maximum length of send_to_port value.
Definition: ProtobufPeerInterface.cpp:390
fawkes::ProtobufPeerInterface::CreatePeerLocalMessage
CreatePeerLocalMessage Fawkes BlackBoard Interface Message.
Definition: ProtobufPeerInterface.h:83
fawkes::ProtobufPeerInterface::maxlenof_peers
size_t maxlenof_peers() const
Get maximum length of peers value.
Definition: ProtobufPeerInterface.cpp:96
fawkes
Fawkes library namespace.
fawkes::Interface::set_hash
void set_hash(unsigned char *ihash)
Set hash.
Definition: interface.cpp:316
fawkes::ProtobufPeerInterface::CreatePeerCryptoMessage::~CreatePeerCryptoMessage
~CreatePeerCryptoMessage()
Destructor.
Definition: ProtobufPeerInterface.cpp:492
fawkes::Message::data_size
unsigned int data_size
Size of memory needed to hold all data.
Definition: message.h:129
fawkes::ProtobufPeerInterface::message_valid
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
Definition: ProtobufPeerInterface.cpp:874
fawkes::ProtobufPeerInterface::CreatePeerLocalCryptoMessage::maxlenof_send_to_port
size_t maxlenof_send_to_port() const
Get maximum length of send_to_port value.
Definition: ProtobufPeerInterface.cpp:754
fawkes::ProtobufPeerInterface::CreatePeerCryptoMessage::set_port
void set_port(const int32_t new_port)
Set port value.
Definition: ProtobufPeerInterface.cpp:565
fawkes::Interface
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
fawkes::ProtobufPeerInterface::CreatePeerMessage::address
char * address() const
Get address value.
Definition: ProtobufPeerInterface.cpp:221
fawkes::ProtobufPeerInterface::CreatePeerMessage::clone
virtual Message * clone() const
Clone this message.
Definition: ProtobufPeerInterface.cpp:282
fawkes::ProtobufPeerInterface::CreatePeerLocalCryptoMessage::set_recv_on_port
void set_recv_on_port(const int32_t new_recv_on_port)
Set recv_on_port value.
Definition: ProtobufPeerInterface.cpp:794
fawkes::ProtobufPeerInterface::CreatePeerLocalCryptoMessage::set_address
void set_address(const char *new_address)
Set address value.
Definition: ProtobufPeerInterface.cpp:734
fawkes::ProtobufPeerInterface::CreatePeerMessage::~CreatePeerMessage
~CreatePeerMessage()
Destructor.
Definition: ProtobufPeerInterface.cpp:198
fawkes::ProtobufPeerInterface::CreatePeerLocalMessage::~CreatePeerLocalMessage
~CreatePeerLocalMessage()
Destructor.
Definition: ProtobufPeerInterface.cpp:327
fawkes::IFT_INT64
@ IFT_INT64
64 bit integer field
Definition: types.h:44
fawkes::ProtobufPeerInterface::CreatePeerMessage::port
int32_t port() const
Get port value.
Definition: ProtobufPeerInterface.cpp:251
fawkes::Message::add_fieldinfo
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0, const interface_enum_map_t *enum_map=0)
Add an entry to the info list.
Definition: message.cpp:400
fawkes::ProtobufPeerInterface::CreatePeerLocalMessage::recv_on_port
int32_t recv_on_port() const
Get recv_on_port value.
Definition: ProtobufPeerInterface.cpp:410
fawkes::ProtobufPeerInterface::CreatePeerLocalCryptoMessage::address
char * address() const
Get address value.
Definition: ProtobufPeerInterface.cpp:714
fawkes::Interface::data_size
unsigned int data_size
Minimal data size to hold data storage.
Definition: interface.h:225
fawkes::ProtobufPeerInterface::CreatePeerCryptoMessage::set_address
void set_address(const char *new_address)
Set address value.
Definition: ProtobufPeerInterface.cpp:535
fawkes::ProtobufPeerInterface::CreatePeerCryptoMessage::set_crypto_key
void set_crypto_key(const char *new_crypto_key)
Set crypto_key value.
Definition: ProtobufPeerInterface.cpp:595
fawkes::ProtobufPeerInterface::enum_tostring
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
Definition: ProtobufPeerInterface.cpp:155
fawkes::ProtobufPeerInterface::CreatePeerCryptoMessage::maxlenof_crypto_key
size_t maxlenof_crypto_key() const
Get maximum length of crypto_key value.
Definition: ProtobufPeerInterface.cpp:585
fawkes::IFT_STRING
@ IFT_STRING
string field
Definition: types.h:48
fawkes::ProtobufPeerInterface::CreatePeerCryptoMessage::port
int32_t port() const
Get port value.
Definition: ProtobufPeerInterface.cpp:545
fawkes::ProtobufPeerInterface::CreatePeerLocalMessage::maxlenof_address
size_t maxlenof_address() const
Get maximum length of address value.
Definition: ProtobufPeerInterface.cpp:360
fawkes::ProtobufPeerInterface::CreatePeerLocalCryptoMessage
CreatePeerLocalCryptoMessage Fawkes BlackBoard Interface Message.
Definition: ProtobufPeerInterface.h:153
fawkes::ProtobufPeerInterface::CreatePeerLocalCryptoMessage::set_send_to_port
void set_send_to_port(const int32_t new_send_to_port)
Set send_to_port value.
Definition: ProtobufPeerInterface.cpp:764
fawkes::ProtobufPeerInterface::CreatePeerCryptoMessage
CreatePeerCryptoMessage Fawkes BlackBoard Interface Message.
Definition: ProtobufPeerInterface.h:116
fawkes::ProtobufPeerInterface::CreatePeerLocalCryptoMessage::maxlenof_cipher
size_t maxlenof_cipher() const
Get maximum length of cipher value.
Definition: ProtobufPeerInterface.cpp:844
fawkes::Interface::add_messageinfo
void add_messageinfo(const char *name)
Add an entry to the message info list.
Definition: interface.cpp:375
fawkes::ProtobufPeerInterface::CreatePeerCryptoMessage::maxlenof_cipher
size_t maxlenof_cipher() const
Get maximum length of cipher value.
Definition: ProtobufPeerInterface.cpp:615
fawkes::ProtobufPeerInterface::CreatePeerMessage::set_port
void set_port(const int32_t new_port)
Set port value.
Definition: ProtobufPeerInterface.cpp:271
fawkes::ProtobufPeerInterface::CreatePeerLocalMessage::maxlenof_recv_on_port
size_t maxlenof_recv_on_port() const
Get maximum length of recv_on_port value.
Definition: ProtobufPeerInterface.cpp:420
fawkes::change_field
bool change_field(FieldT &field, const DataT &value)
Set a field and return whether it changed.
Definition: message.h:167
fawkes::ProtobufPeerInterface::CreatePeerLocalCryptoMessage::crypto_key
char * crypto_key() const
Get crypto_key value.
Definition: ProtobufPeerInterface.cpp:804
fawkes::ProtobufPeerInterface::CreatePeerLocalMessage::set_send_to_port
void set_send_to_port(const int32_t new_send_to_port)
Set send_to_port value.
Definition: ProtobufPeerInterface.cpp:400
fawkes::ProtobufPeerInterface::CreatePeerLocalCryptoMessage::set_cipher
void set_cipher(const char *new_cipher)
Set cipher value.
Definition: ProtobufPeerInterface.cpp:854
fawkes::ProtobufPeerInterface::CreatePeerMessage::maxlenof_port
size_t maxlenof_port() const
Get maximum length of port value.
Definition: ProtobufPeerInterface.cpp:261
fawkes::Exception
Base class for exceptions in Fawkes.
Definition: exception.h:36