_i_http_handler_8h_source.html
21.5 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!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
 <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> </div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#ifndef INCLUDE_HUEPLUSPLUS_IHTTPHANDLER_H</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#define INCLUDE_HUEPLUSPLUS_IHTTPHANDLER_H</span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> </div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#include <chrono></span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor">#include <iostream></span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#include <memory></span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="preprocessor">#include <string></span></div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="preprocessor">#include <vector></span></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="preprocessor">#include "json/json.hpp"</span></div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> </div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <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> {</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> <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> {</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="keyword">public</span>:</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <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> </div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <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& msg, <span class="keyword">const</span> std::string& 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> </div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <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& msg, <span class="keyword">const</span> std::string& 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> </div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <span class="keyword">virtual</span> std::vector<std::string> <a class="code" href="classhueplusplus_1_1_i_http_handler.html#ae4de1ed96e6ecf1e41613366dc6fda32">sendMulticast</a>(<span class="keyword">const</span> std::string& msg, <span class="keyword">const</span> std::string& adr = <span class="stringliteral">"239.255.255.250"</span>,</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <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> </div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <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& method, <span class="keyword">const</span> std::string& uri,</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keyword">const</span> std::string& contentType, <span class="keyword">const</span> std::string& body, <span class="keyword">const</span> std::string& 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> </div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <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& uri, <span class="keyword">const</span> std::string& contentType, <span class="keyword">const</span> std::string& body,</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  <span class="keyword">const</span> std::string& 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> </div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  <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& uri, <span class="keyword">const</span> std::string& contentType, <span class="keyword">const</span> std::string& body,</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <span class="keyword">const</span> std::string& 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> </div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <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& uri, <span class="keyword">const</span> std::string& contentType, <span class="keyword">const</span> std::string& body,</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  <span class="keyword">const</span> std::string& 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> </div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  <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& uri, <span class="keyword">const</span> std::string& contentType, <span class="keyword">const</span> std::string& body,</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  <span class="keyword">const</span> std::string& 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> </div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  <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>  <span class="keyword">const</span> std::string& uri, <span class="keyword">const</span> nlohmann::json& body, <span class="keyword">const</span> std::string& 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> </div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span>  <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>  <span class="keyword">const</span> std::string& uri, <span class="keyword">const</span> nlohmann::json& body, <span class="keyword">const</span> std::string& 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> </div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span>  <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>  <span class="keyword">const</span> std::string& uri, <span class="keyword">const</span> nlohmann::json& body, <span class="keyword">const</span> std::string& 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> </div><div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  <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>  <span class="keyword">const</span> std::string& uri, <span class="keyword">const</span> nlohmann::json& body, <span class="keyword">const</span> std::string& 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> };</div><div class="line"><a name="l00198"></a><span class="lineno"> 198</span> } <span class="comment">// namespace hueplusplus</span></div><div class="line"><a name="l00199"></a><span class="lineno"> 199</span> </div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span> <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 &uri, const std::string &contentType, const std::string &body, const std::string &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 &uri, const std::string &contentType, const std::string &body, const std::string &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 &uri, const nlohmann::json &body, const std::string &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< std::string > sendMulticast(const std::string &msg, const std::string &adr="239.255.255.250", 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 &msg, const std::string &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 &uri, const nlohmann::json &body, const std::string &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 &uri, const nlohmann::json &body, const std::string &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 &msg, const std::string &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 &uri, const std::string &contentType, const std::string &body, const std::string &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 &uri, const std::string &contentType, const std::string &body, const std::string &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 &uri, const nlohmann::json &body, const std::string &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 &method, const std::string &uri, const std::string &contentType, const std::string &body, const std::string &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  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>