-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathhost.html
More file actions
1619 lines (1431 loc) · 81.3 KB
/
host.html
File metadata and controls
1619 lines (1431 loc) · 81.3 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
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Host — QuNetSim documentation</title>
<link rel="shortcut icon" href="../_static/favicon.png"/>
<script type="text/javascript" src="../_static/js/modernizr.min.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Network" href="network.html" />
<link rel="prev" title="Network Components" href="../components.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../index.html">
<img src="../_static/Psirocket_white.png" class="logo" alt="Logo"/>
</a>
<div class="version">
0.1.2
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Contents</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../intro.html">Introduction</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../intro.html#overview-video">Overview Video</a></li>
<li class="toctree-l2"><a class="reference internal" href="../intro.html#what-is-qunetsim">What is QuNetSim?</a></li>
<li class="toctree-l2"><a class="reference internal" href="../intro.html#who-should-use-qunetsim">Who should use QuNetSim?</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../install.html">Install</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../install.html#via-pip">Via pip</a></li>
<li class="toctree-l2"><a class="reference internal" href="../install.html#linux-mac-os-x">Linux / Mac OS X</a></li>
<li class="toctree-l2"><a class="reference internal" href="../install.html#windows">Windows</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../quick_start.html">Quick Start Guide</a><ul class="simple">
</ul>
</li>
<li class="toctree-l1 current"><a class="reference internal" href="../design.html">Design Overview</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="../components.html">Network Components</a><ul class="current">
<li class="toctree-l3 current"><a class="current reference internal" href="#">Host</a></li>
<li class="toctree-l3"><a class="reference internal" href="network.html">Network</a></li>
<li class="toctree-l3"><a class="reference internal" href="protocols.html">Protocols</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../objects.html">Network Objects</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../objects/message.html">Message</a></li>
<li class="toctree-l3"><a class="reference internal" href="../objects/qubit.html">Qubit</a></li>
<li class="toctree-l3"><a class="reference internal" href="../objects/quantum_storage.html">Quantum Storage</a></li>
<li class="toctree-l3"><a class="reference internal" href="../objects/classical_storage.html">Classical Storage</a></li>
<li class="toctree-l3"><a class="reference internal" href="../objects/quantum_connection.html">Quantum Connection</a></li>
<li class="toctree-l3"><a class="reference internal" href="../objects/classical_connection.html">Classical Connection</a></li>
<li class="toctree-l3"><a class="reference internal" href="../objects/packet.html">Packet</a></li>
<li class="toctree-l3"><a class="reference internal" href="../objects/routing_packet.html">Routing Packet</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../backends.html">Backends</a></li>
<li class="toctree-l2"><a class="reference internal" href="../backends.html#writing-your-own-backend">Writing your own Backend</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples.html">Examples</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../examples/send_data.html">Send Data Qubits</a></li>
<li class="toctree-l2"><a class="reference internal" href="../examples/send_epr.html">Send EPR Pairs</a></li>
<li class="toctree-l2"><a class="reference internal" href="../examples/send_w.html">Send W State</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../examples/send_w.html#w-state">W state</a></li>
<li class="toctree-l3"><a class="reference internal" href="../examples/send_w.html#example">Example</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../examples/chsh.html">CHSH Game</a></li>
<li class="toctree-l2"><a class="reference internal" href="../examples/packet_sniffing.html">Eavesdropping on channels</a></li>
<li class="toctree-l2"><a class="reference internal" href="../examples/quantum_money.html">Quantum Money with a Man-in-the-Middle Attack</a></li>
<li class="toctree-l2"><a class="reference internal" href="../examples/entanglement_routing.html">Routing with Entanglement</a></li>
<li class="toctree-l2"><a class="reference internal" href="../examples/QKD.html">Quantum Key Distribution</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../examples/QKD_BB84.html">Quantum Key Distribution - BB84</a></li>
<li class="toctree-l3"><a class="reference internal" href="../examples/QKD_B92.html">Quantum Key Distribution - B92</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../examples/quantum_coin_flipping.html">Quantum Coin Flipping</a></li>
<li class="toctree-l2"><a class="reference internal" href="../examples/anonymous_transfer.html">GHZ Based Anonymous Entanglement</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">QuNetSim</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html">Docs</a> »</li>
<li><a href="../design.html">Design Overview</a> »</li>
<li><a href="../components.html">Network Components</a> »</li>
<li>Host</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/components/host.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="host">
<h1>Host<a class="headerlink" href="#host" title="Permalink to this headline">¶</a></h1>
<p>The Host component is analogous to a host, or node in a classical network. Hosts in QuNetSim act either as a routing
node that can relay packets through the network, or they can act as a node that runs a specific protocol. It is up
to the protocol developer to configure how the nodes behave. In most cases, once the network is established,
users will run specific protocols on the nodes. In the examples we see how to accomplish this.</p>
<p>One other feature of a host is that they can also sniff packets, or eavesdrop on channels to manipulate the payload
of the packet. For example, they can apply random noise to any qubit or change the classical messages that are routed
through them. We see an example of that in the examples section.</p>
<p>The most commonly used methods for Hosts are:</p>
<ul class="simple">
<li><dl class="simple">
<dt><code class="code docutils literal notranslate"><span class="pre">add_connection(host_id)</span></code></dt><dd><ul>
<li><p>Add a classical and quantum connection to the host with id <em>host_id</em></p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="code docutils literal notranslate"><span class="pre">get_classical(host_id,</span> <span class="pre">wait=N)</span></code></dt><dd><ul>
<li><p>Get a classical message from sender with host_id <em>host_id</em> and wait <em>N</em> seconds for it</p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="code docutils literal notranslate"><span class="pre">get_qubit(host_id,</span> <span class="pre">wait=N)</span></code>:</dt><dd><ul>
<li><p>Get a data qubit from sender with host_id <em>host_id</em> and wait <em>N</em> seconds for it</p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="code docutils literal notranslate"><span class="pre">get_qubits(host_id)</span></code>:</dt><dd><ul>
<li><p>Get all data qubits from sender with host_id <em>host_id</em></p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="code docutils literal notranslate"><span class="pre">get_epr(host_id,</span> <span class="pre">q_id=q_id)</span></code>:</dt><dd><ul>
<li><p>Get EPR pair with qubit ID <em>q_id</em> from sender with host_id <em>host_id</em>. If <em>q_id=None</em> then get the first free EPR pair</p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="code docutils literal notranslate"><span class="pre">get_epr_pairs(host_id)</span></code>:</dt><dd><ul>
<li><p>Get all EPR pairs established with host with host_id <em>host_id</em></p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="code docutils literal notranslate"><span class="pre">send_classical(host_id,</span> <span class="pre">message,</span> <span class="pre">await_ack=<bool>)</span></code>:</dt><dd><ul>
<li><p>Send the classical message <em>message</em> to host with host_id <em>host_id</em>. Block until ACK arrives if <em>await_ack=True</em></p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="code docutils literal notranslate"><span class="pre">send_key(host_id,</span> <span class="pre">key_size)</span></code>:</dt><dd><ul>
<li><p>Send a secret key via QKD of length <em>key_size</em> to host with ID <em>receiver_id</em>.</p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="code docutils literal notranslate"><span class="pre">send_qubit(host_id,</span> <span class="pre">qubit,</span> <span class="pre">await_ack=<bool>)</span></code>:</dt><dd><ul>
<li><p>Send qubit <em>qubit</em> to host with host_id <em>host_id</em>. Block until ACK arrives if <em>await_ack=True</em>.</p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="code docutils literal notranslate"><span class="pre">send_superdense(host_id,</span> <span class="pre">message,</span> <span class="pre">await_ack=<bool>)</span></code>:</dt><dd><ul>
<li><p>Send a message (one of ‘00’, ‘01’, ‘10’, or ‘11’) as a superdense message</p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="code docutils literal notranslate"><span class="pre">send_teleport(host_id,</span> <span class="pre">qubit,</span> <span class="pre">await_ack=<bool>)</span></code>:</dt><dd><ul>
<li><p>Teleport qubit <em>qubit</em> to host with host_id <em>host_id</em>.</p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="code docutils literal notranslate"><span class="pre">send_epr(host_id,</span> <span class="pre">qubit_id=<None>,</span> <span class="pre">await_ack=<bool>)</span></code>:</dt><dd><ul>
<li><p>Creates a shared EPR pair with the host with host_id <em>host_id</em>.</p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="code docutils literal notranslate"><span class="pre">send_ghz([host_id_list],</span> <span class="pre">qubit_id=<None>,</span> <span class="pre">await_ack=<bool>)</span></code>:</dt><dd><ul>
<li><p>Creates a shared GHZ state with all hosts in the list [host_id_list].</p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="code docutils literal notranslate"><span class="pre">shares_epr(host_id)</span></code>:</dt><dd><ul>
<li><p>Returns if the host shares entanglement already with host with host_id <em>host_id</em></p></li>
</ul>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="code docutils literal notranslate"><span class="pre">run_protocol(protocol,</span> <span class="pre">protocol_params)</span></code>:</dt><dd><ul>
<li><p>Run the function <em>protocol</em> with the parameters <em>protocol_params</em>.</p></li>
</ul>
</dd>
</dl>
</li>
</ul>
<span class="target" id="module-qunetsim.components.host"></span><dl class="class">
<dt id="qunetsim.components.host.Host">
<em class="property">class </em><code class="sig-prename descclassname">qunetsim.components.host.</code><code class="sig-name descname">Host</code><span class="sig-paren">(</span><em class="sig-param">host_id</em>, <em class="sig-param">backend=None</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Host object acting as either a router node or an application host node.</p>
<dl class="method">
<dt id="qunetsim.components.host.Host._get_message_w_seq_num">
<code class="sig-name descname">_get_message_w_seq_num</code><span class="sig-paren">(</span><em class="sig-param">sender_id</em>, <em class="sig-param">seq_num</em>, <em class="sig-param">wait</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host._get_message_w_seq_num" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a message from a sender with a specific sequence number.
:param sender_id: The ID of the sender
:type sender_id: str
:param seq_num: The sequence number
:type seq_num: int
:param wait: The amount of time to wait. (-1 to wait forever)
:type wait: int</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The message</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>(<a class="reference internal" href="../objects/message.html#qunetsim.objects.message.Message" title="qunetsim.objects.message.Message">Message</a>)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host._log_ack">
<code class="sig-name descname">_log_ack</code><span class="sig-paren">(</span><em class="sig-param">protocol</em>, <em class="sig-param">receiver</em>, <em class="sig-param">seq</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host._log_ack" title="Permalink to this definition">¶</a></dt>
<dd><p>Logs acknowledgement messages.
:param protocol: The protocol for the ACK
:type protocol: str
:param receiver: The sender of the ACK
:type receiver: str
:param seq: The sequence number of the packet
:type seq: int</p>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host._process_ack">
<code class="sig-name descname">_process_ack</code><span class="sig-paren">(</span><em class="sig-param">sender</em>, <em class="sig-param">seq_num</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host._process_ack" title="Permalink to this definition">¶</a></dt>
<dd><p>Processes an ACK msg.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sender</strong> (<em>str</em>) – The sender of the ack</p></li>
<li><p><strong>seq_num</strong> (<em>int</em>) – The sequence number of the ack</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host._process_packet">
<code class="sig-name descname">_process_packet</code><span class="sig-paren">(</span><em class="sig-param">packet</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host._process_packet" title="Permalink to this definition">¶</a></dt>
<dd><p>Processes the received packet.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>packet</strong> (<a class="reference internal" href="../objects/packet.html#qunetsim.objects.packets.packet.Packet" title="qunetsim.objects.packets.packet.Packet"><em>Packet</em></a>) – The received packet</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host._process_queue">
<code class="sig-name descname">_process_queue</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host._process_queue" title="Permalink to this definition">¶</a></dt>
<dd><p>Runs a thread for processing the packets in the packet queue.</p>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.add_c_connection">
<code class="sig-name descname">add_c_connection</code><span class="sig-paren">(</span><em class="sig-param">receiver_id</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.add_c_connection" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds the classical connection to host with ID <em>receiver_id</em>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>receiver_id</strong> (<em>str</em>) – The ID of the host to connect with.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.add_c_connections">
<code class="sig-name descname">add_c_connections</code><span class="sig-paren">(</span><em class="sig-param">receiver_ids</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.add_c_connections" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds the classical connections to host with ID <em>receiver_id</em>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>receiver_ids</strong> (<em>list</em>) – The IDs of the hosts to connect with.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.add_checksum">
<code class="sig-name descname">add_checksum</code><span class="sig-paren">(</span><em class="sig-param">qubits</em>, <em class="sig-param">size_per_qubit=2</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.add_checksum" title="Permalink to this definition">¶</a></dt>
<dd><p>Generate a set of qubits that represent a quantum checksum for the set of qubits <em>qubits</em></p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>qubits</strong> (<em>list</em>) – The set of qubits to encode</p></li>
<li><p><strong>size_per_qubit</strong> (<em>int</em>) – The size of the checksum per qubit (i.e. 1 qubit encoded into <em>size</em>)</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A list of qubits that are encoded for <em>qubits</em></p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(list)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.add_connection">
<code class="sig-name descname">add_connection</code><span class="sig-paren">(</span><em class="sig-param">receiver_id</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.add_connection" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds the classical and quantum connection to host with ID <em>receiver_id</em>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>receiver_id</strong> (<em>str</em>) – The ID of the host to connect with.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.add_connections">
<code class="sig-name descname">add_connections</code><span class="sig-paren">(</span><em class="sig-param">receiver_ids</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.add_connections" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds the classical and quantum connections to host with ID <em>receiver_id</em>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>receiver_ids</strong> (<em>list</em>) – A list of receiver IDs to connect with</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.add_data_qubit">
<code class="sig-name descname">add_data_qubit</code><span class="sig-paren">(</span><em class="sig-param">host_id</em>, <em class="sig-param">qubit</em>, <em class="sig-param">q_id=None</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.add_data_qubit" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds the data qubit to the data qubit store of a host. If the qubit has an ID, adds the qubit with it,
otherwise generates an ID for the qubit and adds the qubit with that ID.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>host_id</strong> (<em>str</em>) – The ID of the host to pair the qubit</p></li>
<li><p><strong>qubit</strong> (<a class="reference internal" href="../objects/qubit.html#qunetsim.objects.qubit.Qubit" title="qunetsim.objects.qubit.Qubit"><em>Qubit</em></a>) – The data Qubit to be added.</p></li>
<li><p><strong>q_id</strong> (<em>str</em>) – the ID to set the qubit ID to</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The qubit ID</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.add_epr">
<code class="sig-name descname">add_epr</code><span class="sig-paren">(</span><em class="sig-param">host_id</em>, <em class="sig-param">qubit</em>, <em class="sig-param">q_id=None</em>, <em class="sig-param">blocked=False</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.add_epr" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds the EPR to the EPR store of a host. If the EPR has an ID, adds the EPR with it,
otherwise generates an ID for the EPR and adds the qubit with that ID.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>host_id</strong> (<em>str</em>) – The ID of the host to pair the qubit</p></li>
<li><p><strong>qubit</strong> (<a class="reference internal" href="../objects/qubit.html#qunetsim.objects.qubit.Qubit" title="qunetsim.objects.qubit.Qubit"><em>Qubit</em></a>) – The data Qubit to be added.</p></li>
<li><p><strong>q_id</strong> (<em>str</em>) – The ID of the qubit to be added.</p></li>
<li><p><strong>blocked</strong> (<em>bool</em>) – If the qubit should be stored as blocked or not</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The qubit ID</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.add_ghz_qubit">
<code class="sig-name descname">add_ghz_qubit</code><span class="sig-paren">(</span><em class="sig-param">host_id</em>, <em class="sig-param">qubit</em>, <em class="sig-param">q_id=None</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.add_ghz_qubit" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds the GHZ qubit to the storage of the host. The host id corresponds
to the generator of the GHZ state.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>host_id</strong> (<em>str</em>) – The ID of the host to pair the qubit</p></li>
<li><p><strong>qubit</strong> (<a class="reference internal" href="../objects/qubit.html#qunetsim.objects.qubit.Qubit" title="qunetsim.objects.qubit.Qubit"><em>Qubit</em></a>) – The data Qubit to be added.</p></li>
<li><p><strong>q_id</strong> (<em>str</em>) – the ID to set the qubit ID to</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The qubit ID</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.add_q_connection">
<code class="sig-name descname">add_q_connection</code><span class="sig-paren">(</span><em class="sig-param">receiver_id</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.add_q_connection" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds the quantum connection to host with ID <em>receiver_id</em>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>receiver_id</strong> (<em>str</em>) – The ID of the host to connect with.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.add_q_connections">
<code class="sig-name descname">add_q_connections</code><span class="sig-paren">(</span><em class="sig-param">receiver_ids</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.add_q_connections" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds the quantum connection to host with ID <em>receiver_id</em>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>receiver_ids</strong> (<em>list</em>) – The IDs of the hosts to connect with.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.add_w_qubit">
<code class="sig-name descname">add_w_qubit</code><span class="sig-paren">(</span><em class="sig-param">host_id</em>, <em class="sig-param">qubit</em>, <em class="sig-param">q_id=None</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.add_w_qubit" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds the W qubit to the storage of the host. The host id corresponds
to the generator of the W state.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>host_id</strong> (<em>str</em>) – The ID of the host to pair the qubit</p></li>
<li><p><strong>qubit</strong> (<a class="reference internal" href="../objects/qubit.html#qunetsim.objects.qubit.Qubit" title="qunetsim.objects.qubit.Qubit"><em>Qubit</em></a>) – The data Qubit to be added.</p></li>
<li><p><strong>q_id</strong> (<em>str</em>) – the ID to set the qubit ID to</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The qubit ID</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.await_ack">
<code class="sig-name descname">await_ack</code><span class="sig-paren">(</span><em class="sig-param">sequence_number</em>, <em class="sig-param">sender</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.await_ack" title="Permalink to this definition">¶</a></dt>
<dd><p>Block until an ACK for packet with sequence number arrives.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sequence_number</strong> (<em>int</em>) – The sequence number to wait for.</p></li>
<li><p><strong>sender</strong> (<em>str</em>) – The sender of the ACK</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The status of the ACK</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(bool)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.await_remaining_acks">
<code class="sig-name descname">await_remaining_acks</code><span class="sig-paren">(</span><em class="sig-param">sender</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.await_remaining_acks" title="Permalink to this definition">¶</a></dt>
<dd><p>Awaits all remaining ACKs of one sender.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>sender</strong> (<em>str</em>) – sender for which to wait for all acks.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.c_relay_sniffing">
<em class="property">property </em><code class="sig-name descname">c_relay_sniffing</code><a class="headerlink" href="#qunetsim.components.host.Host.c_relay_sniffing" title="Permalink to this definition">¶</a></dt>
<dd><p>If the host should sniff classical packets.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>If the host should sniff classical packets.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>(bool)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.c_relay_sniffing_fn">
<em class="property">property </em><code class="sig-name descname">c_relay_sniffing_fn</code><a class="headerlink" href="#qunetsim.components.host.Host.c_relay_sniffing_fn" title="Permalink to this definition">¶</a></dt>
<dd><p>The function to apply to the qubits in transit.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The function to apply to the qubits in transit.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>(function)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.change_epr_qubit_id">
<code class="sig-name descname">change_epr_qubit_id</code><span class="sig-paren">(</span><em class="sig-param">host_id</em>, <em class="sig-param">new_id</em>, <em class="sig-param">old_id=None</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.change_epr_qubit_id" title="Permalink to this definition">¶</a></dt>
<dd><p>Change an EPR pair ID to another. If <em>old_id</em> is set, then change that specific
EPR half, otherwise change the first unblocked EPR half to the <em>new_id</em>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>host_id</strong> (<em>str</em>) – The partner ID of the EPR pair.</p></li>
<li><p><strong>new_id</strong> (<em>str</em>) – The new ID to change the qubit too</p></li>
<li><p><strong>old_id</strong> (<em>str</em>) – The old ID of the qubit</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Old if of the qubit which has been changed.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.classical">
<em class="property">property </em><code class="sig-name descname">classical</code><a class="headerlink" href="#qunetsim.components.host.Host.classical" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the received classical messages sorted with the sequence number.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Sorted list of classical messages.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>(list)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.classical_connections">
<em class="property">property </em><code class="sig-name descname">classical_connections</code><a class="headerlink" href="#qunetsim.components.host.Host.classical_connections" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the classical connections of the host.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>classical connections</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>(dict)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.delay">
<em class="property">property </em><code class="sig-name descname">delay</code><a class="headerlink" href="#qunetsim.components.host.Host.delay" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the delay of the queue processor.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The delay per tick for the queue processor.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>(float)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.delete_key">
<code class="sig-name descname">delete_key</code><span class="sig-paren">(</span><em class="sig-param">partner_id</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.delete_key" title="Permalink to this definition">¶</a></dt>
<dd><p>Deletes a key shared with a partner by QKD. Should be used if a key
was eavesdropped and/or a new key should be shared. If there is no key
shared, nothing happens.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>partner_id</strong> (<em>str</em>) – The ID of the key partner</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.empty_classical">
<code class="sig-name descname">empty_classical</code><span class="sig-paren">(</span><em class="sig-param">reset_seq_nums=False</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.empty_classical" title="Permalink to this definition">¶</a></dt>
<dd><p>Empty the classical message buffers.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>reset_seq_nums</strong> (<em>bool</em>) – if all sequence number should also be reset.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.get_classical">
<code class="sig-name descname">get_classical</code><span class="sig-paren">(</span><em class="sig-param">host_id</em>, <em class="sig-param">seq_num=None</em>, <em class="sig-param">wait=0</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.get_classical" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the classical messages from partner host <em>host_id</em>. If you need
the next classical message from the host, don’t pass a seq_num, but
use <em>get_next_classical</em> instead. This is much faster.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>host_id</strong> (<em>str</em>) – The ID of the partner who sent the clasical messages</p></li>
<li><p><strong>seq_num</strong> (<em>int</em>) – The sequence number of the message</p></li>
<li><p><strong>wait</strong> (<em>float</em>) – How long in seconds to wait for the messages if none are set.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A list of classical messages from Host with ID <em>host_id</em>.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(list)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.get_connections">
<code class="sig-name descname">get_connections</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.get_connections" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a list of the connections with the types.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The list of connections for this host.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>(list)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.get_qubit">
<code class="sig-name descname">get_qubit</code><span class="sig-paren">(</span><em class="sig-param">host_id</em>, <em class="sig-param">q_id=None</em>, <em class="sig-param">wait=0</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.get_qubit" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the data qubit received from another host in the network. If qubit ID is specified,
qubit with that ID is returned, else, the last qubit received is returned.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>host_id</strong> (<em>str</em>) – The ID of the host that data qubit to be returned is received from.</p></li>
<li><p><strong>q_id</strong> (<em>str</em>) – The qubit ID of the data qubit to get.</p></li>
<li><p><strong>wait</strong> (<em>float</em>) – The amount of time to wait for the a qubit to arrive</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Qubit received from the host with <em>host_id</em> and <em>q_id</em>.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(<a class="reference internal" href="../objects/qubit.html#qunetsim.objects.qubit.Qubit" title="qunetsim.objects.qubit.Qubit">Qubit</a>)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.get_qubits">
<code class="sig-name descname">get_qubits</code><span class="sig-paren">(</span><em class="sig-param">host_id</em>, <em class="sig-param">remove_from_storage=False</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.get_qubits" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the dictionary of data qubits stored, just for the information regarding which qubits are stored.
Optional to remove the qubits from storage like <em>get_qubit</em> does with <em>remove_from_storage</em> field.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>host_id</strong> (<em>str</em>) – The host id from which the data qubit have been received.</p></li>
<li><p><strong>remove_from_storage</strong> (<em>bool</em>) – Get and remove from storage.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>If <em>host_id</em> is not set, then return the entire dictionary of data qubits.</dt><dd><p>Else If <em>host_id</em> is set, then return the data qubits for that particular host if there are any.
Return an empty list otherwise.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(dict)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.get_epr">
<code class="sig-name descname">get_epr</code><span class="sig-paren">(</span><em class="sig-param">host_id</em>, <em class="sig-param">q_id=None</em>, <em class="sig-param">wait=0</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.get_epr" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the EPR that is entangled with another host in the network. If qubit ID is specified,
EPR with that ID is returned, else, the last EPR added is returned.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>host_id</strong> (<em>str</em>) – The ID of the host that returned EPR is entangled to.</p></li>
<li><p><strong>q_id</strong> (<em>str</em>) – The qubit ID of the EPR to get.</p></li>
<li><p><strong>wait</strong> (<em>float</em>) – the amount of time to wait</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Qubit shared with the host with <em>host_id</em> and <em>q_id</em>.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(<a class="reference internal" href="../objects/qubit.html#qunetsim.objects.qubit.Qubit" title="qunetsim.objects.qubit.Qubit">Qubit</a>)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.get_epr_pairs">
<code class="sig-name descname">get_epr_pairs</code><span class="sig-paren">(</span><em class="sig-param">host_id</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.get_epr_pairs" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the dictionary of EPR pairs stored, just for the information regarding which qubits are stored.
Does not remove the qubits from storage like <em>get_epr_pair</em> does.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>host_id</strong> (<em>str</em>) – Get the EPR pairs established with host with <em>host_id</em></p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>If <em>host_id</em> is not set, then return the entire dictionary of EPR pairs.</dt><dd><p>Else If <em>host_id</em> is set, then return the EPRs for that particular host if there are any.
Return an empty list otherwise.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(dict)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.get_ghz">
<code class="sig-name descname">get_ghz</code><span class="sig-paren">(</span><em class="sig-param">host_id</em>, <em class="sig-param">q_id=None</em>, <em class="sig-param">wait=0</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.get_ghz" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the GHZ qubit which has been created by the host with the host ID <em>host_id</em>.
It is not necessary to know with whom the states are shared.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>host_id</strong> (<em>str</em>) – The ID of the host that creates the GHZ state.</p></li>
<li><p><strong>q_id</strong> (<em>str</em>) – The qubit ID of the GHZ to get.</p></li>
<li><p><strong>wait</strong> (<em>float</em>) – the amount of time to wait</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Qubit shared with the host with <em>host_id</em> and <em>q_id</em>.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(<a class="reference internal" href="../objects/qubit.html#qunetsim.objects.qubit.Qubit" title="qunetsim.objects.qubit.Qubit">Qubit</a>)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.get_key">
<code class="sig-name descname">get_key</code><span class="sig-paren">(</span><em class="sig-param">receiver_id</em>, <em class="sig-param">wait=-1</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.get_key" title="Permalink to this definition">¶</a></dt>
<dd><p>Should be called after <em>send_key</em> is called. Blocks, till the key sharing
is finished and returns the key and the amount of attemptes needed in QKD.
From this value, the user can decide if the transmission was assumed safe
or not.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>receiver_id</strong> (<em>str</em>) – The ID of the key partner</p></li>
<li><p><strong>wait</strong> (<em>float</em>) – The amount to wait for the key, -1 to wait forever.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The key, as a list of ints, and the amount of attempts needed</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(key, int)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.get_next_classical">
<code class="sig-name descname">get_next_classical</code><span class="sig-paren">(</span><em class="sig-param">sender_id</em>, <em class="sig-param">wait=-1</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.get_next_classical" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the next classical message available from a sender.
If wait is -1 (default), it is waited till a message arrives.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sender_id</strong> (<em>str</em>) – ID of the sender from the returned message.</p></li>
<li><p><strong>wait</strong> (<em>int</em>) – waiting time, default forever.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The message or None</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(str)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.get_next_sequence_number">
<code class="sig-name descname">get_next_sequence_number</code><span class="sig-paren">(</span><em class="sig-param">host</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.get_next_sequence_number" title="Permalink to this definition">¶</a></dt>
<dd><p>Get and set the next sequence number of connection with a receiver.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>host</strong> (<em>str</em>) – The ID of the receiver</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The next sequence number of connection with a receiver.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(int)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.get_number_of_data_qubits">
<code class="sig-name descname">get_number_of_data_qubits</code><span class="sig-paren">(</span><em class="sig-param">host_id</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.get_number_of_data_qubits" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the number of data qubits associated with host <em>host_id</em>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>host_id</strong> (<em>str</em>) – </p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p></p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(int)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.get_qubit_by_id">
<code class="sig-name descname">get_qubit_by_id</code><span class="sig-paren">(</span><em class="sig-param">q_id</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.get_qubit_by_id" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the qubit that has the id <em>q_id</em> from the quantum storage.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>q_id</strong> (<em>str</em>) – The ID of the qubit</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The qubit with the id <em>q_id</em> or None if it does not exist</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(<a class="reference internal" href="../objects/qubit.html#qunetsim.objects.qubit.Qubit" title="qunetsim.objects.qubit.Qubit">Qubit</a>)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.get_sequence_number">
<code class="sig-name descname">get_sequence_number</code><span class="sig-paren">(</span><em class="sig-param">host</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.get_sequence_number" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the sequence number on the sending side of connection with a host <em>host</em>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>host</strong> (<em>str</em>) – The ID of the sender</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The next sequence number of connection with a receiver.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>(int)</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="qunetsim.components.host.Host.get_sequence_number_receiver">
<code class="sig-name descname">get_sequence_number_receiver</code><span class="sig-paren">(</span><em class="sig-param">host</em><span class="sig-paren">)</span><a class="headerlink" href="#qunetsim.components.host.Host.get_sequence_number_receiver" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the sequence number on the receiving side of the connection with host <em>host</em>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>host</strong> (<em>str</em>) – The ID of the connected host</p>
</dd>
<dt class="field-even">Returns</dt>