blob: 6a9a14729ccfaba849bdce4e1d3f3997234c8ceb [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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.20"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Qpid Proton C API: receive.c</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="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.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>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function() { init_search(); });
/* @license-end */
</script>
<link href="doxygen.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">Qpid Proton C API
&#160;<span id="projectnumber">0.32.0</span>
</div>
</td>
<td> <div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.svg"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.20 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('receive_8c-example.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- 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 class="header">
<div class="headertitle">
<div class="title">receive.c</div> </div>
</div><!--header-->
<div class="contents">
<p>Subscribes to the 'example' node and prints the message bodies received.Can be used with <a class="el" href="broker_8c-example.html">broker.c</a>, <a class="el" href="direct_8c-example.html">direct.c</a> or an external AMQP broker.</p>
<div class="fragment"><div class="line"><span class="comment">/*</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * Licensed to the Apache Software Foundation (ASF) under one</span></div>
<div class="line"><span class="comment"> * or more contributor license agreements. See the NOTICE file</span></div>
<div class="line"><span class="comment"> * distributed with this work for additional information</span></div>
<div class="line"><span class="comment"> * regarding copyright ownership. The ASF licenses this file</span></div>
<div class="line"><span class="comment"> * to you under the Apache License, Version 2.0 (the</span></div>
<div class="line"><span class="comment"> * &quot;License&quot;); you may not use this file except in compliance</span></div>
<div class="line"><span class="comment"> * with the License. You may obtain a copy of the License at</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * Unless required by applicable law or agreed to in writing,</span></div>
<div class="line"><span class="comment"> * software distributed under the License is distributed on an</span></div>
<div class="line"><span class="comment"> * &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY</span></div>
<div class="line"><span class="comment"> * KIND, either express or implied. See the License for the</span></div>
<div class="line"><span class="comment"> * specific language governing permissions and limitations</span></div>
<div class="line"><span class="comment"> * under the License.</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="connection_8h.html">proton/connection.h</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="condition_8h.html">proton/condition.h</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="delivery_8h.html">proton/delivery.h</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="link_8h.html">proton/link.h</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="message_8h.html">proton/message.h</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="proactor_8h.html">proton/proactor.h</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="session_8h.html">proton/session.h</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="transport_8h.html">proton/transport.h</a>&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;stdio.h&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;stdlib.h&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="keyword">typedef</span> <span class="keyword">struct </span>app_data_t {</div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *host, *port;</div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *amqp_address;</div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *container_id;</div>
<div class="line"> <span class="keywordtype">int</span> message_count;</div>
<div class="line"> </div>
<div class="line"> <a class="code" href="group__proactor.html#gabba42c7929dfceb9d296535bad0c93dc">pn_proactor_t</a> *proactor;</div>
<div class="line"> <span class="keywordtype">int</span> received;</div>
<div class="line"> <span class="keywordtype">bool</span> finished;</div>
<div class="line"> <a name="_a0"></a><a class="code" href="group__api__types.html#structpn__rwbytes__t">pn_rwbytes_t</a> msgin; <span class="comment">/* Partially received message */</span></div>
<div class="line">} app_data_t;</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> BATCH = 1000; <span class="comment">/* Batch size for unlimited receive */</span></div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">int</span> exit_code = 0;</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> check_condition(<a class="code" href="group__event.html#ga87f3028b4888632bbd56fb71ac737ae8">pn_event_t</a> *e, <a class="code" href="group__condition.html#ga11eb7db7d2c205169fe3d47c996a95a5">pn_condition_t</a> *cond) {</div>
<div class="line"> <span class="keywordflow">if</span> (<a name="a1"></a><a class="code" href="group__condition.html#ga112611a7a4087e050c476a430db2cfb9">pn_condition_is_set</a>(cond)) {</div>
<div class="line"> fprintf(stderr, <span class="stringliteral">&quot;%s: %s: %s\n&quot;</span>, <a name="a2"></a><a class="code" href="group__event.html#ga3a85c046c11ce692c23b9566b022d54b">pn_event_type_name</a>(<a name="a3"></a><a class="code" href="group__event.html#gacaea54ca51885933b4987c131a3d1b0d">pn_event_type</a>(e)),</div>
<div class="line"> <a name="a4"></a><a class="code" href="group__condition.html#ga05b0d374d90f11d9ebbf818662569689">pn_condition_get_name</a>(cond), <a name="a5"></a><a class="code" href="group__condition.html#gaabebb65bfcf47b6f7d83ab6fb0153bb8">pn_condition_get_description</a>(cond));</div>
<div class="line"> <a name="a6"></a><a class="code" href="group__connection.html#gac25afdf810ad188b2cb3bf31a7482ca0">pn_connection_close</a>(<a name="a7"></a><a class="code" href="group__event.html#ga4f2c6a0fdf86a43e7e9874fcd2ccaf52">pn_event_connection</a>(e));</div>
<div class="line"> exit_code = 1;</div>
<div class="line"> }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> decode_message(<a class="code" href="group__api__types.html#structpn__rwbytes__t">pn_rwbytes_t</a> data) {</div>
<div class="line"> <a class="code" href="group__message.html#gad9259fa9271e8844c8e05a7e8978e3b2">pn_message_t</a> *m = <a name="a8"></a><a class="code" href="group__message.html#gaaf98d84b9ddc1c6537dddd4c9c5b979e">pn_message</a>();</div>
<div class="line"> <span class="keywordtype">int</span> err = <a name="a9"></a><a class="code" href="group__message.html#gab0bae90838f4661b0c82c15f25e1e988">pn_message_decode</a>(m, data.<a name="a10"></a>start, data.<a name="a11"></a>size);</div>
<div class="line"> <span class="keywordflow">if</span> (!err) {</div>
<div class="line"> <span class="comment">/* Print the decoded message */</span></div>
<div class="line"> pn_string_t *s = pn_string(NULL);</div>
<div class="line"> pn_inspect(<a name="a12"></a><a class="code" href="group__message.html#ga145c06edbcccfbe97136bfb5cb2b22b1">pn_message_body</a>(m), s);</div>
<div class="line"> printf(<span class="stringliteral">&quot;%s\n&quot;</span>, pn_string_get(s));</div>
<div class="line"> pn_free(s);</div>
<div class="line"> <a name="a13"></a><a class="code" href="group__message.html#ga69aadbc3a80f1fa16962774e711392f8">pn_message_free</a>(m);</div>
<div class="line"> free(data.start);</div>
<div class="line"> } <span class="keywordflow">else</span> {</div>
<div class="line"> fprintf(stderr, <span class="stringliteral">&quot;decode_message: %s\n&quot;</span>, <a name="a14"></a><a class="code" href="group__error.html#gac6b84f09fac8e82bd41a62212d4d8f64">pn_code</a>(err));</div>
<div class="line"> exit_code = 1;</div>
<div class="line"> }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">/* Return true to continue, false to exit */</span></div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">bool</span> handle(app_data_t* app, <a class="code" href="group__event.html#ga87f3028b4888632bbd56fb71ac737ae8">pn_event_t</a>* event) {</div>
<div class="line"> <span class="keywordflow">switch</span> (<a class="code" href="group__event.html#gacaea54ca51885933b4987c131a3d1b0d">pn_event_type</a>(event)) {</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">case</span> <a name="a15"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa182e571a0310028514bce66a41063a6e">PN_CONNECTION_INIT</a>: {</div>
<div class="line"> <a class="code" href="group__connection.html#ga886351d81ff3a977a284a206526c5aff">pn_connection_t</a>* c = <a class="code" href="group__event.html#ga4f2c6a0fdf86a43e7e9874fcd2ccaf52">pn_event_connection</a>(event);</div>
<div class="line"> <a class="code" href="group__session.html#ga38ccb93b8f5c2892adafce5d5f0fbcd9">pn_session_t</a>* s = <a name="a16"></a><a class="code" href="group__session.html#ga1feff407b8fe308a14f283d193246f3c">pn_session</a>(c);</div>
<div class="line"> <a name="a17"></a><a class="code" href="group__connection.html#gac4a34e0b1fc5665b26ae47a80a422a1a">pn_connection_set_container</a>(c, app-&gt;container_id);</div>
<div class="line"> <a name="a18"></a><a class="code" href="group__connection.html#ga4c0a2d40bb95202477ccc5aaa7456670">pn_connection_open</a>(c);</div>
<div class="line"> <a name="a19"></a><a class="code" href="group__session.html#ga2b345eada2c15249caaefaa894d1aae3">pn_session_open</a>(s);</div>
<div class="line"> {</div>
<div class="line"> <a class="code" href="group__link.html#ga89dad3aa7934329a7ff467c636687bc0">pn_link_t</a>* l = <a name="a20"></a><a class="code" href="group__link.html#ga5e314b3e07b48ebcffbac63f265fa69f">pn_receiver</a>(s, <span class="stringliteral">&quot;my_receiver&quot;</span>);</div>
<div class="line"> <a name="a21"></a><a class="code" href="group__terminus.html#ga0603db45f03fcef0ef18f4f89ebf3de1">pn_terminus_set_address</a>(<a name="a22"></a><a class="code" href="group__link.html#ga2c8985a9d44a813ab1739a91ae3708a3">pn_link_source</a>(l), app-&gt;amqp_address);</div>
<div class="line"> <a name="a23"></a><a class="code" href="group__link.html#gaabaca3f5d03970a122240eebc588add6">pn_link_open</a>(l);</div>
<div class="line"> <span class="comment">/* cannot receive without granting credit: */</span></div>
<div class="line"> <a name="a24"></a><a class="code" href="group__link.html#gafec44cf1c79ec03f3ac009e1879e71a9">pn_link_flow</a>(l, app-&gt;message_count ? app-&gt;message_count : BATCH);</div>
<div class="line"> }</div>
<div class="line"> } <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">case</span> <a name="a25"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa70bbfc163d85732b5652dc70fb3330fe">PN_DELIVERY</a>: {</div>
<div class="line"> <span class="comment">/* A message (or part of a message) has been received */</span></div>
<div class="line"> <a class="code" href="group__delivery.html#gacdfce854066c0a4ff4db9f9a0478f340">pn_delivery_t</a> *d = <a name="a26"></a><a class="code" href="group__event.html#ga10fa6f53bdabe0851ebb2d8a0bf6a52c">pn_event_delivery</a>(event);</div>
<div class="line"> <span class="keywordflow">if</span> (<a name="a27"></a><a class="code" href="group__delivery.html#ga13364206124b653b90f5ee3ddae9ff35">pn_delivery_readable</a>(d)) {</div>
<div class="line"> <a class="code" href="group__link.html#ga89dad3aa7934329a7ff467c636687bc0">pn_link_t</a> *l = <a name="a28"></a><a class="code" href="group__delivery.html#gad3dd82fe9a649d70d4f3430c34699638">pn_delivery_link</a>(d);</div>
<div class="line"> <span class="keywordtype">size_t</span> size = <a name="a29"></a><a class="code" href="group__delivery.html#ga17523835dbc8d1906bd71df69d09cc40">pn_delivery_pending</a>(d);</div>
<div class="line"> <a class="code" href="group__api__types.html#structpn__rwbytes__t">pn_rwbytes_t</a>* m = &amp;app-&gt;msgin; <span class="comment">/* Append data to incoming message buffer */</span></div>
<div class="line"> <span class="keywordtype">int</span> recv;</div>
<div class="line"> <span class="keywordtype">size_t</span> oldsize = m-&gt;size;</div>
<div class="line"> m-&gt;size += size;</div>
<div class="line"> m-&gt;start = (<span class="keywordtype">char</span>*)realloc(m-&gt;start, m-&gt;size);</div>
<div class="line"> recv = <a name="a30"></a><a class="code" href="group__link.html#ga06c97ce7396973dca0d311567f25f95a">pn_link_recv</a>(l, m-&gt;start + oldsize, m-&gt;size);</div>
<div class="line"> <span class="keywordflow">if</span> (recv == <a name="a31"></a><a class="code" href="group__error.html#ga82db456291c2627e31becc44b733a7f0">PN_ABORTED</a>) {</div>
<div class="line"> printf(<span class="stringliteral">&quot;Message aborted\n&quot;</span>);</div>
<div class="line"> m-&gt;size = 0; <span class="comment">/* Forget the data we accumulated */</span></div>
<div class="line"> <a name="a32"></a><a class="code" href="group__delivery.html#ga98c275fd7158e8b9d7d48d70503d68df">pn_delivery_settle</a>(d); <span class="comment">/* Free the delivery so we can receive the next message */</span></div>
<div class="line"> <a class="code" href="group__link.html#gafec44cf1c79ec03f3ac009e1879e71a9">pn_link_flow</a>(l, 1); <span class="comment">/* Replace credit for aborted message */</span></div>
<div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (recv &lt; 0 &amp;&amp; recv != <a name="a33"></a><a class="code" href="group__error.html#ga9e0f51b097f94293cdbbdeb5422a27a3">PN_EOS</a>) { <span class="comment">/* Unexpected error */</span></div>
<div class="line"> <a name="a34"></a><a class="code" href="group__condition.html#ga65d9818487fc61e7ca75a9ec4abc8676">pn_condition_format</a>(<a name="a35"></a><a class="code" href="group__link.html#ga52c99044eabb7712efa2f1098c760804">pn_link_condition</a>(l), <span class="stringliteral">&quot;broker&quot;</span>, <span class="stringliteral">&quot;PN_DELIVERY error: %s&quot;</span>, <a class="code" href="group__error.html#gac6b84f09fac8e82bd41a62212d4d8f64">pn_code</a>(recv));</div>
<div class="line"> <a name="a36"></a><a class="code" href="group__link.html#ga4851693eb6a16fd9ab61e2df6f00770d">pn_link_close</a>(l); <span class="comment">/* Unexpected error, close the link */</span></div>
<div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!<a name="a37"></a><a class="code" href="group__delivery.html#ga23c7b3c678228ccb21378e7c8ec9a72d">pn_delivery_partial</a>(d)) { <span class="comment">/* Message is complete */</span></div>
<div class="line"> decode_message(*m);</div>
<div class="line"> *m = pn_rwbytes_null; <span class="comment">/* Reset the buffer for the next message*/</span></div>
<div class="line"> <span class="comment">/* Accept the delivery */</span></div>
<div class="line"> <a name="a38"></a><a class="code" href="group__delivery.html#ga570c54003c2ba18b84405737925e5176">pn_delivery_update</a>(d, <a name="a39"></a><a class="code" href="group__delivery.html#gac64952b813a707586c6b3898e09552e4">PN_ACCEPTED</a>);</div>
<div class="line"> <a class="code" href="group__delivery.html#ga98c275fd7158e8b9d7d48d70503d68df">pn_delivery_settle</a>(d); <span class="comment">/* settle and free d */</span></div>
<div class="line"> <span class="keywordflow">if</span> (app-&gt;message_count == 0) {</div>
<div class="line"> <span class="comment">/* receive forever - see if more credit is needed */</span></div>
<div class="line"> <span class="keywordflow">if</span> (<a name="a40"></a><a class="code" href="group__link.html#ga55428637f3b8c446efd5fea3f26c932d">pn_link_credit</a>(l) &lt; BATCH/2) {</div>
<div class="line"> <span class="comment">/* Grant enough credit to bring it up to BATCH: */</span></div>
<div class="line"> <a class="code" href="group__link.html#gafec44cf1c79ec03f3ac009e1879e71a9">pn_link_flow</a>(l, BATCH - <a class="code" href="group__link.html#ga55428637f3b8c446efd5fea3f26c932d">pn_link_credit</a>(l));</div>
<div class="line"> }</div>
<div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (++app-&gt;received &gt;= app-&gt;message_count) {</div>
<div class="line"> <a class="code" href="group__session.html#ga38ccb93b8f5c2892adafce5d5f0fbcd9">pn_session_t</a> *ssn = <a name="a41"></a><a class="code" href="group__link.html#gac63e43305fb1a5e3b14399a9ddc8f24d">pn_link_session</a>(l);</div>
<div class="line"> printf(<span class="stringliteral">&quot;%d messages received\n&quot;</span>, app-&gt;received);</div>
<div class="line"> <a class="code" href="group__link.html#ga4851693eb6a16fd9ab61e2df6f00770d">pn_link_close</a>(l);</div>
<div class="line"> <a name="a42"></a><a class="code" href="group__session.html#ga12e5c4e71b0df4087d16ccc8b63b42b5">pn_session_close</a>(ssn);</div>
<div class="line"> <a class="code" href="group__connection.html#gac25afdf810ad188b2cb3bf31a7482ca0">pn_connection_close</a>(<a name="a43"></a><a class="code" href="group__session.html#gaa45a8aa758334528a86cb7914ebe8545">pn_session_connection</a>(ssn));</div>
<div class="line"> }</div>
<div class="line"> }</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">case</span> <a name="a44"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa1ca722ce3c0b2c13a33636cded8430ba">PN_TRANSPORT_CLOSED</a>:</div>
<div class="line"> check_condition(event, <a name="a45"></a><a class="code" href="group__transport.html#gac458d9fdb684f9501e89b96fc51f5c34">pn_transport_condition</a>(<a name="a46"></a><a class="code" href="group__event.html#ga14525ae84870388141898bbf57f2b151">pn_event_transport</a>(event)));</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">case</span> <a name="a47"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa1252529cf9f03d214c9b4fea5cf11b2f">PN_CONNECTION_REMOTE_CLOSE</a>:</div>
<div class="line"> check_condition(event, <a name="a48"></a><a class="code" href="group__connection.html#ga72a362389b99d8e891bf2e4fb4290754">pn_connection_remote_condition</a>(<a class="code" href="group__event.html#ga4f2c6a0fdf86a43e7e9874fcd2ccaf52">pn_event_connection</a>(event)));</div>
<div class="line"> <a class="code" href="group__connection.html#gac25afdf810ad188b2cb3bf31a7482ca0">pn_connection_close</a>(<a class="code" href="group__event.html#ga4f2c6a0fdf86a43e7e9874fcd2ccaf52">pn_event_connection</a>(event));</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">case</span> <a name="a49"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa3410075b825c59b8f4efdcddf5a5b135">PN_SESSION_REMOTE_CLOSE</a>:</div>
<div class="line"> check_condition(event, <a name="a50"></a><a class="code" href="group__session.html#gae21b3fda1567bad1f8a8fe162ffaeece">pn_session_remote_condition</a>(<a name="a51"></a><a class="code" href="group__event.html#gaf4af0bfbe0e0a8e432f0e803df14ecb5">pn_event_session</a>(event)));</div>
<div class="line"> <a class="code" href="group__connection.html#gac25afdf810ad188b2cb3bf31a7482ca0">pn_connection_close</a>(<a class="code" href="group__event.html#ga4f2c6a0fdf86a43e7e9874fcd2ccaf52">pn_event_connection</a>(event));</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">case</span> <a name="a52"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa1153f0108be071c31210dd1cd3e40a1f">PN_LINK_REMOTE_CLOSE</a>:</div>
<div class="line"> <span class="keywordflow">case</span> <a name="a53"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa5a84b68a2bd5ca705187381a785121d2">PN_LINK_REMOTE_DETACH</a>:</div>
<div class="line"> check_condition(event, <a name="a54"></a><a class="code" href="group__link.html#ga97dc5133125c9b7e4afbb1b76e6efe7b">pn_link_remote_condition</a>(<a name="a55"></a><a class="code" href="group__event.html#ga75f230ef55f03a1f943df79279f8d111">pn_event_link</a>(event)));</div>
<div class="line"> <a class="code" href="group__connection.html#gac25afdf810ad188b2cb3bf31a7482ca0">pn_connection_close</a>(<a class="code" href="group__event.html#ga4f2c6a0fdf86a43e7e9874fcd2ccaf52">pn_event_connection</a>(event));</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">case</span> <a name="a56"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa894e93f167ef39e28a07c9cdf6b1181b">PN_PROACTOR_INACTIVE</a>:</div>
<div class="line"> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">default</span>:</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> run(app_data_t *app) {</div>
<div class="line"> <span class="comment">/* Loop and handle events */</span></div>
<div class="line"> <span class="keywordflow">do</span> {</div>
<div class="line"> <a class="code" href="group__proactor.html#ga6bc581dfeaa8e8d46d07d37229d565c9">pn_event_batch_t</a> *events = <a name="a57"></a><a class="code" href="group__proactor.html#ga2b66a46f3e557010ec61bd105326753d">pn_proactor_wait</a>(app-&gt;proactor);</div>
<div class="line"> <a class="code" href="group__event.html#ga87f3028b4888632bbd56fb71ac737ae8">pn_event_t</a> *e;</div>
<div class="line"> <span class="keywordflow">for</span> (e = <a name="a58"></a><a class="code" href="group__proactor.html#ga6dafc0823e7f5a815600d0c9738555f5">pn_event_batch_next</a>(events); e; e = <a class="code" href="group__proactor.html#ga6dafc0823e7f5a815600d0c9738555f5">pn_event_batch_next</a>(events)) {</div>
<div class="line"> <span class="keywordflow">if</span> (!handle(app, e) || exit_code != 0) {</div>
<div class="line"> <span class="keywordflow">return</span>;</div>
<div class="line"> }</div>
<div class="line"> }</div>
<div class="line"> <a name="a59"></a><a class="code" href="group__proactor.html#gade60ff2292b74841766f953b906285c0">pn_proactor_done</a>(app-&gt;proactor, events);</div>
<div class="line"> } <span class="keywordflow">while</span>(<span class="keyword">true</span>);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv) {</div>
<div class="line"> <span class="keyword">struct </span>app_data_t app = {0};</div>
<div class="line"> <span class="keywordtype">char</span> addr[<a name="a60"></a><a class="code" href="group__proactor.html#ga29ae114b42fb797c103dc9883ebcb256">PN_MAX_ADDR</a>];</div>
<div class="line"> </div>
<div class="line"> app.container_id = argv[0]; <span class="comment">/* Should be unique */</span></div>
<div class="line"> app.host = (argc &gt; 1) ? argv[1] : <span class="stringliteral">&quot;&quot;</span>;</div>
<div class="line"> app.port = (argc &gt; 2) ? argv[2] : <span class="stringliteral">&quot;amqp&quot;</span>;</div>
<div class="line"> app.amqp_address = (argc &gt; 3) ? argv[3] : <span class="stringliteral">&quot;examples&quot;</span>;</div>
<div class="line"> app.message_count = (argc &gt; 4) ? atoi(argv[4]) : 10;</div>
<div class="line"> </div>
<div class="line"> <span class="comment">/* Create the proactor and connect */</span></div>
<div class="line"> app.proactor = <a name="a61"></a><a class="code" href="group__proactor.html#gac2a925b3de00efd8cd40fa9920169554">pn_proactor</a>();</div>
<div class="line"> <a name="a62"></a><a class="code" href="group__proactor.html#gaf67a7642c9003b36255b58776b494c96">pn_proactor_addr</a>(addr, <span class="keyword">sizeof</span>(addr), app.host, app.port);</div>
<div class="line"> <a name="a63"></a><a class="code" href="group__proactor.html#gabb093e51449351cf5530bb300bd67ba1">pn_proactor_connect2</a>(app.proactor, NULL, NULL, addr);</div>
<div class="line"> run(&amp;app);</div>
<div class="line"> <a name="a64"></a><a class="code" href="group__proactor.html#ga5260c2653d4af5eb2f1c8c6190e9d6cf">pn_proactor_free</a>(app.proactor);</div>
<div class="line"> <span class="keywordflow">return</span> exit_code;</div>
<div class="line">}</div>
</div><!-- fragment --> </div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="agroup__delivery_html_ga98c275fd7158e8b9d7d48d70503d68df"><div class="ttname"><a href="group__delivery.html#ga98c275fd7158e8b9d7d48d70503d68df">pn_delivery_settle</a></div><div class="ttdeci">void pn_delivery_settle(pn_delivery_t *delivery)</div><div class="ttdoc">Settle a delivery.</div></div>
<div class="ttc" id="agroup__connection_html_ga72a362389b99d8e891bf2e4fb4290754"><div class="ttname"><a href="group__connection.html#ga72a362389b99d8e891bf2e4fb4290754">pn_connection_remote_condition</a></div><div class="ttdeci">pn_condition_t * pn_connection_remote_condition(pn_connection_t *connection)</div><div class="ttdoc">Get the remote condition associated with the connection endpoint.</div></div>
<div class="ttc" id="agroup__proactor_html_ga6bc581dfeaa8e8d46d07d37229d565c9"><div class="ttname"><a href="group__proactor.html#ga6bc581dfeaa8e8d46d07d37229d565c9">pn_event_batch_t</a></div><div class="ttdeci">struct pn_event_batch_t pn_event_batch_t</div><div class="ttdoc">A batch of events that must be handled in sequence.</div><div class="ttdef"><b>Definition:</b> types.h:462</div></div>
<div class="ttc" id="agroup__link_html_gaabaca3f5d03970a122240eebc588add6"><div class="ttname"><a href="group__link.html#gaabaca3f5d03970a122240eebc588add6">pn_link_open</a></div><div class="ttdeci">void pn_link_open(pn_link_t *link)</div><div class="ttdoc">Open a link.</div></div>
<div class="ttc" id="agroup__link_html_ga5e314b3e07b48ebcffbac63f265fa69f"><div class="ttname"><a href="group__link.html#ga5e314b3e07b48ebcffbac63f265fa69f">pn_receiver</a></div><div class="ttdeci">pn_link_t * pn_receiver(pn_session_t *session, const char *name)</div><div class="ttdoc">Construct a new receiver on a session.</div></div>
<div class="ttc" id="agroup__proactor_html_ga2b66a46f3e557010ec61bd105326753d"><div class="ttname"><a href="group__proactor.html#ga2b66a46f3e557010ec61bd105326753d">pn_proactor_wait</a></div><div class="ttdeci">PNP_EXTERN pn_event_batch_t * pn_proactor_wait(pn_proactor_t *proactor)</div><div class="ttdoc">Wait until there are Proactor events to handle.</div></div>
<div class="ttc" id="agroup__link_html_ga52c99044eabb7712efa2f1098c760804"><div class="ttname"><a href="group__link.html#ga52c99044eabb7712efa2f1098c760804">pn_link_condition</a></div><div class="ttdeci">pn_condition_t * pn_link_condition(pn_link_t *link)</div><div class="ttdoc">Get the local condition associated with a link endpoint.</div></div>
<div class="ttc" id="agroup__event_html_ga87f3028b4888632bbd56fb71ac737ae8"><div class="ttname"><a href="group__event.html#ga87f3028b4888632bbd56fb71ac737ae8">pn_event_t</a></div><div class="ttdeci">struct pn_event_t pn_event_t</div><div class="ttdoc">Notification of a state change in the protocol engine.</div><div class="ttdef"><b>Definition:</b> event.h:75</div></div>
<div class="ttc" id="agroup__proactor_html_ga6dafc0823e7f5a815600d0c9738555f5"><div class="ttname"><a href="group__proactor.html#ga6dafc0823e7f5a815600d0c9738555f5">pn_event_batch_next</a></div><div class="ttdeci">PNP_EXTERN pn_event_t * pn_event_batch_next(pn_event_batch_t *batch)</div><div class="ttdoc">Remove the next event from the batch and return it.</div></div>
<div class="ttc" id="agroup__terminus_html_ga0603db45f03fcef0ef18f4f89ebf3de1"><div class="ttname"><a href="group__terminus.html#ga0603db45f03fcef0ef18f4f89ebf3de1">pn_terminus_set_address</a></div><div class="ttdeci">int pn_terminus_set_address(pn_terminus_t *terminus, const char *address)</div><div class="ttdoc">Set the address of a terminus object.</div></div>
<div class="ttc" id="agroup__message_html_ga69aadbc3a80f1fa16962774e711392f8"><div class="ttname"><a href="group__message.html#ga69aadbc3a80f1fa16962774e711392f8">pn_message_free</a></div><div class="ttdeci">void pn_message_free(pn_message_t *msg)</div><div class="ttdoc">Free a previously constructed pn_message_t.</div></div>
<div class="ttc" id="agroup__event_html_gga4876e2eed24a4d4e4c52b99842103cdaa70bbfc163d85732b5652dc70fb3330fe"><div class="ttname"><a href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa70bbfc163d85732b5652dc70fb3330fe">PN_DELIVERY</a></div><div class="ttdeci">@ PN_DELIVERY</div><div class="ttdoc">A delivery has been created or updated.</div><div class="ttdef"><b>Definition:</b> event.h:254</div></div>
<div class="ttc" id="agroup__event_html_gga4876e2eed24a4d4e4c52b99842103cdaa1153f0108be071c31210dd1cd3e40a1f"><div class="ttname"><a href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa1153f0108be071c31210dd1cd3e40a1f">PN_LINK_REMOTE_CLOSE</a></div><div class="ttdeci">@ PN_LINK_REMOTE_CLOSE</div><div class="ttdoc">The remote endpoint has closed the link.</div><div class="ttdef"><b>Definition:</b> event.h:223</div></div>
<div class="ttc" id="alink_8h_html"><div class="ttname"><a href="link_8h.html">link.h</a></div><div class="ttdoc">A channel for transferring messages.</div></div>
<div class="ttc" id="agroup__link_html_gac63e43305fb1a5e3b14399a9ddc8f24d"><div class="ttname"><a href="group__link.html#gac63e43305fb1a5e3b14399a9ddc8f24d">pn_link_session</a></div><div class="ttdeci">pn_session_t * pn_link_session(pn_link_t *link)</div><div class="ttdoc">Get the parent session for a link object.</div></div>
<div class="ttc" id="agroup__event_html_gga4876e2eed24a4d4e4c52b99842103cdaa1ca722ce3c0b2c13a33636cded8430ba"><div class="ttname"><a href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa1ca722ce3c0b2c13a33636cded8430ba">PN_TRANSPORT_CLOSED</a></div><div class="ttdeci">@ PN_TRANSPORT_CLOSED</div><div class="ttdoc">Indicates that the both the head and tail of the transport are closed.</div><div class="ttdef"><b>Definition:</b> event.h:295</div></div>
<div class="ttc" id="agroup__condition_html_ga05b0d374d90f11d9ebbf818662569689"><div class="ttname"><a href="group__condition.html#ga05b0d374d90f11d9ebbf818662569689">pn_condition_get_name</a></div><div class="ttdeci">const char * pn_condition_get_name(pn_condition_t *condition)</div><div class="ttdoc">Returns the name associated with the exceptional condition, or NULL if there is no conditional inform...</div></div>
<div class="ttc" id="agroup__event_html_gga4876e2eed24a4d4e4c52b99842103cdaa894e93f167ef39e28a07c9cdf6b1181b"><div class="ttname"><a href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa894e93f167ef39e28a07c9cdf6b1181b">PN_PROACTOR_INACTIVE</a></div><div class="ttdeci">@ PN_PROACTOR_INACTIVE</div><div class="ttdoc">The proactor has become inactive: all listeners and connections were closed and the timeout (if set) ...</div><div class="ttdef"><b>Definition:</b> event.h:344</div></div>
<div class="ttc" id="agroup__session_html_ga2b345eada2c15249caaefaa894d1aae3"><div class="ttname"><a href="group__session.html#ga2b345eada2c15249caaefaa894d1aae3">pn_session_open</a></div><div class="ttdeci">void pn_session_open(pn_session_t *session)</div><div class="ttdoc">Open a session.</div></div>
<div class="ttc" id="agroup__link_html_ga97dc5133125c9b7e4afbb1b76e6efe7b"><div class="ttname"><a href="group__link.html#ga97dc5133125c9b7e4afbb1b76e6efe7b">pn_link_remote_condition</a></div><div class="ttdeci">pn_condition_t * pn_link_remote_condition(pn_link_t *link)</div><div class="ttdoc">Get the remote condition associated with a link endpoint.</div></div>
<div class="ttc" id="agroup__session_html_ga1feff407b8fe308a14f283d193246f3c"><div class="ttname"><a href="group__session.html#ga1feff407b8fe308a14f283d193246f3c">pn_session</a></div><div class="ttdeci">pn_session_t * pn_session(pn_connection_t *connection)</div><div class="ttdoc">Factory for creating a new session on a given connection object.</div></div>
<div class="ttc" id="agroup__proactor_html_gabb093e51449351cf5530bb300bd67ba1"><div class="ttname"><a href="group__proactor.html#gabb093e51449351cf5530bb300bd67ba1">pn_proactor_connect2</a></div><div class="ttdeci">PNP_EXTERN void pn_proactor_connect2(pn_proactor_t *proactor, pn_connection_t *connection, pn_transport_t *transport, const char *addr)</div><div class="ttdoc">Connect transport to addr and bind to connection.</div></div>
<div class="ttc" id="agroup__condition_html_ga65d9818487fc61e7ca75a9ec4abc8676"><div class="ttname"><a href="group__condition.html#ga65d9818487fc61e7ca75a9ec4abc8676">pn_condition_format</a></div><div class="ttdeci">int pn_condition_format(pn_condition_t *, const char *name, const char *fmt,...)</div><div class="ttdoc">Set the name and printf-style formatted description.</div></div>
<div class="ttc" id="agroup__message_html_gad9259fa9271e8844c8e05a7e8978e3b2"><div class="ttname"><a href="group__message.html#gad9259fa9271e8844c8e05a7e8978e3b2">pn_message_t</a></div><div class="ttdeci">struct pn_message_t pn_message_t</div><div class="ttdoc">An AMQP Message object.</div><div class="ttdef"><b>Definition:</b> message.h:51</div></div>
<div class="ttc" id="agroup__condition_html_gaabebb65bfcf47b6f7d83ab6fb0153bb8"><div class="ttname"><a href="group__condition.html#gaabebb65bfcf47b6f7d83ab6fb0153bb8">pn_condition_get_description</a></div><div class="ttdeci">const char * pn_condition_get_description(pn_condition_t *condition)</div><div class="ttdoc">Gets the description associated with the exceptional condition.</div></div>
<div class="ttc" id="agroup__delivery_html_ga570c54003c2ba18b84405737925e5176"><div class="ttname"><a href="group__delivery.html#ga570c54003c2ba18b84405737925e5176">pn_delivery_update</a></div><div class="ttdeci">void pn_delivery_update(pn_delivery_t *delivery, uint64_t state)</div><div class="ttdoc">Update the disposition of a delivery.</div></div>
<div class="ttc" id="agroup__message_html_gaaf98d84b9ddc1c6537dddd4c9c5b979e"><div class="ttname"><a href="group__message.html#gaaf98d84b9ddc1c6537dddd4c9c5b979e">pn_message</a></div><div class="ttdeci">pn_message_t * pn_message(void)</div><div class="ttdoc">Construct a new pn_message_t.</div></div>
<div class="ttc" id="agroup__error_html_gac6b84f09fac8e82bd41a62212d4d8f64"><div class="ttname"><a href="group__error.html#gac6b84f09fac8e82bd41a62212d4d8f64">pn_code</a></div><div class="ttdeci">const char * pn_code(int code)</div><div class="ttdoc">Get the name of the error code.</div></div>
<div class="ttc" id="agroup__api__types_html_structpn__rwbytes__t"><div class="ttname"><a href="group__api__types.html#structpn__rwbytes__t">pn_rwbytes_t</a></div><div class="ttdoc">A non-const byte buffer.</div><div class="ttdef"><b>Definition:</b> types.h:235</div></div>
<div class="ttc" id="agroup__session_html_ga12e5c4e71b0df4087d16ccc8b63b42b5"><div class="ttname"><a href="group__session.html#ga12e5c4e71b0df4087d16ccc8b63b42b5">pn_session_close</a></div><div class="ttdeci">void pn_session_close(pn_session_t *session)</div><div class="ttdoc">Close a session.</div></div>
<div class="ttc" id="acondition_8h_html"><div class="ttname"><a href="condition_8h.html">condition.h</a></div><div class="ttdoc">An endpoint error state.</div></div>
<div class="ttc" id="agroup__proactor_html_gabba42c7929dfceb9d296535bad0c93dc"><div class="ttname"><a href="group__proactor.html#gabba42c7929dfceb9d296535bad0c93dc">pn_proactor_t</a></div><div class="ttdeci">struct pn_proactor_t pn_proactor_t</div><div class="ttdoc">A harness for multithreaded IO.</div><div class="ttdef"><b>Definition:</b> types.h:442</div></div>
<div class="ttc" id="agroup__event_html_ga10fa6f53bdabe0851ebb2d8a0bf6a52c"><div class="ttname"><a href="group__event.html#ga10fa6f53bdabe0851ebb2d8a0bf6a52c">pn_event_delivery</a></div><div class="ttdeci">pn_delivery_t * pn_event_delivery(pn_event_t *event)</div><div class="ttdoc">Get the delivery associated with an event.</div></div>
<div class="ttc" id="amessage_8h_html"><div class="ttname"><a href="message_8h.html">message.h</a></div><div class="ttdoc">A mutable holder of application content.</div></div>
<div class="ttc" id="agroup__event_html_gga4876e2eed24a4d4e4c52b99842103cdaa182e571a0310028514bce66a41063a6e"><div class="ttname"><a href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa182e571a0310028514bce66a41063a6e">PN_CONNECTION_INIT</a></div><div class="ttdeci">@ PN_CONNECTION_INIT</div><div class="ttdoc">The connection has been created.</div><div class="ttdef"><b>Definition:</b> event.h:113</div></div>
<div class="ttc" id="agroup__proactor_html_gac2a925b3de00efd8cd40fa9920169554"><div class="ttname"><a href="group__proactor.html#gac2a925b3de00efd8cd40fa9920169554">pn_proactor</a></div><div class="ttdeci">PNP_EXTERN pn_proactor_t * pn_proactor(void)</div><div class="ttdoc">Create a proactor.</div></div>
<div class="ttc" id="agroup__delivery_html_gacdfce854066c0a4ff4db9f9a0478f340"><div class="ttname"><a href="group__delivery.html#gacdfce854066c0a4ff4db9f9a0478f340">pn_delivery_t</a></div><div class="ttdeci">struct pn_delivery_t pn_delivery_t</div><div class="ttdoc">An AMQP Delivery object.</div><div class="ttdef"><b>Definition:</b> types.h:405</div></div>
<div class="ttc" id="agroup__link_html_gafec44cf1c79ec03f3ac009e1879e71a9"><div class="ttname"><a href="group__link.html#gafec44cf1c79ec03f3ac009e1879e71a9">pn_link_flow</a></div><div class="ttdeci">void pn_link_flow(pn_link_t *receiver, int credit)</div><div class="ttdoc">Grant credit for incoming deliveries on a receiver.</div></div>
<div class="ttc" id="agroup__condition_html_ga11eb7db7d2c205169fe3d47c996a95a5"><div class="ttname"><a href="group__condition.html#ga11eb7db7d2c205169fe3d47c996a95a5">pn_condition_t</a></div><div class="ttdeci">struct pn_condition_t pn_condition_t</div><div class="ttdoc">An AMQP Condition object.</div><div class="ttdef"><b>Definition:</b> condition.h:64</div></div>
<div class="ttc" id="agroup__event_html_gga4876e2eed24a4d4e4c52b99842103cdaa5a84b68a2bd5ca705187381a785121d2"><div class="ttname"><a href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa5a84b68a2bd5ca705187381a785121d2">PN_LINK_REMOTE_DETACH</a></div><div class="ttdeci">@ PN_LINK_REMOTE_DETACH</div><div class="ttdoc">The remote endpoint has detached the link.</div><div class="ttdef"><b>Definition:</b> event.h:235</div></div>
<div class="ttc" id="agroup__error_html_ga9e0f51b097f94293cdbbdeb5422a27a3"><div class="ttname"><a href="group__error.html#ga9e0f51b097f94293cdbbdeb5422a27a3">PN_EOS</a></div><div class="ttdeci">#define PN_EOS</div><div class="ttdoc">End of stream.</div><div class="ttdef"><b>Definition:</b> error.h:47</div></div>
<div class="ttc" id="agroup__event_html_ga4f2c6a0fdf86a43e7e9874fcd2ccaf52"><div class="ttname"><a href="group__event.html#ga4f2c6a0fdf86a43e7e9874fcd2ccaf52">pn_event_connection</a></div><div class="ttdeci">pn_connection_t * pn_event_connection(pn_event_t *event)</div><div class="ttdoc">Get the connection associated with an event.</div></div>
<div class="ttc" id="agroup__event_html_gga4876e2eed24a4d4e4c52b99842103cdaa1252529cf9f03d214c9b4fea5cf11b2f"><div class="ttname"><a href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa1252529cf9f03d214c9b4fea5cf11b2f">PN_CONNECTION_REMOTE_CLOSE</a></div><div class="ttdeci">@ PN_CONNECTION_REMOTE_CLOSE</div><div class="ttdoc">The remote endpoint has closed the connection.</div><div class="ttdef"><b>Definition:</b> event.h:149</div></div>
<div class="ttc" id="agroup__message_html_gab0bae90838f4661b0c82c15f25e1e988"><div class="ttname"><a href="group__message.html#gab0bae90838f4661b0c82c15f25e1e988">pn_message_decode</a></div><div class="ttdeci">int pn_message_decode(pn_message_t *msg, const char *bytes, size_t size)</div><div class="ttdoc">Decode/load message content from AMQP formatted binary data.</div></div>
<div class="ttc" id="agroup__condition_html_ga112611a7a4087e050c476a430db2cfb9"><div class="ttname"><a href="group__condition.html#ga112611a7a4087e050c476a430db2cfb9">pn_condition_is_set</a></div><div class="ttdeci">bool pn_condition_is_set(pn_condition_t *condition)</div><div class="ttdoc">Returns true if the condition object is holding some information, i.e.</div></div>
<div class="ttc" id="agroup__connection_html_ga886351d81ff3a977a284a206526c5aff"><div class="ttname"><a href="group__connection.html#ga886351d81ff3a977a284a206526c5aff">pn_connection_t</a></div><div class="ttdeci">struct pn_connection_t pn_connection_t</div><div class="ttdoc">An AMQP Connection object.</div><div class="ttdef"><b>Definition:</b> types.h:285</div></div>
<div class="ttc" id="agroup__event_html_gga4876e2eed24a4d4e4c52b99842103cdaa3410075b825c59b8f4efdcddf5a5b135"><div class="ttname"><a href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa3410075b825c59b8f4efdcddf5a5b135">PN_SESSION_REMOTE_CLOSE</a></div><div class="ttdeci">@ PN_SESSION_REMOTE_CLOSE</div><div class="ttdoc">The remote endpoint has closed the session.</div><div class="ttdef"><b>Definition:</b> event.h:186</div></div>
<div class="ttc" id="agroup__connection_html_gac25afdf810ad188b2cb3bf31a7482ca0"><div class="ttname"><a href="group__connection.html#gac25afdf810ad188b2cb3bf31a7482ca0">pn_connection_close</a></div><div class="ttdeci">void pn_connection_close(pn_connection_t *connection)</div><div class="ttdoc">Close a connection.</div></div>
<div class="ttc" id="agroup__event_html_gaf4af0bfbe0e0a8e432f0e803df14ecb5"><div class="ttname"><a href="group__event.html#gaf4af0bfbe0e0a8e432f0e803df14ecb5">pn_event_session</a></div><div class="ttdeci">pn_session_t * pn_event_session(pn_event_t *event)</div><div class="ttdoc">Get the session associated with an event.</div></div>
<div class="ttc" id="agroup__proactor_html_ga5260c2653d4af5eb2f1c8c6190e9d6cf"><div class="ttname"><a href="group__proactor.html#ga5260c2653d4af5eb2f1c8c6190e9d6cf">pn_proactor_free</a></div><div class="ttdeci">PNP_EXTERN void pn_proactor_free(pn_proactor_t *proactor)</div><div class="ttdoc">Free the proactor.</div></div>
<div class="ttc" id="aproactor_8h_html"><div class="ttname"><a href="proactor_8h.html">proactor.h</a></div><div class="ttdoc">Unsettled API - An API for multithreaded IO.</div></div>
<div class="ttc" id="aconnection_8h_html"><div class="ttname"><a href="connection_8h.html">connection.h</a></div><div class="ttdoc">A connection to a remote AMQP peer.</div></div>
<div class="ttc" id="agroup__link_html_ga06c97ce7396973dca0d311567f25f95a"><div class="ttname"><a href="group__link.html#ga06c97ce7396973dca0d311567f25f95a">pn_link_recv</a></div><div class="ttdeci">ssize_t pn_link_recv(pn_link_t *receiver, char *bytes, size_t n)</div><div class="ttdoc">Receive message data for the current delivery on a link.</div></div>
<div class="ttc" id="agroup__delivery_html_ga23c7b3c678228ccb21378e7c8ec9a72d"><div class="ttname"><a href="group__delivery.html#ga23c7b3c678228ccb21378e7c8ec9a72d">pn_delivery_partial</a></div><div class="ttdeci">bool pn_delivery_partial(pn_delivery_t *delivery)</div><div class="ttdoc">Check if a delivery only has partial message data.</div></div>
<div class="ttc" id="agroup__connection_html_ga4c0a2d40bb95202477ccc5aaa7456670"><div class="ttname"><a href="group__connection.html#ga4c0a2d40bb95202477ccc5aaa7456670">pn_connection_open</a></div><div class="ttdeci">void pn_connection_open(pn_connection_t *connection)</div><div class="ttdoc">Open a connection.</div></div>
<div class="ttc" id="agroup__link_html_ga89dad3aa7934329a7ff467c636687bc0"><div class="ttname"><a href="group__link.html#ga89dad3aa7934329a7ff467c636687bc0">pn_link_t</a></div><div class="ttdeci">struct pn_link_t pn_link_t</div><div class="ttdoc">An AMQP Link object.</div><div class="ttdef"><b>Definition:</b> types.h:315</div></div>
<div class="ttc" id="agroup__proactor_html_gade60ff2292b74841766f953b906285c0"><div class="ttname"><a href="group__proactor.html#gade60ff2292b74841766f953b906285c0">pn_proactor_done</a></div><div class="ttdeci">PNP_EXTERN void pn_proactor_done(pn_proactor_t *proactor, pn_event_batch_t *events)</div><div class="ttdoc">Call when finished handling a batch of events.</div></div>
<div class="ttc" id="agroup__delivery_html_gac64952b813a707586c6b3898e09552e4"><div class="ttname"><a href="group__delivery.html#gac64952b813a707586c6b3898e09552e4">PN_ACCEPTED</a></div><div class="ttdeci">#define PN_ACCEPTED</div><div class="ttdoc">The PN_ACCEPTED delivery state is a terminal state indicating that the delivery was successfully proc...</div><div class="ttdef"><b>Definition:</b> disposition.h:66</div></div>
<div class="ttc" id="agroup__delivery_html_gad3dd82fe9a649d70d4f3430c34699638"><div class="ttname"><a href="group__delivery.html#gad3dd82fe9a649d70d4f3430c34699638">pn_delivery_link</a></div><div class="ttdeci">pn_link_t * pn_delivery_link(pn_delivery_t *delivery)</div><div class="ttdoc">Get the parent link for a delivery object.</div></div>
<div class="ttc" id="agroup__connection_html_gac4a34e0b1fc5665b26ae47a80a422a1a"><div class="ttname"><a href="group__connection.html#gac4a34e0b1fc5665b26ae47a80a422a1a">pn_connection_set_container</a></div><div class="ttdeci">void pn_connection_set_container(pn_connection_t *connection, const char *container)</div><div class="ttdoc">Set the AMQP Container name advertised by a connection object.</div></div>
<div class="ttc" id="agroup__delivery_html_ga13364206124b653b90f5ee3ddae9ff35"><div class="ttname"><a href="group__delivery.html#ga13364206124b653b90f5ee3ddae9ff35">pn_delivery_readable</a></div><div class="ttdeci">bool pn_delivery_readable(pn_delivery_t *delivery)</div><div class="ttdoc">Check if a delivery is readable.</div></div>
<div class="ttc" id="agroup__session_html_gae21b3fda1567bad1f8a8fe162ffaeece"><div class="ttname"><a href="group__session.html#gae21b3fda1567bad1f8a8fe162ffaeece">pn_session_remote_condition</a></div><div class="ttdeci">pn_condition_t * pn_session_remote_condition(pn_session_t *session)</div><div class="ttdoc">Get the remote condition associated with the session endpoint.</div></div>
<div class="ttc" id="adelivery_8h_html"><div class="ttname"><a href="delivery_8h.html">delivery.h</a></div><div class="ttdoc">A message transfer.</div></div>
<div class="ttc" id="atransport_8h_html"><div class="ttname"><a href="transport_8h.html">transport.h</a></div><div class="ttdoc">A network channel supporting an AMQP connection.</div></div>
<div class="ttc" id="agroup__error_html_ga82db456291c2627e31becc44b733a7f0"><div class="ttname"><a href="group__error.html#ga82db456291c2627e31becc44b733a7f0">PN_ABORTED</a></div><div class="ttdeci">#define PN_ABORTED</div><div class="ttdoc">Delivery aborted error.</div><div class="ttdef"><b>Definition:</b> error.h:57</div></div>
<div class="ttc" id="asession_8h_html"><div class="ttname"><a href="session_8h.html">session.h</a></div><div class="ttdoc">A container of links.</div></div>
<div class="ttc" id="agroup__session_html_ga38ccb93b8f5c2892adafce5d5f0fbcd9"><div class="ttname"><a href="group__session.html#ga38ccb93b8f5c2892adafce5d5f0fbcd9">pn_session_t</a></div><div class="ttdeci">struct pn_session_t pn_session_t</div><div class="ttdoc">An AMQP Session object.</div><div class="ttdef"><b>Definition:</b> types.h:296</div></div>
<div class="ttc" id="agroup__message_html_ga145c06edbcccfbe97136bfb5cb2b22b1"><div class="ttname"><a href="group__message.html#ga145c06edbcccfbe97136bfb5cb2b22b1">pn_message_body</a></div><div class="ttdeci">pn_data_t * pn_message_body(pn_message_t *msg)</div><div class="ttdoc">Get and set the body of a message.</div></div>
<div class="ttc" id="agroup__transport_html_gac458d9fdb684f9501e89b96fc51f5c34"><div class="ttname"><a href="group__transport.html#gac458d9fdb684f9501e89b96fc51f5c34">pn_transport_condition</a></div><div class="ttdeci">pn_condition_t * pn_transport_condition(pn_transport_t *transport)</div><div class="ttdoc">Get additional information about the condition of the transport.</div></div>
<div class="ttc" id="agroup__event_html_gacaea54ca51885933b4987c131a3d1b0d"><div class="ttname"><a href="group__event.html#gacaea54ca51885933b4987c131a3d1b0d">pn_event_type</a></div><div class="ttdeci">pn_event_type_t pn_event_type(pn_event_t *event)</div><div class="ttdoc">Get the type of an event.</div></div>
<div class="ttc" id="agroup__event_html_ga3a85c046c11ce692c23b9566b022d54b"><div class="ttname"><a href="group__event.html#ga3a85c046c11ce692c23b9566b022d54b">pn_event_type_name</a></div><div class="ttdeci">const char * pn_event_type_name(pn_event_type_t type)</div><div class="ttdoc">Get a human readable name for an event type.</div></div>
<div class="ttc" id="agroup__delivery_html_ga17523835dbc8d1906bd71df69d09cc40"><div class="ttname"><a href="group__delivery.html#ga17523835dbc8d1906bd71df69d09cc40">pn_delivery_pending</a></div><div class="ttdeci">size_t pn_delivery_pending(pn_delivery_t *delivery)</div><div class="ttdoc">Get the amount of pending message data for a delivery.</div></div>
<div class="ttc" id="agroup__proactor_html_ga29ae114b42fb797c103dc9883ebcb256"><div class="ttname"><a href="group__proactor.html#ga29ae114b42fb797c103dc9883ebcb256">PN_MAX_ADDR</a></div><div class="ttdeci">#define PN_MAX_ADDR</div><div class="ttdoc">Size of buffer that can hold the largest connection or listening address.</div><div class="ttdef"><b>Definition:</b> proactor.h:74</div></div>
<div class="ttc" id="agroup__session_html_gaa45a8aa758334528a86cb7914ebe8545"><div class="ttname"><a href="group__session.html#gaa45a8aa758334528a86cb7914ebe8545">pn_session_connection</a></div><div class="ttdeci">pn_connection_t * pn_session_connection(pn_session_t *session)</div><div class="ttdoc">Get the parent connection for a session object.</div></div>
<div class="ttc" id="agroup__link_html_ga55428637f3b8c446efd5fea3f26c932d"><div class="ttname"><a href="group__link.html#ga55428637f3b8c446efd5fea3f26c932d">pn_link_credit</a></div><div class="ttdeci">int pn_link_credit(pn_link_t *link)</div><div class="ttdoc">Get the credit balance for a link.</div></div>
<div class="ttc" id="agroup__link_html_ga4851693eb6a16fd9ab61e2df6f00770d"><div class="ttname"><a href="group__link.html#ga4851693eb6a16fd9ab61e2df6f00770d">pn_link_close</a></div><div class="ttdeci">void pn_link_close(pn_link_t *link)</div><div class="ttdoc">Close a link.</div></div>
<div class="ttc" id="agroup__event_html_ga14525ae84870388141898bbf57f2b151"><div class="ttname"><a href="group__event.html#ga14525ae84870388141898bbf57f2b151">pn_event_transport</a></div><div class="ttdeci">pn_transport_t * pn_event_transport(pn_event_t *event)</div><div class="ttdoc">Get the transport associated with an event.</div></div>
<div class="ttc" id="agroup__event_html_ga75f230ef55f03a1f943df79279f8d111"><div class="ttname"><a href="group__event.html#ga75f230ef55f03a1f943df79279f8d111">pn_event_link</a></div><div class="ttdeci">pn_link_t * pn_event_link(pn_event_t *event)</div><div class="ttdoc">Get the link associated with an event.</div></div>
<div class="ttc" id="agroup__link_html_ga2c8985a9d44a813ab1739a91ae3708a3"><div class="ttname"><a href="group__link.html#ga2c8985a9d44a813ab1739a91ae3708a3">pn_link_source</a></div><div class="ttdeci">pn_terminus_t * pn_link_source(pn_link_t *link)</div><div class="ttdoc">Access the locally defined source definition for a link.</div></div>
<div class="ttc" id="agroup__proactor_html_gaf67a7642c9003b36255b58776b494c96"><div class="ttname"><a href="group__proactor.html#gaf67a7642c9003b36255b58776b494c96">pn_proactor_addr</a></div><div class="ttdeci">PNP_EXTERN int pn_proactor_addr(char *addr, size_t size, const char *host, const char *port)</div><div class="ttdoc">Format a host:port address string for pn_proactor_connect() or pn_proactor_listen()</div></div>
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated by <a href="http://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.8.20 </li>
</ul>
</div>
</body>
</html>