2015-01-03 17:04:14 +01:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<title>JSDoc: Module: bitmessage/structs</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: bitmessage/structs</h1>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<section>
|
|
|
|
|
|
|
|
<header>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</header>
|
|
|
|
|
|
|
|
<article>
|
|
|
|
<div class="container-overview">
|
|
|
|
|
|
|
|
|
|
|
|
<div class="description"><p>Implements common structures.</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#line1">line 1</a>
|
|
|
|
</li></ul></dd>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<dt class="tag-see">See:</dt>
|
|
|
|
<dd class="tag-see">
|
|
|
|
<ul>
|
|
|
|
<li><a href="https://bitmessage.org/wiki/Protocol_specification#Common_structures">https://bitmessage.org/wiki/Protocol_specification#Common_structures</a></li>
|
|
|
|
</ul>
|
|
|
|
</dd>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-12 11:44:15 +01:00
|
|
|
<h5>Example</h5>
|
|
|
|
|
|
|
|
<pre class="prettyprint"><code>var structs = require("bitmessage").structs;
|
|
|
|
|
|
|
|
var encoded = Buffer.concat([
|
|
|
|
structs.var_int.encode(4),
|
|
|
|
Buffer("test"),
|
|
|
|
structs.var_str.encode("test2"),
|
|
|
|
structs.var_int_list.encode([1, 2, 3]),
|
|
|
|
]);
|
|
|
|
|
|
|
|
var decoded1 = structs.var_str.decode(encoded);
|
|
|
|
console.log(decoded1.str); // test
|
|
|
|
var decoded2 = structs.var_str.decode(decoded1.rest);
|
|
|
|
console.log(decoded2.str); // test2
|
|
|
|
var decoded3 = structs.var_int.decode(decoded2.rest);
|
|
|
|
console.log(decoded3.value); // 3
|
|
|
|
var decoded4 = structs.var_int_list.decode(decoded2.rest);
|
|
|
|
console.log(decoded4.list); // [1, 2, 3]</code></pre>
|
|
|
|
|
|
|
|
|
2015-01-03 17:04:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-12 11:44:15 +01:00
|
|
|
<h3 class="subsection-title">Classes</h3>
|
|
|
|
|
|
|
|
<dl>
|
|
|
|
<dt><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></dt>
|
|
|
|
<dd></dd>
|
|
|
|
|
|
|
|
<dt><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></dt>
|
|
|
|
<dd></dd>
|
|
|
|
</dl>
|
|
|
|
|
2015-01-03 17:04:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3 class="subsection-title">Namespaces</h3>
|
|
|
|
|
|
|
|
<dl>
|
2015-01-31 12:54:23 +01:00
|
|
|
<dt><a href="module-bitmessage_structs.encrypted.html">encrypted</a></dt>
|
|
|
|
<dd></dd>
|
|
|
|
|
|
|
|
<dt><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></dt>
|
|
|
|
<dd></dd>
|
|
|
|
|
|
|
|
<dt><a href="module-bitmessage_structs.message.html">message</a></dt>
|
|
|
|
<dd></dd>
|
|
|
|
|
|
|
|
<dt><a href="module-bitmessage_structs.net_addr.html">net_addr</a></dt>
|
|
|
|
<dd></dd>
|
|
|
|
|
|
|
|
<dt><a href="module-bitmessage_structs.object.html">object</a></dt>
|
|
|
|
<dd></dd>
|
|
|
|
|
2015-01-03 17:04:14 +01:00
|
|
|
<dt><a href="module-bitmessage_structs.var_int.html">var_int</a></dt>
|
|
|
|
<dd></dd>
|
|
|
|
|
|
|
|
<dt><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></dt>
|
|
|
|
<dd></dd>
|
|
|
|
|
|
|
|
<dt><a href="module-bitmessage_structs.var_str.html">var_str</a></dt>
|
|
|
|
<dd></dd>
|
|
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</article>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<nav>
|
2015-02-14 12:00:58 +01:00
|
|
|
<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_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</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_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</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>
|
2015-01-03 17:04:14 +01:00
|
|
|
</nav>
|
|
|
|
|
|
|
|
<br class="clear">
|
|
|
|
|
|
|
|
<footer>
|
2015-02-14 12:06:56 +01:00
|
|
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Sat Feb 14 2015 14:05:38 GMT+0300 (MSK)
|
2015-01-03 17:04:14 +01:00
|
|
|
</footer>
|
|
|
|
|
|
|
|
<script> prettyPrint(); </script>
|
|
|
|
<script src="scripts/linenumber.js"> </script>
|
|
|
|
</body>
|
|
|
|
</html>
|