<?xml version="1.0"?>
<page xmlns="http://projectmallard.org/1.0/"
      type="topic"
      style="function"
      xmlns:api="http://projectmallard.org/experimental/api/"
      xmlns:ui="http://projectmallard.org/experimental/ui/"
      id="bson_reader_new_from_handle">
  <info>
    <link type="guide" xref="bson_reader_t" group="function"/>
  </info>
  <title>bson_reader_new_from_handle()</title>

  <section id="synopsis">
    <title>Synopsis</title>
    <synopsis><code mime="text/x-csrc"><![CDATA[bson_reader_t *
bson_reader_new_from_handle (void                      *handle,
                             bson_reader_read_func_t    rf,
                             bson_reader_destroy_func_t df);
]]></code></synopsis>
  </section>

  <section id="parameters">
    <title>Parameters</title>
    <table>
      <tr><td><p><code>handle</code></p></td><td><p>A user-provided pointer or NULL.</p></td></tr>
      <tr><td><p><code>rf</code></p></td><td><p>A <code xref="bson_reader_read_func_t">bson_reader_read_func_t</code>.</p></td></tr>
      <tr><td><p><code>df</code></p></td><td><p>A <code xref="bson_reader_destroy_func_t">bson_reader_destroy_func_t</code>.</p></td></tr>
    </table>
  </section>

  <section id="description">
    <title>Description</title>
    <p>This function allows for a pluggable data stream for the reader. This can be used to read from sockets, files, memory, or other arbitrary sources.</p>
  </section>

  <section id="return">
    <title>Returns</title>
    <p>A newly allocated bson_reader_t if successful; otherwise NULL.</p>
  </section>

</page>
