This repository was archived by the owner on Feb 28, 2019. It is now read-only.
forked from Jester565/CommColab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNGCP.uxf
More file actions
1886 lines (1766 loc) · 60.1 KB
/
Copy pathNGCP.uxf
File metadata and controls
1886 lines (1766 loc) · 60.1 KB
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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<diagram program="umlet" version="14.2">
<zoom_level>8</zoom_level>
<element>
<id>UMLClass</id>
<coordinates>
<x>1528</x>
<y>1464</y>
<w>256</w>
<h>232</h>
</coordinates>
<panel_attributes>//Abstract class to be used for determining what data should be sent and what callback to use when received. Has a unique key to distinguish it from other packets.
AbstractPacket
--
public:
//New instance of AbstractPacket, sets the typeID attribute to the hash of typeIDHashKey
+AbstractPacket(const char* typeIDHashKey);
//Accessor for the id of the packet, used to set the msg_id of a header
+uint32_t GetID() const;
//Serializes the contents of the packet to the outStream parameter (pure virtual). Called by Comm::send.
+void Pack(ObjectStream& outStream) = 0;
//Parses the contents of the packet from the inStream parameter (pure virtual)
+void Unpack(ObjectStream& inStream) = 0;
//Casts AbstractPacket to Type and returns it (return by reference evil?)
+static Type& GetValue(AbstractPacket& packet);
//Returns a new instance of some child of AbstractPacket (pure virtual). Used by PacketFactory.
+AbstractPacket* Create() = 0;
//Default destructor
+~AbstractPacket();
--
//Default constructor (maybe this shouldn't exist?)
-AbstractPacket();
//Accessed by getID(), set by constructor. Identification number for the packet.
-uint32_t type_id;
--
//Call from child's constructor to AbstractPacket's constructor. Pass in the type of the child and it
//will be converted into a const char* and be passed into AbstractPacket constructor as classname parameter.
CHAIN_ABSPACKET(class_name)
//Example - class Packet : INHERITS_ABSPACKET {};
INHERITS_ABSPACKET
//Defined as the name of the class representing the abstractpacket (so in this case comnet::AbstractPacket)
ABSPACKET</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>0</x>
<y>2200</y>
<w>248</w>
<h>408</h>
</coordinates>
<panel_attributes>api.h
--
--
//Hexidecmial representatoin of the minimum version of the library
_COMNET_MINIMUM_API_VERSION_
//Hexidecimal representation of the last version of the library that has the same method names (no deprecated methods)
_COMNET_COMPATIBLE_API_VERSOIN_
//Hexidecimal representation of the current version of the library (Should be greater than COMENT_COMPATIBLE_API_VERSION_ and COMNET_MINIMUM_API_VERSION_
_COMNET_CURRENT_API_VERSION_
//I still don't really know what this does... you pass it one of the API_VERSOIN defines and it just gives you the hexideceimal (so it just returns the parameter you passed it...)
obtain_api_version(_api_version)
//Put before classes to denote what part of the API they are (public in this case). Never get rid of this define or the program won't compile.
_COMNET_PUBLIC_API_
//Put before classes to denote what part of the API they are (general in this case). Never get rid of this define or the program won't compile.
_COMNET_API_
//Put before classes to denote what part of the API they are (private in this case). Never get rid of this define or the program won't compile.
_COMNET_API_PRIVATE_
//Not implemented anywhere yet. Denotes how much implementers of the library will have to see the classes 0 means they will probably never see it and 5 means they will see it. Just a guess though.
_COMNET_API_LEVEL_(UNKNOWN, 0, 1, 2,3,4,5)_
//Replace for class so that the class behaving as an interface is more clear. Not implemented anywhere.
_COMNET_INTERFACE_
//Replace for class so that the class behaving as an abstract class is more clear. Not implemented anywhere.
_COMNET_ABSTRACT_
//Replace for class so that the class behaving as a normal class is more clear. Not implemented anywhere.
_CLASS_
//Retunrs the value of _COMNET_CURRENT_API_VERSION_
_current_api_version obtain_api_version(_COMNET_CURRENT_API_VERSION_)
//This define is put in classes that should be apart of the DLL. However, when in static library mode, this is left blank.
COMM_EXPORT
//Not sure what the purpose of this is. Usually the linker will figure out dll imports for you.
COMM_IMPORT
</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>48</x>
<y>1968</y>
<w>152</w>
<h>200</h>
</coordinates>
<panel_attributes>arch.h
--
--
//Set to one of the defines below based on macro detection of which OS the library is being built on
COM_TARGET_OS
COM_OS_UNKNOWN
COM_OS_WINDOWS
COM_OS_LINUX
//Not used
COM_OS_QX
//Not used
COM_OS_BSD</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>112</x>
<y>2160</y>
<w>24</w>
<h>56</h>
</coordinates>
<panel_attributes>lt=<<-</panel_attributes>
<additional_attributes>10.0;10.0;10.0;50.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1792</x>
<y>3008</y>
<w>328</w>
<h>264</h>
</coordinates>
<panel_attributes>Comms
--
-CommMutex send_mutex;
-CommMutex recv_mutex;
-CommMutex console_mutex;
-CommConditionVariable comm_cond_var_send;
-uint32_t rx_length;
-CommThread comm_thread_send;
-CommThread comm_thread_recv;
-CommThread console_thread;
-void CommunicationHandlerSend();
-void CommunicationHandlerRecv();
-CommsLink *conn_layer;
-encryption::CommEncryptor encrypt;
-encryption::CommDecryptor decrypt;
-std::shared_ptr <ConnectionStateManager> conStateManager;
--
+Comms(uint8_t platform_id);
+~Comms();
+bool LoadKey(char* key);
+bool LoadKeyFromFile(char*keyFileName);</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1760</x>
<y>2608</y>
<w>544</w>
<h>336</h>
</coordinates>
<panel_attributes>//Abstract class that will allow for easy adjustments in node changing and style.
/CommsNode/
--
//Initially 0, is incremented every time a CommNode is created so the value of unique_id can be set to this value.
static uint16_t number_of_nodes;
//Sets unique_id to number_of_nodes, increments number_of_nodes. Sets attributes to default.
CommNode();
//Sets node_id to the parameter platform_id (this name is a bit confusing to me).
//Sets unique_id to number_of_nodes, increments number_of_nodes. Sets attributes to default.
CommNode(const uint32_t platform_id);
//Delets the recv_queue and send_queue
//MEMEORY LEAK: Elements inside the queues are not deleted! (Not too sure about this yet)
~CommNode();
//Calls packet_manger.Insert to add packet to table. Callback is set to NULL. True if added successfull.
bool AddPacket(const AbstractPacket* packet);
//Calls packet_manager.Insert to add packet, callback pair to table. True if added successfully.
bool LinkCallback(AbstractPacket* packet, const Callback* callback);
//Not implemented
bool LinkQueue(const AbstractPacket* packet, const Queue<AbstractPacket*>* queue);
//Delete the current send_queue and reassign it to the one passed as a parameter.
bool ReplaceSendQueue(const Queue<ObjectStream*>* queue);
//Delete the current recv_queue and reassign it to the one passed as a parameter.
bool ReplaceReceiveQueue(const Queue<AbstractPacket*>* queue);
//Send packet to specified destination.
bool Send(AbstractPacket* packet, uint8_t dest_id) = 0;
//Checks if data was received, if it was, the AbstractPacket is created, the corresponding callback is called, and the abstractpacket is returned.
AbstractPacket* Receive(uint8_t& source_id) = 0;
//Will initialize a connection device
bool InitConnection(transport_protocol_t conn_type, const char* port, const char* address, uint16_t port) = 0;</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1824</x>
<y>2184</y>
<w>328</w>
<h>384</h>
</coordinates>
<panel_attributes>PacketManager
--
//Initializes table to DEFAULT_TABLE_SIZE
PacketManager();
//Initializes table to the parameter value
PacketManager(uint32_t setSize);
//Deletes the table
~PacketManager();
//Inserts 2 parameters as a pair into list
bool Insert(const AbstractPacket* key, const Callback* callback);
//Calls table->GetCallback, gets the Callback associated with the key, null if key doesn't exist in the table.
Callback* PacketManager::Get(const AbstractPacket& key);
//Calls table->remove true if removed successfully, false otherwise.
//WILL FAIL EVERY TIME RIGHT NOW
bool Remove(const AbstractPacket* key);
//NOT IMPLEMENTED
bool Contains(const AbstractPacket& key);
//NOT IMPLEMENTED
//Well, this would certainly be a slow lookup, is it necessary
bool Contains(Callback* call);
//Accessor for size attribute
int32_t GetSize();
//Uses factory to create a new instance of a AbstractPacket subtype of the AbstractPacket saved at the key. Nullptr if key has no elements or AbstractPacket::Create returns nullptr.
AbstractPacket* ProduceFromId(uint32_t key);
private:
//Used in ProduceFromId method. Creates instance of AbstractPacket matching subtype of other AbstractPacket.
PacketFactory factory;
//Hashtable storing AbstractPacket and Callback pairs
PacketTable* table;
//Stores amount of pairs in table
//THIS SHOULDN'T EXIST
int32_t size;
//THIS SHOULDN't EXIST
int32_t MaxSize;</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1912</x>
<y>2072</y>
<w>296</w>
<h>72</h>
</coordinates>
<panel_attributes>//Creates new packets of the same sub-type of the AbstractPacket that was passed in.
PacketFactory
--
//Sets id to 1 (no idea what id is supposed to do)
+PacketFactory();
//Takes a packet and returns AbstractPacket::create() if that packet was not nullptr.
+AbstractPacket* ProduceNewPacket(AbstractPacket* ref);
--
//No idea what this does. Is not currently used anywher.
-uint32_t id;</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>2112</x>
<y>1688</y>
<w>328</w>
<h>248</h>
</coordinates>
<panel_attributes>//Implementation of a hashtable for AbstractPackets and CallBacks
/PacketTable/
--
//Creates an array of null pointers to Pair arrays that will be the size of the parameter
+PacketTable(uint32_t setSize);
//Creates an array of null pointers to Pair arrays that will be the size of DEFAULT_TABLE_SIZE
+PacketTable();
//Deletes all the elements inside of the pairs that make up the table and then deletes the table/
+~PacketTable();
//Inserts an element into the hashtable. Will fail if array is full. Returns true if element was added successfully.
//Called by PacketManager::insert
+bool Insert(const AbstractPacket* key, const Callback* callback);
//Gets the element at the hashed key and returns the callback, nullptr if no element exists at the key.
+Callback* GetCallback(uint32_t key);
//Gets the element at the hashed key and returns the AbstractPacket, nullptr if no element exists at the key.
+AbstractPacket* PacketTable::GetPacket(uint32_t key);
//Pointer to a callback
+bool Contains(Callback* call);
//Removes the pair with the matching key from the array. True on success, false otherwise.
+bool Remove(uint32_t key);
//Aquires more memory for the Pairs. Cannot decrease the size of the memory.
+bool Reserve(uint32_t newSize);</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>2592</x>
<y>2984</y>
<w>440</w>
<h>184</h>
</coordinates>
<panel_attributes>/CommsLink/
--
//Default constructor.
+CommsLink();
//Default destructor.
+virtual ~CommsLink();
//Opens a socket on the machine (address is not used).
+virtual bool InitConnection(const char* port, const char* address, uint32_t baudrate) = 0;
+virtual bool AddAddress(uint8_t dest_id, const char* addreses, uint16_t port) = 0;
+virtual bool RemoveAddress(uint8_t dest_id) = 0;
+virtual bool Send(uint8_t dest_id, uint8_t* tx_data, uint32_t tx_length) = 0;
+virtual bool Recv(uint8_t* rx_data, uint32_t* rx_length) = 0;
+virtual void DigestCommand(const char* cmd) = 0;
+transport_protocol_t GetPrtocol();
--
-transport_protocol_t protocol;</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>2056</x>
<y>3376</y>
<w>408</w>
<h>272</h>
</coordinates>
<panel_attributes>UDPLink
--
//Sets protocol to UDP_LINK
+UDPLink();
//Closes local
+~UDPLink();
//Initializes local object and binds it to the port parameter on localhost.
+bool InitConnection(const char* port, const char* address, uint16_t port) override;
//Initializes a udp object and adds it to clients. Returns true on successful connection.
+bool AddAddress(uint8_t dest_id, const char* address, uint16_t port) override;
//Removes the client with the dest_id. True on successful removal.
+bool RemoveAddress(uint8_t dest_id) override;
//Sends data to the client with the dest_id.
+bool Send(uint8_t dest_id, int8_t* txData, uint32_t txLength) override;
//Receives data from all clients.
+bool Recv(int8_t* rxData, uint32_t* rxLength) override;
//Not implemented
+void DigestCommand(const char* cmd);
--
//Doesn't send or receive anything. Initializes and opens the socket.
-UDP local;
//Contains all of the clients connected to this socket.
-std::map<uint8_t, std::unique_ptr<UDP>> clients;</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>2480</x>
<y>3664</y>
<w>432</w>
<h>192</h>
</coordinates>
<panel_attributes>SerialLink
--
+SerialLink();
+~SerialLink();
+bool InitConnection(const char* port, const char* address, uint32_t baudrate) override;
+bool AddAddress(uint8_t dest_id, const char* address, uint16_t port) override;
+bool RemoveAddress(uint8_t dest_id) override;
+bool Send(uint8_t dest_id, uint8_t* tx_data, uint32_t tx_length) override;
+bool Recv(uint8_t* rx_data, uint32_t* rx_length) override;
+void DigestCommand(const char* cmd) override;
--
-Serial* local;
-LIst <SerialConn*>* connections;</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>2920</x>
<y>3432</y>
<w>288</w>
<h>352</h>
</coordinates>
<panel_attributes>XBeeLink
--</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>2688</x>
<y>2864</y>
<w>168</w>
<h>64</h>
</coordinates>
<panel_attributes>transport_protocol_t
--</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>2152</x>
<y>3072</y>
<w>424</w>
<h>248</h>
</coordinates>
<panel_attributes>UDP
--
//Default constructor.
+UDP();
//Move constructor. Uses copy and swap idiom.
+UDP(UDP&& udp);
//Default destructor.
+~UDP();
//Calls UdpOpen and binds the socket to the port passed in as a parameter.
+bool InitConnection(const char* port, const char* address, uint32_t baudrate);
//If the socket is open, create and return a UDP object representing a client with the IP of the parameters passed in.
+std::unique_ptr<UDP> Connect(uint8_t dest_id, const char* address, uint16_t port);
//Sends the data array by using the sendto function in the OS API.
+bool Send(uint8_t* tx_data, uint32_t tx_length);
//If data was received, set the rx_data array to the data that was received and return true.
+bool Recv(uint8_t* rx_data, uint32_t* rx_length);
+socket_t& GetSocket();
//Closes the socket if the socket is not already closed. True on success.
+bool Close();
--
//Initializes UDP socket
-UdpOpen(int* fd);
//The socket id, set by UdpOpen.
-int fd;
//The IP address of the UDP socket.
-socket_t sockaddr;
//The size of sockaddr.socket_address in bytes.
-int slen;</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>2336</x>
<y>2952</y>
<w>192</w>
<h>96</h>
</coordinates>
<panel_attributes>socket_t
--
//Integer that holds the socket identication number for calls to winsock.
+SOCKET socket;
//Port the socket binds to.
+PORT port;
//Holds the destination id of the UDP object.
+ID_T id;
//Either SOCKET_OPEN, SOCKET_CLOSED, SOCKET_RESOLVING, SOCKET_CONNECTING, SOCKET_CONNECTED, SOCKET_LISTENING, SOCKET_FAILED
+socket_status_t socket_status;
//Holds the information necessary for calls to send and receive.
+struct sockaddr_in socket_address;</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>2264</x>
<y>2016</y>
<w>360</w>
<h>280</h>
</coordinates>
<panel_attributes>CommEncryptor
--
-std::shared_ptr<EncryptionInterface> encryption;
-CommDecryptor* decryptor;
-CryptProtocol protocol;
-friend class CommDecryptor;
--
-COMM_DISALLOW_COPYING(CommEncryptor)
+CommEncryptor();
+CommEncryptor(CryptProtocol proto);
+CommEncryptor(CryptProtocol proto, CommDecryptor* decryptor);
+CommEncryptor(CommEncryptor&& encrypt);
+CommEncryptor& operator=(CommEncryptor&& encrypt);
+~CommEncryptor();
+uint8_t LoadKey(char* key);
+uint8_t LoadKeyFromFile(char* filename_key);
+int32_t Encrypt(comnet::serialization::ObjectStream* obj);
+CommDecryptor* GetDecryptor() { return decryptor; }
+void LinkDecryptor(CommDecryptor* decrypt) { decryptor = decrypt; }
+CryptProtocol GetEncryptionType() { return protocol; }
+bool KeyIsLoaded();
-void Setup();</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1840</x>
<y>1528</y>
<w>472</w>
<h>136</h>
</coordinates>
<panel_attributes>//Stores an std::function (typedefed as CallbackFunc) that is invoked by CallFunction
//WARNING: CallbackFunc is a typedef of std::function but takes the appropiate parameters and has the right return type
Callback
--
//Initializes the CallbackFunc to a method that returns -100
+Callback();
//Initialize the Callback and set the CallbackFunc to the parameter. Function must take parameters: const Header& header, AbstractPacket& abPacket, CommNode& node
+Callback(CallbackFunc call);
//Default destructor
+~Callback();
//Set the CallbackFunc to the parameter, the function must take parameters: const Header& header, AbstractPacket& abPacket, CommNode& node
+void SetCallbackListener(CallbackFunc call);
//Called by Comms::CommunicationHandlerRecv and will run the method and will pass in the appropiate parameters
+error_t CallFunction(const Header& header, AbstractPacket& abPacket, CommNode& node);
--
//Remember that CallBackFunc is a typedef for std::function. Must take the parameters (const Header&, AbstractPacket&, CommNode&)
-CallBackFunc callback;</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1736</x>
<y>1784</y>
<w>328</w>
<h>192</h>
</coordinates>
<panel_attributes>PacketHashTable
--
//Creates an array of null pointers to Pair arrays that will be the size of the parameter
+PacketTable(uint32_t setSize);
//Creates an array of null pointers to Pair arrays that will be the size of DEFAULT_TABLE_SIZE
+PacketTable();
//Deletes all the elements inside of the pairs that make up the table and then deletes the table/
+~PacketTable();
//Inserts an element into the hashtable. Will fail if array is full. Returns true if element was added successfully.
//Called by PacketManager::insert
+bool Insert(const AbstractPacket* key, const Callback* callback);
//Gets the element at the hashed key and returns the callback, nullptr if no element exists at the key.
+Callback* GetCallback(uint32_t key);
//Gets the element at the hashed key and returns the AbstractPacket, nullptr if no element exists at the key.
+AbstractPacket* PacketTable::GetPacket(uint32_t key);
//Not implemented yet
+bool Remove(uint32_t key);
//Not implemented yet
+bool Resize(uint32_t newSize);
--
//Increments i, sets it to 0 if greater than or equal to tableSize. Called by Insert.
-int32_t TraverseIndex(int32_t i);
//Hashes the key and returns an integer between 0 and tableSize (but no equal to tableSize)
-uint32_t KeyHash(uint32_t key);
//An array of Pair* with size tableSize. Where all the elements are inserted, etc.
-Pair** table;
//Number of elements in the array.
-uint32_t numOfPairs;
//The maximum amount of elements that can be stored in the map before a resize is needed.
-uint32_t tableSize;</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>2512</x>
<y>3376</y>
<w>400</w>
<h>248</h>
</coordinates>
<panel_attributes>Serial
--
+Serial();
+Serial(uint32_t id);
+~Serial();
+bool OpenConnection(const char* port, const char* address, uint32_t baudrate);
+bool Send(uint8_t dest_id, uint8_t* tx_data, uint32_t tx_length);
+bool Recv(uint8_t* rx_data, uint32_t* rx_length);
+serial_status GetStatus();
+bool CloseSerialPort();
+serial_t& GetSerialPort();
+void SetId(uint32_t id);
--
-int32_t id;
-serial_t h_serial;
-bool connection_established;
-Parser parser;
-uint8_t buffer_recv[];
-uint8_t buffer_send[];</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>3128</x>
<y>24</y>
<w>400</w>
<h>408</h>
</coordinates>
<panel_attributes>marshal
(non class)
--
+typedef uint8_t* marshal_t;
+typedef char* string_t;
--
+uint32_t PackString(string_t data, uint8_t len, marshal_t input);
+uint32_t UnpackString(string_t data, uint8_t len, marshal_t input);
+uint32_t PackWideString(std::wstring &data, uint8_t len, marshal_t input);
+uint32_t UnpackWideString(std::wstring &data, uint8_t len, marshal_t input);
+uint32_t PackByte(uint8_t data, marshal_t input);
+uint8_t UnpackByte(marshal_t input);
+uint32_t PackUint16(uint16_t data, marshal_t input);
+uint16_t UnpackUint16(marshal_t input);
+uint32_t PackInt16(int16_t data, marshal_t input);
+int16_t UnpackInt16(marshal_t input);
+uint32_t PackUint32(uint32_t data, marshal_t input);
+uint32_t UnpackUint32(marshal_t input);
+uint32_t PackInt32(int32_t data, marshal_t input);
+int32_t UnpackInt32(marshal_t input);
+uint32_t PackUint64(uint64_t data, marshal_t input);
+uint64_t UnpackUint64(marshal_t input);
+uint32_t PackInt64(int64_t data, marshal_t input);
+int64_t UnpackInt64(marshal_t input);
+uint32_t PackReal32(real32_t data, marshal_t input);
+real32_t UnpackReal32(marshal_t input);
+uint32_t PackReal64(real64_t data, marshal_t input);
+real64_t UnpackReal64(marshal_t input);
--
+template <typename T> void SwapEndian(T& pX)
+template <typename T> T SwapEndianCopy(T pX)
+template <typename T> int16_t PackGeneric(T data, marshal_t input)
+template <typename T> T UnpackGeneric(marshal_t input)</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>3128</x>
<y>456</y>
<w>384</w>
<h>1456</h>
</coordinates>
<panel_attributes>ObjectStream
--
-marshal_t stream_buffer;
-int32_t curr_pos;
-void PrintErrorUnderFlow();
-void PrintErrorOverFlow();
--
+Header header_packet;
+ObjectStream();
+ObjectStream(ObjectStream&& obj);
+ObjectStream& operator=(ObjectStream&& obj);
+~ObjectStream();
+int32_t GetPosition() const { return curr_pos; }
+int32_t GetSize() const { return curr_pos; }
+marshal_t GetBuffer() const { return stream_buffer; }
+Header& GetHeaderPacket() { return header_packet; }
+void SetBuffer(const char* buffer, int len);
+void SetHeader(Header& header);
+void SerializeHeader();
+Header DeserializeHeader();
+ObjectStream& operator<<(string_t& data);
+ObjectStream& operator<<(std::wstring& data);
+ObjectStream& operator<<(std::string& data);
+ObjectStream& operator<<(uint8_t& data);
+ObjectStream& operator<<(int8_t& data);
+ObjectStream& operator<<(uint16_t& data);
+ObjectStream& operator<<(int16_t& data);
+ObjectStream& operator<<(int32_t& data);
+ObjectStream& operator<<(uint32_t& data);
+ObjectStream& operator<<(int64_t& data);
+ObjectStream& operator<<(uint64_t& data);
+ObjectStream& operator<<(real32_t& data);
+ObjectStream& operator<<(real64_t& data);
+ObjectStream& operator<<(ObjSerializable& data);
//Overloaded output stream operators to output variables to a variable from the object stream
//string_t (char*) must use malloc when inputing data into new c-string variable
+ObjectStream& operator>>(string_t& data);
+ObjectStream& operator>>(std::wstring& data);
+ObjectStream& operator>>(std::string& data);
+ObjectStream& operator>>(uint8_t& data);
+ObjectStream& operator>>(int8_t& data);
+ObjectStream& operator>>(uint16_t& data);
+ObjectStream& operator>>(int16_t& data);
+ObjectStream& operator>>(uint32_t& data);
+ObjectStream& operator>>(int32_t& data);
+ObjectStream& operator>>(uint64_t& data);
+ObjectStream& operator>>(int64_t& data);
+ObjectStream& operator>>(real32_t& data);
+ObjectStream& operator>>(real64_t& data);
+ObjectStream& operator>>(ObjSerializable& data);
+ObjectStream& operater<<(const std::vector<T>& data);
+ObjectStream& operator>>(std::vector<T>& data);
+ObjectStream& operater<<(const std::vector<T*>& data);
+ObjectStream& operator>>(std::vector<T*>& data);
+ObjectStream& operator<<(const std::list<T>& data);
+ObjectStream& operator>>(std::list<T>& data);
+ObjectStream& operator<<(const std::list<T*>& data);
+ObjectStream& operator>>(std::list<T*>& data);
+ObjectStream& operator<<(const std::set<T>& data);
+ObjectStream& operator>>(std::set<T>& data);
+ObjectStream& operator<<(const std::set<T*>& data);
+ObjectStream& operator>>(std::set<T*>& data);
+ObjectStream& operator<<(const std::multiset<T>& data);
+ObjectStream& operator>>(std::multiset<T>& data);
+ObjectStream& operator<<(const std::multiset<T*>& data);
+ObjectStream& operator>>(std::multiset<T*>& data);
+ObjectStream& operator<<(const std::unordered_set<T>& data);
+ObjectStream& operator>>(std::unordered_set<T>& data);
+ObjectStream& operator<<(const std::unordered_set<T*>& data);
+ObjectStream& operator>>(std::unordered_set<T*>& data);
+ObjectStream& operator<<(const std::unordered_multiset<T>& data);
+ObjectStream& operator>>(std::unordered_multiset<T>& data);
+ObjectStream& operator<<(const std::unordered_multiset<T*>& data);
+ObjectStream& operator>>(std::unordered_multiset<T*>& data);
+ObjectStream& operator<<(const std::map<T,D>& data);
+ObjectStream& operator>>(std::map<T,D>& data);
+ObjectStream& operator<<(const std::map<T*,D>& data);
+ObjectStream& operator>>(std::map<T*,D>& data);
+ObjectStream& operator<<(const std::map<T,D*>& data);
+ObjectStream& operator>>(std::map<T,D*>& data);
+ObjectStream& operator<<(const std::map<T*,D*>& data);
+ObjectStream& operator>>(std::map<T*,D*>& data);
+ObjectStream& operator<<(const std::multimap<T,D>& data);
+ObjectStream& operator>>(std::multimap<T,D>& data);
+ObjectStream& operator<<(const std::multimap<T,D*>& data);
+ObjectStream& operator>>(std::multimap<T,D*>& data);
+ObjectStream& operator<<(const std::multimap<T*,D>& data);
+ObjectStream& operator>>(std::multimap<T*,D>& data);
+ObjectStream& operator<<(const std::multimap<T*,D*>& data);
+ObjectStream& operator>>(std::multimap<T*,D*>& data);
+ObjectStream& operator<<(const std::unordered_map<T,D>& data);
+ObjectStream& operator>>(std::unordered_map<T,D>& data);
+ObjectStream& operator<<(const std::unordered_map<T*,D>& data);
+ObjectStream& operator>>(std::unordered_map<T*,D>& data);
+ObjectStream& operator<<(const std::unordered_map<T,D*>& data);
+ObjectStream& operator>>(std::unordered_map<T,D*>& data);
+ObjectStream& operator<<(const std::unordered_map<T*,D*>& data);
+ObjectStream& operator>>(std::unordered_map<T*,D*>& data);
+ObjectStream& operator<<(const std::unordered_multimap<T,D>& data);
+ObjectStream& operator>>(std::unordered_multimap<T,D>& data);
+ObjectStream& operator<<(const std::unordered_multimap<T,D*>& data);
+ObjectStream& operator>>(std::unordered_multimap<T,D*>& data);
+ObjectStream& operator<<(const std::unordered_multimap<T*,D>& data);
+ObjectStream& operator>>(std::unordered_multimap<T*,D>& data);
+ObjectStream& operator<<(const std::unordered_multimap<T*,D*>& data);
+ObjectStream& operator>>(std::unordered_multimap<T*,D*>& data);</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>2472</x>
<y>1064</y>
<w>400</w>
<h>160</h>
</coordinates>
<panel_attributes>Header
--
+uint8_t dest_id;
+uint8_t source_id;
+uint16_t msg_len;
+uint16_t msg_id;
+uint8_t source_time_arr[4];
+uint8_t iv[KEY_LENGTH];
--
+int32_t GetSourceTime() const;
+void SetSourceTime(int32_t source_time);
+static uint32_t Serialize(Header& header, uint8_t* buffer, uint32_t offset);
+static uint32_t Deserialize(Header& header, uint8_t* buffer, uint32_t offset);</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1480</x>
<y>1280</y>
<w>184</w>
<h>128</h>
</coordinates>
<panel_attributes>Ping
--
+std::string test;
--
+Ping();
+Ping(std::string num);
+~Ping() { }
+void Pack(ObjectStream& obj);
+void Unpack(ObjectStream& obj);
+AbstractPacket* Create();
</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1680</x>
<y>1280</y>
<w>184</w>
<h>128</h>
</coordinates>
<panel_attributes>Pong
--
+char letter;
--
+Pong(char letter);
+~Pong();
+void Pack(ObjectStream& obj);
+void Unpack(ObjectStream& obj);
+AbstractPacket* Create();
</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>3032</x>
<y>2016</y>
<w>432</w>
<h>152</h>
</coordinates>
<panel_attributes><<Interface>>
EncryptionInterface
namespace comnet::encryption
--
public:
+virtual ~EncryptionInterface();
+virtual uint8_t LoadKey(char* key) = 0;
+virtual uint8_t LoadKeyFromFile(char*keyFileName) = 0;
+virtual int32_t Encrypt(uint8_t* buffer, uint32_t length, uint8_t iv[BLOCK_SIZE]) = 0;
+virtual int32_t Decrypt(uint8_t* buffer, uint32_t length, uint8_t iv[BLOCK_SIZE]) = 0;
+virtual uint8_t GenerateRandomIV(uint8_t * buffer, uint32_t length) = 0;
+virtual bool KeyIsLoaded() = 0;</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>2640</x>
<y>2016</y>
<w>352</w>
<h>240</h>
</coordinates>
<panel_attributes>CommDecryptor
--
- std::shared_ptr<EncryptionInterface> encryption;
- CommEncryptor* encryptor;
-CryptProtocol protocol;
- friend class CommEncryptor;
--
-COMM_DISALLOW_COPYING(CommDecryptor);
+CommDecryptor();
+CommDecryptor(CryptProtocol proto);
+CommDecryptor(CryptProtocol proto, CommEncryptor* encryptor);
+CommDecryptor(CommDecryptor&& decrypt);
+CommDecryptor& operator=(CommDecryptor&& decrypt);
+~CommDecryptor();
+uint8_t LoadKey(char* key);
+uint8_t LoadKeyFromFile(char* filename_key);
+int32_t Decrypt(comnet::serialization::ObjectStream* obj);
+CommEncryptor* GetEncryptor() { return encryptor; }
+void LinkEncryptor
</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLPackage</id>
<coordinates>
<x>3104</x>
<y>0</y>
<w>736</w>
<h>1944</h>
</coordinates>
<panel_attributes>Serilization
--
bg=orange
</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLPackage</id>
<coordinates>
<x>2248</x>
<y>1968</y>
<w>1256</w>
<h>600</h>
</coordinates>
<panel_attributes>Encryption
--
bg=orange</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>2640</x>
<y>2352</y>
<w>352</w>
<h>176</h>
</coordinates>
<panel_attributes>AesEncryption
--
-CryptoPP::SecByteBlock sec_key;
-static const int RANDOM_GEN_MIN;
-static const int RANDOM_GEN_MAX;
--
+AesEncryption();
+~AesEncryption();
+uint8_t LoadKey(char* key) override;
+uint8_t LoadKeyFromFile(char*keyFileName) override;
+int32_t Encrypt(uint8_t* buffer, uint32_t length, uint8_t iv[BLOCK_SIZE]) override;
+int32_t Decrypt(uint8_t* buffer, uint32_t length, uint8_t iv[BLOCK_SIZE]) override;
+uint8_t GenerateRandomIV(uint8_t * buffer, uint32_t length) override;
+bool KeyIsLoaded() override { return !sec_key.empty(); }
layer=1</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>2400</x>
<y>2288</y>
<w>288</w>
<h>80</h>
</coordinates>
<panel_attributes>lt=<<<<-</panel_attributes>
<additional_attributes>340.0;80.0;340.0;30.0;10.0;30.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>2784</x>
<y>2248</y>
<w>24</w>
<h>120</h>
</coordinates>
<panel_attributes>lt=<<<<-</panel_attributes>
<additional_attributes>10.0;130.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>