reference.html
1 <!doctype html> 2 <html class="no-js" lang="en" data-content_root="./"> 3 <head><meta charset="utf-8"> 4 <meta name="viewport" content="width=device-width,initial-scale=1"> 5 <meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" /> 6 <link rel="index" title="Index" href="genindex.html"><link rel="search" title="Search" href="search.html"><link rel="prev" title="Reticulum License" href="license.html"> 7 <link rel="prefetch" href="_static/rns_logo_512.png" as="image"> 8 9 <!-- Generated with Sphinx 8.2.3 and Furo 2025.09.25.dev1 --> 10 <title>API Reference - Reticulum Network Stack 1.1.3 documentation</title> 11 <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=d111a655" /> 12 <link rel="stylesheet" type="text/css" href="_static/styles/furo.css?v=580074bf" /> 13 <link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" /> 14 <link rel="stylesheet" type="text/css" href="_static/styles/furo-extensions.css?v=8dab3a3b" /> 15 <link rel="stylesheet" type="text/css" href="_static/custom.css?v=bb3cebc5" /> 16 17 18 19 20 <style> 21 body { 22 --color-code-background: #f2f2f2; 23 --color-code-foreground: #1e1e1e; 24 25 } 26 @media not print { 27 body[data-theme="dark"] { 28 --color-code-background: #202020; 29 --color-code-foreground: #d0d0d0; 30 --color-background-primary: #202b38; 31 --color-background-secondary: #161f27; 32 --color-foreground-primary: #dbdbdb; 33 --color-foreground-secondary: #a9b1ba; 34 --color-brand-primary: #41adff; 35 --color-background-hover: #161f27; 36 --color-api-name: #ffbe85; 37 --color-api-pre-name: #efae75; 38 39 } 40 @media (prefers-color-scheme: dark) { 41 body:not([data-theme="light"]) { 42 --color-code-background: #202020; 43 --color-code-foreground: #d0d0d0; 44 --color-background-primary: #202b38; 45 --color-background-secondary: #161f27; 46 --color-foreground-primary: #dbdbdb; 47 --color-foreground-secondary: #a9b1ba; 48 --color-brand-primary: #41adff; 49 --color-background-hover: #161f27; 50 --color-api-name: #ffbe85; 51 --color-api-pre-name: #efae75; 52 53 } 54 } 55 } 56 </style></head> 57 <body> 58 59 <script> 60 document.body.dataset.theme = localStorage.getItem("theme") || "auto"; 61 </script> 62 63 64 <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> 65 <symbol id="svg-toc" viewBox="0 0 24 24"> 66 <title>Contents</title> 67 <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024"> 68 <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/> 69 </svg> 70 </symbol> 71 <symbol id="svg-menu" viewBox="0 0 24 24"> 72 <title>Menu</title> 73 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" 74 stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu"> 75 <line x1="3" y1="12" x2="21" y2="12"></line> 76 <line x1="3" y1="6" x2="21" y2="6"></line> 77 <line x1="3" y1="18" x2="21" y2="18"></line> 78 </svg> 79 </symbol> 80 <symbol id="svg-arrow-right" viewBox="0 0 24 24"> 81 <title>Expand</title> 82 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" 83 stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right"> 84 <polyline points="9 18 15 12 9 6"></polyline> 85 </svg> 86 </symbol> 87 <symbol id="svg-sun" viewBox="0 0 24 24"> 88 <title>Light mode</title> 89 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" 90 stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather-sun"> 91 <circle cx="12" cy="12" r="5"></circle> 92 <line x1="12" y1="1" x2="12" y2="3"></line> 93 <line x1="12" y1="21" x2="12" y2="23"></line> 94 <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> 95 <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> 96 <line x1="1" y1="12" x2="3" y2="12"></line> 97 <line x1="21" y1="12" x2="23" y2="12"></line> 98 <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> 99 <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> 100 </svg> 101 </symbol> 102 <symbol id="svg-moon" viewBox="0 0 24 24"> 103 <title>Dark mode</title> 104 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" 105 stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon"> 106 <path stroke="none" d="M0 0h24v24H0z" fill="none" /> 107 <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" /> 108 </svg> 109 </symbol> 110 <symbol id="svg-sun-with-moon" viewBox="0 0 24 24"> 111 <title>Auto light/dark, in light mode</title> 112 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" 113 stroke-width="1" stroke-linecap="round" stroke-linejoin="round" 114 class="icon-custom-derived-from-feather-sun-and-tabler-moon"> 115 <path style="opacity: 50%" d="M 5.411 14.504 C 5.471 14.504 5.532 14.504 5.591 14.504 C 3.639 16.319 4.383 19.569 6.931 20.352 C 7.693 20.586 8.512 20.551 9.25 20.252 C 8.023 23.207 4.056 23.725 2.11 21.184 C 0.166 18.642 1.702 14.949 4.874 14.536 C 5.051 14.512 5.231 14.5 5.411 14.5 L 5.411 14.504 Z"/> 116 <line x1="14.5" y1="3.25" x2="14.5" y2="1.25"/> 117 <line x1="14.5" y1="15.85" x2="14.5" y2="17.85"/> 118 <line x1="10.044" y1="5.094" x2="8.63" y2="3.68"/> 119 <line x1="19" y1="14.05" x2="20.414" y2="15.464"/> 120 <line x1="8.2" y1="9.55" x2="6.2" y2="9.55"/> 121 <line x1="20.8" y1="9.55" x2="22.8" y2="9.55"/> 122 <line x1="10.044" y1="14.006" x2="8.63" y2="15.42"/> 123 <line x1="19" y1="5.05" x2="20.414" y2="3.636"/> 124 <circle cx="14.5" cy="9.55" r="3.6"/> 125 </svg> 126 </symbol> 127 <symbol id="svg-moon-with-sun" viewBox="0 0 24 24"> 128 <title>Auto light/dark, in dark mode</title> 129 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" 130 stroke-width="1" stroke-linecap="round" stroke-linejoin="round" 131 class="icon-custom-derived-from-feather-sun-and-tabler-moon"> 132 <path d="M 8.282 7.007 C 8.385 7.007 8.494 7.007 8.595 7.007 C 5.18 10.184 6.481 15.869 10.942 17.24 C 12.275 17.648 13.706 17.589 15 17.066 C 12.851 22.236 5.91 23.143 2.505 18.696 C -0.897 14.249 1.791 7.786 7.342 7.063 C 7.652 7.021 7.965 7 8.282 7 L 8.282 7.007 Z"/> 133 <line style="opacity: 50%" x1="18" y1="3.705" x2="18" y2="2.5"/> 134 <line style="opacity: 50%" x1="18" y1="11.295" x2="18" y2="12.5"/> 135 <line style="opacity: 50%" x1="15.316" y1="4.816" x2="14.464" y2="3.964"/> 136 <line style="opacity: 50%" x1="20.711" y1="10.212" x2="21.563" y2="11.063"/> 137 <line style="opacity: 50%" x1="14.205" y1="7.5" x2="13.001" y2="7.5"/> 138 <line style="opacity: 50%" x1="21.795" y1="7.5" x2="23" y2="7.5"/> 139 <line style="opacity: 50%" x1="15.316" y1="10.184" x2="14.464" y2="11.036"/> 140 <line style="opacity: 50%" x1="20.711" y1="4.789" x2="21.563" y2="3.937"/> 141 <circle style="opacity: 50%" cx="18" cy="7.5" r="2.169"/> 142 </svg> 143 </symbol> 144 <symbol id="svg-pencil" viewBox="0 0 24 24"> 145 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" 146 stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-pencil-code"> 147 <path d="M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4" /> 148 <path d="M13.5 6.5l4 4" /> 149 <path d="M20 21l2 -2l-2 -2" /> 150 <path d="M17 17l-2 2l2 2" /> 151 </svg> 152 </symbol> 153 <symbol id="svg-eye" viewBox="0 0 24 24"> 154 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" 155 stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-eye-code"> 156 <path stroke="none" d="M0 0h24v24H0z" fill="none" /> 157 <path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" /> 158 <path 159 d="M11.11 17.958c-3.209 -.307 -5.91 -2.293 -8.11 -5.958c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6c-.21 .352 -.427 .688 -.647 1.008" /> 160 <path d="M20 21l2 -2l-2 -2" /> 161 <path d="M17 17l-2 2l2 2" /> 162 </svg> 163 </symbol> 164 </svg> 165 166 <input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation" aria-label="Toggle site navigation sidebar"> 167 <input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc" aria-label="Toggle table of contents sidebar"> 168 <label class="overlay sidebar-overlay" for="__navigation"></label> 169 <label class="overlay toc-overlay" for="__toc"></label> 170 171 <a class="skip-to-content muted-link" href="#furo-main-content">Skip to content</a> 172 173 174 175 <div class="page"> 176 <header class="mobile-header"> 177 <div class="header-left"> 178 <label class="nav-overlay-icon" for="__navigation"> 179 <span class="icon"><svg><use href="#svg-menu"></use></svg></span> 180 </label> 181 </div> 182 <div class="header-center"> 183 <a href="index.html"><div class="brand">Reticulum Network Stack 1.1.3 documentation</div></a> 184 </div> 185 <div class="header-right"> 186 <div class="theme-toggle-container theme-toggle-header"> 187 <button class="theme-toggle" aria-label="Toggle Light / Dark / Auto color theme"> 188 <svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg> 189 <svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg> 190 <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> 191 <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> 192 </button> 193 </div> 194 <label class="toc-overlay-icon toc-header-icon" for="__toc"> 195 <span class="icon"><svg><use href="#svg-toc"></use></svg></span> 196 </label> 197 </div> 198 </header> 199 <aside class="sidebar-drawer"> 200 <div class="sidebar-container"> 201 202 <div class="sidebar-sticky"><a class="sidebar-brand" href="index.html"> 203 <div class="sidebar-logo-container"> 204 <img class="sidebar-logo" src="_static/rns_logo_512.png" alt="Logo"/> 205 </div> 206 207 <span class="sidebar-brand-text">Reticulum Network Stack 1.1.3 documentation</span> 208 209 </a><form class="sidebar-search-container" method="get" action="search.html" role="search"> 210 <input class="sidebar-search" placeholder="Search" name="q" aria-label="Search"> 211 <input type="hidden" name="check_keywords" value="yes"> 212 <input type="hidden" name="area" value="default"> 213 </form> 214 <div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree"> 215 <ul> 216 <li class="toctree-l1"><a class="reference internal" href="whatis.html">What is Reticulum?</a></li> 217 <li class="toctree-l1"><a class="reference internal" href="gettingstartedfast.html">Getting Started Fast</a></li> 218 <li class="toctree-l1"><a class="reference internal" href="zen.html">Zen of Reticulum</a></li> 219 <li class="toctree-l1"><a class="reference internal" href="software.html">Programs Using Reticulum</a></li> 220 <li class="toctree-l1"><a class="reference internal" href="using.html">Using Reticulum on Your System</a></li> 221 <li class="toctree-l1"><a class="reference internal" href="understanding.html">Understanding Reticulum</a></li> 222 <li class="toctree-l1"><a class="reference internal" href="hardware.html">Communications Hardware</a></li> 223 <li class="toctree-l1"><a class="reference internal" href="interfaces.html">Configuring Interfaces</a></li> 224 <li class="toctree-l1"><a class="reference internal" href="networks.html">Building Networks</a></li> 225 <li class="toctree-l1"><a class="reference internal" href="support.html">Support Reticulum</a></li> 226 <li class="toctree-l1"><a class="reference internal" href="examples.html">Code Examples</a></li> 227 <li class="toctree-l1"><a class="reference internal" href="license.html">Reticulum License</a></li> 228 </ul> 229 <ul class="current"> 230 <li class="toctree-l1 current current-page"><a class="current reference internal" href="#">API Reference</a></li> 231 </ul> 232 233 </div> 234 </div> 235 236 </div> 237 238 </div> 239 </aside> 240 <div class="main"> 241 <div class="content"> 242 <div class="article-container"> 243 <a href="#" class="back-to-top muted-link"> 244 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> 245 <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path> 246 </svg> 247 <span>Back to top</span> 248 </a> 249 <div class="content-icon-container"> 250 <div class="theme-toggle-container theme-toggle-content"> 251 <button class="theme-toggle" aria-label="Toggle Light / Dark / Auto color theme"> 252 <svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg> 253 <svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg> 254 <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> 255 <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> 256 </button> 257 </div> 258 <label class="toc-overlay-icon toc-content-icon" for="__toc"> 259 <span class="icon"><svg><use href="#svg-toc"></use></svg></span> 260 </label> 261 </div> 262 <article role="main" id="furo-main-content"> 263 <section id="api-reference"> 264 <span id="api-main"></span><h1>API Reference<a class="headerlink" href="#api-reference" title="Link to this heading">¶</a></h1> 265 <p>Communication over Reticulum networks is achieved by using a simple set of classes exposed by the RNS API. 266 This chapter lists and explains all classes exposed by the Reticulum Network Stack API, along with their method signatures and usage. It can be used as a reference while writing applications that utilise Reticulum, or it can be read in entirity to gain an understanding of the complete functionality of RNS from a developers perspective.</p> 267 <p id="api-reticulum"><h3> Reticulum </h3></p> 268 <dl class="py class"> 269 <dt class="sig sig-object py" id="RNS.Reticulum"> 270 <em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">Reticulum</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">configdir</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">loglevel</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">logdest</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">verbosity</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">require_shared_instance</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">shared_instance_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Reticulum" title="Link to this definition">¶</a></dt> 271 <dd><p>This class is used to initialise access to Reticulum within a 272 program. You must create exactly one instance of this class before 273 carrying out any other RNS operations, such as creating destinations 274 or sending traffic. Every independently executed program must create 275 their own instance of the Reticulum class, but Reticulum will 276 automatically handle inter-program communication on the same system, 277 and expose all connected programs to external interfaces as well.</p> 278 <p>As soon as an instance of this class is created, Reticulum will start 279 opening and configuring any hardware devices specified in the supplied 280 configuration.</p> 281 <p>Currently the first running instance must be kept running while other 282 local instances are connected, as the first created instance will 283 act as a master instance that directly communicates with external 284 hardware such as modems, TNCs and radios. If a master instance is 285 asked to exit, it will not exit until all client processes have 286 terminated (unless killed forcibly).</p> 287 <p>If you are running Reticulum on a system with several different 288 programs that use RNS starting and terminating at different times, 289 it will be advantageous to run a master RNS instance as a daemon for 290 other programs to use on demand.</p> 291 <dl class="py attribute"> 292 <dt class="sig sig-object py" id="RNS.Reticulum.MTU"> 293 <span class="sig-name descname"><span class="pre">MTU</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">500</span></em><a class="headerlink" href="#RNS.Reticulum.MTU" title="Link to this definition">¶</a></dt> 294 <dd><p>The MTU that Reticulum adheres to, and will expect other peers to 295 adhere to. By default, the MTU is 500 bytes. In custom RNS network 296 implementations, it is possible to change this value, but doing so will 297 completely break compatibility with all other RNS networks. An identical 298 MTU is a prerequisite for peers to communicate in the same network.</p> 299 <p>Unless you really know what you are doing, the MTU should be left at 300 the default value.</p> 301 </dd></dl> 302 303 <dl class="py attribute"> 304 <dt class="sig sig-object py" id="RNS.Reticulum.LINK_MTU_DISCOVERY"> 305 <span class="sig-name descname"><span class="pre">LINK_MTU_DISCOVERY</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">True</span></em><a class="headerlink" href="#RNS.Reticulum.LINK_MTU_DISCOVERY" title="Link to this definition">¶</a></dt> 306 <dd><p>Whether automatic link MTU discovery is enabled by default in this 307 release. Link MTU discovery significantly increases throughput over 308 fast links, but requires all intermediary hops to also support it. 309 Support for this feature was added in RNS version 0.9.0. This option 310 will become enabled by default in the near future. Please update your 311 RNS instances.</p> 312 </dd></dl> 313 314 <dl class="py attribute"> 315 <dt class="sig sig-object py" id="RNS.Reticulum.ANNOUNCE_CAP"> 316 <span class="sig-name descname"><span class="pre">ANNOUNCE_CAP</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">2</span></em><a class="headerlink" href="#RNS.Reticulum.ANNOUNCE_CAP" title="Link to this definition">¶</a></dt> 317 <dd><p>The maximum percentage of interface bandwidth that, at any given time, 318 may be used to propagate announces. If an announce was scheduled for 319 broadcasting on an interface, but doing so would exceed the allowed 320 bandwidth allocation, the announce will be queued for transmission 321 when there is bandwidth available.</p> 322 <p>Reticulum will always prioritise propagating announces with fewer 323 hops, ensuring that distant, large networks with many peers on fast 324 links don’t overwhelm the capacity of smaller networks on slower 325 mediums. If an announce remains queued for an extended amount of time, 326 it will eventually be dropped.</p> 327 <p>This value will be applied by default to all created interfaces, 328 but it can be configured individually on a per-interface basis. In 329 general, the global default setting should not be changed, and any 330 alterations should be made on a per-interface basis instead.</p> 331 </dd></dl> 332 333 <dl class="py attribute"> 334 <dt class="sig sig-object py" id="RNS.Reticulum.MINIMUM_BITRATE"> 335 <span class="sig-name descname"><span class="pre">MINIMUM_BITRATE</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">5</span></em><a class="headerlink" href="#RNS.Reticulum.MINIMUM_BITRATE" title="Link to this definition">¶</a></dt> 336 <dd><p>Minimum bitrate required across a medium for Reticulum to be able 337 to successfully establish links. Currently 5 bits per second.</p> 338 </dd></dl> 339 340 <dl class="py method"> 341 <dt class="sig sig-object py" id="RNS.Reticulum.get_instance"> 342 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">get_instance</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Reticulum.get_instance" title="Link to this definition">¶</a></dt> 343 <dd><p>Return the currently running Reticulum instance</p> 344 </dd></dl> 345 346 <dl class="py method"> 347 <dt class="sig sig-object py" id="RNS.Reticulum.should_use_implicit_proof"> 348 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">should_use_implicit_proof</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Reticulum.should_use_implicit_proof" title="Link to this definition">¶</a></dt> 349 <dd><p>Returns whether proofs sent are explicit or implicit.</p> 350 <dl class="field-list simple"> 351 <dt class="field-odd">Returns<span class="colon">:</span></dt> 352 <dd class="field-odd"><p>True if the current running configuration specifies to use implicit proofs. False if not.</p> 353 </dd> 354 </dl> 355 </dd></dl> 356 357 <dl class="py method"> 358 <dt class="sig sig-object py" id="RNS.Reticulum.transport_enabled"> 359 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">transport_enabled</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Reticulum.transport_enabled" title="Link to this definition">¶</a></dt> 360 <dd><p>Returns whether Transport is enabled for the running 361 instance.</p> 362 <p>When Transport is enabled, Reticulum will 363 route traffic for other peers, respond to path requests 364 and pass announces over the network.</p> 365 <dl class="field-list simple"> 366 <dt class="field-odd">Returns<span class="colon">:</span></dt> 367 <dd class="field-odd"><p>True if Transport is enabled, False if not.</p> 368 </dd> 369 </dl> 370 </dd></dl> 371 372 <dl class="py method"> 373 <dt class="sig sig-object py" id="RNS.Reticulum.link_mtu_discovery"> 374 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">link_mtu_discovery</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Reticulum.link_mtu_discovery" title="Link to this definition">¶</a></dt> 375 <dd><p>Returns whether link MTU discovery is enabled for the running 376 instance.</p> 377 <p>When link MTU discovery is enabled, Reticulum will 378 automatically upgrade link MTUs to the highest supported 379 value, increasing transfer speed and efficiency.</p> 380 <dl class="field-list simple"> 381 <dt class="field-odd">Returns<span class="colon">:</span></dt> 382 <dd class="field-odd"><p>True if link MTU discovery is enabled, False if not.</p> 383 </dd> 384 </dl> 385 </dd></dl> 386 387 <dl class="py method"> 388 <dt class="sig sig-object py" id="RNS.Reticulum.remote_management_enabled"> 389 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">remote_management_enabled</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Reticulum.remote_management_enabled" title="Link to this definition">¶</a></dt> 390 <dd><p>Returns whether remote management is enabled for the 391 running instance.</p> 392 <p>When remote management is enabled, authenticated peers 393 can remotely query and manage this instance.</p> 394 <dl class="field-list simple"> 395 <dt class="field-odd">Returns<span class="colon">:</span></dt> 396 <dd class="field-odd"><p>True if remote management is enabled, False if not.</p> 397 </dd> 398 </dl> 399 </dd></dl> 400 401 <dl class="py method"> 402 <dt class="sig sig-object py" id="RNS.Reticulum.required_discovery_value"> 403 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">required_discovery_value</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Reticulum.required_discovery_value" title="Link to this definition">¶</a></dt> 404 <dd><p>Returns the required stamp value for a discovered interface 405 to be considered valid and remembered.</p> 406 <dl class="field-list simple"> 407 <dt class="field-odd">Returns<span class="colon">:</span></dt> 408 <dd class="field-odd"><p>The required stamp value as an integer.</p> 409 </dd> 410 </dl> 411 </dd></dl> 412 413 <dl class="py method"> 414 <dt class="sig sig-object py" id="RNS.Reticulum.publish_blackhole_enabled"> 415 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">publish_blackhole_enabled</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Reticulum.publish_blackhole_enabled" title="Link to this definition">¶</a></dt> 416 <dd><p>Returns whether blackhole list publishing is enabled for the 417 running instance.</p> 418 <dl class="field-list simple"> 419 <dt class="field-odd">Returns<span class="colon">:</span></dt> 420 <dd class="field-odd"><p>True if blackhole list publishing is enabled, False if not.</p> 421 </dd> 422 </dl> 423 </dd></dl> 424 425 <dl class="py method"> 426 <dt class="sig sig-object py" id="RNS.Reticulum.blackhole_sources"> 427 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">blackhole_sources</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Reticulum.blackhole_sources" title="Link to this definition">¶</a></dt> 428 <dd><p>Returns the list of transport identity hashes from which 429 blackhole lists are sourced.</p> 430 <dl class="field-list simple"> 431 <dt class="field-odd">Returns<span class="colon">:</span></dt> 432 <dd class="field-odd"><p>A list of identity hashes.</p> 433 </dd> 434 </dl> 435 </dd></dl> 436 437 <dl class="py method"> 438 <dt class="sig sig-object py" id="RNS.Reticulum.discovered_interfaces"> 439 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">discovered_interfaces</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Reticulum.discovered_interfaces" title="Link to this definition">¶</a></dt> 440 <dd><p>Returns a list of interfaces discovered over the network.</p> 441 <dl class="field-list simple"> 442 <dt class="field-odd">Returns<span class="colon">:</span></dt> 443 <dd class="field-odd"><p>A list of discovered interfaces.</p> 444 </dd> 445 </dl> 446 </dd></dl> 447 448 <dl class="py method"> 449 <dt class="sig sig-object py" id="RNS.Reticulum.interface_discovery_sources"> 450 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">interface_discovery_sources</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Reticulum.interface_discovery_sources" title="Link to this definition">¶</a></dt> 451 <dd><p>Returns the list of network identity hashes from which 452 interfaces are discovered.</p> 453 <dl class="field-list simple"> 454 <dt class="field-odd">Returns<span class="colon">:</span></dt> 455 <dd class="field-odd"><p>A list of identity hashes.</p> 456 </dd> 457 </dl> 458 </dd></dl> 459 460 </dd></dl> 461 462 <p id="api-identity"><h3> Identity </h3></p> 463 <dl class="py class"> 464 <dt class="sig sig-object py" id="RNS.Identity"> 465 <em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">Identity</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">create_keys</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity" title="Link to this definition">¶</a></dt> 466 <dd><p>This class is used to manage identities in Reticulum. It provides methods 467 for encryption, decryption, signatures and verification, and is the basis 468 for all encrypted communication over Reticulum networks.</p> 469 <dl class="field-list simple"> 470 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 471 <dd class="field-odd"><p><strong>create_keys</strong> – Specifies whether new encryption and signing keys should be generated.</p> 472 </dd> 473 </dl> 474 <dl class="py attribute"> 475 <dt class="sig sig-object py" id="RNS.Identity.CURVE"> 476 <span class="sig-name descname"><span class="pre">CURVE</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'Curve25519'</span></em><a class="headerlink" href="#RNS.Identity.CURVE" title="Link to this definition">¶</a></dt> 477 <dd><p>The curve used for Elliptic Curve DH key exchanges</p> 478 </dd></dl> 479 480 <dl class="py attribute"> 481 <dt class="sig sig-object py" id="RNS.Identity.KEYSIZE"> 482 <span class="sig-name descname"><span class="pre">KEYSIZE</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">512</span></em><a class="headerlink" href="#RNS.Identity.KEYSIZE" title="Link to this definition">¶</a></dt> 483 <dd><p>X.25519 key size in bits. A complete key is the concatenation of a 256 bit encryption key, and a 256 bit signing key.</p> 484 </dd></dl> 485 486 <dl class="py attribute"> 487 <dt class="sig sig-object py" id="RNS.Identity.RATCHETSIZE"> 488 <span class="sig-name descname"><span class="pre">RATCHETSIZE</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">256</span></em><a class="headerlink" href="#RNS.Identity.RATCHETSIZE" title="Link to this definition">¶</a></dt> 489 <dd><p>X.25519 ratchet key size in bits.</p> 490 </dd></dl> 491 492 <dl class="py attribute"> 493 <dt class="sig sig-object py" id="RNS.Identity.RATCHET_EXPIRY"> 494 <span class="sig-name descname"><span class="pre">RATCHET_EXPIRY</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">2592000</span></em><a class="headerlink" href="#RNS.Identity.RATCHET_EXPIRY" title="Link to this definition">¶</a></dt> 495 <dd><p>The expiry time for received ratchets in seconds, defaults to 30 days. Reticulum will always use the most recently 496 announced ratchet, and remember it for up to <code class="docutils literal notranslate"><span class="pre">RATCHET_EXPIRY</span></code> since receiving it, after which it will be discarded. 497 If a newer ratchet is announced in the meantime, it will be replace the already known ratchet.</p> 498 </dd></dl> 499 500 <dl class="py attribute"> 501 <dt class="sig sig-object py" id="RNS.Identity.TRUNCATED_HASHLENGTH"> 502 <span class="sig-name descname"><span class="pre">TRUNCATED_HASHLENGTH</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">128</span></em><a class="headerlink" href="#RNS.Identity.TRUNCATED_HASHLENGTH" title="Link to this definition">¶</a></dt> 503 <dd><p>Constant specifying the truncated hash length (in bits) used by Reticulum 504 for addressable hashes and other purposes. Non-configurable.</p> 505 </dd></dl> 506 507 <dl class="py method"> 508 <dt class="sig sig-object py" id="RNS.Identity.recall"> 509 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">recall</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target_hash</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">from_identity_hash</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.recall" title="Link to this definition">¶</a></dt> 510 <dd><p>Recall identity for a destination or identity hash. By default, this function 511 will return the identity associated with a given <em>destination</em> hash. As an 512 example, if you know the <code class="docutils literal notranslate"><span class="pre">lxmf.delivery</span></code> destination hash of an endpoint, 513 this function will return the associated underlying identity. You can also 514 search for an identity from a known <em>identity hash</em>, by setting the 515 <code class="docutils literal notranslate"><span class="pre">from_identity_hash</span></code> argument.</p> 516 <dl class="field-list simple"> 517 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 518 <dd class="field-odd"><ul class="simple"> 519 <li><p><strong>target_hash</strong> – Destination or identity hash as <em>bytes</em>.</p></li> 520 <li><p><strong>from_identity_hash</strong> – Whether to search based on identity hash instead of destination hash as <em>bool</em>.</p></li> 521 </ul> 522 </dd> 523 <dt class="field-even">Returns<span class="colon">:</span></dt> 524 <dd class="field-even"><p>An <a class="reference internal" href="#api-identity"><span class="std std-ref">RNS.Identity</span></a> instance that can be used to create an outgoing <a class="reference internal" href="#api-destination"><span class="std std-ref">RNS.Destination</span></a>, or <em>None</em> if the destination is unknown.</p> 525 </dd> 526 </dl> 527 </dd></dl> 528 529 <dl class="py method"> 530 <dt class="sig sig-object py" id="RNS.Identity.recall_app_data"> 531 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">recall_app_data</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">destination_hash</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.recall_app_data" title="Link to this definition">¶</a></dt> 532 <dd><p>Recall last heard app_data for a destination hash.</p> 533 <dl class="field-list simple"> 534 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 535 <dd class="field-odd"><p><strong>destination_hash</strong> – Destination hash as <em>bytes</em>.</p> 536 </dd> 537 <dt class="field-even">Returns<span class="colon">:</span></dt> 538 <dd class="field-even"><p><em>Bytes</em> containing app_data, or <em>None</em> if the destination is unknown.</p> 539 </dd> 540 </dl> 541 </dd></dl> 542 543 <dl class="py method"> 544 <dt class="sig sig-object py" id="RNS.Identity.full_hash"> 545 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">full_hash</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.full_hash" title="Link to this definition">¶</a></dt> 546 <dd><p>Get a SHA-256 hash of passed data.</p> 547 <dl class="field-list simple"> 548 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 549 <dd class="field-odd"><p><strong>data</strong> – Data to be hashed as <em>bytes</em>.</p> 550 </dd> 551 <dt class="field-even">Returns<span class="colon">:</span></dt> 552 <dd class="field-even"><p>SHA-256 hash as <em>bytes</em>.</p> 553 </dd> 554 </dl> 555 </dd></dl> 556 557 <dl class="py method"> 558 <dt class="sig sig-object py" id="RNS.Identity.truncated_hash"> 559 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">truncated_hash</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.truncated_hash" title="Link to this definition">¶</a></dt> 560 <dd><p>Get a truncated SHA-256 hash of passed data.</p> 561 <dl class="field-list simple"> 562 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 563 <dd class="field-odd"><p><strong>data</strong> – Data to be hashed as <em>bytes</em>.</p> 564 </dd> 565 <dt class="field-even">Returns<span class="colon">:</span></dt> 566 <dd class="field-even"><p>Truncated SHA-256 hash as <em>bytes</em>.</p> 567 </dd> 568 </dl> 569 </dd></dl> 570 571 <dl class="py method"> 572 <dt class="sig sig-object py" id="RNS.Identity.get_random_hash"> 573 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">get_random_hash</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.get_random_hash" title="Link to this definition">¶</a></dt> 574 <dd><p>Get a random SHA-256 hash.</p> 575 <dl class="field-list simple"> 576 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 577 <dd class="field-odd"><p><strong>data</strong> – Data to be hashed as <em>bytes</em>.</p> 578 </dd> 579 <dt class="field-even">Returns<span class="colon">:</span></dt> 580 <dd class="field-even"><p>Truncated SHA-256 hash of random data as <em>bytes</em>.</p> 581 </dd> 582 </dl> 583 </dd></dl> 584 585 <dl class="py method"> 586 <dt class="sig sig-object py" id="RNS.Identity.current_ratchet_id"> 587 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">current_ratchet_id</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">destination_hash</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.current_ratchet_id" title="Link to this definition">¶</a></dt> 588 <dd><p>Get the ID of the currently used ratchet key for a given destination hash</p> 589 <dl class="field-list simple"> 590 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 591 <dd class="field-odd"><p><strong>destination_hash</strong> – A destination hash as <em>bytes</em>.</p> 592 </dd> 593 <dt class="field-even">Returns<span class="colon">:</span></dt> 594 <dd class="field-even"><p>A ratchet ID as <em>bytes</em> or <em>None</em>.</p> 595 </dd> 596 </dl> 597 </dd></dl> 598 599 <dl class="py method"> 600 <dt class="sig sig-object py" id="RNS.Identity.from_bytes"> 601 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_bytes</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">prv_bytes</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.from_bytes" title="Link to this definition">¶</a></dt> 602 <dd><p>Create a new <a class="reference internal" href="#api-identity"><span class="std std-ref">RNS.Identity</span></a> instance from <em>bytes</em> of private key. 603 Can be used to load previously created and saved identities into Reticulum.</p> 604 <dl class="field-list simple"> 605 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 606 <dd class="field-odd"><p><strong>prv_bytes</strong> – The <em>bytes</em> of private a saved private key. <strong>HAZARD!</strong> Never use this to generate a new key by feeding random data in prv_bytes.</p> 607 </dd> 608 <dt class="field-even">Returns<span class="colon">:</span></dt> 609 <dd class="field-even"><p>A <a class="reference internal" href="#api-identity"><span class="std std-ref">RNS.Identity</span></a> instance, or <em>None</em> if the <em>bytes</em> data was invalid.</p> 610 </dd> 611 </dl> 612 </dd></dl> 613 614 <dl class="py method"> 615 <dt class="sig sig-object py" id="RNS.Identity.from_file"> 616 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_file</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.from_file" title="Link to this definition">¶</a></dt> 617 <dd><p>Create a new <a class="reference internal" href="#api-identity"><span class="std std-ref">RNS.Identity</span></a> instance from a file. 618 Can be used to load previously created and saved identities into Reticulum.</p> 619 <dl class="field-list simple"> 620 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 621 <dd class="field-odd"><p><strong>path</strong> – The full path to the saved <a class="reference internal" href="#api-identity"><span class="std std-ref">RNS.Identity</span></a> data</p> 622 </dd> 623 <dt class="field-even">Returns<span class="colon">:</span></dt> 624 <dd class="field-even"><p>A <a class="reference internal" href="#api-identity"><span class="std std-ref">RNS.Identity</span></a> instance, or <em>None</em> if the loaded data was invalid.</p> 625 </dd> 626 </dl> 627 </dd></dl> 628 629 <dl class="py method"> 630 <dt class="sig sig-object py" id="RNS.Identity.to_file"> 631 <span class="sig-name descname"><span class="pre">to_file</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.to_file" title="Link to this definition">¶</a></dt> 632 <dd><p>Saves the identity to a file. This will write the private key to disk, 633 and anyone with access to this file will be able to decrypt all 634 communication for the identity. Be very careful with this method.</p> 635 <dl class="field-list simple"> 636 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 637 <dd class="field-odd"><p><strong>path</strong> – The full path specifying where to save the identity.</p> 638 </dd> 639 <dt class="field-even">Returns<span class="colon">:</span></dt> 640 <dd class="field-even"><p>True if the file was saved, otherwise False.</p> 641 </dd> 642 </dl> 643 </dd></dl> 644 645 <dl class="py method"> 646 <dt class="sig sig-object py" id="RNS.Identity.get_private_key"> 647 <span class="sig-name descname"><span class="pre">get_private_key</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.get_private_key" title="Link to this definition">¶</a></dt> 648 <dd><dl class="field-list simple"> 649 <dt class="field-odd">Returns<span class="colon">:</span></dt> 650 <dd class="field-odd"><p>The private key as <em>bytes</em></p> 651 </dd> 652 </dl> 653 </dd></dl> 654 655 <dl class="py method"> 656 <dt class="sig sig-object py" id="RNS.Identity.get_public_key"> 657 <span class="sig-name descname"><span class="pre">get_public_key</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.get_public_key" title="Link to this definition">¶</a></dt> 658 <dd><dl class="field-list simple"> 659 <dt class="field-odd">Returns<span class="colon">:</span></dt> 660 <dd class="field-odd"><p>The public key as <em>bytes</em></p> 661 </dd> 662 </dl> 663 </dd></dl> 664 665 <dl class="py method"> 666 <dt class="sig sig-object py" id="RNS.Identity.load_private_key"> 667 <span class="sig-name descname"><span class="pre">load_private_key</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">prv_bytes</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.load_private_key" title="Link to this definition">¶</a></dt> 668 <dd><p>Load a private key into the instance.</p> 669 <dl class="field-list simple"> 670 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 671 <dd class="field-odd"><p><strong>prv_bytes</strong> – The private key as <em>bytes</em>.</p> 672 </dd> 673 <dt class="field-even">Returns<span class="colon">:</span></dt> 674 <dd class="field-even"><p>True if the key was loaded, otherwise False.</p> 675 </dd> 676 </dl> 677 </dd></dl> 678 679 <dl class="py method"> 680 <dt class="sig sig-object py" id="RNS.Identity.load_public_key"> 681 <span class="sig-name descname"><span class="pre">load_public_key</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pub_bytes</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.load_public_key" title="Link to this definition">¶</a></dt> 682 <dd><p>Load a public key into the instance.</p> 683 <dl class="field-list simple"> 684 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 685 <dd class="field-odd"><p><strong>pub_bytes</strong> – The public key as <em>bytes</em>.</p> 686 </dd> 687 <dt class="field-even">Returns<span class="colon">:</span></dt> 688 <dd class="field-even"><p>True if the key was loaded, otherwise False.</p> 689 </dd> 690 </dl> 691 </dd></dl> 692 693 <dl class="py method"> 694 <dt class="sig sig-object py" id="RNS.Identity.encrypt"> 695 <span class="sig-name descname"><span class="pre">encrypt</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">plaintext</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ratchet</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.encrypt" title="Link to this definition">¶</a></dt> 696 <dd><p>Encrypts information for the identity.</p> 697 <dl class="field-list simple"> 698 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 699 <dd class="field-odd"><p><strong>plaintext</strong> – The plaintext to be encrypted as <em>bytes</em>.</p> 700 </dd> 701 <dt class="field-even">Returns<span class="colon">:</span></dt> 702 <dd class="field-even"><p>Ciphertext token as <em>bytes</em>.</p> 703 </dd> 704 <dt class="field-odd">Raises<span class="colon">:</span></dt> 705 <dd class="field-odd"><p><em>KeyError</em> if the instance does not hold a public key.</p> 706 </dd> 707 </dl> 708 </dd></dl> 709 710 <dl class="py method"> 711 <dt class="sig sig-object py" id="RNS.Identity.decrypt"> 712 <span class="sig-name descname"><span class="pre">decrypt</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ciphertext_token</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ratchets</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">enforce_ratchets</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ratchet_id_receiver</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.decrypt" title="Link to this definition">¶</a></dt> 713 <dd><p>Decrypts information for the identity.</p> 714 <dl class="field-list simple"> 715 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 716 <dd class="field-odd"><p><strong>ciphertext</strong> – The ciphertext to be decrypted as <em>bytes</em>.</p> 717 </dd> 718 <dt class="field-even">Returns<span class="colon">:</span></dt> 719 <dd class="field-even"><p>Plaintext as <em>bytes</em>, or <em>None</em> if decryption fails.</p> 720 </dd> 721 <dt class="field-odd">Raises<span class="colon">:</span></dt> 722 <dd class="field-odd"><p><em>KeyError</em> if the instance does not hold a private key.</p> 723 </dd> 724 </dl> 725 </dd></dl> 726 727 <dl class="py method"> 728 <dt class="sig sig-object py" id="RNS.Identity.sign"> 729 <span class="sig-name descname"><span class="pre">sign</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">message</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.sign" title="Link to this definition">¶</a></dt> 730 <dd><p>Signs information by the identity.</p> 731 <dl class="field-list simple"> 732 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 733 <dd class="field-odd"><p><strong>message</strong> – The message to be signed as <em>bytes</em>.</p> 734 </dd> 735 <dt class="field-even">Returns<span class="colon">:</span></dt> 736 <dd class="field-even"><p>Signature as <em>bytes</em>.</p> 737 </dd> 738 <dt class="field-odd">Raises<span class="colon">:</span></dt> 739 <dd class="field-odd"><p><em>KeyError</em> if the instance does not hold a private key.</p> 740 </dd> 741 </dl> 742 </dd></dl> 743 744 <dl class="py method"> 745 <dt class="sig sig-object py" id="RNS.Identity.validate"> 746 <span class="sig-name descname"><span class="pre">validate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">signature</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">message</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.validate" title="Link to this definition">¶</a></dt> 747 <dd><p>Validates the signature of a signed message.</p> 748 <dl class="field-list simple"> 749 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 750 <dd class="field-odd"><ul class="simple"> 751 <li><p><strong>signature</strong> – The signature to be validated as <em>bytes</em>.</p></li> 752 <li><p><strong>message</strong> – The message to be validated as <em>bytes</em>.</p></li> 753 </ul> 754 </dd> 755 <dt class="field-even">Returns<span class="colon">:</span></dt> 756 <dd class="field-even"><p>True if the signature is valid, otherwise False.</p> 757 </dd> 758 <dt class="field-odd">Raises<span class="colon">:</span></dt> 759 <dd class="field-odd"><p><em>KeyError</em> if the instance does not hold a public key.</p> 760 </dd> 761 </dl> 762 </dd></dl> 763 764 </dd></dl> 765 766 <p id="api-destination"><h3> Destination </h3></p> 767 <dl class="py class"> 768 <dt class="sig sig-object py" id="RNS.Destination"> 769 <em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">Destination</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">identity</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">direction</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">type</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">app_name</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">aspects</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination" title="Link to this definition">¶</a></dt> 770 <dd><p>A class used to describe endpoints in a Reticulum Network. Destination 771 instances are used both to create outgoing and incoming endpoints. The 772 destination type will decide if encryption, and what type, is used in 773 communication with the endpoint. A destination can also announce its 774 presence on the network, which will distribute necessary keys for 775 encrypted communication with it.</p> 776 <dl class="field-list simple"> 777 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 778 <dd class="field-odd"><ul class="simple"> 779 <li><p><strong>identity</strong> – An instance of <a class="reference internal" href="#api-identity"><span class="std std-ref">RNS.Identity</span></a>. Can hold only public keys for an outgoing destination, or holding private keys for an ingoing.</p></li> 780 <li><p><strong>direction</strong> – <code class="docutils literal notranslate"><span class="pre">RNS.Destination.IN</span></code> or <code class="docutils literal notranslate"><span class="pre">RNS.Destination.OUT</span></code>.</p></li> 781 <li><p><strong>type</strong> – <code class="docutils literal notranslate"><span class="pre">RNS.Destination.SINGLE</span></code>, <code class="docutils literal notranslate"><span class="pre">RNS.Destination.GROUP</span></code> or <code class="docutils literal notranslate"><span class="pre">RNS.Destination.PLAIN</span></code>.</p></li> 782 <li><p><strong>app_name</strong> – A string specifying the app name.</p></li> 783 <li><p><strong>*aspects</strong> – Any non-zero number of string arguments.</p></li> 784 </ul> 785 </dd> 786 </dl> 787 <dl class="py attribute"> 788 <dt class="sig sig-object py" id="RNS.Destination.RATCHET_COUNT"> 789 <span class="sig-name descname"><span class="pre">RATCHET_COUNT</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">512</span></em><a class="headerlink" href="#RNS.Destination.RATCHET_COUNT" title="Link to this definition">¶</a></dt> 790 <dd><p>The default number of generated ratchet keys a destination will retain, if it has ratchets enabled.</p> 791 </dd></dl> 792 793 <dl class="py attribute"> 794 <dt class="sig sig-object py" id="RNS.Destination.RATCHET_INTERVAL"> 795 <span class="sig-name descname"><span class="pre">RATCHET_INTERVAL</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">1800</span></em><a class="headerlink" href="#RNS.Destination.RATCHET_INTERVAL" title="Link to this definition">¶</a></dt> 796 <dd><p>The minimum interval between rotating ratchet keys, in seconds.</p> 797 </dd></dl> 798 799 <dl class="py method"> 800 <dt class="sig sig-object py" id="RNS.Destination.expand_name"> 801 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">expand_name</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">identity</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">app_name</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">aspects</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.expand_name" title="Link to this definition">¶</a></dt> 802 <dd><dl class="field-list simple"> 803 <dt class="field-odd">Returns<span class="colon">:</span></dt> 804 <dd class="field-odd"><p>A string containing the full human-readable name of the destination, for an app_name and a number of aspects.</p> 805 </dd> 806 </dl> 807 </dd></dl> 808 809 <dl class="py method"> 810 <dt class="sig sig-object py" id="RNS.Destination.app_and_aspects_from_name"> 811 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">app_and_aspects_from_name</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">full_name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.app_and_aspects_from_name" title="Link to this definition">¶</a></dt> 812 <dd><dl class="field-list simple"> 813 <dt class="field-odd">Returns<span class="colon">:</span></dt> 814 <dd class="field-odd"><p>A tuple containing the app name and a list of aspects, for a full-name string.</p> 815 </dd> 816 </dl> 817 </dd></dl> 818 819 <dl class="py method"> 820 <dt class="sig sig-object py" id="RNS.Destination.hash_from_name_and_identity"> 821 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">hash_from_name_and_identity</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">full_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">identity</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.hash_from_name_and_identity" title="Link to this definition">¶</a></dt> 822 <dd><dl class="field-list simple"> 823 <dt class="field-odd">Returns<span class="colon">:</span></dt> 824 <dd class="field-odd"><p>A destination name in adressable hash form, for a full name string and Identity instance.</p> 825 </dd> 826 </dl> 827 </dd></dl> 828 829 <dl class="py method"> 830 <dt class="sig sig-object py" id="RNS.Destination.hash"> 831 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">hash</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">identity</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">app_name</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">aspects</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.hash" title="Link to this definition">¶</a></dt> 832 <dd><dl class="field-list simple"> 833 <dt class="field-odd">Returns<span class="colon">:</span></dt> 834 <dd class="field-odd"><p>A destination name in adressable hash form, for an app_name and a number of aspects.</p> 835 </dd> 836 </dl> 837 </dd></dl> 838 839 <dl class="py method"> 840 <dt class="sig sig-object py" id="RNS.Destination.announce"> 841 <span class="sig-name descname"><span class="pre">announce</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">app_data</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path_response</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">attached_interface</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tag</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">send</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.announce" title="Link to this definition">¶</a></dt> 842 <dd><p>Creates an announce packet for this destination and broadcasts it on all 843 relevant interfaces. Application specific data can be added to the announce.</p> 844 <dl class="field-list simple"> 845 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 846 <dd class="field-odd"><ul class="simple"> 847 <li><p><strong>app_data</strong> – <em>bytes</em> containing the app_data.</p></li> 848 <li><p><strong>path_response</strong> – Internal flag used by <a class="reference internal" href="#api-transport"><span class="std std-ref">RNS.Transport</span></a>. Ignore.</p></li> 849 </ul> 850 </dd> 851 </dl> 852 </dd></dl> 853 854 <dl class="py method"> 855 <dt class="sig sig-object py" id="RNS.Destination.accepts_links"> 856 <span class="sig-name descname"><span class="pre">accepts_links</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">accepts</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.accepts_links" title="Link to this definition">¶</a></dt> 857 <dd><p>Set or query whether the destination accepts incoming link requests.</p> 858 <dl class="field-list simple"> 859 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 860 <dd class="field-odd"><p><strong>accepts</strong> – If <code class="docutils literal notranslate"><span class="pre">True</span></code> or <code class="docutils literal notranslate"><span class="pre">False</span></code>, this method sets whether the destination accepts incoming link requests. If not provided or <code class="docutils literal notranslate"><span class="pre">None</span></code>, the method returns whether the destination currently accepts link requests.</p> 861 </dd> 862 <dt class="field-even">Returns<span class="colon">:</span></dt> 863 <dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">True</span></code> or <code class="docutils literal notranslate"><span class="pre">False</span></code> depending on whether the destination accepts incoming link requests, if the <em>accepts</em> parameter is not provided or <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p> 864 </dd> 865 </dl> 866 </dd></dl> 867 868 <dl class="py method"> 869 <dt class="sig sig-object py" id="RNS.Destination.set_link_established_callback"> 870 <span class="sig-name descname"><span class="pre">set_link_established_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.set_link_established_callback" title="Link to this definition">¶</a></dt> 871 <dd><p>Registers a function to be called when a link has been established to 872 this destination.</p> 873 <dl class="field-list simple"> 874 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 875 <dd class="field-odd"><p><strong>callback</strong> – A function or method with the signature <em>callback(link)</em> to be called when a new link is established with this destination.</p> 876 </dd> 877 </dl> 878 </dd></dl> 879 880 <dl class="py method"> 881 <dt class="sig sig-object py" id="RNS.Destination.set_packet_callback"> 882 <span class="sig-name descname"><span class="pre">set_packet_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.set_packet_callback" title="Link to this definition">¶</a></dt> 883 <dd><p>Registers a function to be called when a packet has been received by 884 this destination.</p> 885 <dl class="field-list simple"> 886 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 887 <dd class="field-odd"><p><strong>callback</strong> – A function or method with the signature <em>callback(data, packet)</em> to be called when this destination receives a packet.</p> 888 </dd> 889 </dl> 890 </dd></dl> 891 892 <dl class="py method"> 893 <dt class="sig sig-object py" id="RNS.Destination.set_proof_requested_callback"> 894 <span class="sig-name descname"><span class="pre">set_proof_requested_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.set_proof_requested_callback" title="Link to this definition">¶</a></dt> 895 <dd><p>Registers a function to be called when a proof has been requested for 896 a packet sent to this destination. Allows control over when and if 897 proofs should be returned for received packets.</p> 898 <dl class="field-list simple"> 899 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 900 <dd class="field-odd"><p><strong>callback</strong> – A function or method to with the signature <em>callback(packet)</em> be called when a packet that requests a proof is received. The callback must return one of True or False. If the callback returns True, a proof will be sent. If it returns False, a proof will not be sent.</p> 901 </dd> 902 </dl> 903 </dd></dl> 904 905 <dl class="py method"> 906 <dt class="sig sig-object py" id="RNS.Destination.set_proof_strategy"> 907 <span class="sig-name descname"><span class="pre">set_proof_strategy</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">proof_strategy</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.set_proof_strategy" title="Link to this definition">¶</a></dt> 908 <dd><p>Sets the destinations proof strategy.</p> 909 <dl class="field-list simple"> 910 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 911 <dd class="field-odd"><p><strong>proof_strategy</strong> – One of <code class="docutils literal notranslate"><span class="pre">RNS.Destination.PROVE_NONE</span></code>, <code class="docutils literal notranslate"><span class="pre">RNS.Destination.PROVE_ALL</span></code> or <code class="docutils literal notranslate"><span class="pre">RNS.Destination.PROVE_APP</span></code>. If <code class="docutils literal notranslate"><span class="pre">RNS.Destination.PROVE_APP</span></code> is set, the <cite>proof_requested_callback</cite> will be called to determine whether a proof should be sent or not.</p> 912 </dd> 913 </dl> 914 </dd></dl> 915 916 <dl class="py method"> 917 <dt class="sig sig-object py" id="RNS.Destination.register_request_handler"> 918 <span class="sig-name descname"><span class="pre">register_request_handler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">response_generator</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">allow</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">ALLOW_NONE</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">allowed_list</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">auto_compress</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.register_request_handler" title="Link to this definition">¶</a></dt> 919 <dd><p>Registers a request handler.</p> 920 <dl class="field-list simple"> 921 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 922 <dd class="field-odd"><ul class="simple"> 923 <li><p><strong>path</strong> – The path for the request handler to be registered.</p></li> 924 <li><p><strong>response_generator</strong> – A function or method with the signature <em>response_generator(path, data, request_id, link_id, remote_identity, requested_at)</em> to be called. Whatever this funcion returns will be sent as a response to the requester. If the function returns <code class="docutils literal notranslate"><span class="pre">None</span></code>, no response will be sent.</p></li> 925 <li><p><strong>allow</strong> – One of <code class="docutils literal notranslate"><span class="pre">RNS.Destination.ALLOW_NONE</span></code>, <code class="docutils literal notranslate"><span class="pre">RNS.Destination.ALLOW_ALL</span></code> or <code class="docutils literal notranslate"><span class="pre">RNS.Destination.ALLOW_LIST</span></code>. If <code class="docutils literal notranslate"><span class="pre">RNS.Destination.ALLOW_LIST</span></code> is set, the request handler will only respond to requests for identified peers in the supplied list.</p></li> 926 <li><p><strong>allowed_list</strong> – A list of <em>bytes-like</em> <a class="reference internal" href="#api-identity"><span class="std std-ref">RNS.Identity</span></a> hashes.</p></li> 927 <li><p><strong>auto_compress</strong> – If <code class="docutils literal notranslate"><span class="pre">True</span></code> or <code class="docutils literal notranslate"><span class="pre">False</span></code>, determines whether automatic compression of responses should be carried out. If set to an integer value, responses will only be auto-compressed if under this size in bytes. If omitted, the default compression settings will be followed.</p></li> 928 </ul> 929 </dd> 930 <dt class="field-even">Raises<span class="colon">:</span></dt> 931 <dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">ValueError</span></code> if any of the supplied arguments are invalid.</p> 932 </dd> 933 </dl> 934 </dd></dl> 935 936 <dl class="py method"> 937 <dt class="sig sig-object py" id="RNS.Destination.deregister_request_handler"> 938 <span class="sig-name descname"><span class="pre">deregister_request_handler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.deregister_request_handler" title="Link to this definition">¶</a></dt> 939 <dd><p>Deregisters a request handler.</p> 940 <dl class="field-list simple"> 941 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 942 <dd class="field-odd"><p><strong>path</strong> – The path for the request handler to be deregistered.</p> 943 </dd> 944 <dt class="field-even">Returns<span class="colon">:</span></dt> 945 <dd class="field-even"><p>True if the handler was deregistered, otherwise False.</p> 946 </dd> 947 </dl> 948 </dd></dl> 949 950 <dl class="py method"> 951 <dt class="sig sig-object py" id="RNS.Destination.enable_ratchets"> 952 <span class="sig-name descname"><span class="pre">enable_ratchets</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ratchets_path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.enable_ratchets" title="Link to this definition">¶</a></dt> 953 <dd><p>Enables ratchets on the destination. When ratchets are enabled, Reticulum will automatically rotate 954 the keys used to encrypt packets to this destination, and include the latest ratchet key in announces.</p> 955 <p>Enabling ratchets on a destination will provide forward secrecy for packets sent to that destination, 956 even when sent outside a <code class="docutils literal notranslate"><span class="pre">Link</span></code>. The normal Reticulum <code class="docutils literal notranslate"><span class="pre">Link</span></code> establishment procedure already performs 957 its own ephemeral key exchange for each link establishment, which means that ratchets are not necessary 958 to provide forward secrecy for links.</p> 959 <p>Enabling ratchets will have a small impact on announce size, adding 32 bytes to every sent announce.</p> 960 <dl class="field-list simple"> 961 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 962 <dd class="field-odd"><p><strong>ratchets_path</strong> – The path to a file to store ratchet data in.</p> 963 </dd> 964 <dt class="field-even">Returns<span class="colon">:</span></dt> 965 <dd class="field-even"><p>True if the operation succeeded, otherwise False.</p> 966 </dd> 967 </dl> 968 </dd></dl> 969 970 <dl class="py method"> 971 <dt class="sig sig-object py" id="RNS.Destination.enforce_ratchets"> 972 <span class="sig-name descname"><span class="pre">enforce_ratchets</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.enforce_ratchets" title="Link to this definition">¶</a></dt> 973 <dd><p>When ratchet enforcement is enabled, this destination will never accept packets that use its 974 base Identity key for encryption, but only accept packets encrypted with one of the retained 975 ratchet keys.</p> 976 </dd></dl> 977 978 <dl class="py method"> 979 <dt class="sig sig-object py" id="RNS.Destination.set_retained_ratchets"> 980 <span class="sig-name descname"><span class="pre">set_retained_ratchets</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">retained_ratchets</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.set_retained_ratchets" title="Link to this definition">¶</a></dt> 981 <dd><p>Sets the number of previously generated ratchet keys this destination will retain, 982 and try to use when decrypting incoming packets. Defaults to <code class="docutils literal notranslate"><span class="pre">Destination.RATCHET_COUNT</span></code>.</p> 983 <dl class="field-list simple"> 984 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 985 <dd class="field-odd"><p><strong>retained_ratchets</strong> – The number of generated ratchets to retain.</p> 986 </dd> 987 <dt class="field-even">Returns<span class="colon">:</span></dt> 988 <dd class="field-even"><p>True if the operation succeeded, False if not.</p> 989 </dd> 990 </dl> 991 </dd></dl> 992 993 <dl class="py method"> 994 <dt class="sig sig-object py" id="RNS.Destination.set_ratchet_interval"> 995 <span class="sig-name descname"><span class="pre">set_ratchet_interval</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">interval</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.set_ratchet_interval" title="Link to this definition">¶</a></dt> 996 <dd><p>Sets the minimum interval in seconds between ratchet key rotation. 997 Defaults to <code class="docutils literal notranslate"><span class="pre">Destination.RATCHET_INTERVAL</span></code>.</p> 998 <dl class="field-list simple"> 999 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1000 <dd class="field-odd"><p><strong>interval</strong> – The minimum interval in seconds.</p> 1001 </dd> 1002 <dt class="field-even">Returns<span class="colon">:</span></dt> 1003 <dd class="field-even"><p>True if the operation succeeded, False if not.</p> 1004 </dd> 1005 </dl> 1006 </dd></dl> 1007 1008 <dl class="py method"> 1009 <dt class="sig sig-object py" id="RNS.Destination.create_keys"> 1010 <span class="sig-name descname"><span class="pre">create_keys</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.create_keys" title="Link to this definition">¶</a></dt> 1011 <dd><p>For a <code class="docutils literal notranslate"><span class="pre">RNS.Destination.GROUP</span></code> type destination, creates a new symmetric key.</p> 1012 <dl class="field-list simple"> 1013 <dt class="field-odd">Raises<span class="colon">:</span></dt> 1014 <dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">TypeError</span></code> if called on an incompatible type of destination.</p> 1015 </dd> 1016 </dl> 1017 </dd></dl> 1018 1019 <dl class="py method"> 1020 <dt class="sig sig-object py" id="RNS.Destination.get_private_key"> 1021 <span class="sig-name descname"><span class="pre">get_private_key</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.get_private_key" title="Link to this definition">¶</a></dt> 1022 <dd><p>For a <code class="docutils literal notranslate"><span class="pre">RNS.Destination.GROUP</span></code> type destination, returns the symmetric private key.</p> 1023 <dl class="field-list simple"> 1024 <dt class="field-odd">Raises<span class="colon">:</span></dt> 1025 <dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">TypeError</span></code> if called on an incompatible type of destination.</p> 1026 </dd> 1027 </dl> 1028 </dd></dl> 1029 1030 <dl class="py method"> 1031 <dt class="sig sig-object py" id="RNS.Destination.load_private_key"> 1032 <span class="sig-name descname"><span class="pre">load_private_key</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.load_private_key" title="Link to this definition">¶</a></dt> 1033 <dd><p>For a <code class="docutils literal notranslate"><span class="pre">RNS.Destination.GROUP</span></code> type destination, loads a symmetric private key.</p> 1034 <dl class="field-list simple"> 1035 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1036 <dd class="field-odd"><p><strong>key</strong> – A <em>bytes-like</em> containing the symmetric key.</p> 1037 </dd> 1038 <dt class="field-even">Raises<span class="colon">:</span></dt> 1039 <dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">TypeError</span></code> if called on an incompatible type of destination.</p> 1040 </dd> 1041 </dl> 1042 </dd></dl> 1043 1044 <dl class="py method"> 1045 <dt class="sig sig-object py" id="RNS.Destination.encrypt"> 1046 <span class="sig-name descname"><span class="pre">encrypt</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">plaintext</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.encrypt" title="Link to this definition">¶</a></dt> 1047 <dd><p>Encrypts information for <code class="docutils literal notranslate"><span class="pre">RNS.Destination.SINGLE</span></code> or <code class="docutils literal notranslate"><span class="pre">RNS.Destination.GROUP</span></code> type destination.</p> 1048 <dl class="field-list simple"> 1049 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1050 <dd class="field-odd"><p><strong>plaintext</strong> – A <em>bytes-like</em> containing the plaintext to be encrypted.</p> 1051 </dd> 1052 <dt class="field-even">Raises<span class="colon">:</span></dt> 1053 <dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">ValueError</span></code> if destination does not hold a necessary key for encryption.</p> 1054 </dd> 1055 </dl> 1056 </dd></dl> 1057 1058 <dl class="py method"> 1059 <dt class="sig sig-object py" id="RNS.Destination.decrypt"> 1060 <span class="sig-name descname"><span class="pre">decrypt</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ciphertext</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.decrypt" title="Link to this definition">¶</a></dt> 1061 <dd><p>Decrypts information for <code class="docutils literal notranslate"><span class="pre">RNS.Destination.SINGLE</span></code> or <code class="docutils literal notranslate"><span class="pre">RNS.Destination.GROUP</span></code> type destination.</p> 1062 <dl class="field-list simple"> 1063 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1064 <dd class="field-odd"><p><strong>ciphertext</strong> – <em>Bytes</em> containing the ciphertext to be decrypted.</p> 1065 </dd> 1066 <dt class="field-even">Raises<span class="colon">:</span></dt> 1067 <dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">ValueError</span></code> if destination does not hold a necessary key for decryption.</p> 1068 </dd> 1069 </dl> 1070 </dd></dl> 1071 1072 <dl class="py method"> 1073 <dt class="sig sig-object py" id="RNS.Destination.sign"> 1074 <span class="sig-name descname"><span class="pre">sign</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">message</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.sign" title="Link to this definition">¶</a></dt> 1075 <dd><p>Signs information for <code class="docutils literal notranslate"><span class="pre">RNS.Destination.SINGLE</span></code> type destination.</p> 1076 <dl class="field-list simple"> 1077 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1078 <dd class="field-odd"><p><strong>message</strong> – <em>Bytes</em> containing the message to be signed.</p> 1079 </dd> 1080 <dt class="field-even">Returns<span class="colon">:</span></dt> 1081 <dd class="field-even"><p>A <em>bytes-like</em> containing the message signature, or <em>None</em> if the destination could not sign the message.</p> 1082 </dd> 1083 </dl> 1084 </dd></dl> 1085 1086 <dl class="py method"> 1087 <dt class="sig sig-object py" id="RNS.Destination.set_default_app_data"> 1088 <span class="sig-name descname"><span class="pre">set_default_app_data</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">app_data</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.set_default_app_data" title="Link to this definition">¶</a></dt> 1089 <dd><p>Sets the default app_data for the destination. If set, the default 1090 app_data will be included in every announce sent by the destination, 1091 unless other app_data is specified in the <em>announce</em> method.</p> 1092 <dl class="field-list simple"> 1093 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1094 <dd class="field-odd"><p><strong>app_data</strong> – A <em>bytes-like</em> containing the default app_data, or a <em>callable</em> returning a <em>bytes-like</em> containing the app_data.</p> 1095 </dd> 1096 </dl> 1097 </dd></dl> 1098 1099 <dl class="py method"> 1100 <dt class="sig sig-object py" id="RNS.Destination.clear_default_app_data"> 1101 <span class="sig-name descname"><span class="pre">clear_default_app_data</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.clear_default_app_data" title="Link to this definition">¶</a></dt> 1102 <dd><p>Clears default app_data previously set for the destination.</p> 1103 </dd></dl> 1104 1105 </dd></dl> 1106 1107 <p id="api-packet"><h3> Packet </h3></p> 1108 <dl class="py class"> 1109 <dt class="sig sig-object py" id="RNS.Packet"> 1110 <em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">Packet</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">destination</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">create_receipt</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Packet" title="Link to this definition">¶</a></dt> 1111 <dd><p>The Packet class is used to create packet instances that can be sent 1112 over a Reticulum network. Packets will automatically be encrypted if 1113 they are addressed to a <code class="docutils literal notranslate"><span class="pre">RNS.Destination.SINGLE</span></code> destination, 1114 <code class="docutils literal notranslate"><span class="pre">RNS.Destination.GROUP</span></code> destination or a <a class="reference internal" href="#api-link"><span class="std std-ref">RNS.Link</span></a>.</p> 1115 <p>For <code class="docutils literal notranslate"><span class="pre">RNS.Destination.GROUP</span></code> destinations, Reticulum will use the 1116 pre-shared key configured for the destination. All packets to group 1117 destinations are encrypted with the same AES-256 key.</p> 1118 <p>For <code class="docutils literal notranslate"><span class="pre">RNS.Destination.SINGLE</span></code> destinations, Reticulum will use a newly 1119 derived ephemeral AES-256 key for every packet.</p> 1120 <p>For <a class="reference internal" href="#api-link"><span class="std std-ref">RNS.Link</span></a> destinations, Reticulum will use per-link 1121 ephemeral keys, and offers <strong>Forward Secrecy</strong>.</p> 1122 <dl class="field-list simple"> 1123 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1124 <dd class="field-odd"><ul class="simple"> 1125 <li><p><strong>destination</strong> – A <a class="reference internal" href="#api-destination"><span class="std std-ref">RNS.Destination</span></a> instance to which the packet will be sent.</p></li> 1126 <li><p><strong>data</strong> – The data payload to be included in the packet as <em>bytes</em>.</p></li> 1127 <li><p><strong>create_receipt</strong> – Specifies whether a <a class="reference internal" href="#api-packetreceipt"><span class="std std-ref">RNS.PacketReceipt</span></a> should be created when instantiating the packet.</p></li> 1128 </ul> 1129 </dd> 1130 </dl> 1131 <dl class="py attribute"> 1132 <dt class="sig sig-object py" id="RNS.Packet.ENCRYPTED_MDU"> 1133 <span class="sig-name descname"><span class="pre">ENCRYPTED_MDU</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">383</span></em><a class="headerlink" href="#RNS.Packet.ENCRYPTED_MDU" title="Link to this definition">¶</a></dt> 1134 <dd><p>The maximum size of the payload data in a single encrypted packet</p> 1135 </dd></dl> 1136 1137 <dl class="py attribute"> 1138 <dt class="sig sig-object py" id="RNS.Packet.PLAIN_MDU"> 1139 <span class="sig-name descname"><span class="pre">PLAIN_MDU</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">464</span></em><a class="headerlink" href="#RNS.Packet.PLAIN_MDU" title="Link to this definition">¶</a></dt> 1140 <dd><p>The maximum size of the payload data in a single unencrypted packet</p> 1141 </dd></dl> 1142 1143 <dl class="py method"> 1144 <dt class="sig sig-object py" id="RNS.Packet.send"> 1145 <span class="sig-name descname"><span class="pre">send</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Packet.send" title="Link to this definition">¶</a></dt> 1146 <dd><p>Sends the packet.</p> 1147 <dl class="field-list simple"> 1148 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1149 <dd class="field-odd"><p>A <a class="reference internal" href="#api-packetreceipt"><span class="std std-ref">RNS.PacketReceipt</span></a> instance if <em>create_receipt</em> was set to <em>True</em> when the packet was instantiated, if not returns <em>None</em>. If the packet could not be sent <em>False</em> is returned.</p> 1150 </dd> 1151 </dl> 1152 </dd></dl> 1153 1154 <dl class="py method"> 1155 <dt class="sig sig-object py" id="RNS.Packet.resend"> 1156 <span class="sig-name descname"><span class="pre">resend</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Packet.resend" title="Link to this definition">¶</a></dt> 1157 <dd><p>Re-sends the packet.</p> 1158 <dl class="field-list simple"> 1159 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1160 <dd class="field-odd"><p>A <a class="reference internal" href="#api-packetreceipt"><span class="std std-ref">RNS.PacketReceipt</span></a> instance if <em>create_receipt</em> was set to <em>True</em> when the packet was instantiated, if not returns <em>None</em>. If the packet could not be sent <em>False</em> is returned.</p> 1161 </dd> 1162 </dl> 1163 </dd></dl> 1164 1165 <dl class="py method"> 1166 <dt class="sig sig-object py" id="RNS.Packet.get_rssi"> 1167 <span class="sig-name descname"><span class="pre">get_rssi</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Packet.get_rssi" title="Link to this definition">¶</a></dt> 1168 <dd><dl class="field-list simple"> 1169 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1170 <dd class="field-odd"><p>The physical layer <em>Received Signal Strength Indication</em> if available, otherwise <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p> 1171 </dd> 1172 </dl> 1173 </dd></dl> 1174 1175 <dl class="py method"> 1176 <dt class="sig sig-object py" id="RNS.Packet.get_snr"> 1177 <span class="sig-name descname"><span class="pre">get_snr</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Packet.get_snr" title="Link to this definition">¶</a></dt> 1178 <dd><dl class="field-list simple"> 1179 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1180 <dd class="field-odd"><p>The physical layer <em>Signal-to-Noise Ratio</em> if available, otherwise <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p> 1181 </dd> 1182 </dl> 1183 </dd></dl> 1184 1185 <dl class="py method"> 1186 <dt class="sig sig-object py" id="RNS.Packet.get_q"> 1187 <span class="sig-name descname"><span class="pre">get_q</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Packet.get_q" title="Link to this definition">¶</a></dt> 1188 <dd><dl class="field-list simple"> 1189 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1190 <dd class="field-odd"><p>The physical layer <em>Link Quality</em> if available, otherwise <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p> 1191 </dd> 1192 </dl> 1193 </dd></dl> 1194 1195 </dd></dl> 1196 1197 <p id="api-packetreceipt"><h3> Packet Receipt </h3></p> 1198 <dl class="py class"> 1199 <dt class="sig sig-object py" id="RNS.PacketReceipt"> 1200 <em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">PacketReceipt</span></span><a class="headerlink" href="#RNS.PacketReceipt" title="Link to this definition">¶</a></dt> 1201 <dd><p>The PacketReceipt class is used to receive notifications about 1202 <a class="reference internal" href="#api-packet"><span class="std std-ref">RNS.Packet</span></a> instances sent over the network. Instances 1203 of this class are never created manually, but always returned from 1204 the <em>send()</em> method of a <a class="reference internal" href="#api-packet"><span class="std std-ref">RNS.Packet</span></a> instance.</p> 1205 <dl class="py method"> 1206 <dt class="sig sig-object py" id="RNS.PacketReceipt.get_status"> 1207 <span class="sig-name descname"><span class="pre">get_status</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.PacketReceipt.get_status" title="Link to this definition">¶</a></dt> 1208 <dd><dl class="field-list simple"> 1209 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1210 <dd class="field-odd"><p>The status of the associated <a class="reference internal" href="#api-packet"><span class="std std-ref">RNS.Packet</span></a> instance. Can be one of <code class="docutils literal notranslate"><span class="pre">RNS.PacketReceipt.SENT</span></code>, <code class="docutils literal notranslate"><span class="pre">RNS.PacketReceipt.DELIVERED</span></code>, <code class="docutils literal notranslate"><span class="pre">RNS.PacketReceipt.FAILED</span></code> or <code class="docutils literal notranslate"><span class="pre">RNS.PacketReceipt.CULLED</span></code>.</p> 1211 </dd> 1212 </dl> 1213 </dd></dl> 1214 1215 <dl class="py method"> 1216 <dt class="sig sig-object py" id="RNS.PacketReceipt.get_rtt"> 1217 <span class="sig-name descname"><span class="pre">get_rtt</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.PacketReceipt.get_rtt" title="Link to this definition">¶</a></dt> 1218 <dd><dl class="field-list simple"> 1219 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1220 <dd class="field-odd"><p>The round-trip-time in seconds</p> 1221 </dd> 1222 </dl> 1223 </dd></dl> 1224 1225 <dl class="py method"> 1226 <dt class="sig sig-object py" id="RNS.PacketReceipt.set_timeout"> 1227 <span class="sig-name descname"><span class="pre">set_timeout</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">timeout</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.PacketReceipt.set_timeout" title="Link to this definition">¶</a></dt> 1228 <dd><p>Sets a timeout in seconds</p> 1229 <dl class="field-list simple"> 1230 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1231 <dd class="field-odd"><p><strong>timeout</strong> – The timeout in seconds.</p> 1232 </dd> 1233 </dl> 1234 </dd></dl> 1235 1236 <dl class="py method"> 1237 <dt class="sig sig-object py" id="RNS.PacketReceipt.set_delivery_callback"> 1238 <span class="sig-name descname"><span class="pre">set_delivery_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.PacketReceipt.set_delivery_callback" title="Link to this definition">¶</a></dt> 1239 <dd><p>Sets a function that gets called if a successfull delivery has been proven.</p> 1240 <dl class="field-list simple"> 1241 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1242 <dd class="field-odd"><p><strong>callback</strong> – A <em>callable</em> with the signature <em>callback(packet_receipt)</em></p> 1243 </dd> 1244 </dl> 1245 </dd></dl> 1246 1247 <dl class="py method"> 1248 <dt class="sig sig-object py" id="RNS.PacketReceipt.set_timeout_callback"> 1249 <span class="sig-name descname"><span class="pre">set_timeout_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.PacketReceipt.set_timeout_callback" title="Link to this definition">¶</a></dt> 1250 <dd><p>Sets a function that gets called if the delivery times out.</p> 1251 <dl class="field-list simple"> 1252 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1253 <dd class="field-odd"><p><strong>callback</strong> – A <em>callable</em> with the signature <em>callback(packet_receipt)</em></p> 1254 </dd> 1255 </dl> 1256 </dd></dl> 1257 1258 </dd></dl> 1259 1260 <p id="api-link"><h3> Link </h3></p> 1261 <dl class="py class"> 1262 <dt class="sig sig-object py" id="RNS.Link"> 1263 <em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">Link</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">destination</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">established_callback</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">closed_callback</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link" title="Link to this definition">¶</a></dt> 1264 <dd><p>This class is used to establish and manage links to other peers. When a 1265 link instance is created, Reticulum will attempt to establish verified 1266 and encrypted connectivity with the specified destination.</p> 1267 <dl class="field-list simple"> 1268 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1269 <dd class="field-odd"><ul class="simple"> 1270 <li><p><strong>destination</strong> – A <a class="reference internal" href="#api-destination"><span class="std std-ref">RNS.Destination</span></a> instance which to establish a link to.</p></li> 1271 <li><p><strong>established_callback</strong> – An optional function or method with the signature <em>callback(link)</em> to be called when the link has been established.</p></li> 1272 <li><p><strong>closed_callback</strong> – An optional function or method with the signature <em>callback(link)</em> to be called when the link is closed.</p></li> 1273 </ul> 1274 </dd> 1275 </dl> 1276 <dl class="py attribute"> 1277 <dt class="sig sig-object py" id="RNS.Link.CURVE"> 1278 <span class="sig-name descname"><span class="pre">CURVE</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'Curve25519'</span></em><a class="headerlink" href="#RNS.Link.CURVE" title="Link to this definition">¶</a></dt> 1279 <dd><p>The curve used for Elliptic Curve DH key exchanges</p> 1280 </dd></dl> 1281 1282 <dl class="py attribute"> 1283 <dt class="sig sig-object py" id="RNS.Link.ESTABLISHMENT_TIMEOUT_PER_HOP"> 1284 <span class="sig-name descname"><span class="pre">ESTABLISHMENT_TIMEOUT_PER_HOP</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">6</span></em><a class="headerlink" href="#RNS.Link.ESTABLISHMENT_TIMEOUT_PER_HOP" title="Link to this definition">¶</a></dt> 1285 <dd><p>Timeout for link establishment in seconds per hop to destination.</p> 1286 </dd></dl> 1287 1288 <dl class="py attribute"> 1289 <dt class="sig sig-object py" id="RNS.Link.KEEPALIVE_TIMEOUT_FACTOR"> 1290 <span class="sig-name descname"><span class="pre">KEEPALIVE_TIMEOUT_FACTOR</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">4</span></em><a class="headerlink" href="#RNS.Link.KEEPALIVE_TIMEOUT_FACTOR" title="Link to this definition">¶</a></dt> 1291 <dd><p>RTT timeout factor used in link timeout calculation.</p> 1292 </dd></dl> 1293 1294 <dl class="py attribute"> 1295 <dt class="sig sig-object py" id="RNS.Link.STALE_GRACE"> 1296 <span class="sig-name descname"><span class="pre">STALE_GRACE</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">5</span></em><a class="headerlink" href="#RNS.Link.STALE_GRACE" title="Link to this definition">¶</a></dt> 1297 <dd><p>Grace period in seconds used in link timeout calculation.</p> 1298 </dd></dl> 1299 1300 <dl class="py attribute"> 1301 <dt class="sig sig-object py" id="RNS.Link.KEEPALIVE"> 1302 <span class="sig-name descname"><span class="pre">KEEPALIVE</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">360</span></em><a class="headerlink" href="#RNS.Link.KEEPALIVE" title="Link to this definition">¶</a></dt> 1303 <dd><p>Default interval for sending keep-alive packets on established links in seconds.</p> 1304 </dd></dl> 1305 1306 <dl class="py attribute"> 1307 <dt class="sig sig-object py" id="RNS.Link.STALE_TIME"> 1308 <span class="sig-name descname"><span class="pre">STALE_TIME</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">720</span></em><a class="headerlink" href="#RNS.Link.STALE_TIME" title="Link to this definition">¶</a></dt> 1309 <dd><p>If no traffic or keep-alive packets are received within this period, the 1310 link will be marked as stale, and a final keep-alive packet will be sent. 1311 If after this no traffic or keep-alive packets are received within <code class="docutils literal notranslate"><span class="pre">RTT</span></code> * 1312 <code class="docutils literal notranslate"><span class="pre">KEEPALIVE_TIMEOUT_FACTOR</span></code> + <code class="docutils literal notranslate"><span class="pre">STALE_GRACE</span></code>, the link is considered timed out, 1313 and will be torn down.</p> 1314 </dd></dl> 1315 1316 <dl class="py method"> 1317 <dt class="sig sig-object py" id="RNS.Link.identify"> 1318 <span class="sig-name descname"><span class="pre">identify</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">identity</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.identify" title="Link to this definition">¶</a></dt> 1319 <dd><p>Identifies the initiator of the link to the remote peer. This can only happen 1320 once the link has been established, and is carried out over the encrypted link. 1321 The identity is only revealed to the remote peer, and initiator anonymity is 1322 thus preserved. This method can be used for authentication.</p> 1323 <dl class="field-list simple"> 1324 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1325 <dd class="field-odd"><p><strong>identity</strong> – An RNS.Identity instance to identify as.</p> 1326 </dd> 1327 </dl> 1328 </dd></dl> 1329 1330 <dl class="py method"> 1331 <dt class="sig sig-object py" id="RNS.Link.request"> 1332 <span class="sig-name descname"><span class="pre">request</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">response_callback</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">failed_callback</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">progress_callback</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.request" title="Link to this definition">¶</a></dt> 1333 <dd><p>Sends a request to the remote peer.</p> 1334 <dl class="field-list simple"> 1335 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1336 <dd class="field-odd"><ul class="simple"> 1337 <li><p><strong>path</strong> – The request path.</p></li> 1338 <li><p><strong>response_callback</strong> – An optional function or method with the signature <em>response_callback(request_receipt)</em> to be called when a response is received. See the <a class="reference internal" href="examples.html#example-request"><span class="std std-ref">Request Example</span></a> for more info.</p></li> 1339 <li><p><strong>failed_callback</strong> – An optional function or method with the signature <em>failed_callback(request_receipt)</em> to be called when a request fails. See the <a class="reference internal" href="examples.html#example-request"><span class="std std-ref">Request Example</span></a> for more info.</p></li> 1340 <li><p><strong>progress_callback</strong> – An optional function or method with the signature <em>progress_callback(request_receipt)</em> to be called when progress is made receiving the response. Progress can be accessed as a float between 0.0 and 1.0 by the <em>request_receipt.progress</em> property.</p></li> 1341 <li><p><strong>timeout</strong> – An optional timeout in seconds for the request. If <em>None</em> is supplied it will be calculated based on link RTT.</p></li> 1342 </ul> 1343 </dd> 1344 <dt class="field-even">Returns<span class="colon">:</span></dt> 1345 <dd class="field-even"><p>A <a class="reference internal" href="#api-requestreceipt"><span class="std std-ref">RNS.RequestReceipt</span></a> instance if the request was sent, or <em>False</em> if it was not.</p> 1346 </dd> 1347 </dl> 1348 </dd></dl> 1349 1350 <dl class="py method"> 1351 <dt class="sig sig-object py" id="RNS.Link.track_phy_stats"> 1352 <span class="sig-name descname"><span class="pre">track_phy_stats</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">track</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.track_phy_stats" title="Link to this definition">¶</a></dt> 1353 <dd><p>You can enable physical layer statistics on a per-link basis. If this is enabled, 1354 and the link is running over an interface that supports reporting physical layer 1355 statistics, you will be able to retrieve stats such as <em>RSSI</em>, <em>SNR</em> and physical 1356 <em>Link Quality</em> for the link.</p> 1357 <dl class="field-list simple"> 1358 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1359 <dd class="field-odd"><p><strong>track</strong> – Whether or not to keep track of physical layer statistics. Value must be <code class="docutils literal notranslate"><span class="pre">True</span></code> or <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p> 1360 </dd> 1361 </dl> 1362 </dd></dl> 1363 1364 <dl class="py method"> 1365 <dt class="sig sig-object py" id="RNS.Link.get_rssi"> 1366 <span class="sig-name descname"><span class="pre">get_rssi</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.get_rssi" title="Link to this definition">¶</a></dt> 1367 <dd><dl class="field-list simple"> 1368 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1369 <dd class="field-odd"><p>The physical layer <em>Received Signal Strength Indication</em> if available, otherwise <code class="docutils literal notranslate"><span class="pre">None</span></code>. Physical layer statistics must be enabled on the link for this method to return a value.</p> 1370 </dd> 1371 </dl> 1372 </dd></dl> 1373 1374 <dl class="py method"> 1375 <dt class="sig sig-object py" id="RNS.Link.get_snr"> 1376 <span class="sig-name descname"><span class="pre">get_snr</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.get_snr" title="Link to this definition">¶</a></dt> 1377 <dd><dl class="field-list simple"> 1378 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1379 <dd class="field-odd"><p>The physical layer <em>Signal-to-Noise Ratio</em> if available, otherwise <code class="docutils literal notranslate"><span class="pre">None</span></code>. Physical layer statistics must be enabled on the link for this method to return a value.</p> 1380 </dd> 1381 </dl> 1382 </dd></dl> 1383 1384 <dl class="py method"> 1385 <dt class="sig sig-object py" id="RNS.Link.get_q"> 1386 <span class="sig-name descname"><span class="pre">get_q</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.get_q" title="Link to this definition">¶</a></dt> 1387 <dd><dl class="field-list simple"> 1388 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1389 <dd class="field-odd"><p>The physical layer <em>Link Quality</em> if available, otherwise <code class="docutils literal notranslate"><span class="pre">None</span></code>. Physical layer statistics must be enabled on the link for this method to return a value.</p> 1390 </dd> 1391 </dl> 1392 </dd></dl> 1393 1394 <dl class="py method"> 1395 <dt class="sig sig-object py" id="RNS.Link.get_establishment_rate"> 1396 <span class="sig-name descname"><span class="pre">get_establishment_rate</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.get_establishment_rate" title="Link to this definition">¶</a></dt> 1397 <dd><dl class="field-list simple"> 1398 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1399 <dd class="field-odd"><p>The data transfer rate at which the link establishment procedure ocurred, in bits per second.</p> 1400 </dd> 1401 </dl> 1402 </dd></dl> 1403 1404 <dl class="py method"> 1405 <dt class="sig sig-object py" id="RNS.Link.get_mtu"> 1406 <span class="sig-name descname"><span class="pre">get_mtu</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.get_mtu" title="Link to this definition">¶</a></dt> 1407 <dd><dl class="field-list simple"> 1408 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1409 <dd class="field-odd"><p>The MTU of an established link.</p> 1410 </dd> 1411 </dl> 1412 </dd></dl> 1413 1414 <dl class="py method"> 1415 <dt class="sig sig-object py" id="RNS.Link.get_mdu"> 1416 <span class="sig-name descname"><span class="pre">get_mdu</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.get_mdu" title="Link to this definition">¶</a></dt> 1417 <dd><dl class="field-list simple"> 1418 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1419 <dd class="field-odd"><p>The packet MDU of an established link.</p> 1420 </dd> 1421 </dl> 1422 </dd></dl> 1423 1424 <dl class="py method"> 1425 <dt class="sig sig-object py" id="RNS.Link.get_expected_rate"> 1426 <span class="sig-name descname"><span class="pre">get_expected_rate</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.get_expected_rate" title="Link to this definition">¶</a></dt> 1427 <dd><dl class="field-list simple"> 1428 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1429 <dd class="field-odd"><p>The packet expected in-flight data rate of an established link.</p> 1430 </dd> 1431 </dl> 1432 </dd></dl> 1433 1434 <dl class="py method"> 1435 <dt class="sig sig-object py" id="RNS.Link.get_mode"> 1436 <span class="sig-name descname"><span class="pre">get_mode</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.get_mode" title="Link to this definition">¶</a></dt> 1437 <dd><dl class="field-list simple"> 1438 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1439 <dd class="field-odd"><p>The mode of an established link.</p> 1440 </dd> 1441 </dl> 1442 </dd></dl> 1443 1444 <dl class="py method"> 1445 <dt class="sig sig-object py" id="RNS.Link.get_age"> 1446 <span class="sig-name descname"><span class="pre">get_age</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.get_age" title="Link to this definition">¶</a></dt> 1447 <dd><dl class="field-list simple"> 1448 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1449 <dd class="field-odd"><p>The time in seconds since this link was established.</p> 1450 </dd> 1451 </dl> 1452 </dd></dl> 1453 1454 <dl class="py method"> 1455 <dt class="sig sig-object py" id="RNS.Link.no_inbound_for"> 1456 <span class="sig-name descname"><span class="pre">no_inbound_for</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.no_inbound_for" title="Link to this definition">¶</a></dt> 1457 <dd><dl class="field-list simple"> 1458 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1459 <dd class="field-odd"><p>The time in seconds since last inbound packet on the link. This includes keepalive packets.</p> 1460 </dd> 1461 </dl> 1462 </dd></dl> 1463 1464 <dl class="py method"> 1465 <dt class="sig sig-object py" id="RNS.Link.no_outbound_for"> 1466 <span class="sig-name descname"><span class="pre">no_outbound_for</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.no_outbound_for" title="Link to this definition">¶</a></dt> 1467 <dd><dl class="field-list simple"> 1468 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1469 <dd class="field-odd"><p>The time in seconds since last outbound packet on the link. This includes keepalive packets.</p> 1470 </dd> 1471 </dl> 1472 </dd></dl> 1473 1474 <dl class="py method"> 1475 <dt class="sig sig-object py" id="RNS.Link.no_data_for"> 1476 <span class="sig-name descname"><span class="pre">no_data_for</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.no_data_for" title="Link to this definition">¶</a></dt> 1477 <dd><dl class="field-list simple"> 1478 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1479 <dd class="field-odd"><p>The time in seconds since payload data traversed the link. This excludes keepalive packets.</p> 1480 </dd> 1481 </dl> 1482 </dd></dl> 1483 1484 <dl class="py method"> 1485 <dt class="sig sig-object py" id="RNS.Link.inactive_for"> 1486 <span class="sig-name descname"><span class="pre">inactive_for</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.inactive_for" title="Link to this definition">¶</a></dt> 1487 <dd><dl class="field-list simple"> 1488 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1489 <dd class="field-odd"><p>The time in seconds since activity on the link. This includes keepalive packets.</p> 1490 </dd> 1491 </dl> 1492 </dd></dl> 1493 1494 <dl class="py method"> 1495 <dt class="sig sig-object py" id="RNS.Link.get_remote_identity"> 1496 <span class="sig-name descname"><span class="pre">get_remote_identity</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.get_remote_identity" title="Link to this definition">¶</a></dt> 1497 <dd><dl class="field-list simple"> 1498 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1499 <dd class="field-odd"><p>The identity of the remote peer, if it is known. Calling this method will not query the remote initiator to reveal its identity. Returns <code class="docutils literal notranslate"><span class="pre">None</span></code> if the link initiator has not already independently called the <code class="docutils literal notranslate"><span class="pre">identify(identity)</span></code> method.</p> 1500 </dd> 1501 </dl> 1502 </dd></dl> 1503 1504 <dl class="py method"> 1505 <dt class="sig sig-object py" id="RNS.Link.teardown"> 1506 <span class="sig-name descname"><span class="pre">teardown</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.teardown" title="Link to this definition">¶</a></dt> 1507 <dd><p>Closes the link and purges encryption keys. New keys will 1508 be used if a new link to the same destination is established.</p> 1509 </dd></dl> 1510 1511 <dl class="py method"> 1512 <dt class="sig sig-object py" id="RNS.Link.get_channel"> 1513 <span class="sig-name descname"><span class="pre">get_channel</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.get_channel" title="Link to this definition">¶</a></dt> 1514 <dd><p>Get the <code class="docutils literal notranslate"><span class="pre">Channel</span></code> for this link.</p> 1515 <dl class="field-list simple"> 1516 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1517 <dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">Channel</span></code> object</p> 1518 </dd> 1519 </dl> 1520 </dd></dl> 1521 1522 <dl class="py method"> 1523 <dt class="sig sig-object py" id="RNS.Link.set_link_closed_callback"> 1524 <span class="sig-name descname"><span class="pre">set_link_closed_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.set_link_closed_callback" title="Link to this definition">¶</a></dt> 1525 <dd><p>Registers a function to be called when a link has been 1526 torn down.</p> 1527 <dl class="field-list simple"> 1528 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1529 <dd class="field-odd"><p><strong>callback</strong> – A function or method with the signature <em>callback(link)</em> to be called.</p> 1530 </dd> 1531 </dl> 1532 </dd></dl> 1533 1534 <dl class="py method"> 1535 <dt class="sig sig-object py" id="RNS.Link.set_packet_callback"> 1536 <span class="sig-name descname"><span class="pre">set_packet_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.set_packet_callback" title="Link to this definition">¶</a></dt> 1537 <dd><p>Registers a function to be called when a packet has been 1538 received over this link.</p> 1539 <dl class="field-list simple"> 1540 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1541 <dd class="field-odd"><p><strong>callback</strong> – A function or method with the signature <em>callback(message, packet)</em> to be called.</p> 1542 </dd> 1543 </dl> 1544 </dd></dl> 1545 1546 <dl class="py method"> 1547 <dt class="sig sig-object py" id="RNS.Link.set_resource_callback"> 1548 <span class="sig-name descname"><span class="pre">set_resource_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.set_resource_callback" title="Link to this definition">¶</a></dt> 1549 <dd><p>Registers a function to be called when a resource has been 1550 advertised over this link. If the function returns <em>True</em> 1551 the resource will be accepted. If it returns <em>False</em> it will 1552 be ignored.</p> 1553 <dl class="field-list simple"> 1554 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1555 <dd class="field-odd"><p><strong>callback</strong> – A function or method with the signature <em>callback(resource)</em> to be called. Please note that only the basic information of the resource is available at this time, such as <em>get_transfer_size()</em>, <em>get_data_size()</em>, <em>get_parts()</em> and <em>is_compressed()</em>.</p> 1556 </dd> 1557 </dl> 1558 </dd></dl> 1559 1560 <dl class="py method"> 1561 <dt class="sig sig-object py" id="RNS.Link.set_resource_started_callback"> 1562 <span class="sig-name descname"><span class="pre">set_resource_started_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.set_resource_started_callback" title="Link to this definition">¶</a></dt> 1563 <dd><p>Registers a function to be called when a resource has begun 1564 transferring over this link.</p> 1565 <dl class="field-list simple"> 1566 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1567 <dd class="field-odd"><p><strong>callback</strong> – A function or method with the signature <em>callback(resource)</em> to be called.</p> 1568 </dd> 1569 </dl> 1570 </dd></dl> 1571 1572 <dl class="py method"> 1573 <dt class="sig sig-object py" id="RNS.Link.set_resource_concluded_callback"> 1574 <span class="sig-name descname"><span class="pre">set_resource_concluded_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.set_resource_concluded_callback" title="Link to this definition">¶</a></dt> 1575 <dd><p>Registers a function to be called when a resource has concluded 1576 transferring over this link.</p> 1577 <dl class="field-list simple"> 1578 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1579 <dd class="field-odd"><p><strong>callback</strong> – A function or method with the signature <em>callback(resource)</em> to be called.</p> 1580 </dd> 1581 </dl> 1582 </dd></dl> 1583 1584 <dl class="py method"> 1585 <dt class="sig sig-object py" id="RNS.Link.set_remote_identified_callback"> 1586 <span class="sig-name descname"><span class="pre">set_remote_identified_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.set_remote_identified_callback" title="Link to this definition">¶</a></dt> 1587 <dd><p>Registers a function to be called when an initiating peer has 1588 identified over this link.</p> 1589 <dl class="field-list simple"> 1590 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1591 <dd class="field-odd"><p><strong>callback</strong> – A function or method with the signature <em>callback(link, identity)</em> to be called.</p> 1592 </dd> 1593 </dl> 1594 </dd></dl> 1595 1596 <dl class="py method"> 1597 <dt class="sig sig-object py" id="RNS.Link.set_resource_strategy"> 1598 <span class="sig-name descname"><span class="pre">set_resource_strategy</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">resource_strategy</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.set_resource_strategy" title="Link to this definition">¶</a></dt> 1599 <dd><p>Sets the resource strategy for the link.</p> 1600 <dl class="field-list simple"> 1601 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1602 <dd class="field-odd"><p><strong>resource_strategy</strong> – One of <code class="docutils literal notranslate"><span class="pre">RNS.Link.ACCEPT_NONE</span></code>, <code class="docutils literal notranslate"><span class="pre">RNS.Link.ACCEPT_ALL</span></code> or <code class="docutils literal notranslate"><span class="pre">RNS.Link.ACCEPT_APP</span></code>. If <code class="docutils literal notranslate"><span class="pre">RNS.Link.ACCEPT_APP</span></code> is set, the <cite>resource_callback</cite> will be called to determine whether the resource should be accepted or not.</p> 1603 </dd> 1604 <dt class="field-even">Raises<span class="colon">:</span></dt> 1605 <dd class="field-even"><p><em>TypeError</em> if the resource strategy is unsupported.</p> 1606 </dd> 1607 </dl> 1608 </dd></dl> 1609 1610 </dd></dl> 1611 1612 <p id="api-requestreceipt"><h3> Request Receipt </h3></p> 1613 <dl class="py class"> 1614 <dt class="sig sig-object py" id="RNS.RequestReceipt"> 1615 <em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">RequestReceipt</span></span><a class="headerlink" href="#RNS.RequestReceipt" title="Link to this definition">¶</a></dt> 1616 <dd><p>An instance of this class is returned by the <code class="docutils literal notranslate"><span class="pre">request</span></code> method of <code class="docutils literal notranslate"><span class="pre">RNS.Link</span></code> 1617 instances. It should never be instantiated manually. It provides methods to 1618 check status, response time and response data when the request concludes.</p> 1619 <dl class="py method"> 1620 <dt class="sig sig-object py" id="RNS.RequestReceipt.get_request_id"> 1621 <span class="sig-name descname"><span class="pre">get_request_id</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RequestReceipt.get_request_id" title="Link to this definition">¶</a></dt> 1622 <dd><dl class="field-list simple"> 1623 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1624 <dd class="field-odd"><p>The request ID as <em>bytes</em>.</p> 1625 </dd> 1626 </dl> 1627 </dd></dl> 1628 1629 <dl class="py method"> 1630 <dt class="sig sig-object py" id="RNS.RequestReceipt.get_status"> 1631 <span class="sig-name descname"><span class="pre">get_status</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RequestReceipt.get_status" title="Link to this definition">¶</a></dt> 1632 <dd><dl class="field-list simple"> 1633 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1634 <dd class="field-odd"><p>The current status of the request, one of <code class="docutils literal notranslate"><span class="pre">RNS.RequestReceipt.FAILED</span></code>, <code class="docutils literal notranslate"><span class="pre">RNS.RequestReceipt.SENT</span></code>, <code class="docutils literal notranslate"><span class="pre">RNS.RequestReceipt.DELIVERED</span></code>, <code class="docutils literal notranslate"><span class="pre">RNS.RequestReceipt.READY</span></code>.</p> 1635 </dd> 1636 </dl> 1637 </dd></dl> 1638 1639 <dl class="py method"> 1640 <dt class="sig sig-object py" id="RNS.RequestReceipt.get_progress"> 1641 <span class="sig-name descname"><span class="pre">get_progress</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RequestReceipt.get_progress" title="Link to this definition">¶</a></dt> 1642 <dd><dl class="field-list simple"> 1643 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1644 <dd class="field-odd"><p>The progress of a response being received as a <em>float</em> between 0.0 and 1.0.</p> 1645 </dd> 1646 </dl> 1647 </dd></dl> 1648 1649 <dl class="py method"> 1650 <dt class="sig sig-object py" id="RNS.RequestReceipt.get_response"> 1651 <span class="sig-name descname"><span class="pre">get_response</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RequestReceipt.get_response" title="Link to this definition">¶</a></dt> 1652 <dd><dl class="field-list simple"> 1653 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1654 <dd class="field-odd"><p>The response as <em>bytes</em> if it is ready, otherwise <em>None</em>.</p> 1655 </dd> 1656 </dl> 1657 </dd></dl> 1658 1659 <dl class="py method"> 1660 <dt class="sig sig-object py" id="RNS.RequestReceipt.get_response_time"> 1661 <span class="sig-name descname"><span class="pre">get_response_time</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RequestReceipt.get_response_time" title="Link to this definition">¶</a></dt> 1662 <dd><dl class="field-list simple"> 1663 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1664 <dd class="field-odd"><p>The response time of the request in seconds.</p> 1665 </dd> 1666 </dl> 1667 </dd></dl> 1668 1669 <dl class="py method"> 1670 <dt class="sig sig-object py" id="RNS.RequestReceipt.concluded"> 1671 <span class="sig-name descname"><span class="pre">concluded</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RequestReceipt.concluded" title="Link to this definition">¶</a></dt> 1672 <dd><dl class="field-list simple"> 1673 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1674 <dd class="field-odd"><p>True if the associated request has concluded (successfully or with a failure), otherwise False.</p> 1675 </dd> 1676 </dl> 1677 </dd></dl> 1678 1679 </dd></dl> 1680 1681 <p id="api-resource"><h3> Resource </h3></p> 1682 <dl class="py class"> 1683 <dt class="sig sig-object py" id="RNS.Resource"> 1684 <em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">Resource</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">link</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">advertise</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">auto_compress</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">callback</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">progress_callback</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource" title="Link to this definition">¶</a></dt> 1685 <dd><p>The Resource class allows transferring arbitrary amounts 1686 of data over a link. It will automatically handle sequencing, 1687 compression, coordination and checksumming.</p> 1688 <dl class="field-list simple"> 1689 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1690 <dd class="field-odd"><ul class="simple"> 1691 <li><p><strong>data</strong> – The data to be transferred. Can be <em>bytes</em> or an open <em>file handle</em>. See the <a class="reference internal" href="examples.html#example-filetransfer"><span class="std std-ref">Filetransfer Example</span></a> for details.</p></li> 1692 <li><p><strong>link</strong> – The <a class="reference internal" href="#api-link"><span class="std std-ref">RNS.Link</span></a> instance on which to transfer the data.</p></li> 1693 <li><p><strong>advertise</strong> – Optional. Whether to automatically advertise the resource. Can be <em>True</em> or <em>False</em>.</p></li> 1694 <li><p><strong>auto_compress</strong> – Optional. Whether to auto-compress the resource. Can be <em>True</em> or <em>False</em>.</p></li> 1695 <li><p><strong>callback</strong> – An optional <em>callable</em> with the signature <em>callback(resource)</em>. Will be called when the resource transfer concludes.</p></li> 1696 <li><p><strong>progress_callback</strong> – An optional <em>callable</em> with the signature <em>callback(resource)</em>. Will be called whenever the resource transfer progress is updated.</p></li> 1697 </ul> 1698 </dd> 1699 </dl> 1700 <dl class="py method"> 1701 <dt class="sig sig-object py" id="RNS.Resource.advertise"> 1702 <span class="sig-name descname"><span class="pre">advertise</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource.advertise" title="Link to this definition">¶</a></dt> 1703 <dd><p>Advertise the resource. If the other end of the link accepts 1704 the resource advertisement it will begin transferring.</p> 1705 </dd></dl> 1706 1707 <dl class="py method"> 1708 <dt class="sig sig-object py" id="RNS.Resource.cancel"> 1709 <span class="sig-name descname"><span class="pre">cancel</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource.cancel" title="Link to this definition">¶</a></dt> 1710 <dd><p>Cancels transferring the resource.</p> 1711 </dd></dl> 1712 1713 <dl class="py method"> 1714 <dt class="sig sig-object py" id="RNS.Resource.get_progress"> 1715 <span class="sig-name descname"><span class="pre">get_progress</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource.get_progress" title="Link to this definition">¶</a></dt> 1716 <dd><dl class="field-list simple"> 1717 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1718 <dd class="field-odd"><p>The current progress of the resource transfer as a <em>float</em> between 0.0 and 1.0.</p> 1719 </dd> 1720 </dl> 1721 </dd></dl> 1722 1723 <dl class="py method"> 1724 <dt class="sig sig-object py" id="RNS.Resource.get_transfer_size"> 1725 <span class="sig-name descname"><span class="pre">get_transfer_size</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource.get_transfer_size" title="Link to this definition">¶</a></dt> 1726 <dd><dl class="field-list simple"> 1727 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1728 <dd class="field-odd"><p>The number of bytes needed to transfer the resource.</p> 1729 </dd> 1730 </dl> 1731 </dd></dl> 1732 1733 <dl class="py method"> 1734 <dt class="sig sig-object py" id="RNS.Resource.get_data_size"> 1735 <span class="sig-name descname"><span class="pre">get_data_size</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource.get_data_size" title="Link to this definition">¶</a></dt> 1736 <dd><dl class="field-list simple"> 1737 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1738 <dd class="field-odd"><p>The total data size of the resource.</p> 1739 </dd> 1740 </dl> 1741 </dd></dl> 1742 1743 <dl class="py method"> 1744 <dt class="sig sig-object py" id="RNS.Resource.get_parts"> 1745 <span class="sig-name descname"><span class="pre">get_parts</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource.get_parts" title="Link to this definition">¶</a></dt> 1746 <dd><dl class="field-list simple"> 1747 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1748 <dd class="field-odd"><p>The number of parts the resource will be transferred in.</p> 1749 </dd> 1750 </dl> 1751 </dd></dl> 1752 1753 <dl class="py method"> 1754 <dt class="sig sig-object py" id="RNS.Resource.get_segments"> 1755 <span class="sig-name descname"><span class="pre">get_segments</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource.get_segments" title="Link to this definition">¶</a></dt> 1756 <dd><dl class="field-list simple"> 1757 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1758 <dd class="field-odd"><p>The number of segments the resource is divided into.</p> 1759 </dd> 1760 </dl> 1761 </dd></dl> 1762 1763 <dl class="py method"> 1764 <dt class="sig sig-object py" id="RNS.Resource.get_hash"> 1765 <span class="sig-name descname"><span class="pre">get_hash</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource.get_hash" title="Link to this definition">¶</a></dt> 1766 <dd><dl class="field-list simple"> 1767 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1768 <dd class="field-odd"><p>The hash of the resource.</p> 1769 </dd> 1770 </dl> 1771 </dd></dl> 1772 1773 <dl class="py method"> 1774 <dt class="sig sig-object py" id="RNS.Resource.is_compressed"> 1775 <span class="sig-name descname"><span class="pre">is_compressed</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource.is_compressed" title="Link to this definition">¶</a></dt> 1776 <dd><dl class="field-list simple"> 1777 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1778 <dd class="field-odd"><p>Whether the resource is compressed.</p> 1779 </dd> 1780 </dl> 1781 </dd></dl> 1782 1783 </dd></dl> 1784 1785 <p id="api-channel"><h3> Channel </h3></p> 1786 <dl class="py class"> 1787 <dt class="sig sig-object py" id="RNS.Channel.Channel"> 1788 <em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.Channel.</span></span><span class="sig-name descname"><span class="pre">Channel</span></span><a class="headerlink" href="#RNS.Channel.Channel" title="Link to this definition">¶</a></dt> 1789 <dd><p>Provides reliable delivery of messages over 1790 a link.</p> 1791 <p><code class="docutils literal notranslate"><span class="pre">Channel</span></code> differs from <code class="docutils literal notranslate"><span class="pre">Request</span></code> and 1792 <code class="docutils literal notranslate"><span class="pre">Resource</span></code> in some important ways:</p> 1793 <blockquote> 1794 <div><dl class="simple"> 1795 <dt><strong>Continuous</strong></dt><dd><p>Messages can be sent or received as long as 1796 the <code class="docutils literal notranslate"><span class="pre">Link</span></code> is open.</p> 1797 </dd> 1798 <dt><strong>Bi-directional</strong></dt><dd><p>Messages can be sent in either direction on 1799 the <code class="docutils literal notranslate"><span class="pre">Link</span></code>; neither end is the client or 1800 server.</p> 1801 </dd> 1802 <dt><strong>Size-constrained</strong></dt><dd><p>Messages must be encoded into a single packet.</p> 1803 </dd> 1804 </dl> 1805 </div></blockquote> 1806 <p><code class="docutils literal notranslate"><span class="pre">Channel</span></code> is similar to <code class="docutils literal notranslate"><span class="pre">Packet</span></code>, except that it 1807 provides reliable delivery (automatic retries) as well 1808 as a structure for exchanging several types of 1809 messages over the <code class="docutils literal notranslate"><span class="pre">Link</span></code>.</p> 1810 <p><code class="docutils literal notranslate"><span class="pre">Channel</span></code> is not instantiated directly, but rather 1811 obtained from a <code class="docutils literal notranslate"><span class="pre">Link</span></code> with <code class="docutils literal notranslate"><span class="pre">get_channel()</span></code>.</p> 1812 <dl class="py method"> 1813 <dt class="sig sig-object py" id="RNS.Channel.Channel.register_message_type"> 1814 <span class="sig-name descname"><span class="pre">register_message_type</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">message_class</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Type</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#RNS.MessageBase" title="RNS.Channel.MessageBase"><span class="pre">MessageBase</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Channel.Channel.register_message_type" title="Link to this definition">¶</a></dt> 1815 <dd><p>Register a message class for reception over a <code class="docutils literal notranslate"><span class="pre">Channel</span></code>.</p> 1816 <p>Message classes must extend <code class="docutils literal notranslate"><span class="pre">MessageBase</span></code>.</p> 1817 <dl class="field-list simple"> 1818 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1819 <dd class="field-odd"><p><strong>message_class</strong> – Class to register</p> 1820 </dd> 1821 </dl> 1822 </dd></dl> 1823 1824 <dl class="py method"> 1825 <dt class="sig sig-object py" id="RNS.Channel.Channel.add_message_handler"> 1826 <span class="sig-name descname"><span class="pre">add_message_handler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">MessageCallbackType</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Channel.Channel.add_message_handler" title="Link to this definition">¶</a></dt> 1827 <dd><p>Add a handler for incoming messages. A handler 1828 has the following signature:</p> 1829 <p><code class="docutils literal notranslate"><span class="pre">(message:</span> <span class="pre">MessageBase)</span> <span class="pre">-></span> <span class="pre">bool</span></code></p> 1830 <p>Handlers are processed in the order they are 1831 added. If any handler returns True, processing 1832 of the message stops; handlers after the 1833 returning handler will not be called.</p> 1834 <dl class="field-list simple"> 1835 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1836 <dd class="field-odd"><p><strong>callback</strong> – Function to call</p> 1837 </dd> 1838 </dl> 1839 </dd></dl> 1840 1841 <dl class="py method"> 1842 <dt class="sig sig-object py" id="RNS.Channel.Channel.remove_message_handler"> 1843 <span class="sig-name descname"><span class="pre">remove_message_handler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">MessageCallbackType</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Channel.Channel.remove_message_handler" title="Link to this definition">¶</a></dt> 1844 <dd><p>Remove a handler added with <code class="docutils literal notranslate"><span class="pre">add_message_handler</span></code>.</p> 1845 <dl class="field-list simple"> 1846 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1847 <dd class="field-odd"><p><strong>callback</strong> – handler to remove</p> 1848 </dd> 1849 </dl> 1850 </dd></dl> 1851 1852 <dl class="py method"> 1853 <dt class="sig sig-object py" id="RNS.Channel.Channel.is_ready_to_send"> 1854 <span class="sig-name descname"><span class="pre">is_ready_to_send</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="headerlink" href="#RNS.Channel.Channel.is_ready_to_send" title="Link to this definition">¶</a></dt> 1855 <dd><p>Check if <code class="docutils literal notranslate"><span class="pre">Channel</span></code> is ready to send.</p> 1856 <dl class="field-list simple"> 1857 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1858 <dd class="field-odd"><p>True if ready</p> 1859 </dd> 1860 </dl> 1861 </dd></dl> 1862 1863 <dl class="py method"> 1864 <dt class="sig sig-object py" id="RNS.Channel.Channel.send"> 1865 <span class="sig-name descname"><span class="pre">send</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">message</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#RNS.MessageBase" title="RNS.Channel.MessageBase"><span class="pre">MessageBase</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">Envelope</span></span></span><a class="headerlink" href="#RNS.Channel.Channel.send" title="Link to this definition">¶</a></dt> 1866 <dd><p>Send a message. If a message send is attempted and 1867 <code class="docutils literal notranslate"><span class="pre">Channel</span></code> is not ready, an exception is thrown.</p> 1868 <dl class="field-list simple"> 1869 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1870 <dd class="field-odd"><p><strong>message</strong> – an instance of a <code class="docutils literal notranslate"><span class="pre">MessageBase</span></code> subclass</p> 1871 </dd> 1872 </dl> 1873 </dd></dl> 1874 1875 <dl class="py property"> 1876 <dt class="sig sig-object py" id="RNS.Channel.Channel.mdu"> 1877 <em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">mdu</span></span><a class="headerlink" href="#RNS.Channel.Channel.mdu" title="Link to this definition">¶</a></dt> 1878 <dd><p>Maximum Data Unit: the number of bytes available 1879 for a message to consume in a single send. This 1880 value is adjusted from the <code class="docutils literal notranslate"><span class="pre">Link</span></code> MDU to accommodate 1881 message header information.</p> 1882 <dl class="field-list simple"> 1883 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1884 <dd class="field-odd"><p>number of bytes available</p> 1885 </dd> 1886 </dl> 1887 </dd></dl> 1888 1889 </dd></dl> 1890 1891 <p id="api-messsagebase"><h3> MessageBase </h3></p> 1892 <dl class="py class"> 1893 <dt class="sig sig-object py" id="RNS.MessageBase"> 1894 <em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">MessageBase</span></span><a class="headerlink" href="#RNS.MessageBase" title="Link to this definition">¶</a></dt> 1895 <dd><p>Base type for any messages sent or received on a Channel. 1896 Subclasses must define the two abstract methods as well as 1897 the <code class="docutils literal notranslate"><span class="pre">MSGTYPE</span></code> class variable.</p> 1898 <dl class="py attribute"> 1899 <dt class="sig sig-object py" id="RNS.MessageBase.MSGTYPE"> 1900 <span class="sig-name descname"><span class="pre">MSGTYPE</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">None</span></em><a class="headerlink" href="#RNS.MessageBase.MSGTYPE" title="Link to this definition">¶</a></dt> 1901 <dd><p>Defines a unique identifier for a message class.</p> 1902 <ul class="simple"> 1903 <li><p>Must be unique within all classes registered with a <code class="docutils literal notranslate"><span class="pre">Channel</span></code></p></li> 1904 <li><p>Must be less than <code class="docutils literal notranslate"><span class="pre">0xf000</span></code>. Values greater than or equal to <code class="docutils literal notranslate"><span class="pre">0xf000</span></code> are reserved.</p></li> 1905 </ul> 1906 </dd></dl> 1907 1908 <dl class="py method"> 1909 <dt class="sig sig-object py" id="RNS.MessageBase.pack"> 1910 <em class="property"><span class="k"><span class="pre">abstractmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">pack</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">bytes</span></span></span><a class="headerlink" href="#RNS.MessageBase.pack" title="Link to this definition">¶</a></dt> 1911 <dd><p>Create and return the binary representation of the message</p> 1912 <dl class="field-list simple"> 1913 <dt class="field-odd">Returns<span class="colon">:</span></dt> 1914 <dd class="field-odd"><p>binary representation of message</p> 1915 </dd> 1916 </dl> 1917 </dd></dl> 1918 1919 <dl class="py method"> 1920 <dt class="sig sig-object py" id="RNS.MessageBase.unpack"> 1921 <em class="property"><span class="k"><span class="pre">abstractmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">unpack</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">raw</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bytes</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.MessageBase.unpack" title="Link to this definition">¶</a></dt> 1922 <dd><p>Populate message from binary representation</p> 1923 <dl class="field-list simple"> 1924 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1925 <dd class="field-odd"><p><strong>raw</strong> – binary representation</p> 1926 </dd> 1927 </dl> 1928 </dd></dl> 1929 1930 </dd></dl> 1931 1932 <p id="api-buffer"><h3> Buffer </h3></p> 1933 <dl class="py class"> 1934 <dt class="sig sig-object py" id="RNS.Buffer"> 1935 <em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">Buffer</span></span><a class="headerlink" href="#RNS.Buffer" title="Link to this definition">¶</a></dt> 1936 <dd><p>Static functions for creating buffered streams that send 1937 and receive over a <code class="docutils literal notranslate"><span class="pre">Channel</span></code>.</p> 1938 <p>These functions use <code class="docutils literal notranslate"><span class="pre">BufferedReader</span></code>, <code class="docutils literal notranslate"><span class="pre">BufferedWriter</span></code>, 1939 and <code class="docutils literal notranslate"><span class="pre">BufferedRWPair</span></code> to add buffering to 1940 <code class="docutils literal notranslate"><span class="pre">RawChannelReader</span></code> and <code class="docutils literal notranslate"><span class="pre">RawChannelWriter</span></code>.</p> 1941 <dl class="py method"> 1942 <dt class="sig sig-object py" id="RNS.Buffer.create_reader"> 1943 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">create_reader</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stream_id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#RNS.Channel.Channel" title="RNS.Channel.Channel"><span class="pre">Channel</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">ready_callback</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Callable</span><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">None</span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">BufferedReader</span></span></span><a class="headerlink" href="#RNS.Buffer.create_reader" title="Link to this definition">¶</a></dt> 1944 <dd><p>Create a buffered reader that reads binary data sent 1945 over a <code class="docutils literal notranslate"><span class="pre">Channel</span></code>, with an optional callback when 1946 new data is available.</p> 1947 <p>Callback signature: <code class="docutils literal notranslate"><span class="pre">(ready_bytes:</span> <span class="pre">int)</span> <span class="pre">-></span> <span class="pre">None</span></code></p> 1948 <p>For more information on the reader-specific functions 1949 of this object, see the Python documentation for 1950 <code class="docutils literal notranslate"><span class="pre">BufferedReader</span></code></p> 1951 <dl class="field-list simple"> 1952 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1953 <dd class="field-odd"><ul class="simple"> 1954 <li><p><strong>stream_id</strong> – the local stream id to receive from</p></li> 1955 <li><p><strong>channel</strong> – the channel to receive on</p></li> 1956 <li><p><strong>ready_callback</strong> – function to call when new data is available</p></li> 1957 </ul> 1958 </dd> 1959 <dt class="field-even">Returns<span class="colon">:</span></dt> 1960 <dd class="field-even"><p>a BufferedReader object</p> 1961 </dd> 1962 </dl> 1963 </dd></dl> 1964 1965 <dl class="py method"> 1966 <dt class="sig sig-object py" id="RNS.Buffer.create_writer"> 1967 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">create_writer</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stream_id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#RNS.Channel.Channel" title="RNS.Channel.Channel"><span class="pre">Channel</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">BufferedWriter</span></span></span><a class="headerlink" href="#RNS.Buffer.create_writer" title="Link to this definition">¶</a></dt> 1968 <dd><p>Create a buffered writer that writes binary data over 1969 a <code class="docutils literal notranslate"><span class="pre">Channel</span></code>.</p> 1970 <p>For more information on the writer-specific functions 1971 of this object, see the Python documentation for 1972 <code class="docutils literal notranslate"><span class="pre">BufferedWriter</span></code></p> 1973 <dl class="field-list simple"> 1974 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1975 <dd class="field-odd"><ul class="simple"> 1976 <li><p><strong>stream_id</strong> – the remote stream id to send to</p></li> 1977 <li><p><strong>channel</strong> – the channel to send on</p></li> 1978 </ul> 1979 </dd> 1980 <dt class="field-even">Returns<span class="colon">:</span></dt> 1981 <dd class="field-even"><p>a BufferedWriter object</p> 1982 </dd> 1983 </dl> 1984 </dd></dl> 1985 1986 <dl class="py method"> 1987 <dt class="sig sig-object py" id="RNS.Buffer.create_bidirectional_buffer"> 1988 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">create_bidirectional_buffer</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">receive_stream_id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">send_stream_id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#RNS.Channel.Channel" title="RNS.Channel.Channel"><span class="pre">Channel</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">ready_callback</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Callable</span><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">None</span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">BufferedRWPair</span></span></span><a class="headerlink" href="#RNS.Buffer.create_bidirectional_buffer" title="Link to this definition">¶</a></dt> 1989 <dd><p>Create a buffered reader/writer pair that reads and 1990 writes binary data over a <code class="docutils literal notranslate"><span class="pre">Channel</span></code>, with an 1991 optional callback when new data is available.</p> 1992 <p>Callback signature: <code class="docutils literal notranslate"><span class="pre">(ready_bytes:</span> <span class="pre">int)</span> <span class="pre">-></span> <span class="pre">None</span></code></p> 1993 <p>For more information on the reader-specific functions 1994 of this object, see the Python documentation for 1995 <code class="docutils literal notranslate"><span class="pre">BufferedRWPair</span></code></p> 1996 <dl class="field-list simple"> 1997 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 1998 <dd class="field-odd"><ul class="simple"> 1999 <li><p><strong>receive_stream_id</strong> – the local stream id to receive at</p></li> 2000 <li><p><strong>send_stream_id</strong> – the remote stream id to send to</p></li> 2001 <li><p><strong>channel</strong> – the channel to send and receive on</p></li> 2002 <li><p><strong>ready_callback</strong> – function to call when new data is available</p></li> 2003 </ul> 2004 </dd> 2005 <dt class="field-even">Returns<span class="colon">:</span></dt> 2006 <dd class="field-even"><p>a BufferedRWPair object</p> 2007 </dd> 2008 </dl> 2009 </dd></dl> 2010 2011 </dd></dl> 2012 2013 <p id="api-rawchannelreader"><h3> RawChannelReader </h3></p> 2014 <dl class="py class"> 2015 <dt class="sig sig-object py" id="RNS.RawChannelReader"> 2016 <em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">RawChannelReader</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stream_id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#RNS.Channel.Channel" title="RNS.Channel.Channel"><span class="pre">Channel</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RawChannelReader" title="Link to this definition">¶</a></dt> 2017 <dd><p>An implementation of RawIOBase that receives 2018 binary stream data sent over a <code class="docutils literal notranslate"><span class="pre">Channel</span></code>.</p> 2019 <blockquote> 2020 <div><p>This class generally need not be instantiated directly. 2021 Use <a class="reference internal" href="#RNS.Buffer.create_reader" title="RNS.Buffer.create_reader"><code class="xref py py-func docutils literal notranslate"><span class="pre">RNS.Buffer.create_reader()</span></code></a>, 2022 <a class="reference internal" href="#RNS.Buffer.create_writer" title="RNS.Buffer.create_writer"><code class="xref py py-func docutils literal notranslate"><span class="pre">RNS.Buffer.create_writer()</span></code></a>, and 2023 <a class="reference internal" href="#RNS.Buffer.create_bidirectional_buffer" title="RNS.Buffer.create_bidirectional_buffer"><code class="xref py py-func docutils literal notranslate"><span class="pre">RNS.Buffer.create_bidirectional_buffer()</span></code></a> functions 2024 to create buffered streams with optional callbacks.</p> 2025 <p>For additional information on the API of this 2026 object, see the Python documentation for 2027 <code class="docutils literal notranslate"><span class="pre">RawIOBase</span></code>.</p> 2028 </div></blockquote> 2029 <dl class="py method"> 2030 <dt class="sig sig-object py" id="RNS.RawChannelReader.__init__"> 2031 <span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stream_id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#RNS.Channel.Channel" title="RNS.Channel.Channel"><span class="pre">Channel</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RawChannelReader.__init__" title="Link to this definition">¶</a></dt> 2032 <dd><p>Create a raw channel reader.</p> 2033 <dl class="field-list simple"> 2034 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 2035 <dd class="field-odd"><ul class="simple"> 2036 <li><p><strong>stream_id</strong> – local stream id to receive at</p></li> 2037 <li><p><strong>channel</strong> – <code class="docutils literal notranslate"><span class="pre">Channel</span></code> object to receive from</p></li> 2038 </ul> 2039 </dd> 2040 </dl> 2041 </dd></dl> 2042 2043 <dl class="py method"> 2044 <dt class="sig sig-object py" id="RNS.RawChannelReader.add_ready_callback"> 2045 <span class="sig-name descname"><span class="pre">add_ready_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cb</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Callable</span><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">None</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RawChannelReader.add_ready_callback" title="Link to this definition">¶</a></dt> 2046 <dd><p>Add a function to be called when new data is available. 2047 The function should have the signature <code class="docutils literal notranslate"><span class="pre">(ready_bytes:</span> <span class="pre">int)</span> <span class="pre">-></span> <span class="pre">None</span></code></p> 2048 <dl class="field-list simple"> 2049 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 2050 <dd class="field-odd"><p><strong>cb</strong> – function to call</p> 2051 </dd> 2052 </dl> 2053 </dd></dl> 2054 2055 <dl class="py method"> 2056 <dt class="sig sig-object py" id="RNS.RawChannelReader.remove_ready_callback"> 2057 <span class="sig-name descname"><span class="pre">remove_ready_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cb</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Callable</span><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">None</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RawChannelReader.remove_ready_callback" title="Link to this definition">¶</a></dt> 2058 <dd><p>Remove a function added with <a class="reference internal" href="#RNS.RawChannelReader.add_ready_callback" title="RNS.RawChannelReader.add_ready_callback"><code class="xref py py-func docutils literal notranslate"><span class="pre">RNS.RawChannelReader.add_ready_callback()</span></code></a></p> 2059 <dl class="field-list simple"> 2060 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 2061 <dd class="field-odd"><p><strong>cb</strong> – function to remove</p> 2062 </dd> 2063 </dl> 2064 </dd></dl> 2065 2066 </dd></dl> 2067 2068 <p id="api-rawchannelwriter"><h3> RawChannelWriter </h3></p> 2069 <dl class="py class"> 2070 <dt class="sig sig-object py" id="RNS.RawChannelWriter"> 2071 <em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">RawChannelWriter</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stream_id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#RNS.Channel.Channel" title="RNS.Channel.Channel"><span class="pre">Channel</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RawChannelWriter" title="Link to this definition">¶</a></dt> 2072 <dd><p>An implementation of RawIOBase that receives 2073 binary stream data sent over a channel.</p> 2074 <blockquote> 2075 <div><p>This class generally need not be instantiated directly. 2076 Use <a class="reference internal" href="#RNS.Buffer.create_reader" title="RNS.Buffer.create_reader"><code class="xref py py-func docutils literal notranslate"><span class="pre">RNS.Buffer.create_reader()</span></code></a>, 2077 <a class="reference internal" href="#RNS.Buffer.create_writer" title="RNS.Buffer.create_writer"><code class="xref py py-func docutils literal notranslate"><span class="pre">RNS.Buffer.create_writer()</span></code></a>, and 2078 <a class="reference internal" href="#RNS.Buffer.create_bidirectional_buffer" title="RNS.Buffer.create_bidirectional_buffer"><code class="xref py py-func docutils literal notranslate"><span class="pre">RNS.Buffer.create_bidirectional_buffer()</span></code></a> functions 2079 to create buffered streams with optional callbacks.</p> 2080 <p>For additional information on the API of this 2081 object, see the Python documentation for 2082 <code class="docutils literal notranslate"><span class="pre">RawIOBase</span></code>.</p> 2083 </div></blockquote> 2084 <dl class="py method"> 2085 <dt class="sig sig-object py" id="RNS.RawChannelWriter.__init__"> 2086 <span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stream_id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#RNS.Channel.Channel" title="RNS.Channel.Channel"><span class="pre">Channel</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RawChannelWriter.__init__" title="Link to this definition">¶</a></dt> 2087 <dd><p>Create a raw channel writer.</p> 2088 <dl class="field-list simple"> 2089 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 2090 <dd class="field-odd"><ul class="simple"> 2091 <li><p><strong>stream_id</strong> – remote stream id to sent do</p></li> 2092 <li><p><strong>channel</strong> – <code class="docutils literal notranslate"><span class="pre">Channel</span></code> object to send on</p></li> 2093 </ul> 2094 </dd> 2095 </dl> 2096 </dd></dl> 2097 2098 </dd></dl> 2099 2100 <p id="api-transport"><h3> Transport </h3></p> 2101 <dl class="py class"> 2102 <dt class="sig sig-object py" id="RNS.Transport"> 2103 <em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">Transport</span></span><a class="headerlink" href="#RNS.Transport" title="Link to this definition">¶</a></dt> 2104 <dd><p>Through static methods of this class you can interact with the 2105 Transport system of Reticulum.</p> 2106 <dl class="py attribute"> 2107 <dt class="sig sig-object py" id="RNS.Transport.PATHFINDER_M"> 2108 <span class="sig-name descname"><span class="pre">PATHFINDER_M</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">128</span></em><a class="headerlink" href="#RNS.Transport.PATHFINDER_M" title="Link to this definition">¶</a></dt> 2109 <dd><p>Maximum amount of hops that Reticulum will transport a packet.</p> 2110 </dd></dl> 2111 2112 <dl class="py method"> 2113 <dt class="sig sig-object py" id="RNS.Transport.register_announce_handler"> 2114 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">register_announce_handler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">handler</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Transport.register_announce_handler" title="Link to this definition">¶</a></dt> 2115 <dd><p>Registers an announce handler.</p> 2116 <dl class="field-list simple"> 2117 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 2118 <dd class="field-odd"><p><strong>handler</strong> – Must be an object with an <em>aspect_filter</em> attribute and a <em>received_announce(destination_hash, announced_identity, app_data)</em> 2119 or <em>received_announce(destination_hash, announced_identity, app_data, announce_packet_hash)</em> or 2120 <em>received_announce(destination_hash, announced_identity, app_data, announce_packet_hash, is_path_response)</em> callable. Can 2121 optionally have a <em>receive_path_responses</em> attribute set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, to also receive all path responses, in addition to live 2122 announces. See the <a class="reference internal" href="examples.html#example-announce"><span class="std std-ref">Announce Example</span></a> for more info.</p> 2123 </dd> 2124 </dl> 2125 </dd></dl> 2126 2127 <dl class="py method"> 2128 <dt class="sig sig-object py" id="RNS.Transport.deregister_announce_handler"> 2129 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">deregister_announce_handler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">handler</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Transport.deregister_announce_handler" title="Link to this definition">¶</a></dt> 2130 <dd><p>Deregisters an announce handler.</p> 2131 <dl class="field-list simple"> 2132 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 2133 <dd class="field-odd"><p><strong>handler</strong> – The announce handler to be deregistered.</p> 2134 </dd> 2135 </dl> 2136 </dd></dl> 2137 2138 <dl class="py method"> 2139 <dt class="sig sig-object py" id="RNS.Transport.has_path"> 2140 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">has_path</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">destination_hash</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Transport.has_path" title="Link to this definition">¶</a></dt> 2141 <dd><dl class="field-list simple"> 2142 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 2143 <dd class="field-odd"><p><strong>destination_hash</strong> – A destination hash as <em>bytes</em>.</p> 2144 </dd> 2145 <dt class="field-even">Returns<span class="colon">:</span></dt> 2146 <dd class="field-even"><p><em>True</em> if a path to the destination is known, otherwise <em>False</em>.</p> 2147 </dd> 2148 </dl> 2149 </dd></dl> 2150 2151 <dl class="py method"> 2152 <dt class="sig sig-object py" id="RNS.Transport.hops_to"> 2153 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">hops_to</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">destination_hash</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Transport.hops_to" title="Link to this definition">¶</a></dt> 2154 <dd><dl class="field-list simple"> 2155 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 2156 <dd class="field-odd"><p><strong>destination_hash</strong> – A destination hash as <em>bytes</em>.</p> 2157 </dd> 2158 <dt class="field-even">Returns<span class="colon">:</span></dt> 2159 <dd class="field-even"><p>The number of hops to the specified destination, or <code class="docutils literal notranslate"><span class="pre">RNS.Transport.PATHFINDER_M</span></code> if the number of hops is unknown.</p> 2160 </dd> 2161 </dl> 2162 </dd></dl> 2163 2164 <dl class="py method"> 2165 <dt class="sig sig-object py" id="RNS.Transport.next_hop"> 2166 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">next_hop</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">destination_hash</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Transport.next_hop" title="Link to this definition">¶</a></dt> 2167 <dd><dl class="field-list simple"> 2168 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 2169 <dd class="field-odd"><p><strong>destination_hash</strong> – A destination hash as <em>bytes</em>.</p> 2170 </dd> 2171 <dt class="field-even">Returns<span class="colon">:</span></dt> 2172 <dd class="field-even"><p>The destination hash as <em>bytes</em> for the next hop to the specified destination, or <em>None</em> if the next hop is unknown.</p> 2173 </dd> 2174 </dl> 2175 </dd></dl> 2176 2177 <dl class="py method"> 2178 <dt class="sig sig-object py" id="RNS.Transport.next_hop_interface"> 2179 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">next_hop_interface</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">destination_hash</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Transport.next_hop_interface" title="Link to this definition">¶</a></dt> 2180 <dd><dl class="field-list simple"> 2181 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 2182 <dd class="field-odd"><p><strong>destination_hash</strong> – A destination hash as <em>bytes</em>.</p> 2183 </dd> 2184 <dt class="field-even">Returns<span class="colon">:</span></dt> 2185 <dd class="field-even"><p>The interface for the next hop to the specified destination, or <em>None</em> if the interface is unknown.</p> 2186 </dd> 2187 </dl> 2188 </dd></dl> 2189 2190 <dl class="py method"> 2191 <dt class="sig sig-object py" id="RNS.Transport.await_path"> 2192 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">await_path</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">destination_hash</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">on_interface</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Transport.await_path" title="Link to this definition">¶</a></dt> 2193 <dd><p>Requests a path to the destination from the network and 2194 blocks until the path is available, or the timeout is reached.</p> 2195 <dl class="field-list simple"> 2196 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 2197 <dd class="field-odd"><ul class="simple"> 2198 <li><p><strong>destination_hash</strong> – A destination hash as <em>bytes</em>.</p></li> 2199 <li><p><strong>timeout</strong> – An optional timeout in seconds.</p></li> 2200 <li><p><strong>on_interface</strong> – If specified, the path request will only be sent on this interface. In normal use, Reticulum handles this automatically, and this parameter should not be used.</p></li> 2201 </ul> 2202 </dd> 2203 <dt class="field-even">Returns<span class="colon">:</span></dt> 2204 <dd class="field-even"><p><em>True</em> if a path to the destination is found, otherwise <em>False</em>.</p> 2205 </dd> 2206 </dl> 2207 </dd></dl> 2208 2209 <dl class="py method"> 2210 <dt class="sig sig-object py" id="RNS.Transport.request_path"> 2211 <em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">request_path</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">destination_hash</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">on_interface</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tag</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">recursive</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Transport.request_path" title="Link to this definition">¶</a></dt> 2212 <dd><p>Requests a path to the destination from the network. If 2213 another reachable peer on the network knows a path, it 2214 will announce it.</p> 2215 <dl class="field-list simple"> 2216 <dt class="field-odd">Parameters<span class="colon">:</span></dt> 2217 <dd class="field-odd"><ul class="simple"> 2218 <li><p><strong>destination_hash</strong> – A destination hash as <em>bytes</em>.</p></li> 2219 <li><p><strong>on_interface</strong> – If specified, the path request will only be sent on this interface. In normal use, Reticulum handles this automatically, and this parameter should not be used.</p></li> 2220 </ul> 2221 </dd> 2222 </dl> 2223 </dd></dl> 2224 2225 </dd></dl> 2226 2227 </section> 2228 2229 </article> 2230 </div> 2231 <footer> 2232 2233 <div class="related-pages"> 2234 2235 <a class="prev-page" href="license.html"> 2236 <svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg> 2237 <div class="page-info"> 2238 <div class="context"> 2239 <span>Previous</span> 2240 </div> 2241 2242 <div class="title">Reticulum License</div> 2243 2244 </div> 2245 </a> 2246 </div> 2247 <div class="bottom-of-page"> 2248 <div class="left-details"> 2249 <div class="copyright"> 2250 Copyright © 2025, Mark Qvist 2251 </div> 2252 Generated with <a href="https://www.sphinx-doc.org/">Sphinx</a> and 2253 <a href="https://github.com/pradyunsg/furo">Furo</a> 2254 2255 </div> 2256 <div class="right-details"> 2257 2258 </div> 2259 </div> 2260 2261 </footer> 2262 </div> 2263 <aside class="toc-drawer"> 2264 2265 2266 <div class="toc-sticky toc-scroll"> 2267 <div class="toc-title-container"> 2268 <span class="toc-title"> 2269 On this page 2270 </span> 2271 </div> 2272 <div class="toc-tree-container"> 2273 <div class="toc-tree"> 2274 <ul> 2275 <li><a class="reference internal" href="#">API Reference</a><ul> 2276 <li><a class="reference internal" href="#RNS.Reticulum"><code class="docutils literal notranslate"><span class="pre">Reticulum</span></code></a><ul> 2277 <li><a class="reference internal" href="#RNS.Reticulum.MTU"><code class="docutils literal notranslate"><span class="pre">MTU</span></code></a></li> 2278 <li><a class="reference internal" href="#RNS.Reticulum.LINK_MTU_DISCOVERY"><code class="docutils literal notranslate"><span class="pre">LINK_MTU_DISCOVERY</span></code></a></li> 2279 <li><a class="reference internal" href="#RNS.Reticulum.ANNOUNCE_CAP"><code class="docutils literal notranslate"><span class="pre">ANNOUNCE_CAP</span></code></a></li> 2280 <li><a class="reference internal" href="#RNS.Reticulum.MINIMUM_BITRATE"><code class="docutils literal notranslate"><span class="pre">MINIMUM_BITRATE</span></code></a></li> 2281 <li><a class="reference internal" href="#RNS.Reticulum.get_instance"><code class="docutils literal notranslate"><span class="pre">get_instance()</span></code></a></li> 2282 <li><a class="reference internal" href="#RNS.Reticulum.should_use_implicit_proof"><code class="docutils literal notranslate"><span class="pre">should_use_implicit_proof()</span></code></a></li> 2283 <li><a class="reference internal" href="#RNS.Reticulum.transport_enabled"><code class="docutils literal notranslate"><span class="pre">transport_enabled()</span></code></a></li> 2284 <li><a class="reference internal" href="#RNS.Reticulum.link_mtu_discovery"><code class="docutils literal notranslate"><span class="pre">link_mtu_discovery()</span></code></a></li> 2285 <li><a class="reference internal" href="#RNS.Reticulum.remote_management_enabled"><code class="docutils literal notranslate"><span class="pre">remote_management_enabled()</span></code></a></li> 2286 <li><a class="reference internal" href="#RNS.Reticulum.required_discovery_value"><code class="docutils literal notranslate"><span class="pre">required_discovery_value()</span></code></a></li> 2287 <li><a class="reference internal" href="#RNS.Reticulum.publish_blackhole_enabled"><code class="docutils literal notranslate"><span class="pre">publish_blackhole_enabled()</span></code></a></li> 2288 <li><a class="reference internal" href="#RNS.Reticulum.blackhole_sources"><code class="docutils literal notranslate"><span class="pre">blackhole_sources()</span></code></a></li> 2289 <li><a class="reference internal" href="#RNS.Reticulum.discovered_interfaces"><code class="docutils literal notranslate"><span class="pre">discovered_interfaces()</span></code></a></li> 2290 <li><a class="reference internal" href="#RNS.Reticulum.interface_discovery_sources"><code class="docutils literal notranslate"><span class="pre">interface_discovery_sources()</span></code></a></li> 2291 </ul> 2292 </li> 2293 <li><a class="reference internal" href="#RNS.Identity"><code class="docutils literal notranslate"><span class="pre">Identity</span></code></a><ul> 2294 <li><a class="reference internal" href="#RNS.Identity.CURVE"><code class="docutils literal notranslate"><span class="pre">CURVE</span></code></a></li> 2295 <li><a class="reference internal" href="#RNS.Identity.KEYSIZE"><code class="docutils literal notranslate"><span class="pre">KEYSIZE</span></code></a></li> 2296 <li><a class="reference internal" href="#RNS.Identity.RATCHETSIZE"><code class="docutils literal notranslate"><span class="pre">RATCHETSIZE</span></code></a></li> 2297 <li><a class="reference internal" href="#RNS.Identity.RATCHET_EXPIRY"><code class="docutils literal notranslate"><span class="pre">RATCHET_EXPIRY</span></code></a></li> 2298 <li><a class="reference internal" href="#RNS.Identity.TRUNCATED_HASHLENGTH"><code class="docutils literal notranslate"><span class="pre">TRUNCATED_HASHLENGTH</span></code></a></li> 2299 <li><a class="reference internal" href="#RNS.Identity.recall"><code class="docutils literal notranslate"><span class="pre">recall()</span></code></a></li> 2300 <li><a class="reference internal" href="#RNS.Identity.recall_app_data"><code class="docutils literal notranslate"><span class="pre">recall_app_data()</span></code></a></li> 2301 <li><a class="reference internal" href="#RNS.Identity.full_hash"><code class="docutils literal notranslate"><span class="pre">full_hash()</span></code></a></li> 2302 <li><a class="reference internal" href="#RNS.Identity.truncated_hash"><code class="docutils literal notranslate"><span class="pre">truncated_hash()</span></code></a></li> 2303 <li><a class="reference internal" href="#RNS.Identity.get_random_hash"><code class="docutils literal notranslate"><span class="pre">get_random_hash()</span></code></a></li> 2304 <li><a class="reference internal" href="#RNS.Identity.current_ratchet_id"><code class="docutils literal notranslate"><span class="pre">current_ratchet_id()</span></code></a></li> 2305 <li><a class="reference internal" href="#RNS.Identity.from_bytes"><code class="docutils literal notranslate"><span class="pre">from_bytes()</span></code></a></li> 2306 <li><a class="reference internal" href="#RNS.Identity.from_file"><code class="docutils literal notranslate"><span class="pre">from_file()</span></code></a></li> 2307 <li><a class="reference internal" href="#RNS.Identity.to_file"><code class="docutils literal notranslate"><span class="pre">to_file()</span></code></a></li> 2308 <li><a class="reference internal" href="#RNS.Identity.get_private_key"><code class="docutils literal notranslate"><span class="pre">get_private_key()</span></code></a></li> 2309 <li><a class="reference internal" href="#RNS.Identity.get_public_key"><code class="docutils literal notranslate"><span class="pre">get_public_key()</span></code></a></li> 2310 <li><a class="reference internal" href="#RNS.Identity.load_private_key"><code class="docutils literal notranslate"><span class="pre">load_private_key()</span></code></a></li> 2311 <li><a class="reference internal" href="#RNS.Identity.load_public_key"><code class="docutils literal notranslate"><span class="pre">load_public_key()</span></code></a></li> 2312 <li><a class="reference internal" href="#RNS.Identity.encrypt"><code class="docutils literal notranslate"><span class="pre">encrypt()</span></code></a></li> 2313 <li><a class="reference internal" href="#RNS.Identity.decrypt"><code class="docutils literal notranslate"><span class="pre">decrypt()</span></code></a></li> 2314 <li><a class="reference internal" href="#RNS.Identity.sign"><code class="docutils literal notranslate"><span class="pre">sign()</span></code></a></li> 2315 <li><a class="reference internal" href="#RNS.Identity.validate"><code class="docutils literal notranslate"><span class="pre">validate()</span></code></a></li> 2316 </ul> 2317 </li> 2318 <li><a class="reference internal" href="#RNS.Destination"><code class="docutils literal notranslate"><span class="pre">Destination</span></code></a><ul> 2319 <li><a class="reference internal" href="#RNS.Destination.RATCHET_COUNT"><code class="docutils literal notranslate"><span class="pre">RATCHET_COUNT</span></code></a></li> 2320 <li><a class="reference internal" href="#RNS.Destination.RATCHET_INTERVAL"><code class="docutils literal notranslate"><span class="pre">RATCHET_INTERVAL</span></code></a></li> 2321 <li><a class="reference internal" href="#RNS.Destination.expand_name"><code class="docutils literal notranslate"><span class="pre">expand_name()</span></code></a></li> 2322 <li><a class="reference internal" href="#RNS.Destination.app_and_aspects_from_name"><code class="docutils literal notranslate"><span class="pre">app_and_aspects_from_name()</span></code></a></li> 2323 <li><a class="reference internal" href="#RNS.Destination.hash_from_name_and_identity"><code class="docutils literal notranslate"><span class="pre">hash_from_name_and_identity()</span></code></a></li> 2324 <li><a class="reference internal" href="#RNS.Destination.hash"><code class="docutils literal notranslate"><span class="pre">hash()</span></code></a></li> 2325 <li><a class="reference internal" href="#RNS.Destination.announce"><code class="docutils literal notranslate"><span class="pre">announce()</span></code></a></li> 2326 <li><a class="reference internal" href="#RNS.Destination.accepts_links"><code class="docutils literal notranslate"><span class="pre">accepts_links()</span></code></a></li> 2327 <li><a class="reference internal" href="#RNS.Destination.set_link_established_callback"><code class="docutils literal notranslate"><span class="pre">set_link_established_callback()</span></code></a></li> 2328 <li><a class="reference internal" href="#RNS.Destination.set_packet_callback"><code class="docutils literal notranslate"><span class="pre">set_packet_callback()</span></code></a></li> 2329 <li><a class="reference internal" href="#RNS.Destination.set_proof_requested_callback"><code class="docutils literal notranslate"><span class="pre">set_proof_requested_callback()</span></code></a></li> 2330 <li><a class="reference internal" href="#RNS.Destination.set_proof_strategy"><code class="docutils literal notranslate"><span class="pre">set_proof_strategy()</span></code></a></li> 2331 <li><a class="reference internal" href="#RNS.Destination.register_request_handler"><code class="docutils literal notranslate"><span class="pre">register_request_handler()</span></code></a></li> 2332 <li><a class="reference internal" href="#RNS.Destination.deregister_request_handler"><code class="docutils literal notranslate"><span class="pre">deregister_request_handler()</span></code></a></li> 2333 <li><a class="reference internal" href="#RNS.Destination.enable_ratchets"><code class="docutils literal notranslate"><span class="pre">enable_ratchets()</span></code></a></li> 2334 <li><a class="reference internal" href="#RNS.Destination.enforce_ratchets"><code class="docutils literal notranslate"><span class="pre">enforce_ratchets()</span></code></a></li> 2335 <li><a class="reference internal" href="#RNS.Destination.set_retained_ratchets"><code class="docutils literal notranslate"><span class="pre">set_retained_ratchets()</span></code></a></li> 2336 <li><a class="reference internal" href="#RNS.Destination.set_ratchet_interval"><code class="docutils literal notranslate"><span class="pre">set_ratchet_interval()</span></code></a></li> 2337 <li><a class="reference internal" href="#RNS.Destination.create_keys"><code class="docutils literal notranslate"><span class="pre">create_keys()</span></code></a></li> 2338 <li><a class="reference internal" href="#RNS.Destination.get_private_key"><code class="docutils literal notranslate"><span class="pre">get_private_key()</span></code></a></li> 2339 <li><a class="reference internal" href="#RNS.Destination.load_private_key"><code class="docutils literal notranslate"><span class="pre">load_private_key()</span></code></a></li> 2340 <li><a class="reference internal" href="#RNS.Destination.encrypt"><code class="docutils literal notranslate"><span class="pre">encrypt()</span></code></a></li> 2341 <li><a class="reference internal" href="#RNS.Destination.decrypt"><code class="docutils literal notranslate"><span class="pre">decrypt()</span></code></a></li> 2342 <li><a class="reference internal" href="#RNS.Destination.sign"><code class="docutils literal notranslate"><span class="pre">sign()</span></code></a></li> 2343 <li><a class="reference internal" href="#RNS.Destination.set_default_app_data"><code class="docutils literal notranslate"><span class="pre">set_default_app_data()</span></code></a></li> 2344 <li><a class="reference internal" href="#RNS.Destination.clear_default_app_data"><code class="docutils literal notranslate"><span class="pre">clear_default_app_data()</span></code></a></li> 2345 </ul> 2346 </li> 2347 <li><a class="reference internal" href="#RNS.Packet"><code class="docutils literal notranslate"><span class="pre">Packet</span></code></a><ul> 2348 <li><a class="reference internal" href="#RNS.Packet.ENCRYPTED_MDU"><code class="docutils literal notranslate"><span class="pre">ENCRYPTED_MDU</span></code></a></li> 2349 <li><a class="reference internal" href="#RNS.Packet.PLAIN_MDU"><code class="docutils literal notranslate"><span class="pre">PLAIN_MDU</span></code></a></li> 2350 <li><a class="reference internal" href="#RNS.Packet.send"><code class="docutils literal notranslate"><span class="pre">send()</span></code></a></li> 2351 <li><a class="reference internal" href="#RNS.Packet.resend"><code class="docutils literal notranslate"><span class="pre">resend()</span></code></a></li> 2352 <li><a class="reference internal" href="#RNS.Packet.get_rssi"><code class="docutils literal notranslate"><span class="pre">get_rssi()</span></code></a></li> 2353 <li><a class="reference internal" href="#RNS.Packet.get_snr"><code class="docutils literal notranslate"><span class="pre">get_snr()</span></code></a></li> 2354 <li><a class="reference internal" href="#RNS.Packet.get_q"><code class="docutils literal notranslate"><span class="pre">get_q()</span></code></a></li> 2355 </ul> 2356 </li> 2357 <li><a class="reference internal" href="#RNS.PacketReceipt"><code class="docutils literal notranslate"><span class="pre">PacketReceipt</span></code></a><ul> 2358 <li><a class="reference internal" href="#RNS.PacketReceipt.get_status"><code class="docutils literal notranslate"><span class="pre">get_status()</span></code></a></li> 2359 <li><a class="reference internal" href="#RNS.PacketReceipt.get_rtt"><code class="docutils literal notranslate"><span class="pre">get_rtt()</span></code></a></li> 2360 <li><a class="reference internal" href="#RNS.PacketReceipt.set_timeout"><code class="docutils literal notranslate"><span class="pre">set_timeout()</span></code></a></li> 2361 <li><a class="reference internal" href="#RNS.PacketReceipt.set_delivery_callback"><code class="docutils literal notranslate"><span class="pre">set_delivery_callback()</span></code></a></li> 2362 <li><a class="reference internal" href="#RNS.PacketReceipt.set_timeout_callback"><code class="docutils literal notranslate"><span class="pre">set_timeout_callback()</span></code></a></li> 2363 </ul> 2364 </li> 2365 <li><a class="reference internal" href="#RNS.Link"><code class="docutils literal notranslate"><span class="pre">Link</span></code></a><ul> 2366 <li><a class="reference internal" href="#RNS.Link.CURVE"><code class="docutils literal notranslate"><span class="pre">CURVE</span></code></a></li> 2367 <li><a class="reference internal" href="#RNS.Link.ESTABLISHMENT_TIMEOUT_PER_HOP"><code class="docutils literal notranslate"><span class="pre">ESTABLISHMENT_TIMEOUT_PER_HOP</span></code></a></li> 2368 <li><a class="reference internal" href="#RNS.Link.KEEPALIVE_TIMEOUT_FACTOR"><code class="docutils literal notranslate"><span class="pre">KEEPALIVE_TIMEOUT_FACTOR</span></code></a></li> 2369 <li><a class="reference internal" href="#RNS.Link.STALE_GRACE"><code class="docutils literal notranslate"><span class="pre">STALE_GRACE</span></code></a></li> 2370 <li><a class="reference internal" href="#RNS.Link.KEEPALIVE"><code class="docutils literal notranslate"><span class="pre">KEEPALIVE</span></code></a></li> 2371 <li><a class="reference internal" href="#RNS.Link.STALE_TIME"><code class="docutils literal notranslate"><span class="pre">STALE_TIME</span></code></a></li> 2372 <li><a class="reference internal" href="#RNS.Link.identify"><code class="docutils literal notranslate"><span class="pre">identify()</span></code></a></li> 2373 <li><a class="reference internal" href="#RNS.Link.request"><code class="docutils literal notranslate"><span class="pre">request()</span></code></a></li> 2374 <li><a class="reference internal" href="#RNS.Link.track_phy_stats"><code class="docutils literal notranslate"><span class="pre">track_phy_stats()</span></code></a></li> 2375 <li><a class="reference internal" href="#RNS.Link.get_rssi"><code class="docutils literal notranslate"><span class="pre">get_rssi()</span></code></a></li> 2376 <li><a class="reference internal" href="#RNS.Link.get_snr"><code class="docutils literal notranslate"><span class="pre">get_snr()</span></code></a></li> 2377 <li><a class="reference internal" href="#RNS.Link.get_q"><code class="docutils literal notranslate"><span class="pre">get_q()</span></code></a></li> 2378 <li><a class="reference internal" href="#RNS.Link.get_establishment_rate"><code class="docutils literal notranslate"><span class="pre">get_establishment_rate()</span></code></a></li> 2379 <li><a class="reference internal" href="#RNS.Link.get_mtu"><code class="docutils literal notranslate"><span class="pre">get_mtu()</span></code></a></li> 2380 <li><a class="reference internal" href="#RNS.Link.get_mdu"><code class="docutils literal notranslate"><span class="pre">get_mdu()</span></code></a></li> 2381 <li><a class="reference internal" href="#RNS.Link.get_expected_rate"><code class="docutils literal notranslate"><span class="pre">get_expected_rate()</span></code></a></li> 2382 <li><a class="reference internal" href="#RNS.Link.get_mode"><code class="docutils literal notranslate"><span class="pre">get_mode()</span></code></a></li> 2383 <li><a class="reference internal" href="#RNS.Link.get_age"><code class="docutils literal notranslate"><span class="pre">get_age()</span></code></a></li> 2384 <li><a class="reference internal" href="#RNS.Link.no_inbound_for"><code class="docutils literal notranslate"><span class="pre">no_inbound_for()</span></code></a></li> 2385 <li><a class="reference internal" href="#RNS.Link.no_outbound_for"><code class="docutils literal notranslate"><span class="pre">no_outbound_for()</span></code></a></li> 2386 <li><a class="reference internal" href="#RNS.Link.no_data_for"><code class="docutils literal notranslate"><span class="pre">no_data_for()</span></code></a></li> 2387 <li><a class="reference internal" href="#RNS.Link.inactive_for"><code class="docutils literal notranslate"><span class="pre">inactive_for()</span></code></a></li> 2388 <li><a class="reference internal" href="#RNS.Link.get_remote_identity"><code class="docutils literal notranslate"><span class="pre">get_remote_identity()</span></code></a></li> 2389 <li><a class="reference internal" href="#RNS.Link.teardown"><code class="docutils literal notranslate"><span class="pre">teardown()</span></code></a></li> 2390 <li><a class="reference internal" href="#RNS.Link.get_channel"><code class="docutils literal notranslate"><span class="pre">get_channel()</span></code></a></li> 2391 <li><a class="reference internal" href="#RNS.Link.set_link_closed_callback"><code class="docutils literal notranslate"><span class="pre">set_link_closed_callback()</span></code></a></li> 2392 <li><a class="reference internal" href="#RNS.Link.set_packet_callback"><code class="docutils literal notranslate"><span class="pre">set_packet_callback()</span></code></a></li> 2393 <li><a class="reference internal" href="#RNS.Link.set_resource_callback"><code class="docutils literal notranslate"><span class="pre">set_resource_callback()</span></code></a></li> 2394 <li><a class="reference internal" href="#RNS.Link.set_resource_started_callback"><code class="docutils literal notranslate"><span class="pre">set_resource_started_callback()</span></code></a></li> 2395 <li><a class="reference internal" href="#RNS.Link.set_resource_concluded_callback"><code class="docutils literal notranslate"><span class="pre">set_resource_concluded_callback()</span></code></a></li> 2396 <li><a class="reference internal" href="#RNS.Link.set_remote_identified_callback"><code class="docutils literal notranslate"><span class="pre">set_remote_identified_callback()</span></code></a></li> 2397 <li><a class="reference internal" href="#RNS.Link.set_resource_strategy"><code class="docutils literal notranslate"><span class="pre">set_resource_strategy()</span></code></a></li> 2398 </ul> 2399 </li> 2400 <li><a class="reference internal" href="#RNS.RequestReceipt"><code class="docutils literal notranslate"><span class="pre">RequestReceipt</span></code></a><ul> 2401 <li><a class="reference internal" href="#RNS.RequestReceipt.get_request_id"><code class="docutils literal notranslate"><span class="pre">get_request_id()</span></code></a></li> 2402 <li><a class="reference internal" href="#RNS.RequestReceipt.get_status"><code class="docutils literal notranslate"><span class="pre">get_status()</span></code></a></li> 2403 <li><a class="reference internal" href="#RNS.RequestReceipt.get_progress"><code class="docutils literal notranslate"><span class="pre">get_progress()</span></code></a></li> 2404 <li><a class="reference internal" href="#RNS.RequestReceipt.get_response"><code class="docutils literal notranslate"><span class="pre">get_response()</span></code></a></li> 2405 <li><a class="reference internal" href="#RNS.RequestReceipt.get_response_time"><code class="docutils literal notranslate"><span class="pre">get_response_time()</span></code></a></li> 2406 <li><a class="reference internal" href="#RNS.RequestReceipt.concluded"><code class="docutils literal notranslate"><span class="pre">concluded()</span></code></a></li> 2407 </ul> 2408 </li> 2409 <li><a class="reference internal" href="#RNS.Resource"><code class="docutils literal notranslate"><span class="pre">Resource</span></code></a><ul> 2410 <li><a class="reference internal" href="#RNS.Resource.advertise"><code class="docutils literal notranslate"><span class="pre">advertise()</span></code></a></li> 2411 <li><a class="reference internal" href="#RNS.Resource.cancel"><code class="docutils literal notranslate"><span class="pre">cancel()</span></code></a></li> 2412 <li><a class="reference internal" href="#RNS.Resource.get_progress"><code class="docutils literal notranslate"><span class="pre">get_progress()</span></code></a></li> 2413 <li><a class="reference internal" href="#RNS.Resource.get_transfer_size"><code class="docutils literal notranslate"><span class="pre">get_transfer_size()</span></code></a></li> 2414 <li><a class="reference internal" href="#RNS.Resource.get_data_size"><code class="docutils literal notranslate"><span class="pre">get_data_size()</span></code></a></li> 2415 <li><a class="reference internal" href="#RNS.Resource.get_parts"><code class="docutils literal notranslate"><span class="pre">get_parts()</span></code></a></li> 2416 <li><a class="reference internal" href="#RNS.Resource.get_segments"><code class="docutils literal notranslate"><span class="pre">get_segments()</span></code></a></li> 2417 <li><a class="reference internal" href="#RNS.Resource.get_hash"><code class="docutils literal notranslate"><span class="pre">get_hash()</span></code></a></li> 2418 <li><a class="reference internal" href="#RNS.Resource.is_compressed"><code class="docutils literal notranslate"><span class="pre">is_compressed()</span></code></a></li> 2419 </ul> 2420 </li> 2421 <li><a class="reference internal" href="#RNS.Channel.Channel"><code class="docutils literal notranslate"><span class="pre">Channel</span></code></a><ul> 2422 <li><a class="reference internal" href="#RNS.Channel.Channel.register_message_type"><code class="docutils literal notranslate"><span class="pre">register_message_type()</span></code></a></li> 2423 <li><a class="reference internal" href="#RNS.Channel.Channel.add_message_handler"><code class="docutils literal notranslate"><span class="pre">add_message_handler()</span></code></a></li> 2424 <li><a class="reference internal" href="#RNS.Channel.Channel.remove_message_handler"><code class="docutils literal notranslate"><span class="pre">remove_message_handler()</span></code></a></li> 2425 <li><a class="reference internal" href="#RNS.Channel.Channel.is_ready_to_send"><code class="docutils literal notranslate"><span class="pre">is_ready_to_send()</span></code></a></li> 2426 <li><a class="reference internal" href="#RNS.Channel.Channel.send"><code class="docutils literal notranslate"><span class="pre">send()</span></code></a></li> 2427 <li><a class="reference internal" href="#RNS.Channel.Channel.mdu"><code class="docutils literal notranslate"><span class="pre">mdu</span></code></a></li> 2428 </ul> 2429 </li> 2430 <li><a class="reference internal" href="#RNS.MessageBase"><code class="docutils literal notranslate"><span class="pre">MessageBase</span></code></a><ul> 2431 <li><a class="reference internal" href="#RNS.MessageBase.MSGTYPE"><code class="docutils literal notranslate"><span class="pre">MSGTYPE</span></code></a></li> 2432 <li><a class="reference internal" href="#RNS.MessageBase.pack"><code class="docutils literal notranslate"><span class="pre">pack()</span></code></a></li> 2433 <li><a class="reference internal" href="#RNS.MessageBase.unpack"><code class="docutils literal notranslate"><span class="pre">unpack()</span></code></a></li> 2434 </ul> 2435 </li> 2436 <li><a class="reference internal" href="#RNS.Buffer"><code class="docutils literal notranslate"><span class="pre">Buffer</span></code></a><ul> 2437 <li><a class="reference internal" href="#RNS.Buffer.create_reader"><code class="docutils literal notranslate"><span class="pre">create_reader()</span></code></a></li> 2438 <li><a class="reference internal" href="#RNS.Buffer.create_writer"><code class="docutils literal notranslate"><span class="pre">create_writer()</span></code></a></li> 2439 <li><a class="reference internal" href="#RNS.Buffer.create_bidirectional_buffer"><code class="docutils literal notranslate"><span class="pre">create_bidirectional_buffer()</span></code></a></li> 2440 </ul> 2441 </li> 2442 <li><a class="reference internal" href="#RNS.RawChannelReader"><code class="docutils literal notranslate"><span class="pre">RawChannelReader</span></code></a><ul> 2443 <li><a class="reference internal" href="#RNS.RawChannelReader.__init__"><code class="docutils literal notranslate"><span class="pre">__init__()</span></code></a></li> 2444 <li><a class="reference internal" href="#RNS.RawChannelReader.add_ready_callback"><code class="docutils literal notranslate"><span class="pre">add_ready_callback()</span></code></a></li> 2445 <li><a class="reference internal" href="#RNS.RawChannelReader.remove_ready_callback"><code class="docutils literal notranslate"><span class="pre">remove_ready_callback()</span></code></a></li> 2446 </ul> 2447 </li> 2448 <li><a class="reference internal" href="#RNS.RawChannelWriter"><code class="docutils literal notranslate"><span class="pre">RawChannelWriter</span></code></a><ul> 2449 <li><a class="reference internal" href="#RNS.RawChannelWriter.__init__"><code class="docutils literal notranslate"><span class="pre">__init__()</span></code></a></li> 2450 </ul> 2451 </li> 2452 <li><a class="reference internal" href="#RNS.Transport"><code class="docutils literal notranslate"><span class="pre">Transport</span></code></a><ul> 2453 <li><a class="reference internal" href="#RNS.Transport.PATHFINDER_M"><code class="docutils literal notranslate"><span class="pre">PATHFINDER_M</span></code></a></li> 2454 <li><a class="reference internal" href="#RNS.Transport.register_announce_handler"><code class="docutils literal notranslate"><span class="pre">register_announce_handler()</span></code></a></li> 2455 <li><a class="reference internal" href="#RNS.Transport.deregister_announce_handler"><code class="docutils literal notranslate"><span class="pre">deregister_announce_handler()</span></code></a></li> 2456 <li><a class="reference internal" href="#RNS.Transport.has_path"><code class="docutils literal notranslate"><span class="pre">has_path()</span></code></a></li> 2457 <li><a class="reference internal" href="#RNS.Transport.hops_to"><code class="docutils literal notranslate"><span class="pre">hops_to()</span></code></a></li> 2458 <li><a class="reference internal" href="#RNS.Transport.next_hop"><code class="docutils literal notranslate"><span class="pre">next_hop()</span></code></a></li> 2459 <li><a class="reference internal" href="#RNS.Transport.next_hop_interface"><code class="docutils literal notranslate"><span class="pre">next_hop_interface()</span></code></a></li> 2460 <li><a class="reference internal" href="#RNS.Transport.await_path"><code class="docutils literal notranslate"><span class="pre">await_path()</span></code></a></li> 2461 <li><a class="reference internal" href="#RNS.Transport.request_path"><code class="docutils literal notranslate"><span class="pre">request_path()</span></code></a></li> 2462 </ul> 2463 </li> 2464 </ul> 2465 </li> 2466 </ul> 2467 2468 </div> 2469 </div> 2470 </div> 2471 2472 2473 </aside> 2474 </div> 2475 </div><script src="_static/documentation_options.js?v=cb7bf70b"></script> 2476 <script src="_static/doctools.js?v=9bcbadda"></script> 2477 <script src="_static/sphinx_highlight.js?v=dc90522c"></script> 2478 <script src="_static/scripts/furo.js?v=46bd48cc"></script> 2479 <script src="_static/clipboard.min.js?v=a7894cd8"></script> 2480 <script src="_static/copybutton.js?v=f281be69"></script> 2481 </body> 2482 </html>