bitmessage-js/docs/module-bitmessage_structs.message.html
Kagami Hiiragi feb254d01f Publish docs
2015-03-16 22:33:24 +03:00

1158 lines
15 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Namespace: message</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">Namespace: message</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="module-bitmessage_structs.html">bitmessage/structs</a>.</span>
message
</h2>
</header>
<article>
<div class="container-overview">
<div class="description"><p>Message structure.</p></div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line100">line 100</a>
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="https://bitmessage.org/wiki/Protocol_specification#Message_structure">https://bitmessage.org/wiki/Protocol_specification#Message_structure</a></li>
</ul>
</dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id=".MAGIC"><span class="type-signature">(static, constant) </span>MAGIC<span class="type-signature"> :number</span></h4>
<div class="description">
<p>Bitmessage magic value.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">number</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line105">line 105</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {DecodeResult}</span></h4>
<div class="description">
<p>Decode message.<br>NOTE: <code>payload</code> is copied, <code>rest</code> references input buffer.</p>
</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>buf</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Buffer that starts with encoded message</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line221">line 221</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p><a href="module-bitmessage_structs.message.html#.DecodeResult">Decoded message structure.</a></p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">DecodeResult</span>
</dd>
</dl>
<h4 class="name" id=".encode"><span class="type-signature">(static) </span>encode<span class="signature">(command, payload)</span><span class="type-signature"> &rarr; {Buffer}</span></h4>
<div class="description">
<p>Encode message.</p>
</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>command</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>Message command</p></td>
</tr>
<tr>
<td class="name"><code>payload</code></td>
<td class="type">
<span class="param-type">Bufer</span>
</td>
<td class="description last"><p>Message payload</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line257">line 257</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Encoded message structure.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Buffer</span>
</dd>
</dl>
<h4 class="name" id=".tryDecode"><span class="type-signature">(static) </span>tryDecode<span class="signature">(buf)</span><span class="type-signature"> &rarr; (nullable) {TryDecodeResult}</span></h4>
<div class="description">
<p>Decode message in &quot;stream&quot; mode.<br>NOTE: message payload and <code>rest</code> are copied (so the runtime can GC
processed buffer data).</p>
</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>buf</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Data buffer</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line127">line 127</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p><a href="module-bitmessage_structs.message.html#.TryDecodeResult">Decoded result.</a></p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">TryDecodeResult</span>
</dd>
</dl>
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id=".DecodeResult">DecodeResult</h4>
<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>command</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>Message command</p></td>
</tr>
<tr>
<td class="name"><code>payload</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Message payload</p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Full message length</p></td>
</tr>
<tr>
<td class="name"><code>rest</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>The rest of the input buffer</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line205">line 205</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".TryDecodeResult">TryDecodeResult</h4>
<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>message</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>Decoded message</p>
<h6>Properties</h6>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>command</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>Message command</p></td>
</tr>
<tr>
<td class="name"><code>payload</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Message payload</p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Full message length</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="name"><code>error</code></td>
<td class="type">
<span class="param-type">Error</span>
</td>
<td class="description last"><p>...or decoding error</p></td>
</tr>
<tr>
<td class="name"><code>rest</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>The rest of the input buffer after
processing message</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line107">line 107</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-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</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 Mon Mar 16 2015 22:32:51 GMT+0300 (MSK)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>