_i_http_handler_8h_source.html 21.5 KB
<!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.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>hueplusplus: include/hueplusplus/IHttpHandler.h 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="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<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">hueplusplus
   &#160;<span id="projectnumber">1.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div 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_e05b4b7707bd5f9fd045e8be02b17d0a.html">hueplusplus</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">IHttpHandler.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_i_http_handler_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">#ifndef INCLUDE_HUEPLUSPLUS_IHTTPHANDLER_H</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">#define INCLUDE_HUEPLUSPLUS_IHTTPHANDLER_H</span></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">#include &lt;chrono&gt;</span></div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#include &lt;memory&gt;</span></div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="preprocessor">#include &quot;json/json.hpp&quot;</span></div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacehueplusplus.html">hueplusplus</a></div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;{</div><div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="classhueplusplus_1_1_i_http_handler.html">   37</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhueplusplus_1_1_i_http_handler.html">IHttpHandler</a></div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;{</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    <span class="keyword">virtual</span> <a class="code" href="classhueplusplus_1_1_i_http_handler.html#ac98c198e69bc091636799fd8150b9c13">~IHttpHandler</a>() = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;    <span class="keyword">virtual</span> std::string <a class="code" href="classhueplusplus_1_1_i_http_handler.html#ab48c2539eac3d3af598525a6e8eab507">send</a>(<span class="keyword">const</span> std::string&amp; msg, <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    <span class="keyword">virtual</span> std::string <a class="code" href="classhueplusplus_1_1_i_http_handler.html#a84b57f1a3156d86e7a52df9b25fab77e">sendGetHTTPBody</a>(<span class="keyword">const</span> std::string&amp; msg, <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;    <span class="keyword">virtual</span> std::vector&lt;std::string&gt; <a class="code" href="classhueplusplus_1_1_i_http_handler.html#ae4de1ed96e6ecf1e41613366dc6fda32">sendMulticast</a>(<span class="keyword">const</span> std::string&amp; msg, <span class="keyword">const</span> std::string&amp; adr = <span class="stringliteral">&quot;239.255.255.250&quot;</span>,</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;        <span class="keywordtype">int</span> port = 1900, std::chrono::steady_clock::duration timeout = std::chrono::seconds(5)) <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    <span class="keyword">virtual</span> std::string <a class="code" href="classhueplusplus_1_1_i_http_handler.html#ac82b60eb8da6a11800e6944fd45a93d8">sendHTTPRequest</a>(<span class="keyword">const</span> std::string&amp; method, <span class="keyword">const</span> std::string&amp; uri,</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;        <span class="keyword">const</span> std::string&amp; contentType, <span class="keyword">const</span> std::string&amp; body, <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    <span class="keyword">virtual</span> std::string <a class="code" href="classhueplusplus_1_1_i_http_handler.html#a0a1c318af7d333b6bb01c5a65388ba23">GETString</a>(<span class="keyword">const</span> std::string&amp; uri, <span class="keyword">const</span> std::string&amp; contentType, <span class="keyword">const</span> std::string&amp; body,</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;        <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    <span class="keyword">virtual</span> std::string <a class="code" href="classhueplusplus_1_1_i_http_handler.html#a0bcb134d05ecadcb696ceb3e5e96829a">POSTString</a>(<span class="keyword">const</span> std::string&amp; uri, <span class="keyword">const</span> std::string&amp; contentType, <span class="keyword">const</span> std::string&amp; body,</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;        <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;    <span class="keyword">virtual</span> std::string <a class="code" href="classhueplusplus_1_1_i_http_handler.html#a35bbf8cafa81f87cff137896714ffa08">PUTString</a>(<span class="keyword">const</span> std::string&amp; uri, <span class="keyword">const</span> std::string&amp; contentType, <span class="keyword">const</span> std::string&amp; body,</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;        <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;    <span class="keyword">virtual</span> std::string <a class="code" href="classhueplusplus_1_1_i_http_handler.html#a4b164d1b31ce008845d9b83071ec9784">DELETEString</a>(<span class="keyword">const</span> std::string&amp; uri, <span class="keyword">const</span> std::string&amp; contentType, <span class="keyword">const</span> std::string&amp; body,</div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;        <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;</div><div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;    <span class="keyword">virtual</span> nlohmann::json <a class="code" href="classhueplusplus_1_1_i_http_handler.html#a89b23dc67674fb3a0457a4b8e020f010">GETJson</a>(</div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;        <span class="keyword">const</span> std::string&amp; uri, <span class="keyword">const</span> nlohmann::json&amp; body, <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;    <span class="keyword">virtual</span> nlohmann::json <a class="code" href="classhueplusplus_1_1_i_http_handler.html#aec5d497cf69fe8e3b799d3522aea920f">POSTJson</a>(</div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;        <span class="keyword">const</span> std::string&amp; uri, <span class="keyword">const</span> nlohmann::json&amp; body, <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;</div><div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;    <span class="keyword">virtual</span> nlohmann::json <a class="code" href="classhueplusplus_1_1_i_http_handler.html#a9915845c7104e510e2051b79c76c4f32">PUTJson</a>(</div><div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;        <span class="keyword">const</span> std::string&amp; uri, <span class="keyword">const</span> nlohmann::json&amp; body, <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;</div><div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;    <span class="keyword">virtual</span> nlohmann::json <a class="code" href="classhueplusplus_1_1_i_http_handler.html#a5be243abf0f41efbe25e6db52573415b">DELETEJson</a>(</div><div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;        <span class="keyword">const</span> std::string&amp; uri, <span class="keyword">const</span> nlohmann::json&amp; body, <span class="keyword">const</span> std::string&amp; adr, <span class="keywordtype">int</span> port = 80) <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;};</div><div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;} <span class="comment">// namespace hueplusplus</span></div><div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;</div><div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="classhueplusplus_1_1_i_http_handler_html_a0bcb134d05ecadcb696ceb3e5e96829a"><div class="ttname"><a href="classhueplusplus_1_1_i_http_handler.html#a0bcb134d05ecadcb696ceb3e5e96829a">hueplusplus::IHttpHandler::POSTString</a></div><div class="ttdeci">virtual std::string POSTString(const std::string &amp;uri, const std::string &amp;contentType, const std::string &amp;body, const std::string &amp;adr, int port=80) const =0</div><div class="ttdoc">Send a HTTP POST request to the specified host and return the body of the response. </div></div>
<div class="ttc" id="classhueplusplus_1_1_i_http_handler_html_a4b164d1b31ce008845d9b83071ec9784"><div class="ttname"><a href="classhueplusplus_1_1_i_http_handler.html#a4b164d1b31ce008845d9b83071ec9784">hueplusplus::IHttpHandler::DELETEString</a></div><div class="ttdeci">virtual std::string DELETEString(const std::string &amp;uri, const std::string &amp;contentType, const std::string &amp;body, const std::string &amp;adr, int port=80) const =0</div><div class="ttdoc">Send a HTTP DELETE request to the specified host and return the body of the response. </div></div>
<div class="ttc" id="classhueplusplus_1_1_i_http_handler_html_a9915845c7104e510e2051b79c76c4f32"><div class="ttname"><a href="classhueplusplus_1_1_i_http_handler.html#a9915845c7104e510e2051b79c76c4f32">hueplusplus::IHttpHandler::PUTJson</a></div><div class="ttdeci">virtual nlohmann::json PUTJson(const std::string &amp;uri, const nlohmann::json &amp;body, const std::string &amp;adr, int port=80) const =0</div><div class="ttdoc">Send a HTTP PUT request to the specified host and return the body of the response parsed as JSON...</div></div>
<div class="ttc" id="classhueplusplus_1_1_i_http_handler_html_ac98c198e69bc091636799fd8150b9c13"><div class="ttname"><a href="classhueplusplus_1_1_i_http_handler.html#ac98c198e69bc091636799fd8150b9c13">hueplusplus::IHttpHandler::~IHttpHandler</a></div><div class="ttdeci">virtual ~IHttpHandler()=default</div><div class="ttdoc">Virtual dtor. </div></div>
<div class="ttc" id="namespacehueplusplus_html"><div class="ttname"><a href="namespacehueplusplus.html">hueplusplus</a></div><div class="ttdoc">Namespace for the hueplusplus library. </div><div class="ttdef"><b>Definition:</b> Action.h:27</div></div>
<div class="ttc" id="classhueplusplus_1_1_i_http_handler_html_ae4de1ed96e6ecf1e41613366dc6fda32"><div class="ttname"><a href="classhueplusplus_1_1_i_http_handler.html#ae4de1ed96e6ecf1e41613366dc6fda32">hueplusplus::IHttpHandler::sendMulticast</a></div><div class="ttdeci">virtual std::vector&lt; std::string &gt; sendMulticast(const std::string &amp;msg, const std::string &amp;adr=&quot;239.255.255.250&quot;, int port=1900, std::chrono::steady_clock::duration timeout=std::chrono::seconds(5)) const =0</div><div class="ttdoc">Send a multicast request with a specified message. </div></div>
<div class="ttc" id="classhueplusplus_1_1_i_http_handler_html"><div class="ttname"><a href="classhueplusplus_1_1_i_http_handler.html">hueplusplus::IHttpHandler</a></div><div class="ttdoc">Abstract class for classes that handle http requests and multicast requests. </div><div class="ttdef"><b>Definition:</b> IHttpHandler.h:37</div></div>
<div class="ttc" id="classhueplusplus_1_1_i_http_handler_html_ab48c2539eac3d3af598525a6e8eab507"><div class="ttname"><a href="classhueplusplus_1_1_i_http_handler.html#ab48c2539eac3d3af598525a6e8eab507">hueplusplus::IHttpHandler::send</a></div><div class="ttdeci">virtual std::string send(const std::string &amp;msg, const std::string &amp;adr, int port=80) const =0</div><div class="ttdoc">Send a message to a specified host and return the response. </div></div>
<div class="ttc" id="classhueplusplus_1_1_i_http_handler_html_aec5d497cf69fe8e3b799d3522aea920f"><div class="ttname"><a href="classhueplusplus_1_1_i_http_handler.html#aec5d497cf69fe8e3b799d3522aea920f">hueplusplus::IHttpHandler::POSTJson</a></div><div class="ttdeci">virtual nlohmann::json POSTJson(const std::string &amp;uri, const nlohmann::json &amp;body, const std::string &amp;adr, int port=80) const =0</div><div class="ttdoc">Send a HTTP POST request to the specified host and return the body of the response parsed as JSON...</div></div>
<div class="ttc" id="classhueplusplus_1_1_i_http_handler_html_a89b23dc67674fb3a0457a4b8e020f010"><div class="ttname"><a href="classhueplusplus_1_1_i_http_handler.html#a89b23dc67674fb3a0457a4b8e020f010">hueplusplus::IHttpHandler::GETJson</a></div><div class="ttdeci">virtual nlohmann::json GETJson(const std::string &amp;uri, const nlohmann::json &amp;body, const std::string &amp;adr, int port=80) const =0</div><div class="ttdoc">Send a HTTP GET request to the specified host and return the body of the response parsed as JSON...</div></div>
<div class="ttc" id="classhueplusplus_1_1_i_http_handler_html_a84b57f1a3156d86e7a52df9b25fab77e"><div class="ttname"><a href="classhueplusplus_1_1_i_http_handler.html#a84b57f1a3156d86e7a52df9b25fab77e">hueplusplus::IHttpHandler::sendGetHTTPBody</a></div><div class="ttdeci">virtual std::string sendGetHTTPBody(const std::string &amp;msg, const std::string &amp;adr, int port=80) const =0</div><div class="ttdoc">Send a message to a specified host and return the body of the response. </div></div>
<div class="ttc" id="classhueplusplus_1_1_i_http_handler_html_a0a1c318af7d333b6bb01c5a65388ba23"><div class="ttname"><a href="classhueplusplus_1_1_i_http_handler.html#a0a1c318af7d333b6bb01c5a65388ba23">hueplusplus::IHttpHandler::GETString</a></div><div class="ttdeci">virtual std::string GETString(const std::string &amp;uri, const std::string &amp;contentType, const std::string &amp;body, const std::string &amp;adr, int port=80) const =0</div><div class="ttdoc">Send a HTTP GET request to the specified host and return the body of the response. </div></div>
<div class="ttc" id="classhueplusplus_1_1_i_http_handler_html_a35bbf8cafa81f87cff137896714ffa08"><div class="ttname"><a href="classhueplusplus_1_1_i_http_handler.html#a35bbf8cafa81f87cff137896714ffa08">hueplusplus::IHttpHandler::PUTString</a></div><div class="ttdeci">virtual std::string PUTString(const std::string &amp;uri, const std::string &amp;contentType, const std::string &amp;body, const std::string &amp;adr, int port=80) const =0</div><div class="ttdoc">Send a HTTP PUT request to the specified host and return the body of the response. </div></div>
<div class="ttc" id="classhueplusplus_1_1_i_http_handler_html_a5be243abf0f41efbe25e6db52573415b"><div class="ttname"><a href="classhueplusplus_1_1_i_http_handler.html#a5be243abf0f41efbe25e6db52573415b">hueplusplus::IHttpHandler::DELETEJson</a></div><div class="ttdeci">virtual nlohmann::json DELETEJson(const std::string &amp;uri, const nlohmann::json &amp;body, const std::string &amp;adr, int port=80) const =0</div><div class="ttdoc">Send a HTTP DELETE request to the specified host and return the body of the response parsed as JSON...</div></div>
<div class="ttc" id="classhueplusplus_1_1_i_http_handler_html_ac82b60eb8da6a11800e6944fd45a93d8"><div class="ttname"><a href="classhueplusplus_1_1_i_http_handler.html#ac82b60eb8da6a11800e6944fd45a93d8">hueplusplus::IHttpHandler::sendHTTPRequest</a></div><div class="ttdeci">virtual std::string sendHTTPRequest(const std::string &amp;method, const std::string &amp;uri, const std::string &amp;contentType, const std::string &amp;body, const std::string &amp;adr, int port=80) const =0</div><div class="ttdoc">Send a HTTP request with the given method to the specified host and return the body of the response...</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>