aboutsummaryrefslogtreecommitdiff
path: root/template/probnat/api.html.j2
blob: 64267f695d130bb03bbd7909da66a1c8e0a8916c (plain) (blame)
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
{% extends "common/base.j2" %}
{% block body_content %}
<main id="maincontent">
<article class="container">

  <header>
    <h1>{{ _("API Documentation") }}</h1>
  </header>

  <div class="row">
    <div class="col-2 d-none d-lg-block"><!-- for large viewports show menu for better orientation -->
      <nav class="nav subnav position-fixed flex-column border-right" style="position:fixed">
      <a class="nav-link" href="index.html#idea">{{ _("Project main page") }}</a>
      </nav>
    </div>
    <div class="col">

      <h2>Sync Protocol</h2>

      <section>
        
        <p>
          {% trans %}
	  To use the probabilistic NAT traversal library, the peers to be connected must first be synchronized. For that, each peer has to use two API calls.<br/><br/>

	  enum GNUNET_GenericReturnValue<br/>
	  GNUNET_is_burst_ready (struct GNUNET_TIME_Relative rtt_avarage,<br/>
                                 &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&ensp; struct GNUNET_BurstSync *burst_sync,<br/>
                                 &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&ensp; GNUNET_SCHEDULER_TaskCallback task,<br/>
                                 &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&ensp; struct GNUNET_StartBurstCls *task_cls)<br/><br/>

	  and<br/><br/>

	  struct GNUNET_BurstSync *<br/>
	  GNUNET_get_burst_sync_msg (struct GNUNET_TIME_Relative rtt_avarage,<br/>
                                     &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&ensp; enum GNUNET_GenericReturnValue sync_ready)<br/><br/>


	  The second is to create the synchronisation message which the caller has to send to the other peer.
	  Within GNUnet the Distance Vector DV protocol is used for sending the synchronisation message. Applications which do not want to use the complete GNUnet stack have to use transportion by other means.<br/><br/>

	  The API call needs two parameters. The avarage round trip time rtt_avarage has to be provided by the callers application. In GNUnet this information is constantly calculated from messages delivered by DV. Again, applications not using the GNUnet stack have to assemble this information by themself. The round trip time has to be calculated as the time a message  needs to arrive at another peer plus the time a response to this message needs to travel back. The messages used to measure this time needs to be send via the same transportion mechanism like the burst synchromisation method. The value used in the API should be an average over several RTTs. rtt_average is measured in microseconds. <br/><br/>

	  The second parameter is returned by the first API call and must be temporarily stored to use it in the second. This is the burst synchromisation method, which encapsulates the RTT calculated by the sending peer, and if that peer is ready to sync.<br/><br/>

	  The first API call also needs the avarage RTT and the synchronisation message received from another peer. The callback is called, if both peers are ready to synchronize. Therefore the callback should start the burst mode which will finally do the hole punch for NAT traversal. One can find an example in the GNUnet code src/service/transport/gnunet-service-transport.c in the function handle_flow_control. <br/><br/>
          {% endtrans %}
        </p>
      </section>
    </div>
  </div>

</article>
{% endblock body_content %}