/usr/share/doc/libpion-doc/html/plugin__service_8hpp_source.html is in libpion-doc 5.0.7+dfsg-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>pion: include/pion/http/plugin_service.hpp Source File</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="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">pion
 <span id="projectnumber">5.0.6</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_96d8a58f4ca411bbafcf73a070f69a21.html">pion</a></li><li class="navelem"><a class="el" href="dir_a798c42f1e65975a408690f112137fd9.html">http</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">plugin_service.hpp</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">// ---------------------------------------------------------------------</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">// pion: a Boost C++ framework for building lightweight HTTP interfaces</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">// ---------------------------------------------------------------------</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">// Copyright (C) 2007-2014 Splunk Inc. (https://github.com/splunk/pion)</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">//</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">// Distributed under the Boost Software License, Version 1.0.</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment">// See http://www.boost.org/LICENSE_1_0.txt</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment">//</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> </div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="preprocessor">#ifndef __PION_PLUGIN_SERVICE_HEADER__</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="preprocessor">#define __PION_PLUGIN_SERVICE_HEADER__</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> </div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="preprocessor">#include <string></span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="preprocessor">#include <boost/noncopyable.hpp></span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="preprocessor">#include <pion/config.hpp></span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="preprocessor">#include <pion/error.hpp></span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#include <pion/algorithm.hpp></span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#include <pion/http/request.hpp></span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="preprocessor">#include <pion/tcp/connection.hpp></span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> </div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="keyword">namespace </span><a class="code" href="namespacepion.html">pion</a> { <span class="comment">// begin namespace pion</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="keyword">namespace </span>http { <span class="comment">// begin namespace http</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> </div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> </div><div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="classpion_1_1http_1_1plugin__service.html"> 29</a></span> <span class="keyword">class </span><a class="code" href="classpion_1_1http_1_1plugin__service.html">plugin_service</a> :</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  <span class="keyword">private</span> boost::noncopyable</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> {</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="keyword">public</span>:</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> </div><div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="classpion_1_1http_1_1plugin__service.html#a587b482f3e8d7bd03ac0d7d693538b23"> 35</a></span>  <a class="code" href="classpion_1_1http_1_1plugin__service.html#a587b482f3e8d7bd03ac0d7d693538b23">plugin_service</a>(<span class="keywordtype">void</span>) {}</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span> </div><div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="classpion_1_1http_1_1plugin__service.html#a1d7ffeb7d24a0ab951562031b7c16552"> 38</a></span>  <span class="keyword">virtual</span> <a class="code" href="classpion_1_1http_1_1plugin__service.html#a1d7ffeb7d24a0ab951562031b7c16552">~plugin_service</a>() {}</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> </div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classpion_1_1http_1_1plugin__service.html#afa5beb5af6a667151f21772e476486f7">operator()</a>(<span class="keyword">const</span> http::request_ptr& http_request_ptr, <span class="keyword">const</span> tcp::connection_ptr& tcp_conn) = 0;</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  </div><div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="classpion_1_1http_1_1plugin__service.html#a49cddd4c2a99e276373b5f7162ff3cde"> 54</a></span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classpion_1_1http_1_1plugin__service.html#a49cddd4c2a99e276373b5f7162ff3cde">set_option</a>(<span class="keyword">const</span> std::string& name, <span class="keyword">const</span> std::string& value) {</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  BOOST_THROW_EXCEPTION( <a class="code" href="classpion_1_1error_1_1bad__arg.html">error::bad_arg</a>() << error::errinfo_arg_name(name) );</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  }</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  </div><div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="classpion_1_1http_1_1plugin__service.html#acb534a38c423ead57c98d07077579ecc"> 59</a></span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classpion_1_1http_1_1plugin__service.html#acb534a38c423ead57c98d07077579ecc">start</a>(<span class="keywordtype">void</span>) {}</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  </div><div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="classpion_1_1http_1_1plugin__service.html#a6d8c34f35f95d8e45c5476314bebdf6f"> 62</a></span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classpion_1_1http_1_1plugin__service.html#a6d8c34f35f95d8e45c5476314bebdf6f">stop</a>(<span class="keywordtype">void</span>) {}</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  </div><div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="classpion_1_1http_1_1plugin__service.html#a081c90dafdae862ca35b4684eaed4b36"> 65</a></span>  <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classpion_1_1http_1_1plugin__service.html#a081c90dafdae862ca35b4684eaed4b36">set_resource</a>(<span class="keyword">const</span> std::string& str) { m_resource = str; }</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span> </div><div class="line"><a name="l00068"></a><span class="lineno"><a class="line" href="classpion_1_1http_1_1plugin__service.html#a2cd239319b919e66ed961f6a914f7878"> 68</a></span>  <span class="keyword">inline</span> <span class="keyword">const</span> std::string& <a class="code" href="classpion_1_1http_1_1plugin__service.html#a2cd239319b919e66ed961f6a914f7878">get_resource</a>(<span class="keywordtype">void</span>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_resource; }</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  </div><div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="classpion_1_1http_1_1plugin__service.html#a85b4ca1bf18d6f4414f70ca8a1e084a2"> 71</a></span>  <span class="keyword">inline</span> std::string <a class="code" href="classpion_1_1http_1_1plugin__service.html#a85b4ca1bf18d6f4414f70ca8a1e084a2">get_relative_resource</a>(<span class="keyword">const</span> std::string& resource_requested)<span class="keyword"> const </span>{</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  <span class="keywordflow">if</span> (resource_requested.size() <= <a class="code" href="classpion_1_1http_1_1plugin__service.html#a2cd239319b919e66ed961f6a914f7878">get_resource</a>().size()) {</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <span class="comment">// either the request matches the web service's resource path (a directory)</span></div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <span class="comment">// or the request does not match (should never happen)</span></div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="keywordflow">return</span> std::string();</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  }</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  <span class="comment">// strip the web service's resource path plus the slash after it</span></div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <span class="keywordflow">return</span> <a class="code" href="structpion_1_1algorithm.html#a440bd54b07a24c80bc939fdb03583721">algorithm::url_decode</a>(resource_requested.substr(<a class="code" href="classpion_1_1http_1_1plugin__service.html#a2cd239319b919e66ed961f6a914f7878">get_resource</a>().size() + 1));</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  }</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  </div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  </div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span> <span class="keyword">private</span>:</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  </div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  std::string m_resource;</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span> };</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span> </div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span> </div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span> <span class="comment">//</span></div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span> <span class="comment">// The following symbols must be defined for any web service that you would</span></div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span> <span class="comment">// like to be able to load dynamically using the http::server::load_service()</span></div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span> <span class="comment">// function. These are not required for any services that you only want to link</span></div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span> <span class="comment">// directly into your programs.</span></div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span> <span class="comment">//</span></div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span> <span class="comment">// Make sure that you replace "MyPluginName" with the name of your derived class.</span></div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span> <span class="comment">// This name must also match the name of the object file (excluding the</span></div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span> <span class="comment">// extension). These symbols must be linked into your service's object file,</span></div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span> <span class="comment">// not included in any headers that it may use (declarations are OK in headers</span></div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span> <span class="comment">// but not the definitions).</span></div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span> <span class="comment">//</span></div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span> <span class="comment">// The "pion_create" function is used to create new instances of your service.</span></div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span> <span class="comment">// The "pion_destroy" function is used to destroy instances of your service.</span></div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span> <span class="comment">//</span></div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span> <span class="comment">// extern "C" MyPluginName *pion_create_MyPluginName(void) {</span></div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span> <span class="comment">// return new MyPluginName;</span></div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span> <span class="comment">// }</span></div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> <span class="comment">//</span></div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span> <span class="comment">// extern "C" void pion_destroy_MyPluginName(MyPluginName *service_ptr) {</span></div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span> <span class="comment">// delete service_ptr;</span></div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span> <span class="comment">// }</span></div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span> <span class="comment">//</span></div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span> </div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span> </div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span> } <span class="comment">// end namespace http</span></div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span> } <span class="comment">// end namespace pion</span></div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span> </div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span> <span class="preprocessor">#endif</span></div><div class="ttc" id="classpion_1_1http_1_1plugin__service_html"><div class="ttname"><a href="classpion_1_1http_1_1plugin__service.html">pion::http::plugin_service</a></div><div class="ttdef"><b>Definition:</b> <a href="plugin__service_8hpp_source.html#l00029">plugin_service.hpp:29</a></div></div>
<div class="ttc" id="classpion_1_1http_1_1plugin__service_html_a1d7ffeb7d24a0ab951562031b7c16552"><div class="ttname"><a href="classpion_1_1http_1_1plugin__service.html#a1d7ffeb7d24a0ab951562031b7c16552">pion::http::plugin_service::~plugin_service</a></div><div class="ttdeci">virtual ~plugin_service()</div><div class="ttdoc">virtual destructor </div><div class="ttdef"><b>Definition:</b> <a href="plugin__service_8hpp_source.html#l00038">plugin_service.hpp:38</a></div></div>
<div class="ttc" id="classpion_1_1http_1_1plugin__service_html_a081c90dafdae862ca35b4684eaed4b36"><div class="ttname"><a href="classpion_1_1http_1_1plugin__service.html#a081c90dafdae862ca35b4684eaed4b36">pion::http::plugin_service::set_resource</a></div><div class="ttdeci">void set_resource(const std::string &str)</div><div class="ttdoc">sets the URI stem or resource that is bound to the web service </div><div class="ttdef"><b>Definition:</b> <a href="plugin__service_8hpp_source.html#l00065">plugin_service.hpp:65</a></div></div>
<div class="ttc" id="classpion_1_1http_1_1plugin__service_html_a49cddd4c2a99e276373b5f7162ff3cde"><div class="ttname"><a href="classpion_1_1http_1_1plugin__service.html#a49cddd4c2a99e276373b5f7162ff3cde">pion::http::plugin_service::set_option</a></div><div class="ttdeci">virtual void set_option(const std::string &name, const std::string &value)</div><div class="ttdef"><b>Definition:</b> <a href="plugin__service_8hpp_source.html#l00054">plugin_service.hpp:54</a></div></div>
<div class="ttc" id="classpion_1_1http_1_1plugin__service_html_a6d8c34f35f95d8e45c5476314bebdf6f"><div class="ttname"><a href="classpion_1_1http_1_1plugin__service.html#a6d8c34f35f95d8e45c5476314bebdf6f">pion::http::plugin_service::stop</a></div><div class="ttdeci">virtual void stop(void)</div><div class="ttdoc">called when the web service&#39;s server is stopping </div><div class="ttdef"><b>Definition:</b> <a href="plugin__service_8hpp_source.html#l00062">plugin_service.hpp:62</a></div></div>
<div class="ttc" id="structpion_1_1algorithm_html_a440bd54b07a24c80bc939fdb03583721"><div class="ttname"><a href="structpion_1_1algorithm.html#a440bd54b07a24c80bc939fdb03583721">pion::algorithm::url_decode</a></div><div class="ttdeci">static std::string url_decode(const std::string &str)</div><div class="ttdoc">escapes URL-encoded strings (a%20value+with%20spaces) </div><div class="ttdef"><b>Definition:</b> <a href="algorithm_8cpp_source.html#l00153">algorithm.cpp:153</a></div></div>
<div class="ttc" id="classpion_1_1http_1_1plugin__service_html_a587b482f3e8d7bd03ac0d7d693538b23"><div class="ttname"><a href="classpion_1_1http_1_1plugin__service.html#a587b482f3e8d7bd03ac0d7d693538b23">pion::http::plugin_service::plugin_service</a></div><div class="ttdeci">plugin_service(void)</div><div class="ttdoc">default constructor </div><div class="ttdef"><b>Definition:</b> <a href="plugin__service_8hpp_source.html#l00035">plugin_service.hpp:35</a></div></div>
<div class="ttc" id="classpion_1_1http_1_1plugin__service_html_afa5beb5af6a667151f21772e476486f7"><div class="ttname"><a href="classpion_1_1http_1_1plugin__service.html#afa5beb5af6a667151f21772e476486f7">pion::http::plugin_service::operator()</a></div><div class="ttdeci">virtual void operator()(const http::request_ptr &http_request_ptr, const tcp::connection_ptr &tcp_conn)=0</div></div>
<div class="ttc" id="namespacepion_html"><div class="ttname"><a href="namespacepion.html">pion</a></div><div class="ttdef"><b>Definition:</b> <a href="admin__rights_8hpp_source.html#l00019">admin_rights.hpp:19</a></div></div>
<div class="ttc" id="classpion_1_1http_1_1plugin__service_html_a2cd239319b919e66ed961f6a914f7878"><div class="ttname"><a href="classpion_1_1http_1_1plugin__service.html#a2cd239319b919e66ed961f6a914f7878">pion::http::plugin_service::get_resource</a></div><div class="ttdeci">const std::string & get_resource(void) const</div><div class="ttdoc">returns the URI stem or resource that is bound to the web service </div><div class="ttdef"><b>Definition:</b> <a href="plugin__service_8hpp_source.html#l00068">plugin_service.hpp:68</a></div></div>
<div class="ttc" id="classpion_1_1error_1_1bad__arg_html"><div class="ttname"><a href="classpion_1_1error_1_1bad__arg.html">pion::error::bad_arg</a></div><div class="ttdoc">exception thrown for an invalid configuration argument or option </div><div class="ttdef"><b>Definition:</b> <a href="error_8hpp_source.html#l00132">error.hpp:132</a></div></div>
<div class="ttc" id="classpion_1_1http_1_1plugin__service_html_a85b4ca1bf18d6f4414f70ca8a1e084a2"><div class="ttname"><a href="classpion_1_1http_1_1plugin__service.html#a85b4ca1bf18d6f4414f70ca8a1e084a2">pion::http::plugin_service::get_relative_resource</a></div><div class="ttdeci">std::string get_relative_resource(const std::string &resource_requested) const</div><div class="ttdoc">returns the path to the resource requested, relative to the web service&#39;s location ...</div><div class="ttdef"><b>Definition:</b> <a href="plugin__service_8hpp_source.html#l00071">plugin_service.hpp:71</a></div></div>
<div class="ttc" id="classpion_1_1http_1_1plugin__service_html_acb534a38c423ead57c98d07077579ecc"><div class="ttname"><a href="classpion_1_1http_1_1plugin__service.html#acb534a38c423ead57c98d07077579ecc">pion::http::plugin_service::start</a></div><div class="ttdeci">virtual void start(void)</div><div class="ttdoc">called when the web service&#39;s server is starting </div><div class="ttdef"><b>Definition:</b> <a href="plugin__service_8hpp_source.html#l00059">plugin_service.hpp:59</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.12
</small></address>
</body>
</html>
|