bitmessage-js/docs/module-bitmessage_structs.PubkeyBitfield.html

813 lines
12 KiB
HTML
Raw Normal View History

2015-01-31 13:02:04 +01:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
2015-02-12 11:44:15 +01:00
<title>JSDoc: Class: PubkeyBitfield</title>
2015-01-31 13:02:04 +01:00
<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">
2015-02-12 11:44:15 +01:00
<h1 class="page-title">Class: PubkeyBitfield</h1>
2015-01-31 13:02:04 +01:00
<section>
<header>
<h2>
<span class="ancestors"><a href="module-bitmessage_structs.html">bitmessage/structs</a>.</span>
PubkeyBitfield
</h2>
</header>
<article>
<div class="container-overview">
2015-02-12 11:44:15 +01:00
<h4 class="name" id="PubkeyBitfield"><span class="type-signature"></span>new PubkeyBitfield<span class="signature">(buf<span class="signature-attributes">opt</span>, opts<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Pubkey features bitfield (MSB 0).</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
2015-01-31 13:02:04 +01:00
2015-02-12 11:44:15 +01:00
<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="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>A 4-byte bitfield buffer (will be created if
not provided or will be copied if <code>opts.copy</code> is <code>true</code>)</p></td>
</tr>
<tr>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Options</p></td>
</tr>
</tbody>
</table>
2015-01-31 13:02:04 +01:00
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2015-02-12 11:44:15 +01:00
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line1013">line 1013</a>
2015-01-31 13:02:04 +01:00
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="https://bitmessage.org/wiki/Protocol_specification#Pubkey_bitfield_features">https://bitmessage.org/wiki/Protocol_specification#Pubkey_bitfield_features</a></li>
</ul>
</dd>
</dl>
2015-02-12 11:44:15 +01:00
<h5>Example</h5>
<pre class="prettyprint"><code>var PubkeyBitfield = require("bitmessage").structs.PubkeyBitfield;
var behavior = PubkeyBitfield().set([
PubkeyBitfield.INCLUDE_DESTINATION,
PubkeyBitfield.DOES_ACK,
]).set(1);
console.log(behavior.get(PubkeyBitfield.DOES_ACK)); // true
console.log(behavior.get(15)); // false</code></pre>
2015-01-31 13:02:04 +01:00
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id=".DOES_ACK"><span class="type-signature">(static, constant) </span>DOES_ACK<span class="type-signature"> :number</span></h4>
<div class="description">
2015-02-12 11:44:15 +01:00
<p>Bit index.
If set, the receiving node does send acknowledgements (rather than
2015-01-31 13:02:04 +01:00
dropping them).</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>
2015-02-12 11:44:15 +01:00
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line1054">line 1054</a>
2015-01-31 13:02:04 +01:00
</li></ul></dd>
</dl>
<h4 class="name" id=".INCLUDE_DESTINATION"><span class="type-signature">(static, constant) </span>INCLUDE_DESTINATION<span class="type-signature"> :number</span></h4>
<div class="description">
2015-02-12 11:44:15 +01:00
<p>Bit index.
If set, the receiving node expects that the RIPEMD hash encoded in
their address preceedes the encrypted message data of msg messages
bound for them.</p>
2015-01-31 13:02:04 +01:00
</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>
2015-02-12 11:44:15 +01:00
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line1046">line 1046</a>
2015-01-31 13:02:04 +01:00
</li></ul></dd>
</dl>
2015-02-12 11:44:15 +01:00
<h4 class="name" id="buffer"><span class="type-signature"></span>buffer<span class="type-signature"> :Buffer</span></h4>
<div class="description">
<p>The contents of the bitfield.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Buffer</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#line1030">line 1030</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">(index)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
<p>Returns a boolean indicating whether the bit is set.</p>
</div>
<h5>Parameters:</h5>
2015-01-31 13:02:04 +01:00
2015-02-12 11:44:15 +01:00
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Bit index (MSB 0)</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#line1014">line 1014</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="set"><span class="type-signature"></span>set<span class="signature">(index)</span><span class="type-signature"> &rarr; {Object}</span></h4>
<div class="description">
<p>Set the given bit(s) to <code>1</code>.</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>index</code></td>
<td class="type">
<span class="param-type">number</span>
|
<span class="param-type">Array.&lt;number></span>
</td>
<td class="description last"><p>Bit(s) index (MSB 0)</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#line1022">line 1022</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns self so methods can be chained.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
2015-01-31 13:02:04 +01:00
</article>
</section>
</div>
<nav>
2015-02-12 11:44:15 +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-31 13:02:04 +01:00
</nav>
<br class="clear">
<footer>
2015-02-12 11:44:15 +01:00
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
2015-01-31 13:02:04 +01:00
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>