<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libcbor: src/cbor/bytestrings.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">libcbor
 <span id="projectnumber">0.5.0</span>
</div>
<div id="projectbrief">libcbor is a C library for parsing and generating CBOR, the general-purpose schema-less binary data format.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_cb565ba51d82ea933604984cbab6233d.html">cbor</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">bytestrings.c File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include <string.h></code><br />
<code>#include "<a class="el" href="bytestrings_8h_source.html">bytestrings.h</a>"</code><br />
<code>#include "<a class="el" href="memory__utils_8h_source.html">internal/memory_utils.h</a>"</code><br />
</div>
<p><a href="bytestrings_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a7c15a63fdc3830707eac0877a261f1cd"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="bytestrings_8c.html#a7c15a63fdc3830707eac0877a261f1cd">cbor_bytestring_length</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr>
<tr class="memdesc:a7c15a63fdc3830707eac0877a261f1cd"><td class="mdescLeft"> </td><td class="mdescRight">Returns the length of the binary data. <a href="#a7c15a63fdc3830707eac0877a261f1cd">More...</a><br /></td></tr>
<tr class="separator:a7c15a63fdc3830707eac0877a261f1cd"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2c9d6feda3d0f87782168fa817f83be6"><td class="memItemLeft" align="right" valign="top">unsigned char * </td><td class="memItemRight" valign="bottom"><a class="el" href="bytestrings_8c.html#a2c9d6feda3d0f87782168fa817f83be6">cbor_bytestring_handle</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr>
<tr class="memdesc:a2c9d6feda3d0f87782168fa817f83be6"><td class="mdescLeft"> </td><td class="mdescRight">Get the handle to the binary data. <a href="#a2c9d6feda3d0f87782168fa817f83be6">More...</a><br /></td></tr>
<tr class="separator:a2c9d6feda3d0f87782168fa817f83be6"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a368222dbbcea25e06469524e26587e2a"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="bytestrings_8c.html#a368222dbbcea25e06469524e26587e2a">cbor_bytestring_is_definite</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr>
<tr class="memdesc:a368222dbbcea25e06469524e26587e2a"><td class="mdescLeft"> </td><td class="mdescRight">Is the byte string definite? <a href="#a368222dbbcea25e06469524e26587e2a">More...</a><br /></td></tr>
<tr class="separator:a368222dbbcea25e06469524e26587e2a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a3a6c450f105bb18b6b56d20f0de4786a"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="bytestrings_8c.html#a3a6c450f105bb18b6b56d20f0de4786a">cbor_bytestring_is_indefinite</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr>
<tr class="memdesc:a3a6c450f105bb18b6b56d20f0de4786a"><td class="mdescLeft"> </td><td class="mdescRight">Is the byte string indefinite? <a href="#a3a6c450f105bb18b6b56d20f0de4786a">More...</a><br /></td></tr>
<tr class="separator:a3a6c450f105bb18b6b56d20f0de4786a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a86fc646f4520b90c85a704d27b46e69e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="bytestrings_8c.html#a86fc646f4520b90c85a704d27b46e69e">cbor_new_definite_bytestring</a> ()</td></tr>
<tr class="memdesc:a86fc646f4520b90c85a704d27b46e69e"><td class="mdescLeft"> </td><td class="mdescRight">Creates a new definite byte string. <a href="#a86fc646f4520b90c85a704d27b46e69e">More...</a><br /></td></tr>
<tr class="separator:a86fc646f4520b90c85a704d27b46e69e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6de9d6387e856c33d2ef8e8e9fdac0ac"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="bytestrings_8c.html#a6de9d6387e856c33d2ef8e8e9fdac0ac">cbor_new_indefinite_bytestring</a> ()</td></tr>
<tr class="memdesc:a6de9d6387e856c33d2ef8e8e9fdac0ac"><td class="mdescLeft"> </td><td class="mdescRight">Creates a new indefinite byte string. <a href="#a6de9d6387e856c33d2ef8e8e9fdac0ac">More...</a><br /></td></tr>
<tr class="separator:a6de9d6387e856c33d2ef8e8e9fdac0ac"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab76bd5ff62831739cd9a8d7ec2768c1a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="bytestrings_8c.html#ab76bd5ff62831739cd9a8d7ec2768c1a">cbor_build_bytestring</a> (<a class="el" href="data_8h.html#a121c5944682215e742475f12f07c0a72">cbor_data</a> handle, size_t length)</td></tr>
<tr class="memdesc:ab76bd5ff62831739cd9a8d7ec2768c1a"><td class="mdescLeft"> </td><td class="mdescRight">Creates a new byte string and initializes it. <a href="#ab76bd5ff62831739cd9a8d7ec2768c1a">More...</a><br /></td></tr>
<tr class="separator:ab76bd5ff62831739cd9a8d7ec2768c1a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a513fd06374cb4faa9e909c85e4248199"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="bytestrings_8c.html#a513fd06374cb4faa9e909c85e4248199">cbor_bytestring_set_handle</a> (<a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item, <a class="el" href="data_8h.html#aabb40e458ece40477e134a69c76693e8">cbor_mutable_data</a> <a class="el" href="common_8h.html#a9ac79315ed2dcf2c9587e8e3a9a6bc97">CBOR_RESTRICT_POINTER</a> data, size_t length)</td></tr>
<tr class="memdesc:a513fd06374cb4faa9e909c85e4248199"><td class="mdescLeft"> </td><td class="mdescRight">Set the handle to the binary data. <a href="#a513fd06374cb4faa9e909c85e4248199">More...</a><br /></td></tr>
<tr class="separator:a513fd06374cb4faa9e909c85e4248199"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8ab6255d6f8f209149bdf794dffed849"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> ** </td><td class="memItemRight" valign="bottom"><a class="el" href="bytestrings_8c.html#a8ab6255d6f8f209149bdf794dffed849">cbor_bytestring_chunks_handle</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr>
<tr class="memdesc:a8ab6255d6f8f209149bdf794dffed849"><td class="mdescLeft"> </td><td class="mdescRight">Get the handle to the array of chunks. <a href="#a8ab6255d6f8f209149bdf794dffed849">More...</a><br /></td></tr>
<tr class="separator:a8ab6255d6f8f209149bdf794dffed849"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad02102832d452fd5a5cfa96272b1095d"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="bytestrings_8c.html#ad02102832d452fd5a5cfa96272b1095d">cbor_bytestring_chunk_count</a> (const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item)</td></tr>
<tr class="memdesc:ad02102832d452fd5a5cfa96272b1095d"><td class="mdescLeft"> </td><td class="mdescRight">Get the number of chunks this string consist of. <a href="#ad02102832d452fd5a5cfa96272b1095d">More...</a><br /></td></tr>
<tr class="separator:ad02102832d452fd5a5cfa96272b1095d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a5dc8c27d6e7acfdd05fdc15c01e25b47"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="bytestrings_8c.html#a5dc8c27d6e7acfdd05fdc15c01e25b47">cbor_bytestring_add_chunk</a> (<a class="el" href="structcbor__item__t.html">cbor_item_t</a> *item, <a class="el" href="structcbor__item__t.html">cbor_item_t</a> *chunk)</td></tr>
<tr class="memdesc:a5dc8c27d6e7acfdd05fdc15c01e25b47"><td class="mdescLeft"> </td><td class="mdescRight">Appends a chunk to the bytestring. <a href="#a5dc8c27d6e7acfdd05fdc15c01e25b47">More...</a><br /></td></tr>
<tr class="separator:a5dc8c27d6e7acfdd05fdc15c01e25b47"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="ab76bd5ff62831739cd9a8d7ec2768c1a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab76bd5ff62831739cd9a8d7ec2768c1a">§ </a></span>cbor_build_bytestring()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structcbor__item__t.html">cbor_item_t</a>* cbor_build_bytestring </td>
<td>(</td>
<td class="paramtype"><a class="el" href="data_8h.html#a121c5944682215e742475f12f07c0a72">cbor_data</a> </td>
<td class="paramname"><em>handle</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>length</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a new byte string and initializes it. </p>
<p>The <code>handle</code> will be copied to a newly allocated block</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>Block of binary data </td></tr>
<tr><td class="paramname">length</td><td>Length of <code>data</code> </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A <b>new</b> byte string with content <code>handle</code>. <code>NULL</code> on malloc failure. </dd></dl>
<p>Definition at line <a class="el" href="bytestrings_8c_source.html#l00063">63</a> of file <a class="el" href="bytestrings_8c_source.html">bytestrings.c</a>.</p>
</div>
</div>
<a id="a5dc8c27d6e7acfdd05fdc15c01e25b47"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5dc8c27d6e7acfdd05fdc15c01e25b47">§ </a></span>cbor_bytestring_add_chunk()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool cbor_bytestring_add_chunk </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td>
<td class="paramname"><em>item</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td>
<td class="paramname"><em>chunk</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Appends a chunk to the bytestring. </p>
<p>Indefinite byte strings only.</p>
<p>May realloc the chunk storage.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">item[borrow]</td><td>An indefinite byte string </td></tr>
<tr><td class="paramname">item[incref]</td><td>A definite byte string </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true on success, false on realloc failure. In that case, the refcount of <code>chunk</code> is not increased and the <code>item</code> is left intact. </dd></dl>
<p>Definition at line <a class="el" href="bytestrings_8c_source.html#l00095">95</a> of file <a class="el" href="bytestrings_8c_source.html">bytestrings.c</a>.</p>
</div>
</div>
<a id="ad02102832d452fd5a5cfa96272b1095d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad02102832d452fd5a5cfa96272b1095d">§ </a></span>cbor_bytestring_chunk_count()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">size_t cbor_bytestring_chunk_count </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td>
<td class="paramname"><em>item</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the number of chunks this string consist of. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">item[borrow]</td><td>A indefinite bytestring </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The chunk count. 0 for freshly created items. </dd></dl>
<p>Definition at line <a class="el" href="bytestrings_8c_source.html#l00087">87</a> of file <a class="el" href="bytestrings_8c_source.html">bytestrings.c</a>.</p>
</div>
</div>
<a id="a8ab6255d6f8f209149bdf794dffed849"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8ab6255d6f8f209149bdf794dffed849">§ </a></span>cbor_bytestring_chunks_handle()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structcbor__item__t.html">cbor_item_t</a>** cbor_bytestring_chunks_handle </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td>
<td class="paramname"><em>item</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the handle to the array of chunks. </p>
<p>Manipulations with the memory block (e.g. sorting it) are allowed, but the validity and the number of chunks must be retained.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">item[borrow]</td><td>A indefinite byte string </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>array of <a class="el" href="bytestrings_8h.html#ad02102832d452fd5a5cfa96272b1095d" title="Get the number of chunks this string consist of. ">cbor_bytestring_chunk_count</a> definite bytestrings </dd></dl>
<p>Definition at line <a class="el" href="bytestrings_8c_source.html#l00080">80</a> of file <a class="el" href="bytestrings_8c_source.html">bytestrings.c</a>.</p>
</div>
</div>
<a id="a2c9d6feda3d0f87782168fa817f83be6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2c9d6feda3d0f87782168fa817f83be6">§ </a></span>cbor_bytestring_handle()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned char* cbor_bytestring_handle </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td>
<td class="paramname"><em>item</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the handle to the binary data. </p>
<p>Definite items only. Modifying the data is allowed. In that case, the caller takes responsibility for the effect on items this item might be a part of</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">item[borrow]</td><td>A definite byte string </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The address of the binary data. <code>NULL</code> if no data have been assigned yet. </dd></dl>
<p>Definition at line <a class="el" href="bytestrings_8c_source.html#l00018">18</a> of file <a class="el" href="bytestrings_8c_source.html">bytestrings.c</a>.</p>
</div>
</div>
<a id="a368222dbbcea25e06469524e26587e2a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a368222dbbcea25e06469524e26587e2a">§ </a></span>cbor_bytestring_is_definite()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool cbor_bytestring_is_definite </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td>
<td class="paramname"><em>item</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Is the byte string definite? </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">item[borrow]</td><td>a byte string </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Is the byte string definite? </dd></dl>
<p>Definition at line <a class="el" href="bytestrings_8c_source.html#l00024">24</a> of file <a class="el" href="bytestrings_8c_source.html">bytestrings.c</a>.</p>
</div>
</div>
<a id="a3a6c450f105bb18b6b56d20f0de4786a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3a6c450f105bb18b6b56d20f0de4786a">§ </a></span>cbor_bytestring_is_indefinite()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool cbor_bytestring_is_indefinite </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td>
<td class="paramname"><em>item</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Is the byte string indefinite? </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">item[borrow]</td><td>a byte string </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Is the byte string indefinite? </dd></dl>
<p>Definition at line <a class="el" href="bytestrings_8c_source.html#l00030">30</a> of file <a class="el" href="bytestrings_8c_source.html">bytestrings.c</a>.</p>
</div>
</div>
<a id="a7c15a63fdc3830707eac0877a261f1cd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7c15a63fdc3830707eac0877a261f1cd">§ </a></span>cbor_bytestring_length()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">size_t cbor_bytestring_length </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td>
<td class="paramname"><em>item</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the length of the binary data. </p>
<p>For definite byte strings only</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">item[borrow]</td><td>a definite bytestring </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>length of the binary data. Zero if no chunk has been attached yet </dd></dl>
<p>Definition at line <a class="el" href="bytestrings_8c_source.html#l00012">12</a> of file <a class="el" href="bytestrings_8c_source.html">bytestrings.c</a>.</p>
</div>
</div>
<a id="a513fd06374cb4faa9e909c85e4248199"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a513fd06374cb4faa9e909c85e4248199">§ </a></span>cbor_bytestring_set_handle()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void cbor_bytestring_set_handle </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structcbor__item__t.html">cbor_item_t</a> * </td>
<td class="paramname"><em>item</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="data_8h.html#aabb40e458ece40477e134a69c76693e8">cbor_mutable_data</a> <a class="el" href="common_8h.html#a9ac79315ed2dcf2c9587e8e3a9a6bc97">CBOR_RESTRICT_POINTER</a> </td>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>length</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the handle to the binary data. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">item[borrow]</td><td>A definite byte string </td></tr>
<tr><td class="paramname">data</td><td>The memory block. The caller gives up the ownership of the block. libcbor will deallocate it when appropriate using its free function </td></tr>
<tr><td class="paramname">length</td><td>Length of the data block </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="bytestrings_8c_source.html#l00072">72</a> of file <a class="el" href="bytestrings_8c_source.html">bytestrings.c</a>.</p>
</div>
</div>
<a id="a86fc646f4520b90c85a704d27b46e69e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a86fc646f4520b90c85a704d27b46e69e">§ </a></span>cbor_new_definite_bytestring()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structcbor__item__t.html">cbor_item_t</a>* cbor_new_definite_bytestring </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a new definite byte string. </p>
<p>The handle is initialized to <code>NULL</code> and length to 0</p>
<dl class="section return"><dt>Returns</dt><dd><b>new</b> definite bytestring. <code>NULL</code> on malloc failure. </dd></dl>
<p>Definition at line <a class="el" href="bytestrings_8c_source.html#l00035">35</a> of file <a class="el" href="bytestrings_8c_source.html">bytestrings.c</a>.</p>
</div>
</div>
<a id="a6de9d6387e856c33d2ef8e8e9fdac0ac"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6de9d6387e856c33d2ef8e8e9fdac0ac">§ </a></span>cbor_new_indefinite_bytestring()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structcbor__item__t.html">cbor_item_t</a>* cbor_new_indefinite_bytestring </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a new indefinite byte string. </p>
<p>The chunks array is initialized to <code>NULL</code> and chunkcount to 0</p>
<dl class="section return"><dt>Returns</dt><dd><b>new</b> indefinite bytestring. <code>NULL</code> on malloc failure. </dd></dl>
<p>Definition at line <a class="el" href="bytestrings_8c_source.html#l00046">46</a> of file <a class="el" href="bytestrings_8c_source.html">bytestrings.c</a>.</p>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Mon Feb 6 2017 00:26:19 for libcbor by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.12
</small></address>
</body>
</html>