ftpd.js
Version:
A FTP Server made in node.js
2,079 lines (484 loc) • 22.4 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Interface</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">Class: Interface</h1>
<section>
<header>
<h2>
Interface
</h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="Interface"><span class="type-signature"></span>new Interface<span class="signature">(server, options)</span><span class="type-signature"></span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>server</code></td>
<td class="type">
<span class="param-type"><a href="Server.html">Server</a></span>
</td>
<td class="description last">the server utilizing the interface</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">the interface options</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>0.6.0</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="server_interface.js.html">server/interface.js</a>, <a href="server_interface.js.html#line18">line 18</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="close"><span class="type-signature"></span>close<span class="signature">(done)</span><span class="type-signature"></span></h4>
<div class="description">
This function is used to close the interface and disconnect all active connections
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>done</code></td>
<td class="type">
<span class="param-type"><a href="Interface.html#~finishedClose">Interface~finishedClose</a></span>
</td>
<td class="description last">the callback to invoke when finished closing</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>0.6.0</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="server_interface.js.html">server/interface.js</a>, <a href="server_interface.js.html#line154">line 154</a>
</li></ul></dd>
</dl>
<h4 class="name" id="getBaseMessage"><span class="type-signature"></span>getBaseMessage<span class="signature">()</span><span class="type-signature"> → {string}</span></h4>
<div class="description">
This function is used to get the base message for interface logging
</div>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>0.6.o</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="server_interface.js.html">server/interface.js</a>, <a href="server_interface.js.html#line245">line 245</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
the base logging message
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getConnections"><span class="type-signature"></span>getConnections<span class="signature">()</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
This function is used to get all of the connections connected to the interface
</div>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>0.6.0</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="server_interface.js.html">server/interface.js</a>, <a href="server_interface.js.html#line221">line 221</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
the connected connections
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="getFormattedListen"><span class="type-signature"></span>getFormattedListen<span class="signature">()</span><span class="type-signature"> → {string}</span></h4>
<div class="description">
This function is used to get the formatted interface address
</div>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>0.6.0</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="server_interface.js.html">server/interface.js</a>, <a href="server_interface.js.html#line257">line 257</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
the formatted address the interface *should* be listening on
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getID"><span class="type-signature"></span>getID<span class="signature">()</span><span class="type-signature"> → {int}</span></h4>
<div class="description">
This function is used to get the interface's ID
</div>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>0.6.0</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="server_interface.js.html">server/interface.js</a>, <a href="server_interface.js.html#line173">line 173</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
the interface's id
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">int</span>
</dd>
</dl>
<h4 class="name" id="getOptions"><span class="type-signature"></span>getOptions<span class="signature">()</span><span class="type-signature"> → {Object}</span></h4>
<div class="description">
This function is used to get the interface's options
</div>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>0.6.0</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="server_interface.js.html">server/interface.js</a>, <a href="server_interface.js.html#line197">line 197</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
the interface's options
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
<h4 class="name" id="getServer"><span class="type-signature"></span>getServer<span class="signature">()</span><span class="type-signature"> → {<a href="Server.html">Server</a>}</span></h4>
<div class="description">
This function is used to get the server utilizing the interface
</div>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>0.6.0</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="server_interface.js.html">server/interface.js</a>, <a href="server_interface.js.html#line185">line 185</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
the server utilizing the interface
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Server.html">Server</a></span>
</dd>
</dl>
<h4 class="name" id="getSocket"><span class="type-signature"></span>getSocket<span class="signature">()</span><span class="type-signature"> → {net.Server}</span></h4>
<div class="description">
This function is used to get the socket the interface is listening for connections on
</div>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>0.6.0</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="server_interface.js.html">server/interface.js</a>, <a href="server_interface.js.html#line209">line 209</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
the socket the server is listening on
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">net.Server</span>
</dd>
</dl>
<h4 class="name" id="isSetup"><span class="type-signature"></span>isSetup<span class="signature">()</span><span class="type-signature"> → {boolean}</span></h4>
<div class="description">
This function is used to tell wether or not the interface have been setup
</div>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>0.6.0</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="server_interface.js.html">server/interface.js</a>, <a href="server_interface.js.html#line233">line 233</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
true if the server have been setup, false if not
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="listen"><span class="type-signature"></span>listen<span class="signature">(callback)</span><span class="type-signature"></span></h4>
<div class="description">
This function is used to tell the interface to bind to the address it's been provided and start to liten for
connections The function will setup the interface if it haven't been done at the time of execution
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type"><a href="Interface.html#~didListen">Interface~didListen</a></span>
</td>
<td class="description last">the callback to invoke when bound and accepting clients</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>0.6.0</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="server_interface.js.html">server/interface.js</a>, <a href="server_interface.js.html#line97">line 97</a>
</li></ul></dd>
</dl>
<h4 class="name" id="onConnection"><span class="type-signature"></span>onConnection<span class="signature">(connection)</span><span class="type-signature"></span></h4>
<div class="description">
This function gets invoked when a new connection have been made to the interface
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>connection</code></td>
<td class="type">
<span class="param-type">net.Socket</span>
</td>
<td class="description last">the connection object</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>0.6.0</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="server_interface.js.html">server/interface.js</a>, <a href="server_interface.js.html#line132">line 132</a>
</li></ul></dd>
</dl>
<h4 class="name" id="onError"><span class="type-signature"></span>onError<span class="signature">(error)</span><span class="type-signature"></span></h4>
<div class="description">
This function gets invoked when an error occurs with the interface. Usually this is FATAL
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>error</code></td>
<td class="type">
<span class="param-type">Error</span>
</td>
<td class="description last">the error</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>0.6.0</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="server_interface.js.html">server/interface.js</a>, <a href="server_interface.js.html#line120">line 120</a>
</li></ul></dd>
</dl>
<h4 class="name" id="setup"><span class="type-signature"></span>setup<span class="signature">(callback)</span><span class="type-signature"></span></h4>
<div class="description">
This function is used to setup the interface in this order:
- Check for tls certificate
- Read certificate into memory
- Create socket
- Setup listeners
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type"><a href="Interface.html#~didSetup">Interface~didSetup</a></span>
</td>
<td class="description last">the callback to invoke when finished</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>0.6.0</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="server_interface.js.html">server/interface.js</a>, <a href="server_interface.js.html#line49">line 49</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id="~didListen"><span class="type-signature"></span>didListen<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
This callback is used to when the interface have successfully bound to the provided address and is now accepting
connections
</div>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>0.6.0</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="server_interface.js.html">server/interface.js</a>, <a href="server_interface.js.html#line79">line 79</a>
</li></ul></dd>
</dl>
<h4 class="name" id="~didSetup"><span class="type-signature"></span>didSetup<span class="signature">(the)</span><span class="type-signature"></span></h4>
<div class="description">
This callback is used when the interface have finished setting up
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>the</code></td>
<td class="type">
<span class="param-type"><a href="Interface.html">Interface</a></span>
</td>
<td class="description last">interface that finished setting up</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>0.6.0</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="server_interface.js.html">server/interface.js</a>, <a href="server_interface.js.html#line28">line 28</a>
</li></ul></dd>
</dl>
<h4 class="name" id="~finishedClose"><span class="type-signature"></span>finishedClose<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
This callback is used when the interface have closed and finished disconnecting all connections
</div>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>0.6.0</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="server_interface.js.html">server/interface.js</a>, <a href="server_interface.js.html#line138">line 138</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ftpdjs.html">ftpdjs</a></li><li><a href="Interface.html">Interface</a></li><li><a href="Server.html">Server</a></li><li><a href="User.html">User</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Wed May 27 2015 15:03:13 GMT+0200 (CEST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>