UNPKG

thali

Version:
596 lines (189 loc) 15 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Module: ThaliWifiInfrastructure</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Module: ThaliWifiInfrastructure</h1> <section> <header> </header> <article> <div class="container-overview"> </div> <h3 class="subsection-title">Classes</h3> <dl> <dt><a href="module-ThaliWifiInfrastructure-ThaliWifiInfrastructure.html">ThaliWifiInfrastructure</a></dt> <dd></dd> </dl> <h3 class="subsection-title">Events</h3> <h4 class="name" id="~event:discoveryAdvertisingStateUpdateWifiEvent">discoveryAdvertisingStateUpdateWifiEvent</h4> <div class="description"> <p>For the definition of this event please see module:thaliMobileNativeWrapper~discoveryAdvertisingStateUpdateEvent</p> <p>This notifies the listener whenever the state of discovery or advertising changes. In <a href="module-thaliMobileNativeWrapper.html">module:thaliMobileNativeWrapper</a> the equivalent of this event is fired from the native layer and then works its way through <a href="module-thaliMobileNative.html">module:thaliMobileNative</a> to <a href="module-thaliMobileNativeWrapper.html">module:thaliMobileNativeWrapper</a>. But in the case of Wifi there is no native layer. Therefore if there is a call to start/stop discovery/advertising or if a network change event forces a change in status (e.g. someone turned off Wifi) then this class MUST issue this event itself. That is, it must have hooked into the start/stop methods, start/stop discovery/advertising methods, module:thaliMobileNativeWrapper.nonTCPPeerAvailabilityChangedEvent events when we are on mobile devices and module:ThaliWifiInfrastructure.networkChangedWifi when we are on desktop to figure out when status has changed and this event needs to be fired.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Object</span> </li> </ul> <h5 class="subsection-title">Properties:</h5> <table class="props"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>discoveryAdvertisingStateUpdateValue</code></td> <td class="type"> <span class="param-type"><a href="module-thaliMobileNative.html#~discoveryAdvertisingStateUpdate">module:thaliMobileNative~discoveryAdvertisingStateUpdate</a></span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="NextGeneration_thaliWifiInfrastructure.js.html">NextGeneration/thaliWifiInfrastructure.js</a>, <a href="NextGeneration_thaliWifiInfrastructure.js.html#line235">line 235</a> </li></ul></dd> </dl> <h4 class="name" id="~event:networkChangedWifi">networkChangedWifi</h4> <div class="description"> <p>For the definition of this event please see module:thaliMobileNativeWrapper~discoveryAdvertisingStateUpdateEvent.</p> <p>The WiFi layer MUST NOT emit this event unless we are running on Linux, OS/X or Windows. In the case that we are running on those platforms then If we are running on those platforms then blueToothLowEnergy and blueTooth MUST both return radioState set to <code>doNotCare</code>. Also note that these platforms don't generally support a push based way to detect WiFi state (at least not without writing native code). So for now we can use polling and something like <a href="https://www.npmjs.com/package/network-scanner">network-scanner</a> to give us some sense of the system's state.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Object</span> </li> </ul> <h5 class="subsection-title">Properties:</h5> <table class="props"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>networkChangedValue</code></td> <td class="type"> <span class="param-type"><a href="module-thaliMobileNative.html#~networkChanged">module:thaliMobileNative~networkChanged</a></span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="NextGeneration_thaliWifiInfrastructure.js.html">NextGeneration/thaliWifiInfrastructure.js</a>, <a href="NextGeneration_thaliWifiInfrastructure.js.html#line259">line 259</a> </li></ul></dd> </dl> <h4 class="name" id="~event:wifiPeerAvailabilityChanged">wifiPeerAvailabilityChanged</h4> <div class="description"> <p>This event specifies that a peer was discovered over Wi-Fi Infrastructure. Please keep in mind that IP address bindings can change randomly amongst peers and of course peers can disappear. So this should be considered more of a hint than anything else. If the peer has gone (e.g. ssdp:byebye) then both hostAddress and portNumber MUST be set to null.</p> <p>Note that when sending SSDP queries we MUST use a randomly assigned address for the local UDP port as described in ctions. It is not necessary that this be the same UDP port as used in the previously mentioned function.</p> <p><strong>Open Issue:</strong> There is a pretty obvious security hole here that a bad actor could advertise a bunch of IP or DNS addresses of some innocent target on a local network in order to trigger a connection storm. Given the various limitations in place it's unclear how effective this would really be. There are things we can to ameliorate the attack including only accepting IP address that match the local network mask and also rate limiting how quickly we are willing to connect to discovered peers.</p> </div> <h5 class="subsection-title">Properties:</h5> <table class="props"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>peerIdentifier</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>This is the USN value</p></td> </tr> <tr> <td class="name"><code>hostAddress</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>This can be either an IP address or a DNS address encoded as a string</p></td> </tr> <tr> <td class="name"><code>portNumber</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The port on the hostAddress to use to connect to the peer</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="NextGeneration_thaliWifiInfrastructure.js.html">NextGeneration/thaliWifiInfrastructure.js</a>, <a href="NextGeneration_thaliWifiInfrastructure.js.html#line205">line 205</a> </li></ul></dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-TCPServersManager.html">TCPServersManager</a></li><li><a href="module-thaliMobile.html">thaliMobile</a></li><li><a href="module-thaliMobileNative.html">thaliMobileNative</a></li><li><a href="module-thaliMobileNativeWrapper.html">thaliMobileNativeWrapper</a></li><li><a href="module-thaliNotificationAction.html">thaliNotificationAction</a></li><li><a href="module-thaliNotificationBeacons.html">thaliNotificationBeacons</a></li><li><a href="module-thaliNotificationClient.html">thaliNotificationClient</a></li><li><a href="module-thaliNotificationServer.html">thaliNotificationServer</a></li><li><a href="module-thaliPeerAction.html">thaliPeerAction</a></li><li><a href="module-thaliPeerDictionary.html">thaliPeerDictionary</a></li><li><a href="module-thaliPeerPoolInterface.html">thaliPeerPoolInterface</a></li><li><a href="module-ThaliWifiInfrastructure.html">ThaliWifiInfrastructure</a></li><li><a href="module-WifiBasedNativeMock.html">WifiBasedNativeMock</a></li></ul><h3>Externals</h3><ul><li><a href="external-_Mobile(_connect_)_.html">Mobile('connect')</a></li><li><a href="external-_Mobile(_discoveryAdvertisingStateUpdateNonTCP_)_.html">Mobile('discoveryAdvertisingStateUpdateNonTCP')</a></li><li><a href="external-_Mobile(_incomingConnectionToPortNumberFailed_)_.html">Mobile('incomingConnectionToPortNumberFailed')</a></li><li><a href="external-_Mobile(_killConnections_)_.html">Mobile('killConnections')</a></li><li><a href="external-_Mobile(_networkChanged_)_.html">Mobile('networkChanged')</a></li><li><a href="external-_Mobile(_peerAvailabilityChanged_)_.html">Mobile('peerAvailabilityChanged')</a></li><li><a href="external-_Mobile(_startListeningForAdvertisements_)_.html">Mobile('startListeningForAdvertisements')</a></li><li><a href="external-_Mobile(_startUpdateAdvertisingAndListening_)_.html">Mobile('startUpdateAdvertisingAndListening')</a></li><li><a href="external-_Mobile(_stopAdvertisingAndListening_)_.html">Mobile('stopAdvertisingAndListening')</a></li><li><a href="external-_Mobile(_stopListeningForAdvertisements_)_.html">Mobile('stopListeningForAdvertisements')</a></li></ul><h3>Classes</h3><ul><li><a href="ConnectionTable.html">ConnectionTable</a></li><li><a href="module-TCPServersManager-TCPServersManager.html">TCPServersManager</a></li><li><a href="module-thaliNotificationAction-NotificationAction.html">NotificationAction</a></li><li><a href="module-thaliNotificationBeacons-ParseBeaconsResponse.html">ParseBeaconsResponse</a></li><li><a href="module-thaliNotificationClient-ThaliNotificationClient.html">ThaliNotificationClient</a></li><li><a href="module-thaliNotificationServer-ThaliNotificationServer.html">ThaliNotificationServer</a></li><li><a href="module-thaliPeerAction-PeerAction.html">PeerAction</a></li><li><a href="module-thaliPeerDictionary-NotificationPeerDictionaryEntry.html">NotificationPeerDictionaryEntry</a></li><li><a href="module-thaliPeerDictionary-PeerConnectionInformation.html">PeerConnectionInformation</a></li><li><a href="module-thaliPeerDictionary-PeerDictionary.html">PeerDictionary</a></li><li><a href="module-thaliPeerPoolInterface-ThaliPeerPoolInterface.html">ThaliPeerPoolInterface</a></li><li><a href="module-ThaliWifiInfrastructure-ThaliWifiInfrastructure.html">ThaliWifiInfrastructure</a></li><li><a href="module-WifiBasedNativeMock-MobileCallInstance.html">MobileCallInstance</a></li><li><a href="module-WifiBasedNativeMock-WifiBasedNativeMock.html">WifiBasedNativeMock</a></li></ul><h3>Events</h3><ul><li><a href="module-thaliMobileNativeWrapper.html#~event:discoveryAdvertisingStateUpdateNonTCPEvent">discoveryAdvertisingStateUpdateNonTCPEvent</a></li><li><a href="module-ThaliWifiInfrastructure.html#~event:discoveryAdvertisingStateUpdateWifiEvent">discoveryAdvertisingStateUpdateWifiEvent</a></li><li><a href="module-TCPServersManager.html#~event:failedConnection">failedConnection</a></li><li><a href="module-thaliMobileNativeWrapper.html#~event:incomingConnectionToPortNumberFailed">incomingConnectionToPortNumberFailed</a></li><li><a href="module-thaliMobileNativeWrapper.html#~event:networkChangedNonTCP">networkChangedNonTCP</a></li><li><a href="module-ThaliWifiInfrastructure.html#~event:networkChangedWifi">networkChangedWifi</a></li><li><a href="module-thaliMobileNativeWrapper.html#~event:nonTCPPeerAvailabilityChangedEvent">nonTCPPeerAvailabilityChangedEvent</a></li><li><a href="module-TCPServersManager.html#~event:routerPortConnectionFailed">routerPortConnectionFailed</a></li><li><a href="module-ThaliWifiInfrastructure.html#~event:wifiPeerAvailabilityChanged">wifiPeerAvailabilityChanged</a></li><li><a href="module-thaliMobile.html#.event:event:discoveryAdvertisingStateUpdate">discoveryAdvertisingStateUpdate</a></li><li><a href="module-thaliMobile.html#.event:event:networkChanged">networkChanged</a></li><li><a href="module-thaliMobile.html#.event:event:peerAvailabilityChanged">peerAvailabilityChanged</a></li><li><a href="module-thaliNotificationAction-NotificationAction.html#.event:event:Resolved">Resolved</a></li><li><a href="module-thaliNotificationClient.html#.event:event:peerAdvertisesDataForUs">peerAdvertisesDataForUs</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getPKCS12Content">getPKCS12Content</a></li><li><a href="global.html#getPublicKeyHash">getPublicKeyHash</a></li><li><a href="global.html#stopThaliReplicationManager">stopThaliReplicationManager</a></li><li><a href="global.html#ThaliEmitter">ThaliEmitter</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Jan 18 2016 11:19:31 GMT+0200 (EET) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>