qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jr...@apache.org
Subject [19/26] qpid-site git commit: QPID-7350: Examples that should have gone with the previous commit
Date Wed, 13 Jul 2016 09:55:04 GMT
http://git-wip-us.apache.org/repos/asf/qpid-site/blob/75ca8b14/content/releases/qpid-proton-0.13.0/proton/cpp/examples/ssl.cpp
----------------------------------------------------------------------
diff --git a/content/releases/qpid-proton-0.13.0/proton/cpp/examples/ssl.cpp b/content/releases/qpid-proton-0.13.0/proton/cpp/examples/ssl.cpp
new file mode 100755
index 0000000..91a4230
--- /dev/null
+++ b/content/releases/qpid-proton-0.13.0/proton/cpp/examples/ssl.cpp
@@ -0,0 +1,179 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <proton/connection_options.hpp>
+#include <proton/connection.hpp>
+#include <proton/default_container.hpp>
+#include <proton/messaging_handler.hpp>
+#include <proton/ssl.hpp>
+#include <proton/tracker.hpp>
+#include <proton/transport.hpp>
+
+#include <iostream>
+
+#include "fake_cpp11.hpp"
+
+using proton::connection_options;
+using proton::ssl_client_options;
+using proton::ssl_server_options;
+using proton::ssl_certificate;
+
+// Helper functions defined below.
+bool using_OpenSSL();
+std::string platform_CA(const std::string &base_name);
+ssl_certificate platform_certificate(const std::string &base_name, const std::string &passwd);
+static std::string cert_directory;
+std::string find_CN(const std::string &);
+
+
+struct server_handler : public proton::messaging_handler {
+    std::string url;
+
+    void on_connection_open(proton::connection &c) OVERRIDE {
+        std::cout << "Inbound server connection connected via SSL.  Protocol: " <<
+            c.transport().ssl().protocol() << std::endl;
+        c.container().stop_listening(url);
+    }
+
+    void on_message(proton::delivery &, proton::message &m) OVERRIDE {
+        std::cout << m.body() << std::endl;
+    }
+};
+
+
+class hello_world_direct : public proton::messaging_handler {
+  private:
+    std::string url;
+    server_handler s_handler;
+
+  public:
+    hello_world_direct(const std::string& u) : url(u) {}
+
+    void on_container_start(proton::container &c) OVERRIDE {
+        // Configure listener.  Details vary by platform.
+        ssl_certificate server_cert = platform_certificate("tserver", "tserverpw");
+        ssl_server_options ssl_srv(server_cert);
+        connection_options server_opts;
+        server_opts.ssl_server_options(ssl_srv).handler(s_handler);
+        c.server_connection_options(server_opts);
+
+        // Configure client with a Certificate Authority database populated with the server's self signed certificate.
+        // Since the test certifcate's credentials are unlikely to match this host's name, downgrade the verification
+        // from VERIFY_PEER_NAME to VERIFY_PEER.
+        connection_options client_opts;
+        ssl_client_options ssl_cli(platform_CA("tserver"), proton::ssl::VERIFY_PEER);
+        client_opts.ssl_client_options(ssl_cli);
+        c.client_connection_options(client_opts);
+
+        s_handler.url = url;
+        c.listen(url);
+        c.open_sender(url);
+    }
+
+    void on_connection_open(proton::connection &c) OVERRIDE {
+        std::string subject = c.transport().ssl().remote_subject();
+        std::cout << "Outgoing client connection connected via SSL.  Server certificate identity " <<
+            find_CN(subject) << std::endl;
+    }
+
+    void on_sendable(proton::sender &s) OVERRIDE {
+        proton::message m;
+        m.body("Hello World!");
+        s.send(m);
+        s.close();
+    }
+
+    void on_tracker_accept(proton::tracker &t) OVERRIDE {
+        // All done.
+        t.connection().close();
+    }
+};
+
+int main(int argc, char **argv) {
+    try {
+        // Pick an "unusual" port since we are going to be talking to ourselves, not a broker.
+        // Note the use of "amqps" as the URL scheme to denote a TLS/SSL connection.
+        std::string url = argc > 1 ? argv[1] : "amqps://127.0.0.1:8888/examples";
+        // Location of certificates and private key information:
+        if (argc > 2) {
+            cert_directory = argv[2];
+            size_t sz = cert_directory.size();
+            if (sz && cert_directory[sz -1] != '/')
+                cert_directory.append("/");
+        }
+        else cert_directory = "ssl_certs/";
+
+        hello_world_direct hwd(url);
+        proton::default_container(hwd).run();
+        return 0;
+    } catch (const std::exception& e) {
+        std::cerr << e.what() << std::endl;
+    }
+    return 1;
+}
+
+
+bool using_OpenSSL() {
+    // Current defaults.
+#if defined(WIN32)
+    return false;
+#else
+    return true;
+#endif
+}
+
+ssl_certificate platform_certificate(const std::string &base_name, const std::string &passwd) {
+    if (using_OpenSSL()) {
+        // The first argument will be the name of the file containing the public certificate, the
+        // second argument will be the name of the file containing the private key.
+        return ssl_certificate(cert_directory + base_name + "-certificate.pem",
+                               cert_directory + base_name + "-private-key.pem", passwd);
+    }
+    else {
+        // Windows SChannel
+        // The first argument will be the database or store that contains one or more complete certificates
+        // (public and private data).  The second will be an optional name of the certificate in the store
+        // (not used in this example with one certificate per store).
+        return ssl_certificate(cert_directory + base_name + "-full.p12", "", passwd);
+    }
+}
+
+std::string platform_CA(const std::string &base_name) {
+    if (using_OpenSSL()) {
+        // In this simple example with self-signed certificates, the peer's certificate is the CA database.
+        return cert_directory + base_name + "-certificate.pem";
+    }
+    else {
+        // Windows SChannel.  Use a pkcs#12 file with just the peer's public certificate information.
+        return cert_directory + base_name + "-certificate.p12";
+    }
+}
+
+std::string find_CN(const std::string &subject) {
+    // The subject string is returned with different whitespace and component ordering between platforms.
+    // Here we just return the common name by searching for "CN=...." in the subject, knowing that
+    // the test certificates do not contain any escaped characters.
+    size_t pos = subject.find("CN=");
+    if (pos == std::string::npos) throw std::runtime_error("No common name in certificate subject");
+    std::string cn = subject.substr(pos);
+    pos = cn.find(',');
+    return pos == std::string::npos ? cn : cn.substr(0, pos);
+}

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/75ca8b14/content/releases/qpid-proton-0.13.0/proton/cpp/examples/ssl.cpp.html
----------------------------------------------------------------------
diff --git a/content/releases/qpid-proton-0.13.0/proton/cpp/examples/ssl.cpp.html b/content/releases/qpid-proton-0.13.0/proton/cpp/examples/ssl.cpp.html
new file mode 100644
index 0000000..0f15d4d
--- /dev/null
+++ b/content/releases/qpid-proton-0.13.0/proton/cpp/examples/ssl.cpp.html
@@ -0,0 +1,307 @@
+<!DOCTYPE html>
+<!--
+ -
+ - Licensed to the Apache Software Foundation (ASF) under one
+ - or more contributor license agreements.  See the NOTICE file
+ - distributed with this work for additional information
+ - regarding copyright ownership.  The ASF licenses this file
+ - to you under the Apache License, Version 2.0 (the
+ - "License"); you may not use this file except in compliance
+ - with the License.  You may obtain a copy of the License at
+ -
+ -   http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing,
+ - software distributed under the License is distributed on an
+ - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ - KIND, either express or implied.  See the License for the
+ - specific language governing permissions and limitations
+ - under the License.
+ -
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+  <head>
+    <title>ssl.cpp - Apache Qpid&#8482;</title>
+    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+    <link rel="stylesheet" href="/site.css" type="text/css" async="async"/>
+    <link rel="stylesheet" href="/deferred.css" type="text/css" defer="defer"/>
+    <script type="text/javascript">var _deferredFunctions = [];</script>
+    <script type="text/javascript" src="/deferred.js" defer="defer"></script>
+    <!--[if lte IE 8]>
+      <link rel="stylesheet" href="/ie.css" type="text/css"/>
+      <script type="text/javascript" src="/html5shiv.js"></script>
+    <![endif]-->
+
+    <!-- Redirects for `go get` and godoc.org -->
+    <meta name="go-import"
+          content="qpid.apache.org git https://git-wip-us.apache.org/repos/asf/qpid-proton.git"/>
+    <meta name="go-source"
+          content="qpid.apache.org
+https://github.com/apache/qpid-proton/blob/go1/README.md
+https://github.com/apache/qpid-proton/tree/go1{/dir}
+https://github.com/apache/qpid-proton/blob/go1{/dir}/{file}#L{line}"/>
+  </head>
+  <body>
+    <div id="-content">
+      <div id="-top" class="panel">
+        <a id="-menu-link"><img width="16" height="16" src="" alt="Menu"/></a>
+
+        <a id="-search-link"><img width="22" height="16" src="" alt="Search"/></a>
+
+        <ul id="-global-navigation">
+          <li><a id="-logotype" href="/index.html">Apache Qpid<sup>&#8482;</sup></a></li>
+          <li><a href="/documentation.html">Documentation</a></li>
+          <li><a href="/download.html">Download</a></li>
+          <li><a href="/discussion.html">Discussion</a></li>
+        </ul>
+      </div>
+
+      <div id="-menu" class="panel" style="display: none;">
+        <div class="flex">
+          <section>
+            <h3>Project</h3>
+
+            <ul>
+              <li><a href="/overview.html">Overview</a></li>
+              <li><a href="/components/index.html">Components</a></li>
+              <li><a href="/releases/index.html">Releases</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Messaging APIs</h3>
+
+            <ul>
+              <li><a href="/proton/index.html">Qpid Proton</a></li>
+              <li><a href="/components/jms/index.html">Qpid JMS</a></li>
+              <li><a href="/components/messaging-api/index.html">Qpid Messaging API</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Servers and tools</h3>
+
+            <ul>
+              <li><a href="/components/java-broker/index.html">Java broker</a></li>
+              <li><a href="/components/cpp-broker/index.html">C++ broker</a></li>
+              <li><a href="/components/dispatch-router/index.html">Dispatch router</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Resources</h3>
+
+            <ul>
+              <li><a href="/dashboard.html">Dashboard</a></li>
+              <li><a href="https://cwiki.apache.org/confluence/display/qpid/Index">Wiki</a></li>
+              <li><a href="/resources.html">More resources</a></li>
+            </ul>
+          </section>
+        </div>
+      </div>
+
+      <div id="-search" class="panel" style="display: none;">
+        <form action="http://www.google.com/search" method="get">
+          <input type="hidden" name="sitesearch" value="qpid.apache.org"/>
+          <input type="text" name="q" maxlength="255" autofocus="autofocus" tabindex="1"/>
+          <button type="submit">Search</button>
+          <a href="/search.html">More ways to search</a>
+        </form>
+      </div>
+
+      <div id="-middle" class="panel">
+        <ul id="-path-navigation"><li><a href="/index.html">Home</a></li><li><a href="/releases/index.html">Releases</a></li><li><a href="/releases/qpid-proton-0.13.0/index.html">Qpid Proton 0.13.0</a></li><li><a href="/releases/qpid-proton-0.13.0/proton/cpp/examples/index.html">Proton C++ Examples</a></li><li>ssl.cpp</li></ul>
+
+        <div id="-middle-content">
+          
+<h1>ssl.cpp</h1>
+<div class="highlight"><pre><span></span><span class="cp">#include</span> <span class="cpf">&lt;proton/connection_options.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/connection.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/default_container.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/messaging_handler.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/ssl.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/tracker.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/transport.hpp&gt;</span><span class="cp"></span>
+
+<span class="cp">#include</span> <span class="cpf">&lt;iostream&gt;</span><span class="cp"></span>
+
+<span class="cp">#include</span> <span class="cpf">&quot;fake_cpp11.hpp&quot;</span><span class="cp"></span>
+
+<span class="k">using</span> <span class="n">proton</span><span class="o">::</span><span class="n">connection_options</span><span class="p">;</span>
+<span class="k">using</span> <span class="n">proton</span><span class="o">::</span><span class="n">ssl_client_options</span><span class="p">;</span>
+<span class="k">using</span> <span class="n">proton</span><span class="o">::</span><span class="n">ssl_server_options</span><span class="p">;</span>
+<span class="k">using</span> <span class="n">proton</span><span class="o">::</span><span class="n">ssl_certificate</span><span class="p">;</span>
+
+<span class="c1">// Helper functions defined below.</span>
+<span class="kt">bool</span> <span class="nf">using_OpenSSL</span><span class="p">();</span>
+<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">platform_CA</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">base_name</span><span class="p">);</span>
+<span class="n">ssl_certificate</span> <span class="nf">platform_certificate</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">base_name</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">passwd</span><span class="p">);</span>
+<span class="k">static</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">cert_directory</span><span class="p">;</span>
+<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">find_CN</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="p">);</span>
+
+
+<span class="k">struct</span> <span class="nl">server_handler</span> <span class="p">:</span> <span class="k">public</span> <span class="n">proton</span><span class="o">::</span><span class="n">messaging_handler</span> <span class="p">{</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">url</span><span class="p">;</span>
+
+    <span class="kt">void</span> <span class="nf">on_connection_open</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">connection</span> <span class="o">&amp;</span><span class="n">c</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Inbound server connection connected via SSL.  Protocol: &quot;</span> <span class="o">&lt;&lt;</span>
+            <span class="n">c</span><span class="p">.</span><span class="n">transport</span><span class="p">().</span><span class="n">ssl</span><span class="p">().</span><span class="n">protocol</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+        <span class="n">c</span><span class="p">.</span><span class="n">container</span><span class="p">().</span><span class="n">stop_listening</span><span class="p">(</span><span class="n">url</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="kt">void</span> <span class="nf">on_message</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">delivery</span> <span class="o">&amp;</span><span class="p">,</span> <span class="n">proton</span><span class="o">::</span><span class="n">message</span> <span class="o">&amp;</span><span class="n">m</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="n">m</span><span class="p">.</span><span class="n">body</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+    <span class="p">}</span>
+<span class="p">};</span>
+
+
+<span class="k">class</span> <span class="nc">hello_world_direct</span> <span class="o">:</span> <span class="k">public</span> <span class="n">proton</span><span class="o">::</span><span class="n">messaging_handler</span> <span class="p">{</span>
+  <span class="k">private</span><span class="o">:</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">url</span><span class="p">;</span>
+    <span class="n">server_handler</span> <span class="n">s_handler</span><span class="p">;</span>
+
+  <span class="k">public</span><span class="o">:</span>
+    <span class="n">hello_world_direct</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">u</span><span class="p">)</span> <span class="o">:</span> <span class="n">url</span><span class="p">(</span><span class="n">u</span><span class="p">)</span> <span class="p">{}</span>
+
+    <span class="kt">void</span> <span class="n">on_container_start</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">container</span> <span class="o">&amp;</span><span class="n">c</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="c1">// Configure listener.  Details vary by platform.</span>
+        <span class="n">ssl_certificate</span> <span class="n">server_cert</span> <span class="o">=</span> <span class="n">platform_certificate</span><span class="p">(</span><span class="s">&quot;tserver&quot;</span><span class="p">,</span> <span class="s">&quot;tserverpw&quot;</span><span class="p">);</span>
+        <span class="n">ssl_server_options</span> <span class="nf">ssl_srv</span><span class="p">(</span><span class="n">server_cert</span><span class="p">);</span>
+        <span class="n">connection_options</span> <span class="n">server_opts</span><span class="p">;</span>
+        <span class="n">server_opts</span><span class="p">.</span><span class="n">ssl_server_options</span><span class="p">(</span><span class="n">ssl_srv</span><span class="p">).</span><span class="n">handler</span><span class="p">(</span><span class="n">s_handler</span><span class="p">);</span>
+        <span class="n">c</span><span class="p">.</span><span class="n">server_connection_options</span><span class="p">(</span><span class="n">server_opts</span><span class="p">);</span>
+
+        <span class="c1">// Configure client with a Certificate Authority database populated with the server&#39;s self signed certificate.</span>
+        <span class="c1">// Since the test certifcate&#39;s credentials are unlikely to match this host&#39;s name, downgrade the verification</span>
+        <span class="c1">// from VERIFY_PEER_NAME to VERIFY_PEER.</span>
+        <span class="n">connection_options</span> <span class="n">client_opts</span><span class="p">;</span>
+        <span class="n">ssl_client_options</span> <span class="nf">ssl_cli</span><span class="p">(</span><span class="n">platform_CA</span><span class="p">(</span><span class="s">&quot;tserver&quot;</span><span class="p">),</span> <span class="n">proton</span><span class="o">::</span><span class="n">ssl</span><span class="o">::</span><span class="n">VERIFY_PEER</span><span class="p">);</span>
+        <span class="n">client_opts</span><span class="p">.</span><span class="n">ssl_client_options</span><span class="p">(</span><span class="n">ssl_cli</span><span class="p">);</span>
+        <span class="n">c</span><span class="p">.</span><span class="n">client_connection_options</span><span class="p">(</span><span class="n">client_opts</span><span class="p">);</span>
+
+        <span class="n">s_handler</span><span class="p">.</span><span class="n">url</span> <span class="o">=</span> <span class="n">url</span><span class="p">;</span>
+        <span class="n">c</span><span class="p">.</span><span class="n">listen</span><span class="p">(</span><span class="n">url</span><span class="p">);</span>
+        <span class="n">c</span><span class="p">.</span><span class="n">open_sender</span><span class="p">(</span><span class="n">url</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="kt">void</span> <span class="n">on_connection_open</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">connection</span> <span class="o">&amp;</span><span class="n">c</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">subject</span> <span class="o">=</span> <span class="n">c</span><span class="p">.</span><span class="n">transport</span><span class="p">().</span><span class="n">ssl</span><span class="p">().</span><span class="n">remote_subject</span><span class="p">();</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Outgoing client connection connected via SSL.  Server certificate identity &quot;</span> <span class="o">&lt;&lt;</span>
+            <span class="n">find_CN</span><span class="p">(</span><span class="n">subject</span><span class="p">)</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+    <span class="p">}</span>
+
+    <span class="kt">void</span> <span class="n">on_sendable</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">sender</span> <span class="o">&amp;</span><span class="n">s</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="n">proton</span><span class="o">::</span><span class="n">message</span> <span class="n">m</span><span class="p">;</span>
+        <span class="n">m</span><span class="p">.</span><span class="n">body</span><span class="p">(</span><span class="s">&quot;Hello World!&quot;</span><span class="p">);</span>
+        <span class="n">s</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="n">m</span><span class="p">);</span>
+        <span class="n">s</span><span class="p">.</span><span class="n">close</span><span class="p">();</span>
+    <span class="p">}</span>
+
+    <span class="kt">void</span> <span class="n">on_tracker_accept</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">tracker</span> <span class="o">&amp;</span><span class="n">t</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="c1">// All done.</span>
+        <span class="n">t</span><span class="p">.</span><span class="n">connection</span><span class="p">().</span><span class="n">close</span><span class="p">();</span>
+    <span class="p">}</span>
+<span class="p">};</span>
+
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span> <span class="o">**</span><span class="n">argv</span><span class="p">)</span> <span class="p">{</span>
+    <span class="k">try</span> <span class="p">{</span>
+        <span class="c1">// Pick an &quot;unusual&quot; port since we are going to be talking to ourselves, not a broker.</span>
+        <span class="c1">// Note the use of &quot;amqps&quot; as the URL scheme to denote a TLS/SSL connection.</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">url</span> <span class="o">=</span> <span class="n">argc</span> <span class="o">&gt;</span> <span class="mi">1</span> <span class="o">?</span> <span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">:</span> <span class="s">&quot;amqps://127.0.0.1:8888/examples&quot;</span><span class="p">;</span>
+        <span class="c1">// Location of certificates and private key information:</span>
+        <span class="k">if</span> <span class="p">(</span><span class="n">argc</span> <span class="o">&gt;</span> <span class="mi">2</span><span class="p">)</span> <span class="p">{</span>
+            <span class="n">cert_directory</span> <span class="o">=</span> <span class="n">argv</span><span class="p">[</span><span class="mi">2</span><span class="p">];</span>
+            <span class="kt">size_t</span> <span class="n">sz</span> <span class="o">=</span> <span class="n">cert_directory</span><span class="p">.</span><span class="n">size</span><span class="p">();</span>
+            <span class="k">if</span> <span class="p">(</span><span class="n">sz</span> <span class="o">&amp;&amp;</span> <span class="n">cert_directory</span><span class="p">[</span><span class="n">sz</span> <span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">!=</span> <span class="sc">&#39;/&#39;</span><span class="p">)</span>
+                <span class="n">cert_directory</span><span class="p">.</span><span class="n">append</span><span class="p">(</span><span class="s">&quot;/&quot;</span><span class="p">);</span>
+        <span class="p">}</span>
+        <span class="k">else</span> <span class="n">cert_directory</span> <span class="o">=</span> <span class="s">&quot;ssl_certs/&quot;</span><span class="p">;</span>
+
+        <span class="n">hello_world_direct</span> <span class="n">hwd</span><span class="p">(</span><span class="n">url</span><span class="p">);</span>
+        <span class="n">proton</span><span class="o">::</span><span class="n">default_container</span><span class="p">(</span><span class="n">hwd</span><span class="p">).</span><span class="n">run</span><span class="p">();</span>
+        <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">exception</span><span class="o">&amp;</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cerr</span> <span class="o">&lt;&lt;</span> <span class="n">e</span><span class="p">.</span><span class="n">what</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+    <span class="p">}</span>
+    <span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
+<span class="p">}</span>
+
+
+<span class="kt">bool</span> <span class="nf">using_OpenSSL</span><span class="p">()</span> <span class="p">{</span>
+    <span class="c1">// Current defaults.</span>
+<span class="cp">#if defined(WIN32)</span>
+    <span class="k">return</span> <span class="nb">false</span><span class="p">;</span>
+<span class="cp">#else</span>
+    <span class="k">return</span> <span class="nb">true</span><span class="p">;</span>
+<span class="cp">#endif</span>
+<span class="p">}</span>
+
+<span class="n">ssl_certificate</span> <span class="nf">platform_certificate</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">base_name</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">passwd</span><span class="p">)</span> <span class="p">{</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">using_OpenSSL</span><span class="p">())</span> <span class="p">{</span>
+        <span class="c1">// The first argument will be the name of the file containing the public certificate, the</span>
+        <span class="c1">// second argument will be the name of the file containing the private key.</span>
+        <span class="k">return</span> <span class="n">ssl_certificate</span><span class="p">(</span><span class="n">cert_directory</span> <span class="o">+</span> <span class="n">base_name</span> <span class="o">+</span> <span class="s">&quot;-certificate.pem&quot;</span><span class="p">,</span>
+                               <span class="n">cert_directory</span> <span class="o">+</span> <span class="n">base_name</span> <span class="o">+</span> <span class="s">&quot;-private-key.pem&quot;</span><span class="p">,</span> <span class="n">passwd</span><span class="p">);</span>
+    <span class="p">}</span>
+    <span class="k">else</span> <span class="p">{</span>
+        <span class="c1">// Windows SChannel</span>
+        <span class="c1">// The first argument will be the database or store that contains one or more complete certificates</span>
+        <span class="c1">// (public and private data).  The second will be an optional name of the certificate in the store</span>
+        <span class="c1">// (not used in this example with one certificate per store).</span>
+        <span class="k">return</span> <span class="n">ssl_certificate</span><span class="p">(</span><span class="n">cert_directory</span> <span class="o">+</span> <span class="n">base_name</span> <span class="o">+</span> <span class="s">&quot;-full.p12&quot;</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">,</span> <span class="n">passwd</span><span class="p">);</span>
+    <span class="p">}</span>
+<span class="p">}</span>
+
+<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">platform_CA</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">base_name</span><span class="p">)</span> <span class="p">{</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">using_OpenSSL</span><span class="p">())</span> <span class="p">{</span>
+        <span class="c1">// In this simple example with self-signed certificates, the peer&#39;s certificate is the CA database.</span>
+        <span class="k">return</span> <span class="n">cert_directory</span> <span class="o">+</span> <span class="n">base_name</span> <span class="o">+</span> <span class="s">&quot;-certificate.pem&quot;</span><span class="p">;</span>
+    <span class="p">}</span>
+    <span class="k">else</span> <span class="p">{</span>
+        <span class="c1">// Windows SChannel.  Use a pkcs#12 file with just the peer&#39;s public certificate information.</span>
+        <span class="k">return</span> <span class="n">cert_directory</span> <span class="o">+</span> <span class="n">base_name</span> <span class="o">+</span> <span class="s">&quot;-certificate.p12&quot;</span><span class="p">;</span>
+    <span class="p">}</span>
+<span class="p">}</span>
+
+<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">find_CN</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">subject</span><span class="p">)</span> <span class="p">{</span>
+    <span class="c1">// The subject string is returned with different whitespace and component ordering between platforms.</span>
+    <span class="c1">// Here we just return the common name by searching for &quot;CN=....&quot; in the subject, knowing that</span>
+    <span class="c1">// the test certificates do not contain any escaped characters.</span>
+    <span class="kt">size_t</span> <span class="n">pos</span> <span class="o">=</span> <span class="n">subject</span><span class="p">.</span><span class="n">find</span><span class="p">(</span><span class="s">&quot;CN=&quot;</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">pos</span> <span class="o">==</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">::</span><span class="n">npos</span><span class="p">)</span> <span class="k">throw</span> <span class="n">std</span><span class="o">::</span><span class="n">runtime_error</span><span class="p">(</span><span class="s">&quot;No common name in certificate subject&quot;</span><span class="p">);</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">cn</span> <span class="o">=</span> <span class="n">subject</span><span class="p">.</span><span class="n">substr</span><span class="p">(</span><span class="n">pos</span><span class="p">);</span>
+    <span class="n">pos</span> <span class="o">=</span> <span class="n">cn</span><span class="p">.</span><span class="n">find</span><span class="p">(</span><span class="sc">&#39;,&#39;</span><span class="p">);</span>
+    <span class="k">return</span> <span class="n">pos</span> <span class="o">==</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">::</span><span class="n">npos</span> <span class="o">?</span> <span class="nl">cn</span> <span class="p">:</span> <span class="n">cn</span><span class="p">.</span><span class="n">substr</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">pos</span><span class="p">);</span>
+<span class="p">}</span>
+</pre></div>
+
+<p><a href="ssl.cpp">Download this file</a></p>
+
+
+          <hr/>
+
+          <ul id="-apache-navigation">
+            <li><a href="http://www.apache.org/">Apache</a></li>
+            <li><a href="http://www.apache.org/licenses/">License</a></li>
+            <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+            <li><a href="http://www.apache.org/foundation/thanks.html">Thanks!</a></li>
+            <li><a href="/security.html">Security</a></li>
+            <li><a href="http://www.apache.org/"><img id="-apache-feather" width="48" height="14" src="" alt="Apache"/></a></li>
+          </ul>
+
+          <p id="-legal">
+            Apache Qpid, Messaging built on AMQP; Copyright &#169; 2015
+            The Apache Software Foundation; Licensed under
+            the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache
+            License, Version 2.0</a>; Apache Qpid, Qpid, Qpid Proton,
+            Proton, Apache, the Apache feather logo, and the Apache Qpid
+            project logo are trademarks of The Apache Software
+            Foundation; All other marks mentioned may be trademarks or
+            registered trademarks of their respective owners
+          </p>
+        </div>
+      </div>
+    </div>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/75ca8b14/content/releases/qpid-proton-0.13.0/proton/cpp/examples/ssl_client_cert.cpp
----------------------------------------------------------------------
diff --git a/content/releases/qpid-proton-0.13.0/proton/cpp/examples/ssl_client_cert.cpp b/content/releases/qpid-proton-0.13.0/proton/cpp/examples/ssl_client_cert.cpp
new file mode 100755
index 0000000..42b6593
--- /dev/null
+++ b/content/releases/qpid-proton-0.13.0/proton/cpp/examples/ssl_client_cert.cpp
@@ -0,0 +1,193 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <proton/connection.hpp>
+#include <proton/connection_options.hpp>
+#include <proton/default_container.hpp>
+#include <proton/messaging_handler.hpp>
+#include <proton/sasl.hpp>
+#include <proton/ssl.hpp>
+#include <proton/tracker.hpp>
+#include <proton/transport.hpp>
+
+#include <iostream>
+
+#include "fake_cpp11.hpp"
+
+using proton::connection_options;
+using proton::ssl_client_options;
+using proton::ssl_server_options;
+using proton::ssl_certificate;
+using proton::sasl;
+
+// Helper functions defined below.
+bool using_OpenSSL();
+std::string platform_CA(const std::string &base_name);
+ssl_certificate platform_certificate(const std::string &base_name, const std::string &passwd);
+static std::string cert_directory;
+static std::string find_CN(const std::string &);
+
+
+struct server_handler : public proton::messaging_handler {
+    proton::listener listener;
+
+    void on_connection_open(proton::connection &c) OVERRIDE {
+        std::cout << "Inbound server connection connected via SSL.  Protocol: " <<
+            c.transport().ssl().protocol() << std::endl;
+        if (c.transport().sasl().outcome() == sasl::OK) {
+            std::string subject = c.transport().ssl().remote_subject();
+            std::cout << "Inbound client certificate identity " << find_CN(subject) << std::endl;
+        }
+        else {
+            std::cout << "Inbound client authentication failed" <<std::endl;
+            c.close();
+        }
+        listener.stop();
+    }
+
+    void on_message(proton::delivery &, proton::message &m) OVERRIDE {
+        std::cout << m.body() << std::endl;
+    }
+};
+
+
+class hello_world_direct : public proton::messaging_handler {
+  private:
+    std::string url;
+    server_handler s_handler;
+
+  public:
+    hello_world_direct(const std::string& u) : url(u) {}
+
+    void on_container_start(proton::container &c) OVERRIDE {
+        // Configure listener.  Details vary by platform.
+        ssl_certificate server_cert = platform_certificate("tserver", "tserverpw");
+        std::string client_CA = platform_CA("tclient");
+        // Specify an SSL domain with CA's for client certificate verification.
+        ssl_server_options srv_ssl(server_cert, client_CA);
+        connection_options server_opts;
+        server_opts.ssl_server_options(srv_ssl).handler(s_handler);
+        server_opts.sasl_allowed_mechs("EXTERNAL");
+        c.server_connection_options(server_opts);
+
+        // Configure client.
+        ssl_certificate client_cert = platform_certificate("tclient", "tclientpw");
+        std::string server_CA = platform_CA("tserver");
+        // Since the test certifcate's credentials are unlikely to match this host's name, downgrade the verification
+        // from VERIFY_PEER_NAME to VERIFY_PEER.
+        ssl_client_options ssl_cli(client_cert, server_CA, proton::ssl::VERIFY_PEER);
+        connection_options client_opts;
+        client_opts.ssl_client_options(ssl_cli).sasl_allowed_mechs("EXTERNAL");
+        c.client_connection_options(client_opts);
+
+        s_handler.listener = c.listen(url);
+        c.open_sender(url);
+    }
+
+    void on_connection_open(proton::connection &c) OVERRIDE {
+        std::string subject = c.transport().ssl().remote_subject();
+        std::cout << "Outgoing client connection connected via SSL.  Server certificate identity " <<
+            find_CN(subject) << std::endl;
+    }
+
+    void on_sendable(proton::sender &s) OVERRIDE {
+        proton::message m;
+        m.body("Hello World!");
+        s.send(m);
+        s.close();
+    }
+
+    void on_tracker_accept(proton::tracker &t) OVERRIDE {
+        // All done.
+        t.connection().close();
+    }
+};
+
+int main(int argc, char **argv) {
+    try {
+        // Pick an "unusual" port since we are going to be talking to ourselves, not a broker.
+        // Note the use of "amqps" as the URL scheme to denote a TLS/SSL connection.
+        std::string url = argc > 1 ? argv[1] : "amqps://127.0.0.1:8888/examples";
+        // Location of certificates and private key information:
+        if (argc > 2) {
+            cert_directory = argv[2];
+            size_t sz = cert_directory.size();
+            if (sz && cert_directory[sz -1] != '/')
+                cert_directory.append("/");
+        }
+        else cert_directory = "ssl_certs/";
+
+        hello_world_direct hwd(url);
+        proton::default_container(hwd).run();
+        return 0;
+    } catch (const std::exception& e) {
+        std::cerr << e.what() << std::endl;
+    }
+    return 1;
+}
+
+
+bool using_OpenSSL() {
+    // Current defaults.
+#if defined(WIN32)
+    return false;
+#else
+    return true;
+#endif
+}
+
+ssl_certificate platform_certificate(const std::string &base_name, const std::string &passwd) {
+    if (using_OpenSSL()) {
+        // The first argument will be the name of the file containing the public certificate, the
+        // second argument will be the name of the file containing the private key.
+        return ssl_certificate(cert_directory + base_name + "-certificate.pem",
+                               cert_directory + base_name + "-private-key.pem", passwd);
+    }
+    else {
+        // Windows SChannel
+        // The first argument will be the database or store that contains one or more complete certificates
+        // (public and private data).  The second will be an optional name of the certificate in the store
+        // (not used in this example with one certificate per store).
+        return ssl_certificate(cert_directory + base_name + "-full.p12", "", passwd);
+    }
+}
+
+std::string platform_CA(const std::string &base_name) {
+    if (using_OpenSSL()) {
+        // In this simple example with self-signed certificates, the peer's certificate is the CA database.
+        return cert_directory + base_name + "-certificate.pem";
+    }
+    else {
+        // Windows SChannel.  Use a pkcs#12 file with just the peer's public certificate information.
+        return cert_directory + base_name + "-certificate.p12";
+    }
+}
+
+std::string find_CN(const std::string &subject) {
+    // The subject string is returned with different whitespace and component ordering between platforms.
+    // Here we just return the common name by searching for "CN=...." in the subject, knowing that
+    // the test certificates do not contain any escaped characters.
+    size_t pos = subject.find("CN=");
+    if (pos == std::string::npos) throw std::runtime_error("No common name in certificate subject");
+    std::string cn = subject.substr(pos);
+    pos = cn.find(',');
+    return pos == std::string::npos ? cn : cn.substr(0, pos);
+}

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/75ca8b14/content/releases/qpid-proton-0.13.0/proton/cpp/examples/ssl_client_cert.cpp.html
----------------------------------------------------------------------
diff --git a/content/releases/qpid-proton-0.13.0/proton/cpp/examples/ssl_client_cert.cpp.html b/content/releases/qpid-proton-0.13.0/proton/cpp/examples/ssl_client_cert.cpp.html
new file mode 100644
index 0000000..f3f4712
--- /dev/null
+++ b/content/releases/qpid-proton-0.13.0/proton/cpp/examples/ssl_client_cert.cpp.html
@@ -0,0 +1,321 @@
+<!DOCTYPE html>
+<!--
+ -
+ - Licensed to the Apache Software Foundation (ASF) under one
+ - or more contributor license agreements.  See the NOTICE file
+ - distributed with this work for additional information
+ - regarding copyright ownership.  The ASF licenses this file
+ - to you under the Apache License, Version 2.0 (the
+ - "License"); you may not use this file except in compliance
+ - with the License.  You may obtain a copy of the License at
+ -
+ -   http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing,
+ - software distributed under the License is distributed on an
+ - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ - KIND, either express or implied.  See the License for the
+ - specific language governing permissions and limitations
+ - under the License.
+ -
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+  <head>
+    <title>ssl_client_cert.cpp - Apache Qpid&#8482;</title>
+    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+    <link rel="stylesheet" href="/site.css" type="text/css" async="async"/>
+    <link rel="stylesheet" href="/deferred.css" type="text/css" defer="defer"/>
+    <script type="text/javascript">var _deferredFunctions = [];</script>
+    <script type="text/javascript" src="/deferred.js" defer="defer"></script>
+    <!--[if lte IE 8]>
+      <link rel="stylesheet" href="/ie.css" type="text/css"/>
+      <script type="text/javascript" src="/html5shiv.js"></script>
+    <![endif]-->
+
+    <!-- Redirects for `go get` and godoc.org -->
+    <meta name="go-import"
+          content="qpid.apache.org git https://git-wip-us.apache.org/repos/asf/qpid-proton.git"/>
+    <meta name="go-source"
+          content="qpid.apache.org
+https://github.com/apache/qpid-proton/blob/go1/README.md
+https://github.com/apache/qpid-proton/tree/go1{/dir}
+https://github.com/apache/qpid-proton/blob/go1{/dir}/{file}#L{line}"/>
+  </head>
+  <body>
+    <div id="-content">
+      <div id="-top" class="panel">
+        <a id="-menu-link"><img width="16" height="16" src="" alt="Menu"/></a>
+
+        <a id="-search-link"><img width="22" height="16" src="" alt="Search"/></a>
+
+        <ul id="-global-navigation">
+          <li><a id="-logotype" href="/index.html">Apache Qpid<sup>&#8482;</sup></a></li>
+          <li><a href="/documentation.html">Documentation</a></li>
+          <li><a href="/download.html">Download</a></li>
+          <li><a href="/discussion.html">Discussion</a></li>
+        </ul>
+      </div>
+
+      <div id="-menu" class="panel" style="display: none;">
+        <div class="flex">
+          <section>
+            <h3>Project</h3>
+
+            <ul>
+              <li><a href="/overview.html">Overview</a></li>
+              <li><a href="/components/index.html">Components</a></li>
+              <li><a href="/releases/index.html">Releases</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Messaging APIs</h3>
+
+            <ul>
+              <li><a href="/proton/index.html">Qpid Proton</a></li>
+              <li><a href="/components/jms/index.html">Qpid JMS</a></li>
+              <li><a href="/components/messaging-api/index.html">Qpid Messaging API</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Servers and tools</h3>
+
+            <ul>
+              <li><a href="/components/java-broker/index.html">Java broker</a></li>
+              <li><a href="/components/cpp-broker/index.html">C++ broker</a></li>
+              <li><a href="/components/dispatch-router/index.html">Dispatch router</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Resources</h3>
+
+            <ul>
+              <li><a href="/dashboard.html">Dashboard</a></li>
+              <li><a href="https://cwiki.apache.org/confluence/display/qpid/Index">Wiki</a></li>
+              <li><a href="/resources.html">More resources</a></li>
+            </ul>
+          </section>
+        </div>
+      </div>
+
+      <div id="-search" class="panel" style="display: none;">
+        <form action="http://www.google.com/search" method="get">
+          <input type="hidden" name="sitesearch" value="qpid.apache.org"/>
+          <input type="text" name="q" maxlength="255" autofocus="autofocus" tabindex="1"/>
+          <button type="submit">Search</button>
+          <a href="/search.html">More ways to search</a>
+        </form>
+      </div>
+
+      <div id="-middle" class="panel">
+        <ul id="-path-navigation"><li><a href="/index.html">Home</a></li><li><a href="/releases/index.html">Releases</a></li><li><a href="/releases/qpid-proton-0.13.0/index.html">Qpid Proton 0.13.0</a></li><li><a href="/releases/qpid-proton-0.13.0/proton/cpp/examples/index.html">Proton C++ Examples</a></li><li>ssl_client_cert.cpp</li></ul>
+
+        <div id="-middle-content">
+          
+<h1>ssl_client_cert.cpp</h1>
+<div class="highlight"><pre><span></span><span class="cp">#include</span> <span class="cpf">&lt;proton/connection.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/connection_options.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/default_container.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/messaging_handler.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/sasl.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/ssl.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/tracker.hpp&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;proton/transport.hpp&gt;</span><span class="cp"></span>
+
+<span class="cp">#include</span> <span class="cpf">&lt;iostream&gt;</span><span class="cp"></span>
+
+<span class="cp">#include</span> <span class="cpf">&quot;fake_cpp11.hpp&quot;</span><span class="cp"></span>
+
+<span class="k">using</span> <span class="n">proton</span><span class="o">::</span><span class="n">connection_options</span><span class="p">;</span>
+<span class="k">using</span> <span class="n">proton</span><span class="o">::</span><span class="n">ssl_client_options</span><span class="p">;</span>
+<span class="k">using</span> <span class="n">proton</span><span class="o">::</span><span class="n">ssl_server_options</span><span class="p">;</span>
+<span class="k">using</span> <span class="n">proton</span><span class="o">::</span><span class="n">ssl_certificate</span><span class="p">;</span>
+<span class="k">using</span> <span class="n">proton</span><span class="o">::</span><span class="n">sasl</span><span class="p">;</span>
+
+<span class="c1">// Helper functions defined below.</span>
+<span class="kt">bool</span> <span class="nf">using_OpenSSL</span><span class="p">();</span>
+<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">platform_CA</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">base_name</span><span class="p">);</span>
+<span class="n">ssl_certificate</span> <span class="nf">platform_certificate</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">base_name</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">passwd</span><span class="p">);</span>
+<span class="k">static</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">cert_directory</span><span class="p">;</span>
+<span class="k">static</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">find_CN</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="p">);</span>
+
+
+<span class="k">struct</span> <span class="nl">server_handler</span> <span class="p">:</span> <span class="k">public</span> <span class="n">proton</span><span class="o">::</span><span class="n">messaging_handler</span> <span class="p">{</span>
+    <span class="n">proton</span><span class="o">::</span><span class="n">listener</span> <span class="n">listener</span><span class="p">;</span>
+
+    <span class="kt">void</span> <span class="nf">on_connection_open</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">connection</span> <span class="o">&amp;</span><span class="n">c</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Inbound server connection connected via SSL.  Protocol: &quot;</span> <span class="o">&lt;&lt;</span>
+            <span class="n">c</span><span class="p">.</span><span class="n">transport</span><span class="p">().</span><span class="n">ssl</span><span class="p">().</span><span class="n">protocol</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+        <span class="k">if</span> <span class="p">(</span><span class="n">c</span><span class="p">.</span><span class="n">transport</span><span class="p">().</span><span class="n">sasl</span><span class="p">().</span><span class="n">outcome</span><span class="p">()</span> <span class="o">==</span> <span class="n">sasl</span><span class="o">::</span><span class="n">OK</span><span class="p">)</span> <span class="p">{</span>
+            <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">subject</span> <span class="o">=</span> <span class="n">c</span><span class="p">.</span><span class="n">transport</span><span class="p">().</span><span class="n">ssl</span><span class="p">().</span><span class="n">remote_subject</span><span class="p">();</span>
+            <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Inbound client certificate identity &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">find_CN</span><span class="p">(</span><span class="n">subject</span><span class="p">)</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+        <span class="p">}</span>
+        <span class="k">else</span> <span class="p">{</span>
+            <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Inbound client authentication failed&quot;</span> <span class="o">&lt;&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+            <span class="n">c</span><span class="p">.</span><span class="n">close</span><span class="p">();</span>
+        <span class="p">}</span>
+        <span class="n">listener</span><span class="p">.</span><span class="n">stop</span><span class="p">();</span>
+    <span class="p">}</span>
+
+    <span class="kt">void</span> <span class="nf">on_message</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">delivery</span> <span class="o">&amp;</span><span class="p">,</span> <span class="n">proton</span><span class="o">::</span><span class="n">message</span> <span class="o">&amp;</span><span class="n">m</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="n">m</span><span class="p">.</span><span class="n">body</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+    <span class="p">}</span>
+<span class="p">};</span>
+
+
+<span class="k">class</span> <span class="nc">hello_world_direct</span> <span class="o">:</span> <span class="k">public</span> <span class="n">proton</span><span class="o">::</span><span class="n">messaging_handler</span> <span class="p">{</span>
+  <span class="k">private</span><span class="o">:</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">url</span><span class="p">;</span>
+    <span class="n">server_handler</span> <span class="n">s_handler</span><span class="p">;</span>
+
+  <span class="k">public</span><span class="o">:</span>
+    <span class="n">hello_world_direct</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">u</span><span class="p">)</span> <span class="o">:</span> <span class="n">url</span><span class="p">(</span><span class="n">u</span><span class="p">)</span> <span class="p">{}</span>
+
+    <span class="kt">void</span> <span class="n">on_container_start</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">container</span> <span class="o">&amp;</span><span class="n">c</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="c1">// Configure listener.  Details vary by platform.</span>
+        <span class="n">ssl_certificate</span> <span class="n">server_cert</span> <span class="o">=</span> <span class="n">platform_certificate</span><span class="p">(</span><span class="s">&quot;tserver&quot;</span><span class="p">,</span> <span class="s">&quot;tserverpw&quot;</span><span class="p">);</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">client_CA</span> <span class="o">=</span> <span class="n">platform_CA</span><span class="p">(</span><span class="s">&quot;tclient&quot;</span><span class="p">);</span>
+        <span class="c1">// Specify an SSL domain with CA&#39;s for client certificate verification.</span>
+        <span class="n">ssl_server_options</span> <span class="nf">srv_ssl</span><span class="p">(</span><span class="n">server_cert</span><span class="p">,</span> <span class="n">client_CA</span><span class="p">);</span>
+        <span class="n">connection_options</span> <span class="n">server_opts</span><span class="p">;</span>
+        <span class="n">server_opts</span><span class="p">.</span><span class="n">ssl_server_options</span><span class="p">(</span><span class="n">srv_ssl</span><span class="p">).</span><span class="n">handler</span><span class="p">(</span><span class="n">s_handler</span><span class="p">);</span>
+        <span class="n">server_opts</span><span class="p">.</span><span class="n">sasl_allowed_mechs</span><span class="p">(</span><span class="s">&quot;EXTERNAL&quot;</span><span class="p">);</span>
+        <span class="n">c</span><span class="p">.</span><span class="n">server_connection_options</span><span class="p">(</span><span class="n">server_opts</span><span class="p">);</span>
+
+        <span class="c1">// Configure client.</span>
+        <span class="n">ssl_certificate</span> <span class="n">client_cert</span> <span class="o">=</span> <span class="n">platform_certificate</span><span class="p">(</span><span class="s">&quot;tclient&quot;</span><span class="p">,</span> <span class="s">&quot;tclientpw&quot;</span><span class="p">);</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">server_CA</span> <span class="o">=</span> <span class="n">platform_CA</span><span class="p">(</span><span class="s">&quot;tserver&quot;</span><span class="p">);</span>
+        <span class="c1">// Since the test certifcate&#39;s credentials are unlikely to match this host&#39;s name, downgrade the verification</span>
+        <span class="c1">// from VERIFY_PEER_NAME to VERIFY_PEER.</span>
+        <span class="n">ssl_client_options</span> <span class="nf">ssl_cli</span><span class="p">(</span><span class="n">client_cert</span><span class="p">,</span> <span class="n">server_CA</span><span class="p">,</span> <span class="n">proton</span><span class="o">::</span><span class="n">ssl</span><span class="o">::</span><span class="n">VERIFY_PEER</span><span class="p">);</span>
+        <span class="n">connection_options</span> <span class="n">client_opts</span><span class="p">;</span>
+        <span class="n">client_opts</span><span class="p">.</span><span class="n">ssl_client_options</span><span class="p">(</span><span class="n">ssl_cli</span><span class="p">).</span><span class="n">sasl_allowed_mechs</span><span class="p">(</span><span class="s">&quot;EXTERNAL&quot;</span><span class="p">);</span>
+        <span class="n">c</span><span class="p">.</span><span class="n">client_connection_options</span><span class="p">(</span><span class="n">client_opts</span><span class="p">);</span>
+
+        <span class="n">s_handler</span><span class="p">.</span><span class="n">listener</span> <span class="o">=</span> <span class="n">c</span><span class="p">.</span><span class="n">listen</span><span class="p">(</span><span class="n">url</span><span class="p">);</span>
+        <span class="n">c</span><span class="p">.</span><span class="n">open_sender</span><span class="p">(</span><span class="n">url</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="kt">void</span> <span class="n">on_connection_open</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">connection</span> <span class="o">&amp;</span><span class="n">c</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">subject</span> <span class="o">=</span> <span class="n">c</span><span class="p">.</span><span class="n">transport</span><span class="p">().</span><span class="n">ssl</span><span class="p">().</span><span class="n">remote_subject</span><span class="p">();</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Outgoing client connection connected via SSL.  Server certificate identity &quot;</span> <span class="o">&lt;&lt;</span>
+            <span class="n">find_CN</span><span class="p">(</span><span class="n">subject</span><span class="p">)</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+    <span class="p">}</span>
+
+    <span class="kt">void</span> <span class="n">on_sendable</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">sender</span> <span class="o">&amp;</span><span class="n">s</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="n">proton</span><span class="o">::</span><span class="n">message</span> <span class="n">m</span><span class="p">;</span>
+        <span class="n">m</span><span class="p">.</span><span class="n">body</span><span class="p">(</span><span class="s">&quot;Hello World!&quot;</span><span class="p">);</span>
+        <span class="n">s</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="n">m</span><span class="p">);</span>
+        <span class="n">s</span><span class="p">.</span><span class="n">close</span><span class="p">();</span>
+    <span class="p">}</span>
+
+    <span class="kt">void</span> <span class="n">on_tracker_accept</span><span class="p">(</span><span class="n">proton</span><span class="o">::</span><span class="n">tracker</span> <span class="o">&amp;</span><span class="n">t</span><span class="p">)</span> <span class="n">OVERRIDE</span> <span class="p">{</span>
+        <span class="c1">// All done.</span>
+        <span class="n">t</span><span class="p">.</span><span class="n">connection</span><span class="p">().</span><span class="n">close</span><span class="p">();</span>
+    <span class="p">}</span>
+<span class="p">};</span>
+
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span> <span class="o">**</span><span class="n">argv</span><span class="p">)</span> <span class="p">{</span>
+    <span class="k">try</span> <span class="p">{</span>
+        <span class="c1">// Pick an &quot;unusual&quot; port since we are going to be talking to ourselves, not a broker.</span>
+        <span class="c1">// Note the use of &quot;amqps&quot; as the URL scheme to denote a TLS/SSL connection.</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">url</span> <span class="o">=</span> <span class="n">argc</span> <span class="o">&gt;</span> <span class="mi">1</span> <span class="o">?</span> <span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">:</span> <span class="s">&quot;amqps://127.0.0.1:8888/examples&quot;</span><span class="p">;</span>
+        <span class="c1">// Location of certificates and private key information:</span>
+        <span class="k">if</span> <span class="p">(</span><span class="n">argc</span> <span class="o">&gt;</span> <span class="mi">2</span><span class="p">)</span> <span class="p">{</span>
+            <span class="n">cert_directory</span> <span class="o">=</span> <span class="n">argv</span><span class="p">[</span><span class="mi">2</span><span class="p">];</span>
+            <span class="kt">size_t</span> <span class="n">sz</span> <span class="o">=</span> <span class="n">cert_directory</span><span class="p">.</span><span class="n">size</span><span class="p">();</span>
+            <span class="k">if</span> <span class="p">(</span><span class="n">sz</span> <span class="o">&amp;&amp;</span> <span class="n">cert_directory</span><span class="p">[</span><span class="n">sz</span> <span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">!=</span> <span class="sc">&#39;/&#39;</span><span class="p">)</span>
+                <span class="n">cert_directory</span><span class="p">.</span><span class="n">append</span><span class="p">(</span><span class="s">&quot;/&quot;</span><span class="p">);</span>
+        <span class="p">}</span>
+        <span class="k">else</span> <span class="n">cert_directory</span> <span class="o">=</span> <span class="s">&quot;ssl_certs/&quot;</span><span class="p">;</span>
+
+        <span class="n">hello_world_direct</span> <span class="n">hwd</span><span class="p">(</span><span class="n">url</span><span class="p">);</span>
+        <span class="n">proton</span><span class="o">::</span><span class="n">default_container</span><span class="p">(</span><span class="n">hwd</span><span class="p">).</span><span class="n">run</span><span class="p">();</span>
+        <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">exception</span><span class="o">&amp;</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cerr</span> <span class="o">&lt;&lt;</span> <span class="n">e</span><span class="p">.</span><span class="n">what</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+    <span class="p">}</span>
+    <span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
+<span class="p">}</span>
+
+
+<span class="kt">bool</span> <span class="nf">using_OpenSSL</span><span class="p">()</span> <span class="p">{</span>
+    <span class="c1">// Current defaults.</span>
+<span class="cp">#if defined(WIN32)</span>
+    <span class="k">return</span> <span class="nb">false</span><span class="p">;</span>
+<span class="cp">#else</span>
+    <span class="k">return</span> <span class="nb">true</span><span class="p">;</span>
+<span class="cp">#endif</span>
+<span class="p">}</span>
+
+<span class="n">ssl_certificate</span> <span class="nf">platform_certificate</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">base_name</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">passwd</span><span class="p">)</span> <span class="p">{</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">using_OpenSSL</span><span class="p">())</span> <span class="p">{</span>
+        <span class="c1">// The first argument will be the name of the file containing the public certificate, the</span>
+        <span class="c1">// second argument will be the name of the file containing the private key.</span>
+        <span class="k">return</span> <span class="n">ssl_certificate</span><span class="p">(</span><span class="n">cert_directory</span> <span class="o">+</span> <span class="n">base_name</span> <span class="o">+</span> <span class="s">&quot;-certificate.pem&quot;</span><span class="p">,</span>
+                               <span class="n">cert_directory</span> <span class="o">+</span> <span class="n">base_name</span> <span class="o">+</span> <span class="s">&quot;-private-key.pem&quot;</span><span class="p">,</span> <span class="n">passwd</span><span class="p">);</span>
+    <span class="p">}</span>
+    <span class="k">else</span> <span class="p">{</span>
+        <span class="c1">// Windows SChannel</span>
+        <span class="c1">// The first argument will be the database or store that contains one or more complete certificates</span>
+        <span class="c1">// (public and private data).  The second will be an optional name of the certificate in the store</span>
+        <span class="c1">// (not used in this example with one certificate per store).</span>
+        <span class="k">return</span> <span class="n">ssl_certificate</span><span class="p">(</span><span class="n">cert_directory</span> <span class="o">+</span> <span class="n">base_name</span> <span class="o">+</span> <span class="s">&quot;-full.p12&quot;</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">,</span> <span class="n">passwd</span><span class="p">);</span>
+    <span class="p">}</span>
+<span class="p">}</span>
+
+<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">platform_CA</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">base_name</span><span class="p">)</span> <span class="p">{</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">using_OpenSSL</span><span class="p">())</span> <span class="p">{</span>
+        <span class="c1">// In this simple example with self-signed certificates, the peer&#39;s certificate is the CA database.</span>
+        <span class="k">return</span> <span class="n">cert_directory</span> <span class="o">+</span> <span class="n">base_name</span> <span class="o">+</span> <span class="s">&quot;-certificate.pem&quot;</span><span class="p">;</span>
+    <span class="p">}</span>
+    <span class="k">else</span> <span class="p">{</span>
+        <span class="c1">// Windows SChannel.  Use a pkcs#12 file with just the peer&#39;s public certificate information.</span>
+        <span class="k">return</span> <span class="n">cert_directory</span> <span class="o">+</span> <span class="n">base_name</span> <span class="o">+</span> <span class="s">&quot;-certificate.p12&quot;</span><span class="p">;</span>
+    <span class="p">}</span>
+<span class="p">}</span>
+
+<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">find_CN</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">subject</span><span class="p">)</span> <span class="p">{</span>
+    <span class="c1">// The subject string is returned with different whitespace and component ordering between platforms.</span>
+    <span class="c1">// Here we just return the common name by searching for &quot;CN=....&quot; in the subject, knowing that</span>
+    <span class="c1">// the test certificates do not contain any escaped characters.</span>
+    <span class="kt">size_t</span> <span class="n">pos</span> <span class="o">=</span> <span class="n">subject</span><span class="p">.</span><span class="n">find</span><span class="p">(</span><span class="s">&quot;CN=&quot;</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">pos</span> <span class="o">==</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">::</span><span class="n">npos</span><span class="p">)</span> <span class="k">throw</span> <span class="n">std</span><span class="o">::</span><span class="n">runtime_error</span><span class="p">(</span><span class="s">&quot;No common name in certificate subject&quot;</span><span class="p">);</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">cn</span> <span class="o">=</span> <span class="n">subject</span><span class="p">.</span><span class="n">substr</span><span class="p">(</span><span class="n">pos</span><span class="p">);</span>
+    <span class="n">pos</span> <span class="o">=</span> <span class="n">cn</span><span class="p">.</span><span class="n">find</span><span class="p">(</span><span class="sc">&#39;,&#39;</span><span class="p">);</span>
+    <span class="k">return</span> <span class="n">pos</span> <span class="o">==</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">::</span><span class="n">npos</span> <span class="o">?</span> <span class="nl">cn</span> <span class="p">:</span> <span class="n">cn</span><span class="p">.</span><span class="n">substr</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">pos</span><span class="p">);</span>
+<span class="p">}</span>
+</pre></div>
+
+<p><a href="ssl_client_cert.cpp">Download this file</a></p>
+
+
+          <hr/>
+
+          <ul id="-apache-navigation">
+            <li><a href="http://www.apache.org/">Apache</a></li>
+            <li><a href="http://www.apache.org/licenses/">License</a></li>
+            <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+            <li><a href="http://www.apache.org/foundation/thanks.html">Thanks!</a></li>
+            <li><a href="/security.html">Security</a></li>
+            <li><a href="http://www.apache.org/"><img id="-apache-feather" width="48" height="14" src="" alt="Apache"/></a></li>
+          </ul>
+
+          <p id="-legal">
+            Apache Qpid, Messaging built on AMQP; Copyright &#169; 2015
+            The Apache Software Foundation; Licensed under
+            the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache
+            License, Version 2.0</a>; Apache Qpid, Qpid, Qpid Proton,
+            Proton, Apache, the Apache feather logo, and the Apache Qpid
+            project logo are trademarks of The Apache Software
+            Foundation; All other marks mentioned may be trademarks or
+            registered trademarks of their respective owners
+          </p>
+        </div>
+      </div>
+    </div>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/75ca8b14/content/releases/qpid-proton-0.13.0/proton/python/examples/abstract_server.py
----------------------------------------------------------------------
diff --git a/content/releases/qpid-proton-0.13.0/proton/python/examples/abstract_server.py b/content/releases/qpid-proton-0.13.0/proton/python/examples/abstract_server.py
new file mode 100755
index 0000000..fed7fb2
--- /dev/null
+++ b/content/releases/qpid-proton-0.13.0/proton/python/examples/abstract_server.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+from __future__ import print_function
+from proton_server import Server
+
+class Application(Server):
+    def __init__(self, host, address):
+        super(Application, self).__init__(host, address)
+
+    def on_request(self, request, reply_to):
+        response = request.upper()
+        self.send(response, reply_to)
+        print("Request from: %s" % reply_to)
+
+try:
+    Application("localhost:5672", "examples").run()
+except KeyboardInterrupt: pass
+


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message