blob: 9e30638f872998ff05d481cb5f7a6f3a5b4119e5 [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: broker.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('broker_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">broker.c</div> </div>
</div><!--header-->
<div class="contents">
<p>A simple multithreaded broker that works with the <a class="el" href="send_8c-example.html">send.c</a> and <a class="el" href="receive_8c-example.html">receive.c</a> examples.</p>
<div class="fragment"><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"> </div>
<div class="line"><span class="preprocessor">#include &quot;thread.h&quot;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;proton/engine.h&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="listener_8h.html">proton/listener.h</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="netaddr_8h.html">proton/netaddr.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="sasl_8h.html">proton/sasl.h</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="ssl_8h.html">proton/ssl.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"><span class="preprocessor">#include &lt;string.h&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">/* The ssl-certs subdir must be in the current directory for an ssl-enabled broker */</span></div>
<div class="line"><span class="preprocessor">#define SSL_FILE(NAME) &quot;ssl-certs/&quot; NAME</span></div>
<div class="line"><span class="preprocessor">#define SSL_PW &quot;tserverpw&quot;</span></div>
<div class="line"><span class="comment">/* Windows vs. OpenSSL certificates */</span></div>
<div class="line"><span class="preprocessor">#if defined(_WIN32)</span></div>
<div class="line"><span class="preprocessor"># define CERTIFICATE(NAME) SSL_FILE(NAME &quot;-certificate.p12&quot;)</span></div>
<div class="line"><span class="preprocessor"># define SET_CREDENTIALS(DOMAIN, NAME) \</span></div>
<div class="line"><span class="preprocessor"> pn_ssl_domain_set_credentials(DOMAIN, SSL_FILE(NAME &quot;-full.p12&quot;), &quot;&quot;, SSL_PW)</span></div>
<div class="line"><span class="preprocessor">#else</span></div>
<div class="line"><span class="preprocessor"># define CERTIFICATE(NAME) SSL_FILE(NAME &quot;-certificate.pem&quot;)</span></div>
<div class="line"><span class="preprocessor"># define SET_CREDENTIALS(DOMAIN, NAME) \</span></div>
<div class="line"><span class="preprocessor"> pn_ssl_domain_set_credentials(DOMAIN, CERTIFICATE(NAME), SSL_FILE(NAME &quot;-private-key.pem&quot;), SSL_PW)</span></div>
<div class="line"><span class="preprocessor">#endif</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">/* Simple re-sizable vector that acts as a queue */</span></div>
<div class="line"><span class="preprocessor">#define VEC(T) struct { T* data; size_t len, cap; }</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#define VEC_INIT(V) \</span></div>
<div class="line"><span class="preprocessor"> do { \</span></div>
<div class="line"><span class="preprocessor"> void **vp = (void**)&amp;V.data; \</span></div>
<div class="line"><span class="preprocessor"> V.len = 0; \</span></div>
<div class="line"><span class="preprocessor"> V.cap = 16; \</span></div>
<div class="line"><span class="preprocessor"> *vp = malloc(V.cap * sizeof(*V.data)); \</span></div>
<div class="line"><span class="preprocessor"> } while(0)</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#define VEC_FINAL(V) free(V.data)</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#define VEC_PUSH(V, X) \</span></div>
<div class="line"><span class="preprocessor"> do { \</span></div>
<div class="line"><span class="preprocessor"> if (V.len == V.cap) { \</span></div>
<div class="line"><span class="preprocessor"> void **vp = (void**)&amp;V.data; \</span></div>
<div class="line"><span class="preprocessor"> V.cap *= 2; \</span></div>
<div class="line"><span class="preprocessor"> *vp = realloc(V.data, V.cap * sizeof(*V.data)); \</span></div>
<div class="line"><span class="preprocessor"> } \</span></div>
<div class="line"><span class="preprocessor"> V.data[V.len++] = X; \</span></div>
<div class="line"><span class="preprocessor"> } while(0) \</span></div>
<div class="line"><span class="preprocessor"></span> </div>
<div class="line"><span class="preprocessor">#define VEC_POP(V) \</span></div>
<div class="line"><span class="preprocessor"> do { \</span></div>
<div class="line"><span class="preprocessor"> if (V.len &gt; 0) \</span></div>
<div class="line"><span class="preprocessor"> memmove(V.data, V.data+1, (--V.len)*sizeof(*V.data)); \</span></div>
<div class="line"><span class="preprocessor"> } while(0)</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">/* Simple thread-safe queue implementation */</span></div>
<div class="line"><span class="keyword">typedef</span> <span class="keyword">struct </span>queue_t {</div>
<div class="line"> pthread_mutex_t lock;</div>
<div class="line"> <span class="keywordtype">char</span> *name;</div>
<div class="line"> VEC(<a name="_a0"></a><a class="code" href="group__api__types.html#structpn__rwbytes__t">pn_rwbytes_t</a>) messages; <span class="comment">/* Messages on the queue_t */</span></div>
<div class="line"> VEC(<a class="code" href="group__connection.html#ga886351d81ff3a977a284a206526c5aff">pn_connection_t</a>*) waiting; <span class="comment">/* Connections waiting to send messages from this queue */</span></div>
<div class="line"> <span class="keyword">struct </span>queue_t *next; <span class="comment">/* Next queue in chain */</span></div>
<div class="line"> <span class="keywordtype">size_t</span> sent; <span class="comment">/* Count of messages sent, used as delivery tag */</span></div>
<div class="line">} queue_t;</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> queue_init(queue_t *q, <span class="keyword">const</span> <span class="keywordtype">char</span>* name, queue_t *next) {</div>
<div class="line"> pthread_mutex_init(&amp;q-&gt;lock, NULL);</div>
<div class="line"> q-&gt;name = (<span class="keywordtype">char</span>*)malloc(strlen(name)+1);</div>
<div class="line"> memcpy(q-&gt;name, name, strlen(name)+1);</div>
<div class="line"> VEC_INIT(q-&gt;messages);</div>
<div class="line"> VEC_INIT(q-&gt;waiting);</div>
<div class="line"> q-&gt;next = next;</div>
<div class="line"> q-&gt;sent = 0;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> queue_destroy(queue_t *q) {</div>
<div class="line"> <span class="keywordtype">size_t</span> i;</div>
<div class="line"> pthread_mutex_destroy(&amp;q-&gt;lock);</div>
<div class="line"> <span class="keywordflow">for</span> (i = 0; i &lt; q-&gt;messages.len; ++i)</div>
<div class="line"> free(q-&gt;messages.data[i].start);</div>
<div class="line"> VEC_FINAL(q-&gt;messages);</div>
<div class="line"> <span class="keywordflow">for</span> (i = 0; i &lt; q-&gt;waiting.len; ++i)</div>
<div class="line"> pn_decref(q-&gt;waiting.data[i]);</div>
<div class="line"> VEC_FINAL(q-&gt;waiting);</div>
<div class="line"> free(q-&gt;name);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">/* Send a message on s, or record s as waiting if there are no messages to send.</span></div>
<div class="line"><span class="comment"> Called in s dispatch loop, assumes s has credit.</span></div>
<div class="line"><span class="comment">*/</span></div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> queue_send(queue_t *q, <a class="code" href="group__link.html#ga89dad3aa7934329a7ff467c636687bc0">pn_link_t</a> *s) {</div>
<div class="line"> <a class="code" href="group__api__types.html#structpn__rwbytes__t">pn_rwbytes_t</a> m = { 0 };</div>
<div class="line"> <span class="keywordtype">size_t</span> tag = 0;</div>
<div class="line"> pthread_mutex_lock(&amp;q-&gt;lock);</div>
<div class="line"> <span class="keywordflow">if</span> (q-&gt;messages.len == 0) { <span class="comment">/* Empty, record connection as waiting */</span></div>
<div class="line"> <span class="comment">/* Record connection for wake-up if not already on the list. */</span></div>
<div class="line"> <a class="code" href="group__connection.html#ga886351d81ff3a977a284a206526c5aff">pn_connection_t</a> *c = <a name="a1"></a><a class="code" href="group__session.html#gaa45a8aa758334528a86cb7914ebe8545">pn_session_connection</a>(<a name="a2"></a><a class="code" href="group__link.html#gac63e43305fb1a5e3b14399a9ddc8f24d">pn_link_session</a>(s));</div>
<div class="line"> <span class="keywordtype">size_t</span> i = 0;</div>
<div class="line"> <span class="keywordflow">for</span> (; i &lt; q-&gt;waiting.len &amp;&amp; q-&gt;waiting.data[i] != c; ++i)</div>
<div class="line"> ;</div>
<div class="line"> <span class="keywordflow">if</span> (i == q-&gt;waiting.len) {</div>
<div class="line"> VEC_PUSH(q-&gt;waiting, c);</div>
<div class="line"> }</div>
<div class="line"> } <span class="keywordflow">else</span> {</div>
<div class="line"> m = q-&gt;messages.data[0];</div>
<div class="line"> VEC_POP(q-&gt;messages);</div>
<div class="line"> tag = ++q-&gt;sent;</div>
<div class="line"> }</div>
<div class="line"> pthread_mutex_unlock(&amp;q-&gt;lock);</div>
<div class="line"> <span class="keywordflow">if</span> (m.<a name="a3"></a>start) {</div>
<div class="line"> <a class="code" href="group__delivery.html#gacdfce854066c0a4ff4db9f9a0478f340">pn_delivery_t</a> *d = <a name="a4"></a><a class="code" href="group__delivery.html#ga6a7ef2e317b4ed292cafbb358f0ba6ad">pn_delivery</a>(s, <a name="a5"></a><a class="code" href="group__delivery.html#gaea4522ac1fef9228fb6c743d2a36fd27">pn_dtag</a>((<span class="keywordtype">char</span>*)&amp;tag, <span class="keyword">sizeof</span>(tag)));</div>
<div class="line"> <a name="a6"></a><a class="code" href="group__link.html#gaa825fac21730f3f9fff37d156e5f88e9">pn_link_send</a>(s, m.start, m.<a name="a7"></a>size);</div>
<div class="line"> <a name="a8"></a><a class="code" href="group__link.html#ga93824a3859c37463e44458cd2f63d31f">pn_link_advance</a>(s);</div>
<div class="line"> <a name="a9"></a><a class="code" href="group__delivery.html#ga98c275fd7158e8b9d7d48d70503d68df">pn_delivery_settle</a>(d); <span class="comment">/* Pre-settled: unreliable, there will be no ack/ */</span></div>
<div class="line"> free(m.start);</div>
<div class="line"> }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">/* Use the connection context pointer as a boolean flag to indicate we need to check queues */</span></div>
<div class="line"><span class="keywordtype">void</span> set_check_queues(<a class="code" href="group__connection.html#ga886351d81ff3a977a284a206526c5aff">pn_connection_t</a> *c, <span class="keywordtype">bool</span> check) {</div>
<div class="line"> <a name="a10"></a><a class="code" href="group__connection.html#gad3203b366cb1ff5becd1778a8dd6b1a6">pn_connection_set_context</a>(c, (<span class="keywordtype">void</span>*)check);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">bool</span> get_check_queues(<a class="code" href="group__connection.html#ga886351d81ff3a977a284a206526c5aff">pn_connection_t</a> *c) {</div>
<div class="line"> <span class="keywordflow">return</span> (<span class="keywordtype">bool</span>)<a name="a11"></a><a class="code" href="group__connection.html#ga50613e6c09186dc3f1a2f36238c61f07">pn_connection_get_context</a>(c);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">/* Use a buffer per link to accumulate message data - message can arrive in multiple deliveries,</span></div>
<div class="line"><span class="comment"> and the broker can receive messages on many concurrently. */</span></div>
<div class="line"><a class="code" href="group__api__types.html#structpn__rwbytes__t">pn_rwbytes_t</a> *message_buffer(<a class="code" href="group__link.html#ga89dad3aa7934329a7ff467c636687bc0">pn_link_t</a> *l) {</div>
<div class="line"> <span class="keywordflow">if</span> (!<a name="a12"></a><a class="code" href="group__link.html#ga93e6b527743f433da2ff367c1b2c500a">pn_link_get_context</a>(l)) {</div>
<div class="line"> <a name="a13"></a><a class="code" href="group__link.html#ga376f2cc18bbd771d95aa8222586d19b2">pn_link_set_context</a>(l, calloc(1, <span class="keyword">sizeof</span>(<a class="code" href="group__api__types.html#structpn__rwbytes__t">pn_rwbytes_t</a>)));</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">return</span> (<a class="code" href="group__api__types.html#structpn__rwbytes__t">pn_rwbytes_t</a>*)<a class="code" href="group__link.html#ga93e6b527743f433da2ff367c1b2c500a">pn_link_get_context</a>(l);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">/* Put a message on the queue, called in receiver dispatch loop.</span></div>
<div class="line"><span class="comment"> If the queue was previously empty, notify waiting senders.</span></div>
<div class="line"><span class="comment">*/</span></div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> queue_receive(<a class="code" href="group__proactor.html#gabba42c7929dfceb9d296535bad0c93dc">pn_proactor_t</a> *d, queue_t *q, <a class="code" href="group__api__types.html#structpn__rwbytes__t">pn_rwbytes_t</a> m) {</div>
<div class="line"> pthread_mutex_lock(&amp;q-&gt;lock);</div>
<div class="line"> VEC_PUSH(q-&gt;messages, m);</div>
<div class="line"> <span class="keywordflow">if</span> (q-&gt;messages.len == 1) { <span class="comment">/* Was empty, notify waiting connections */</span></div>
<div class="line"> <span class="keywordtype">size_t</span> i;</div>
<div class="line"> <span class="keywordflow">for</span> (i = 0; i &lt; q-&gt;waiting.len; ++i) {</div>
<div class="line"> <a class="code" href="group__connection.html#ga886351d81ff3a977a284a206526c5aff">pn_connection_t</a> *c = q-&gt;waiting.data[i];</div>
<div class="line"> set_check_queues(c, <span class="keyword">true</span>);</div>
<div class="line"> <a name="a14"></a><a class="code" href="group__proactor.html#ga0f49c771fe3bff54f58c9d583ca30560">pn_connection_wake</a>(c); <span class="comment">/* Wake the connection */</span></div>
<div class="line"> }</div>
<div class="line"> q-&gt;waiting.len = 0;</div>
<div class="line"> }</div>
<div class="line"> pthread_mutex_unlock(&amp;q-&gt;lock);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">/* Thread safe set of queues */</span></div>
<div class="line"><span class="keyword">typedef</span> <span class="keyword">struct </span>queues_t {</div>
<div class="line"> pthread_mutex_t lock;</div>
<div class="line"> queue_t *queues;</div>
<div class="line"> <span class="keywordtype">size_t</span> sent;</div>
<div class="line">} queues_t;</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> queues_init(queues_t *qs) {</div>
<div class="line"> pthread_mutex_init(&amp;qs-&gt;lock, NULL);</div>
<div class="line"> qs-&gt;queues = NULL;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> queues_destroy(queues_t *qs) {</div>
<div class="line"> <span class="keywordflow">while</span> (qs-&gt;queues) {</div>
<div class="line"> queue_t *q = qs-&gt;queues;</div>
<div class="line"> qs-&gt;queues = qs-&gt;queues-&gt;next;</div>
<div class="line"> queue_destroy(q);</div>
<div class="line"> free(q);</div>
<div class="line"> }</div>
<div class="line"> pthread_mutex_destroy(&amp;qs-&gt;lock);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line">queue_t* queues_get(queues_t *qs, <span class="keyword">const</span> <span class="keywordtype">char</span>* name) {</div>
<div class="line"> queue_t *q;</div>
<div class="line"> pthread_mutex_lock(&amp;qs-&gt;lock);</div>
<div class="line"> <span class="keywordflow">for</span> (q = qs-&gt;queues; q &amp;&amp; strcmp(q-&gt;name, name) != 0; q = q-&gt;next)</div>
<div class="line"> ;</div>
<div class="line"> <span class="keywordflow">if</span> (!q) {</div>
<div class="line"> q = (queue_t*)malloc(<span class="keyword">sizeof</span>(queue_t));</div>
<div class="line"> queue_init(q, name, qs-&gt;queues);</div>
<div class="line"> qs-&gt;queues = q;</div>
<div class="line"> }</div>
<div class="line"> pthread_mutex_unlock(&amp;qs-&gt;lock);</div>
<div class="line"> <span class="keywordflow">return</span> q;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">/* The broker implementation */</span></div>
<div class="line"><span class="keyword">typedef</span> <span class="keyword">struct </span>broker_t {</div>
<div class="line"> <a class="code" href="group__proactor.html#gabba42c7929dfceb9d296535bad0c93dc">pn_proactor_t</a> *proactor;</div>
<div class="line"> <span class="keywordtype">size_t</span> threads;</div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *container_id; <span class="comment">/* AMQP container-id */</span></div>
<div class="line"> queues_t queues;</div>
<div class="line"> <a class="code" href="group__ssl.html#gaba83c3a1779c8b35a479bf3a7bb5b175">pn_ssl_domain_t</a> *ssl_domain;</div>
<div class="line">} broker_t;</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> broker_stop(broker_t *b) {</div>
<div class="line"> <span class="comment">/* Interrupt the proactor to stop the working threads. */</span></div>
<div class="line"> <a name="a15"></a><a class="code" href="group__proactor.html#gaa5255cd1bcb5d7f5639b53dc30712711">pn_proactor_interrupt</a>(b-&gt;proactor);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">/* Try to send if link is sender and has credit */</span></div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> link_send(broker_t *b, <a class="code" href="group__link.html#ga89dad3aa7934329a7ff467c636687bc0">pn_link_t</a> *s) {</div>
<div class="line"> <span class="keywordflow">if</span> (<a name="a16"></a><a class="code" href="group__link.html#ga7c48ef214568267839aea04ed337926b">pn_link_is_sender</a>(s) &amp;&amp; <a name="a17"></a><a class="code" href="group__link.html#ga55428637f3b8c446efd5fea3f26c932d">pn_link_credit</a>(s) &gt; 0) {</div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *qname = <a name="a18"></a><a class="code" href="group__terminus.html#ga3507b6cfe260a2bfaae9321235db7c9a">pn_terminus_get_address</a>(<a name="a19"></a><a class="code" href="group__link.html#ga2c8985a9d44a813ab1739a91ae3708a3">pn_link_source</a>(s));</div>
<div class="line"> queue_t *q = queues_get(&amp;b-&gt;queues, qname);</div>
<div class="line"> queue_send(q, s);</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> queue_unsub(queue_t *q, <a class="code" href="group__connection.html#ga886351d81ff3a977a284a206526c5aff">pn_connection_t</a> *c) {</div>
<div class="line"> <span class="keywordtype">size_t</span> i;</div>
<div class="line"> pthread_mutex_lock(&amp;q-&gt;lock);</div>
<div class="line"> <span class="keywordflow">for</span> (i = 0; i &lt; q-&gt;waiting.len; ++i) {</div>
<div class="line"> <span class="keywordflow">if</span> (q-&gt;waiting.data[i] == c){</div>
<div class="line"> q-&gt;waiting.data[i] = q-&gt;waiting.data[0]; <span class="comment">/* save old [0] */</span></div>
<div class="line"> VEC_POP(q-&gt;waiting);</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> }</div>
<div class="line"> }</div>
<div class="line"> pthread_mutex_unlock(&amp;q-&gt;lock);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">/* Unsubscribe from the queue of interest to this link. */</span></div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> link_unsub(broker_t *b, <a class="code" href="group__link.html#ga89dad3aa7934329a7ff467c636687bc0">pn_link_t</a> *s) {</div>
<div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group__link.html#ga7c48ef214568267839aea04ed337926b">pn_link_is_sender</a>(s)) {</div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *qname = <a class="code" href="group__terminus.html#ga3507b6cfe260a2bfaae9321235db7c9a">pn_terminus_get_address</a>(<a class="code" href="group__link.html#ga2c8985a9d44a813ab1739a91ae3708a3">pn_link_source</a>(s));</div>
<div class="line"> <span class="keywordflow">if</span> (qname) {</div>
<div class="line"> queue_t *q = queues_get(&amp;b-&gt;queues, qname);</div>
<div class="line"> queue_unsub(q, <a class="code" href="group__session.html#gaa45a8aa758334528a86cb7914ebe8545">pn_session_connection</a>(<a class="code" href="group__link.html#gac63e43305fb1a5e3b14399a9ddc8f24d">pn_link_session</a>(s)));</div>
<div class="line"> }</div>
<div class="line"> }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">/* Called in connection&#39;s event loop when a connection is woken for messages.*/</span></div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> connection_unsub(broker_t *b, <a class="code" href="group__connection.html#ga886351d81ff3a977a284a206526c5aff">pn_connection_t</a> *c) {</div>
<div class="line"> <a class="code" href="group__link.html#ga89dad3aa7934329a7ff467c636687bc0">pn_link_t</a> *l;</div>
<div class="line"> <span class="keywordflow">for</span> (l = <a name="a20"></a><a class="code" href="group__link.html#ga7c9434c40eb653f007ff5721e2ebf73e">pn_link_head</a>(c, 0); l != NULL; l = <a name="a21"></a><a class="code" href="group__link.html#ga9b2a9cfa00dfdae4e01bf75483433925">pn_link_next</a>(l, 0))</div>
<div class="line"> link_unsub(b, l);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> session_unsub(broker_t *b, <a class="code" href="group__session.html#ga38ccb93b8f5c2892adafce5d5f0fbcd9">pn_session_t</a> *ssn) {</div>
<div class="line"> <a class="code" href="group__connection.html#ga886351d81ff3a977a284a206526c5aff">pn_connection_t</a> *c = <a class="code" href="group__session.html#gaa45a8aa758334528a86cb7914ebe8545">pn_session_connection</a>(ssn);</div>
<div class="line"> <a class="code" href="group__link.html#ga89dad3aa7934329a7ff467c636687bc0">pn_link_t</a> *l;</div>
<div class="line"> <span class="keywordflow">for</span> (l = <a class="code" href="group__link.html#ga7c9434c40eb653f007ff5721e2ebf73e">pn_link_head</a>(c, 0); l != NULL; l = <a class="code" href="group__link.html#ga9b2a9cfa00dfdae4e01bf75483433925">pn_link_next</a>(l, 0)) {</div>
<div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group__link.html#gac63e43305fb1a5e3b14399a9ddc8f24d">pn_link_session</a>(l) == ssn)</div>
<div class="line"> link_unsub(b, l);</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> 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="a22"></a><a class="code" href="group__condition.html#ga112611a7a4087e050c476a430db2cfb9">pn_condition_is_set</a>(cond)) {</div>
<div class="line"> printf(<span class="stringliteral">&quot;%s: %s: %s\n&quot;</span>, <a name="a23"></a><a class="code" href="group__event.html#ga3a85c046c11ce692c23b9566b022d54b">pn_event_type_name</a>(<a name="a24"></a><a class="code" href="group__event.html#gacaea54ca51885933b4987c131a3d1b0d">pn_event_type</a>(e)),</div>
<div class="line"> <a name="a25"></a><a class="code" href="group__condition.html#ga05b0d374d90f11d9ebbf818662569689">pn_condition_get_name</a>(cond), <a name="a26"></a><a class="code" href="group__condition.html#gaabebb65bfcf47b6f7d83ab6fb0153bb8">pn_condition_get_description</a>(cond));</div>
<div class="line"> }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keyword">const</span> <span class="keywordtype">int</span> WINDOW=5; <span class="comment">/* Very small incoming credit window, to show flow control in action */</span></div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">bool</span> handle(broker_t* b, <a class="code" href="group__event.html#ga87f3028b4888632bbd56fb71ac737ae8">pn_event_t</a>* e) {</div>
<div class="line"> <a class="code" href="group__connection.html#ga886351d81ff3a977a284a206526c5aff">pn_connection_t</a> *c = <a name="a27"></a><a class="code" href="group__event.html#ga4f2c6a0fdf86a43e7e9874fcd2ccaf52">pn_event_connection</a>(e);</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">switch</span> (<a class="code" href="group__event.html#gacaea54ca51885933b4987c131a3d1b0d">pn_event_type</a>(e)) {</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">case</span> <a name="a28"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa6e25f00110ab278fd8b34fee00bd5fd7">PN_LISTENER_OPEN</a>: {</div>
<div class="line"> <span class="keywordtype">char</span> port[<a name="a29"></a><a class="code" href="group__proactor.html#ga29ae114b42fb797c103dc9883ebcb256">PN_MAX_ADDR</a>]; <span class="comment">/* Get the listening port */</span></div>
<div class="line"> <a name="a30"></a><a class="code" href="group__proactor.html#ga8cdeab8554e7d376a422dae8ac6d474b">pn_netaddr_host_port</a>(<a name="a31"></a><a class="code" href="group__proactor.html#gacdbda4ea3dc040af5a4c1d633ddd7cd9">pn_listener_addr</a>(<a name="a32"></a><a class="code" href="group__listener.html#ga6214da9323c8e6fcec8badc57a82e9df">pn_event_listener</a>(e)), NULL, 0, port, <span class="keyword">sizeof</span>(port));</div>
<div class="line"> printf(<span class="stringliteral">&quot;listening on %s\n&quot;</span>, port);</div>
<div class="line"> fflush(stdout);</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">case</span> <a name="a33"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa0602b15957883e7d00ccdff4abca992c">PN_LISTENER_ACCEPT</a>: {</div>
<div class="line"> <span class="comment">/* Configure a transport to allow SSL and SASL connections. See ssl_domain setup in main() */</span></div>
<div class="line"> <a class="code" href="group__transport.html#gac26eda05f649bbf0399f3d8d78d12fa8">pn_transport_t</a> *t = <a name="a34"></a><a class="code" href="group__transport.html#gaf9833d93faf6a6ed68039e4a909cdd77">pn_transport</a>();</div>
<div class="line"> <a name="a35"></a><a class="code" href="group__transport.html#gac5bebd26c0942bc17d7fad36577110f8">pn_transport_set_server</a>(t); <span class="comment">/* Must call before pn_sasl() */</span></div>
<div class="line"> <a name="a36"></a><a class="code" href="group__sasl.html#ga73299a6a22e141e7911a739590032625">pn_sasl_allowed_mechs</a>(<a name="a37"></a><a class="code" href="group__sasl.html#ga7968e80e2fe9360fc14cf865dd1ac21c">pn_sasl</a>(t), <span class="stringliteral">&quot;ANONYMOUS&quot;</span>);</div>
<div class="line"> <span class="keywordflow">if</span> (b-&gt;ssl_domain) {</div>
<div class="line"> <a name="a38"></a><a class="code" href="group__ssl.html#ga45f319dd31ad456b8a85927888f94acf">pn_ssl_init</a>(<a name="a39"></a><a class="code" href="group__ssl.html#gaaeb5284b45f9e2146ff671b1ddc9420c">pn_ssl</a>(t), b-&gt;ssl_domain, NULL);</div>
<div class="line"> <a name="a40"></a><a class="code" href="group__transport.html#gaeb7e30ead4a6ab080d0005379be20e34">pn_transport_require_encryption</a>(t, <span class="keyword">false</span>); <span class="comment">/* Must call this after pn_ssl_init */</span></div>
<div class="line"> }</div>
<div class="line"> <a name="a41"></a><a class="code" href="group__listener.html#ga3719a4ab17b8de42fc6bfb262018d070">pn_listener_accept2</a>(<a class="code" href="group__listener.html#ga6214da9323c8e6fcec8badc57a82e9df">pn_event_listener</a>(e), NULL, t);</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">case</span> <a name="a42"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa182e571a0310028514bce66a41063a6e">PN_CONNECTION_INIT</a>:</div>
<div class="line"> <a name="a43"></a><a class="code" href="group__connection.html#gac4a34e0b1fc5665b26ae47a80a422a1a">pn_connection_set_container</a>(c, b-&gt;container_id);</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">case</span> <a name="a44"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaad48bce685db553740fa71cc36473b5cc">PN_CONNECTION_REMOTE_OPEN</a>: {</div>
<div class="line"> <a name="a45"></a><a class="code" href="group__connection.html#ga4c0a2d40bb95202477ccc5aaa7456670">pn_connection_open</a>(<a class="code" href="group__event.html#ga4f2c6a0fdf86a43e7e9874fcd2ccaf52">pn_event_connection</a>(e)); <span class="comment">/* Complete the open */</span></div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">case</span> <a name="a46"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa28a2bfee806bbc1fe31499c8eec39db0">PN_CONNECTION_WAKE</a>: {</div>
<div class="line"> <span class="keywordflow">if</span> (get_check_queues(c)) {</div>
<div class="line"> <span class="keywordtype">int</span> flags = <a name="a47"></a><a class="code" href="group__connection.html#ga0c3bf54f0991944a2f6eea36b561fa2b">PN_LOCAL_ACTIVE</a>&amp;<a name="a48"></a><a class="code" href="group__connection.html#gad96220f2886c21a4f2eebc9487f53a87">PN_REMOTE_ACTIVE</a>;</div>
<div class="line"> <a class="code" href="group__link.html#ga89dad3aa7934329a7ff467c636687bc0">pn_link_t</a> *l;</div>
<div class="line"> set_check_queues(c, <span class="keyword">false</span>);</div>
<div class="line"> <span class="keywordflow">for</span> (l = <a class="code" href="group__link.html#ga7c9434c40eb653f007ff5721e2ebf73e">pn_link_head</a>(c, flags); l != NULL; l = <a class="code" href="group__link.html#ga9b2a9cfa00dfdae4e01bf75483433925">pn_link_next</a>(l, flags))</div>
<div class="line"> link_send(b, l);</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="a49"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaaf67df046bea45df34aea863d9541e806">PN_SESSION_REMOTE_OPEN</a>: {</div>
<div class="line"> <a name="a50"></a><a class="code" href="group__session.html#ga2b345eada2c15249caaefaa894d1aae3">pn_session_open</a>(<a name="a51"></a><a class="code" href="group__event.html#gaf4af0bfbe0e0a8e432f0e803df14ecb5">pn_event_session</a>(e));</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#gga4876e2eed24a4d4e4c52b99842103cdaa45edb44a6cc7908b5032944e08925307">PN_LINK_REMOTE_OPEN</a>: {</div>
<div class="line"> <a class="code" href="group__link.html#ga89dad3aa7934329a7ff467c636687bc0">pn_link_t</a> *l = <a name="a53"></a><a class="code" href="group__event.html#ga75f230ef55f03a1f943df79279f8d111">pn_event_link</a>(e);</div>
<div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group__link.html#ga7c48ef214568267839aea04ed337926b">pn_link_is_sender</a>(l)) {</div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *source = <a class="code" href="group__terminus.html#ga3507b6cfe260a2bfaae9321235db7c9a">pn_terminus_get_address</a>(<a name="a54"></a><a class="code" href="group__link.html#gadf6b8ff6223465f21a481e9287f60671">pn_link_remote_source</a>(l));</div>
<div class="line"> <a name="a55"></a><a class="code" href="group__terminus.html#ga0603db45f03fcef0ef18f4f89ebf3de1">pn_terminus_set_address</a>(<a class="code" href="group__link.html#ga2c8985a9d44a813ab1739a91ae3708a3">pn_link_source</a>(l), source);</div>
<div class="line"> } <span class="keywordflow">else</span> {</div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span>* target = <a class="code" href="group__terminus.html#ga3507b6cfe260a2bfaae9321235db7c9a">pn_terminus_get_address</a>(<a name="a56"></a><a class="code" href="group__link.html#gabf61668a66ae189dbb4820da6ee30d90">pn_link_remote_target</a>(l));</div>
<div class="line"> <a class="code" href="group__terminus.html#ga0603db45f03fcef0ef18f4f89ebf3de1">pn_terminus_set_address</a>(<a name="a57"></a><a class="code" href="group__link.html#ga997c85388b9fb30151ea3b40b946e958">pn_link_target</a>(l), target);</div>
<div class="line"> <a name="a58"></a><a class="code" href="group__link.html#gafec44cf1c79ec03f3ac009e1879e71a9">pn_link_flow</a>(l, WINDOW);</div>
<div class="line"> }</div>
<div class="line"> <a name="a59"></a><a class="code" href="group__link.html#gaabaca3f5d03970a122240eebc588add6">pn_link_open</a>(l);</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">case</span> <a name="a60"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa4eaecc54c07cdc9b0df7b1d536a7dc3f">PN_LINK_FLOW</a>: {</div>
<div class="line"> link_send(b, <a class="code" href="group__event.html#ga75f230ef55f03a1f943df79279f8d111">pn_event_link</a>(e));</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">case</span> <a name="a61"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaaeacdc45bfe24b2a9da2aeed7b6effac5">PN_LINK_FINAL</a>: {</div>
<div class="line"> <a class="code" href="group__api__types.html#structpn__rwbytes__t">pn_rwbytes_t</a> *buf = (<a class="code" href="group__api__types.html#structpn__rwbytes__t">pn_rwbytes_t</a>*)<a class="code" href="group__link.html#ga93e6b527743f433da2ff367c1b2c500a">pn_link_get_context</a>(<a class="code" href="group__event.html#ga75f230ef55f03a1f943df79279f8d111">pn_event_link</a>(e));</div>
<div class="line"> <span class="keywordflow">if</span> (buf) {</div>
<div class="line"> free(buf-&gt;start);</div>
<div class="line"> free(buf);</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="a62"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa70bbfc163d85732b5652dc70fb3330fe">PN_DELIVERY</a>: { <span class="comment">/* Incoming message data */</span></div>
<div class="line"> <a class="code" href="group__delivery.html#gacdfce854066c0a4ff4db9f9a0478f340">pn_delivery_t</a> *d = <a name="a63"></a><a class="code" href="group__event.html#ga10fa6f53bdabe0851ebb2d8a0bf6a52c">pn_event_delivery</a>(e);</div>
<div class="line"> <span class="keywordflow">if</span> (<a name="a64"></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="a65"></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="a66"></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 = message_buffer(l); <span class="comment">/* Append data to incoming message buffer */</span></div>
<div class="line"> ssize_t recv;</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="a67"></a><a class="code" href="group__link.html#ga06c97ce7396973dca0d311567f25f95a">pn_link_recv</a>(l, m-&gt;start, m-&gt;size);</div>
<div class="line"> <span class="keywordflow">if</span> (recv == <a name="a68"></a><a class="code" href="group__error.html#ga82db456291c2627e31becc44b733a7f0">PN_ABORTED</a>) { <span class="comment">/* */</span></div>
<div class="line"> printf(<span class="stringliteral">&quot;Message aborted\n&quot;</span>);</div>
<div class="line"> fflush(stdout);</div>
<div class="line"> m-&gt;size = 0; <span class="comment">/* Forget the data we accumulated */</span></div>
<div class="line"> <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, WINDOW - <a class="code" href="group__link.html#ga55428637f3b8c446efd5fea3f26c932d">pn_link_credit</a>(l)); <span class="comment">/* Replace credit for the 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="a69"></a><a class="code" href="group__error.html#ga9e0f51b097f94293cdbbdeb5422a27a3">PN_EOS</a>) { <span class="comment">/* Unexpected error */</span></div>
<div class="line"> <a name="a70"></a><a class="code" href="group__condition.html#ga65d9818487fc61e7ca75a9ec4abc8676">pn_condition_format</a>(<a name="a71"></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 name="a72"></a><a class="code" href="group__error.html#gac6b84f09fac8e82bd41a62212d4d8f64">pn_code</a>((<span class="keywordtype">int</span>)recv));</div>
<div class="line"> <a name="a73"></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="a74"></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"> <span class="keyword">const</span> <span class="keywordtype">char</span> *qname = <a class="code" href="group__terminus.html#ga3507b6cfe260a2bfaae9321235db7c9a">pn_terminus_get_address</a>(<a class="code" href="group__link.html#ga997c85388b9fb30151ea3b40b946e958">pn_link_target</a>(l));</div>
<div class="line"> queue_receive(b-&gt;proactor, queues_get(&amp;b-&gt;queues, qname), *m);</div>
<div class="line"> *m = pn_rwbytes_null; <span class="comment">/* Reset the buffer for the next message*/</span></div>
<div class="line"> <a name="a75"></a><a class="code" href="group__delivery.html#ga570c54003c2ba18b84405737925e5176">pn_delivery_update</a>(d, <a name="a76"></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);</div>
<div class="line"> <a class="code" href="group__link.html#gafec44cf1c79ec03f3ac009e1879e71a9">pn_link_flow</a>(l, WINDOW - <a class="code" href="group__link.html#ga55428637f3b8c446efd5fea3f26c932d">pn_link_credit</a>(l));</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="a77"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa1ca722ce3c0b2c13a33636cded8430ba">PN_TRANSPORT_CLOSED</a>:</div>
<div class="line"> check_condition(e, <a name="a78"></a><a class="code" href="group__transport.html#gac458d9fdb684f9501e89b96fc51f5c34">pn_transport_condition</a>(<a name="a79"></a><a class="code" href="group__event.html#ga14525ae84870388141898bbf57f2b151">pn_event_transport</a>(e)));</div>
<div class="line"> connection_unsub(b, <a class="code" href="group__event.html#ga4f2c6a0fdf86a43e7e9874fcd2ccaf52">pn_event_connection</a>(e));</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">case</span> <a name="a80"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa1252529cf9f03d214c9b4fea5cf11b2f">PN_CONNECTION_REMOTE_CLOSE</a>:</div>
<div class="line"> check_condition(e, <a name="a81"></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>(e)));</div>
<div class="line"> <a name="a82"></a><a class="code" href="group__connection.html#gac25afdf810ad188b2cb3bf31a7482ca0">pn_connection_close</a>(<a class="code" href="group__event.html#ga4f2c6a0fdf86a43e7e9874fcd2ccaf52">pn_event_connection</a>(e));</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">case</span> <a name="a83"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa3410075b825c59b8f4efdcddf5a5b135">PN_SESSION_REMOTE_CLOSE</a>:</div>
<div class="line"> check_condition(e, <a name="a84"></a><a class="code" href="group__session.html#gae21b3fda1567bad1f8a8fe162ffaeece">pn_session_remote_condition</a>(<a class="code" href="group__event.html#gaf4af0bfbe0e0a8e432f0e803df14ecb5">pn_event_session</a>(e)));</div>
<div class="line"> session_unsub(b, <a class="code" href="group__event.html#gaf4af0bfbe0e0a8e432f0e803df14ecb5">pn_event_session</a>(e));</div>
<div class="line"> <a name="a85"></a><a class="code" href="group__session.html#ga12e5c4e71b0df4087d16ccc8b63b42b5">pn_session_close</a>(<a class="code" href="group__event.html#gaf4af0bfbe0e0a8e432f0e803df14ecb5">pn_event_session</a>(e));</div>
<div class="line"> <a name="a86"></a><a class="code" href="group__session.html#ga0f95b5177494a68991d75444c2f6f812">pn_session_free</a>(<a class="code" href="group__event.html#gaf4af0bfbe0e0a8e432f0e803df14ecb5">pn_event_session</a>(e));</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">case</span> <a name="a87"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa1153f0108be071c31210dd1cd3e40a1f">PN_LINK_REMOTE_CLOSE</a>:</div>
<div class="line"> check_condition(e, <a name="a88"></a><a class="code" href="group__link.html#ga97dc5133125c9b7e4afbb1b76e6efe7b">pn_link_remote_condition</a>(<a class="code" href="group__event.html#ga75f230ef55f03a1f943df79279f8d111">pn_event_link</a>(e)));</div>
<div class="line"> link_unsub(b, <a class="code" href="group__event.html#ga75f230ef55f03a1f943df79279f8d111">pn_event_link</a>(e));</div>
<div class="line"> <a class="code" href="group__link.html#ga4851693eb6a16fd9ab61e2df6f00770d">pn_link_close</a>(<a class="code" href="group__event.html#ga75f230ef55f03a1f943df79279f8d111">pn_event_link</a>(e));</div>
<div class="line"> <a name="a89"></a><a class="code" href="group__link.html#gadd3b8899fe023d3506fb88d228d6b1b7">pn_link_free</a>(<a class="code" href="group__event.html#ga75f230ef55f03a1f943df79279f8d111">pn_event_link</a>(e));</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">case</span> <a name="a90"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaad5920df168cd28daaf253cad789d8aca">PN_LISTENER_CLOSE</a>:</div>
<div class="line"> check_condition(e, <a name="a91"></a><a class="code" href="group__listener.html#gaa49d0d11a9f46a75fbbbebf6def2d4b2">pn_listener_condition</a>(<a class="code" href="group__listener.html#ga6214da9323c8e6fcec8badc57a82e9df">pn_event_listener</a>(e)));</div>
<div class="line"> broker_stop(b);</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">case</span> <a name="a92"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa894e93f167ef39e28a07c9cdf6b1181b">PN_PROACTOR_INACTIVE</a>: <span class="comment">/* listener and all connections closed */</span></div>
<div class="line"> broker_stop(b);</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">case</span> <a name="a93"></a><a class="code" href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaaee05826a80e94b5b86c4544e4715f499">PN_PROACTOR_INTERRUPT</a>:</div>
<div class="line"> <a class="code" href="group__proactor.html#gaa5255cd1bcb5d7f5639b53dc30712711">pn_proactor_interrupt</a>(b-&gt;proactor); <span class="comment">/* Pass along the interrupt to the other threads */</span></div>
<div class="line"> <span class="keywordflow">return</span> <span class="keyword">false</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="keyword">static</span> <span class="keywordtype">void</span>* broker_thread(<span class="keywordtype">void</span> *void_broker) {</div>
<div class="line"> broker_t *b = (broker_t*)void_broker;</div>
<div class="line"> <span class="keywordtype">bool</span> finished = <span class="keyword">false</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="a94"></a><a class="code" href="group__proactor.html#ga2b66a46f3e557010ec61bd105326753d">pn_proactor_wait</a>(b-&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">while</span> ((e = <a name="a95"></a><a class="code" href="group__proactor.html#ga6dafc0823e7f5a815600d0c9738555f5">pn_event_batch_next</a>(events))) {</div>
<div class="line"> <span class="keywordflow">if</span> (!handle(b, e)) finished = <span class="keyword">true</span>;</div>
<div class="line"> }</div>
<div class="line"> <a name="a96"></a><a class="code" href="group__proactor.html#gade60ff2292b74841766f953b906285c0">pn_proactor_done</a>(b-&gt;proactor, events);</div>
<div class="line"> } <span class="keywordflow">while</span>(!finished);</div>
<div class="line"> <span class="keywordflow">return</span> NULL;</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">const</span> <span class="keywordtype">char</span> *host = (argc &gt; 1) ? argv[1] : <span class="stringliteral">&quot;&quot;</span>;</div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *port = (argc &gt; 2) ? argv[2] : <span class="stringliteral">&quot;amqp&quot;</span>;</div>
<div class="line"> <span class="keywordtype">int</span> err;</div>
<div class="line"> </div>
<div class="line"> broker_t b = {0};</div>
<div class="line"> b.proactor = <a name="a97"></a><a class="code" href="group__proactor.html#gac2a925b3de00efd8cd40fa9920169554">pn_proactor</a>();</div>
<div class="line"> queues_init(&amp;b.queues);</div>
<div class="line"> b.container_id = argv[0];</div>
<div class="line"> b.threads = 4;</div>
<div class="line"> b.ssl_domain = <a name="a98"></a><a class="code" href="group__ssl.html#gaab5e86b7a4d22943eba82c6e94b82357">pn_ssl_domain</a>(<a name="a99"></a><a class="code" href="group__ssl.html#gga0f1d40875c45b14a31a77f27430bc225a0c4550c70a6bc74cb906a74c5f1e5078">PN_SSL_MODE_SERVER</a>);</div>
<div class="line"> err = SET_CREDENTIALS(b.ssl_domain, <span class="stringliteral">&quot;tserver&quot;</span>);</div>
<div class="line"> <span class="keywordflow">if</span> (err) {</div>
<div class="line"> printf(<span class="stringliteral">&quot;Failed to set up server certificate: %s, private key: %s\n&quot;</span>, CERTIFICATE(<span class="stringliteral">&quot;tserver&quot;</span>), SSL_FILE(<span class="stringliteral">&quot;tserver-private-key.pem&quot;</span>));</div>
<div class="line"> }</div>
<div class="line"> {</div>
<div class="line"> <span class="comment">/* Listen on addr */</span></div>
<div class="line"> <span class="keywordtype">char</span> addr[<a class="code" href="group__proactor.html#ga29ae114b42fb797c103dc9883ebcb256">PN_MAX_ADDR</a>];</div>
<div class="line"> <a name="a100"></a><a class="code" href="group__proactor.html#gaf67a7642c9003b36255b58776b494c96">pn_proactor_addr</a>(addr, <span class="keyword">sizeof</span>(addr), host, port);</div>
<div class="line"> <a name="a101"></a><a class="code" href="group__proactor.html#gacbed6a4ab75ef8452c10d52e4cd62752">pn_proactor_listen</a>(b.proactor, <a name="a102"></a><a class="code" href="group__listener.html#gabba0a7d2e916188e3ec07d0acf8f3fc5">pn_listener</a>(), addr, 16);</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> {</div>
<div class="line"> <span class="comment">/* Start n-1 threads */</span></div>
<div class="line"> pthread_t* threads = (pthread_t*)calloc(<span class="keyword">sizeof</span>(pthread_t), b.threads);</div>
<div class="line"> <span class="keywordtype">size_t</span> i;</div>
<div class="line"> <span class="keywordflow">for</span> (i = 0; i &lt; b.threads-1; ++i) {</div>
<div class="line"> pthread_create(&amp;threads[i], NULL, broker_thread, &amp;b);</div>
<div class="line"> }</div>
<div class="line"> broker_thread(&amp;b); <span class="comment">/* Use the main thread too. */</span></div>
<div class="line"> <span class="comment">/* Join the other threads */</span></div>
<div class="line"> <span class="keywordflow">for</span> (i = 0; i &lt; b.threads-1; ++i) {</div>
<div class="line"> pthread_join(threads[i], NULL);</div>
<div class="line"> }</div>
<div class="line"> <a name="a103"></a><a class="code" href="group__proactor.html#ga5260c2653d4af5eb2f1c8c6190e9d6cf">pn_proactor_free</a>(b.proactor);</div>
<div class="line"> free(threads);</div>
<div class="line"> <a name="a104"></a><a class="code" href="group__ssl.html#ga5452ded9c36d78a17c6dea292a01c80d">pn_ssl_domain_free</a>(b.ssl_domain);</div>
<div class="line"> <span class="keywordflow">return</span> 0;</div>
<div class="line"> }</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__connection_html_ga0c3bf54f0991944a2f6eea36b561fa2b"><div class="ttname"><a href="group__connection.html#ga0c3bf54f0991944a2f6eea36b561fa2b">PN_LOCAL_ACTIVE</a></div><div class="ttdeci">#define PN_LOCAL_ACTIVE</div><div class="ttdoc">The local endpoint state is active.</div><div class="ttdef"><b>Definition:</b> connection.h:55</div></div>
<div class="ttc" id="anetaddr_8h_html"><div class="ttname"><a href="netaddr_8h.html">netaddr.h</a></div><div class="ttdoc">Unsettled API - The network address of a proactor transport.</div></div>
<div class="ttc" id="agroup__listener_html_ga6214da9323c8e6fcec8badc57a82e9df"><div class="ttname"><a href="group__listener.html#ga6214da9323c8e6fcec8badc57a82e9df">pn_event_listener</a></div><div class="ttdeci">PNP_EXTERN pn_listener_t * pn_event_listener(pn_event_t *event)</div><div class="ttdoc">Return the listener associated with an event.</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__connection_html_gad96220f2886c21a4f2eebc9487f53a87"><div class="ttname"><a href="group__connection.html#gad96220f2886c21a4f2eebc9487f53a87">PN_REMOTE_ACTIVE</a></div><div class="ttdeci">#define PN_REMOTE_ACTIVE</div><div class="ttdoc">The remote endpoint state is active.</div><div class="ttdef"><b>Definition:</b> connection.h:70</div></div>
<div class="ttc" id="agroup__transport_html_gaf9833d93faf6a6ed68039e4a909cdd77"><div class="ttname"><a href="group__transport.html#gaf9833d93faf6a6ed68039e4a909cdd77">pn_transport</a></div><div class="ttdeci">pn_transport_t * pn_transport(void)</div><div class="ttdoc">Factory for creating a transport.</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__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="agroup__listener_html_ga3719a4ab17b8de42fc6bfb262018d070"><div class="ttname"><a href="group__listener.html#ga3719a4ab17b8de42fc6bfb262018d070">pn_listener_accept2</a></div><div class="ttdeci">PNP_EXTERN void pn_listener_accept2(pn_listener_t *listener, pn_connection_t *connection, pn_transport_t *transport)</div><div class="ttdoc">Accept an incoming connection request using transport and connection, which can be configured before ...</div></div>
<div class="ttc" id="agroup__proactor_html_ga8cdeab8554e7d376a422dae8ac6d474b"><div class="ttname"><a href="group__proactor.html#ga8cdeab8554e7d376a422dae8ac6d474b">pn_netaddr_host_port</a></div><div class="ttdeci">PNP_EXTERN int pn_netaddr_host_port(const pn_netaddr_t *na, char *host, size_t hlen, char *port, size_t plen)</div><div class="ttdoc">Get the host and port name from na as separate strings.</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__connection_html_gad3203b366cb1ff5becd1778a8dd6b1a6"><div class="ttname"><a href="group__connection.html#gad3203b366cb1ff5becd1778a8dd6b1a6">pn_connection_set_context</a></div><div class="ttdeci">void pn_connection_set_context(pn_connection_t *connection, void *context)</div><div class="ttdoc">Set a new application context for a connection 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__transport_html_gac26eda05f649bbf0399f3d8d78d12fa8"><div class="ttname"><a href="group__transport.html#gac26eda05f649bbf0399f3d8d78d12fa8">pn_transport_t</a></div><div class="ttdeci">struct pn_transport_t pn_transport_t</div><div class="ttdoc">A network channel supporting an AMQP connection.</div><div class="ttdef"><b>Definition:</b> types.h:435</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__proactor_html_gaa5255cd1bcb5d7f5639b53dc30712711"><div class="ttname"><a href="group__proactor.html#gaa5255cd1bcb5d7f5639b53dc30712711">pn_proactor_interrupt</a></div><div class="ttdeci">PNP_EXTERN void pn_proactor_interrupt(pn_proactor_t *proactor)</div><div class="ttdoc">Return a PN_PROACTOR_INTERRUPT event as soon as possible.</div></div>
<div class="ttc" id="agroup__link_html_ga997c85388b9fb30151ea3b40b946e958"><div class="ttname"><a href="group__link.html#ga997c85388b9fb30151ea3b40b946e958">pn_link_target</a></div><div class="ttdeci">pn_terminus_t * pn_link_target(pn_link_t *link)</div><div class="ttdoc">Access the locally defined target definition for a link.</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__ssl_html_gaaeb5284b45f9e2146ff671b1ddc9420c"><div class="ttname"><a href="group__ssl.html#gaaeb5284b45f9e2146ff671b1ddc9420c">pn_ssl</a></div><div class="ttdeci">pn_ssl_t * pn_ssl(pn_transport_t *transport)</div><div class="ttdoc">Create a new SSL session object associated with a transport.</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="alistener_8h_html"><div class="ttname"><a href="listener_8h.html">listener.h</a></div><div class="ttdoc">Unsettled API - A listener for incoming connections.</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__link_html_gadd3b8899fe023d3506fb88d228d6b1b7"><div class="ttname"><a href="group__link.html#gadd3b8899fe023d3506fb88d228d6b1b7">pn_link_free</a></div><div class="ttdeci">void pn_link_free(pn_link_t *link)</div><div class="ttdoc">Free a link object.</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__link_html_ga7c48ef214568267839aea04ed337926b"><div class="ttname"><a href="group__link.html#ga7c48ef214568267839aea04ed337926b">pn_link_is_sender</a></div><div class="ttdeci">bool pn_link_is_sender(pn_link_t *link)</div><div class="ttdoc">Test if a link is a sender.</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="agroup__event_html_gga4876e2eed24a4d4e4c52b99842103cdaaeacdc45bfe24b2a9da2aeed7b6effac5"><div class="ttname"><a href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaaeacdc45bfe24b2a9da2aeed7b6effac5">PN_LINK_FINAL</a></div><div class="ttdeci">@ PN_LINK_FINAL</div><div class="ttdoc">The link has been freed and any outstanding processing has been completed.</div><div class="ttdef"><b>Definition:</b> event.h:248</div></div>
<div class="ttc" id="agroup__proactor_html_gacdbda4ea3dc040af5a4c1d633ddd7cd9"><div class="ttname"><a href="group__proactor.html#gacdbda4ea3dc040af5a4c1d633ddd7cd9">pn_listener_addr</a></div><div class="ttdeci">PNP_EXTERN const pn_netaddr_t * pn_listener_addr(pn_listener_t *l)</div><div class="ttdoc">Get the listening addresses of a listener.</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__link_html_ga93e6b527743f433da2ff367c1b2c500a"><div class="ttname"><a href="group__link.html#ga93e6b527743f433da2ff367c1b2c500a">pn_link_get_context</a></div><div class="ttdeci">void * pn_link_get_context(pn_link_t *link)</div><div class="ttdoc">Get the application context that is associated with a link object.</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="agroup__proactor_html_ga0f49c771fe3bff54f58c9d583ca30560"><div class="ttname"><a href="group__proactor.html#ga0f49c771fe3bff54f58c9d583ca30560">pn_connection_wake</a></div><div class="ttdeci">PNP_EXTERN void pn_connection_wake(pn_connection_t *connection)</div><div class="ttdoc">Return a PN_CONNECTION_WAKE event for connection as soon as possible.</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__event_html_gga4876e2eed24a4d4e4c52b99842103cdaa0602b15957883e7d00ccdff4abca992c"><div class="ttname"><a href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa0602b15957883e7d00ccdff4abca992c">PN_LISTENER_ACCEPT</a></div><div class="ttdeci">@ PN_LISTENER_ACCEPT</div><div class="ttdoc">Indicates the listener has an incoming connection, call pn_listener_accept2() to accept it.</div><div class="ttdef"><b>Definition:</b> event.h:316</div></div>
<div class="ttc" id="agroup__listener_html_gaa49d0d11a9f46a75fbbbebf6def2d4b2"><div class="ttname"><a href="group__listener.html#gaa49d0d11a9f46a75fbbbebf6def2d4b2">pn_listener_condition</a></div><div class="ttdeci">PNP_EXTERN pn_condition_t * pn_listener_condition(pn_listener_t *l)</div><div class="ttdoc">Get the error condition for a listener.</div></div>
<div class="ttc" id="agroup__proactor_html_gacbed6a4ab75ef8452c10d52e4cd62752"><div class="ttname"><a href="group__proactor.html#gacbed6a4ab75ef8452c10d52e4cd62752">pn_proactor_listen</a></div><div class="ttdeci">PNP_EXTERN void pn_proactor_listen(pn_proactor_t *proactor, pn_listener_t *listener, const char *addr, int backlog)</div><div class="ttdoc">Start listening for incoming connections.</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__terminus_html_ga3507b6cfe260a2bfaae9321235db7c9a"><div class="ttname"><a href="group__terminus.html#ga3507b6cfe260a2bfaae9321235db7c9a">pn_terminus_get_address</a></div><div class="ttdeci">const char * pn_terminus_get_address(pn_terminus_t *terminus)</div><div class="ttdoc">Get the address of a terminus object.</div></div>
<div class="ttc" id="agroup__event_html_gga4876e2eed24a4d4e4c52b99842103cdaa6e25f00110ab278fd8b34fee00bd5fd7"><div class="ttname"><a href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa6e25f00110ab278fd8b34fee00bd5fd7">PN_LISTENER_OPEN</a></div><div class="ttdeci">@ PN_LISTENER_OPEN</div><div class="ttdoc">The listener is listening.</div><div class="ttdef"><b>Definition:</b> event.h:350</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__event_html_gga4876e2eed24a4d4e4c52b99842103cdaaee05826a80e94b5b86c4544e4715f499"><div class="ttname"><a href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaaee05826a80e94b5b86c4544e4715f499">PN_PROACTOR_INTERRUPT</a></div><div class="ttdeci">@ PN_PROACTOR_INTERRUPT</div><div class="ttdoc">Indicates pn_proactor_interrupt() was called to interrupt a proactor thread.</div><div class="ttdef"><b>Definition:</b> event.h:328</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__transport_html_gaeb7e30ead4a6ab080d0005379be20e34"><div class="ttname"><a href="group__transport.html#gaeb7e30ead4a6ab080d0005379be20e34">pn_transport_require_encryption</a></div><div class="ttdeci">void pn_transport_require_encryption(pn_transport_t *transport, bool required)</div><div class="ttdoc">Set whether a non encrypted transport connection is allowed.</div></div>
<div class="ttc" id="agroup__connection_html_ga50613e6c09186dc3f1a2f36238c61f07"><div class="ttname"><a href="group__connection.html#ga50613e6c09186dc3f1a2f36238c61f07">pn_connection_get_context</a></div><div class="ttdeci">void * pn_connection_get_context(pn_connection_t *connection)</div><div class="ttdoc">Get the application context that is associated with a connection object.</div></div>
<div class="ttc" id="agroup__link_html_gaa825fac21730f3f9fff37d156e5f88e9"><div class="ttname"><a href="group__link.html#gaa825fac21730f3f9fff37d156e5f88e9">pn_link_send</a></div><div class="ttdeci">ssize_t pn_link_send(pn_link_t *sender, const char *bytes, size_t n)</div><div class="ttdoc">Send message data for the current delivery on a link.</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="assl_8h_html"><div class="ttname"><a href="ssl_8h.html">ssl.h</a></div><div class="ttdoc">SSL secure transport layer.</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__link_html_gadf6b8ff6223465f21a481e9287f60671"><div class="ttname"><a href="group__link.html#gadf6b8ff6223465f21a481e9287f60671">pn_link_remote_source</a></div><div class="ttdeci">pn_terminus_t * pn_link_remote_source(pn_link_t *link)</div><div class="ttdoc">Access the remotely defined source definition for a link.</div></div>
<div class="ttc" id="asasl_8h_html"><div class="ttname"><a href="sasl_8h.html">sasl.h</a></div><div class="ttdoc">SASL secure transport layer.</div></div>
<div class="ttc" id="agroup__ssl_html_gaab5e86b7a4d22943eba82c6e94b82357"><div class="ttname"><a href="group__ssl.html#gaab5e86b7a4d22943eba82c6e94b82357">pn_ssl_domain</a></div><div class="ttdeci">pn_ssl_domain_t * pn_ssl_domain(pn_ssl_mode_t mode)</div><div class="ttdoc">Create an SSL configuration domain.</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_gga4876e2eed24a4d4e4c52b99842103cdaaf67df046bea45df34aea863d9541e806"><div class="ttname"><a href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaaf67df046bea45df34aea863d9541e806">PN_SESSION_REMOTE_OPEN</a></div><div class="ttdeci">@ PN_SESSION_REMOTE_OPEN</div><div class="ttdoc">The remote endpoint has opened the session.</div><div class="ttdef"><b>Definition:</b> event.h:174</div></div>
<div class="ttc" id="agroup__sasl_html_ga73299a6a22e141e7911a739590032625"><div class="ttname"><a href="group__sasl.html#ga73299a6a22e141e7911a739590032625">pn_sasl_allowed_mechs</a></div><div class="ttdeci">void pn_sasl_allowed_mechs(pn_sasl_t *sasl, const char *mechs)</div><div class="ttdoc">SASL mechanisms that are to be considered for authentication.</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__event_html_gga4876e2eed24a4d4e4c52b99842103cdaa28a2bfee806bbc1fe31499c8eec39db0"><div class="ttname"><a href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa28a2bfee806bbc1fe31499c8eec39db0">PN_CONNECTION_WAKE</a></div><div class="ttdeci">@ PN_CONNECTION_WAKE</div><div class="ttdoc">pn_connection_wake() was called.</div><div class="ttdef"><b>Definition:</b> event.h:309</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="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__ssl_html_ga45f319dd31ad456b8a85927888f94acf"><div class="ttname"><a href="group__ssl.html#ga45f319dd31ad456b8a85927888f94acf">pn_ssl_init</a></div><div class="ttdeci">int pn_ssl_init(pn_ssl_t *ssl, pn_ssl_domain_t *domain, const char *session_id)</div><div class="ttdoc">Initialize an SSL session.</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__event_html_gga4876e2eed24a4d4e4c52b99842103cdaad48bce685db553740fa71cc36473b5cc"><div class="ttname"><a href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaad48bce685db553740fa71cc36473b5cc">PN_CONNECTION_REMOTE_OPEN</a></div><div class="ttdeci">@ PN_CONNECTION_REMOTE_OPEN</div><div class="ttdoc">The remote endpoint has opened the connection.</div><div class="ttdef"><b>Definition:</b> event.h:137</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__ssl_html_gaba83c3a1779c8b35a479bf3a7bb5b175"><div class="ttname"><a href="group__ssl.html#gaba83c3a1779c8b35a479bf3a7bb5b175">pn_ssl_domain_t</a></div><div class="ttdeci">struct pn_ssl_domain_t pn_ssl_domain_t</div><div class="ttdoc">API for using SSL with the Transport Layer.</div><div class="ttdef"><b>Definition:</b> ssl.h:80</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__session_html_ga0f95b5177494a68991d75444c2f6f812"><div class="ttname"><a href="group__session.html#ga0f95b5177494a68991d75444c2f6f812">pn_session_free</a></div><div class="ttdeci">void pn_session_free(pn_session_t *session)</div><div class="ttdoc">Free a session object.</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_ga6a7ef2e317b4ed292cafbb358f0ba6ad"><div class="ttname"><a href="group__delivery.html#ga6a7ef2e317b4ed292cafbb358f0ba6ad">pn_delivery</a></div><div class="ttdeci">pn_delivery_t * pn_delivery(pn_link_t *link, pn_delivery_tag_t tag)</div><div class="ttdoc">Create a delivery on a link.</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__ssl_html_ga5452ded9c36d78a17c6dea292a01c80d"><div class="ttname"><a href="group__ssl.html#ga5452ded9c36d78a17c6dea292a01c80d">pn_ssl_domain_free</a></div><div class="ttdeci">void pn_ssl_domain_free(pn_ssl_domain_t *domain)</div><div class="ttdoc">Release an SSL configuration domain.</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="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__event_html_gga4876e2eed24a4d4e4c52b99842103cdaa4eaecc54c07cdc9b0df7b1d536a7dc3f"><div class="ttname"><a href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa4eaecc54c07cdc9b0df7b1d536a7dc3f">PN_LINK_FLOW</a></div><div class="ttdeci">@ PN_LINK_FLOW</div><div class="ttdoc">The flow control state for a link has changed.</div><div class="ttdef"><b>Definition:</b> event.h:241</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="agroup__link_html_ga9b2a9cfa00dfdae4e01bf75483433925"><div class="ttname"><a href="group__link.html#ga9b2a9cfa00dfdae4e01bf75483433925">pn_link_next</a></div><div class="ttdeci">pn_link_t * pn_link_next(pn_link_t *link, pn_state_t state)</div><div class="ttdoc">Retrieve the next link that matches the given state mask.</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__link_html_gabf61668a66ae189dbb4820da6ee30d90"><div class="ttname"><a href="group__link.html#gabf61668a66ae189dbb4820da6ee30d90">pn_link_remote_target</a></div><div class="ttdeci">pn_terminus_t * pn_link_remote_target(pn_link_t *link)</div><div class="ttdoc">Access the remotely defined target definition for a link.</div></div>
<div class="ttc" id="agroup__event_html_gga4876e2eed24a4d4e4c52b99842103cdaa45edb44a6cc7908b5032944e08925307"><div class="ttname"><a href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaa45edb44a6cc7908b5032944e08925307">PN_LINK_REMOTE_OPEN</a></div><div class="ttdeci">@ PN_LINK_REMOTE_OPEN</div><div class="ttdoc">The remote endpoint has opened the link.</div><div class="ttdef"><b>Definition:</b> event.h:211</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__ssl_html_gga0f1d40875c45b14a31a77f27430bc225a0c4550c70a6bc74cb906a74c5f1e5078"><div class="ttname"><a href="group__ssl.html#gga0f1d40875c45b14a31a77f27430bc225a0c4550c70a6bc74cb906a74c5f1e5078">PN_SSL_MODE_SERVER</a></div><div class="ttdeci">@ PN_SSL_MODE_SERVER</div><div class="ttdoc">Local connection endpoint is an SSL server.</div><div class="ttdef"><b>Definition:</b> ssl.h:92</div></div>
<div class="ttc" id="agroup__sasl_html_ga7968e80e2fe9360fc14cf865dd1ac21c"><div class="ttname"><a href="group__sasl.html#ga7968e80e2fe9360fc14cf865dd1ac21c">pn_sasl</a></div><div class="ttdeci">pn_sasl_t * pn_sasl(pn_transport_t *transport)</div><div class="ttdoc">Construct an Authentication and Security Layer object.</div></div>
<div class="ttc" id="agroup__delivery_html_gaea4522ac1fef9228fb6c743d2a36fd27"><div class="ttname"><a href="group__delivery.html#gaea4522ac1fef9228fb6c743d2a36fd27">pn_dtag</a></div><div class="ttdeci">pn_delivery_tag_t pn_dtag(const char *bytes, size_t size)</div><div class="ttdoc">Construct a delivery tag.</div></div>
<div class="ttc" id="agroup__listener_html_gabba0a7d2e916188e3ec07d0acf8f3fc5"><div class="ttname"><a href="group__listener.html#gabba0a7d2e916188e3ec07d0acf8f3fc5">pn_listener</a></div><div class="ttdeci">PNP_EXTERN pn_listener_t * pn_listener(void)</div><div class="ttdoc">Create a listener to pass to pn_proactor_listen()</div></div>
<div class="ttc" id="agroup__transport_html_gac5bebd26c0942bc17d7fad36577110f8"><div class="ttname"><a href="group__transport.html#gac5bebd26c0942bc17d7fad36577110f8">pn_transport_set_server</a></div><div class="ttdeci">void pn_transport_set_server(pn_transport_t *transport)</div><div class="ttdoc">Configure a transport as a server.</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_ga7c9434c40eb653f007ff5721e2ebf73e"><div class="ttname"><a href="group__link.html#ga7c9434c40eb653f007ff5721e2ebf73e">pn_link_head</a></div><div class="ttdeci">pn_link_t * pn_link_head(pn_connection_t *connection, pn_state_t state)</div><div class="ttdoc">Retrieve the first link that matches the given state mask.</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>
<div class="ttc" id="agroup__event_html_gga4876e2eed24a4d4e4c52b99842103cdaad5920df168cd28daaf253cad789d8aca"><div class="ttname"><a href="group__event.html#gga4876e2eed24a4d4e4c52b99842103cdaad5920df168cd28daaf253cad789d8aca">PN_LISTENER_CLOSE</a></div><div class="ttdeci">@ PN_LISTENER_CLOSE</div><div class="ttdoc">Indicates the listener has closed.</div><div class="ttdef"><b>Definition:</b> event.h:322</div></div>
<div class="ttc" id="agroup__link_html_ga93824a3859c37463e44458cd2f63d31f"><div class="ttname"><a href="group__link.html#ga93824a3859c37463e44458cd2f63d31f">pn_link_advance</a></div><div class="ttdeci">bool pn_link_advance(pn_link_t *link)</div><div class="ttdoc">Advance the current delivery of a link to the next delivery on the link.</div></div>
<div class="ttc" id="agroup__link_html_ga376f2cc18bbd771d95aa8222586d19b2"><div class="ttname"><a href="group__link.html#ga376f2cc18bbd771d95aa8222586d19b2">pn_link_set_context</a></div><div class="ttdeci">void pn_link_set_context(pn_link_t *link, void *context)</div><div class="ttdoc">Set a new application context for a link object.</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>