|
a/src/mediaserver/cdplugins/streamproxy.h |
|
b/src/mediaserver/cdplugins/streamproxy.h |
|
... |
|
... |
21 |
#include <memory>
|
21 |
#include <memory>
|
22 |
#include <functional>
|
22 |
#include <functional>
|
23 |
#include <string>
|
23 |
#include <string>
|
24 |
#include <unordered_map>
|
24 |
#include <unordered_map>
|
25 |
|
25 |
|
|
|
26 |
class NetFetch;
|
|
|
27 |
|
26 |
/// HTTP proxy for UPnP audio transfers
|
28 |
/// HTTP proxy for UPnP audio transfers
|
27 |
///
|
29 |
///
|
28 |
/// Uses microhttpd for the server part and libcurl for talking to the
|
30 |
/// Uses microhttpd for the server part and libcurl for talking to the
|
29 |
/// real server.
|
31 |
/// real server.
|
30 |
///
|
32 |
///
|
31 |
class StreamProxy {
|
33 |
class StreamProxy {
|
32 |
public:
|
34 |
public:
|
|
|
35 |
|
|
|
36 |
/** The fetch method deciding function
|
|
|
37 |
* @param[in,out] url The original URL from the client, changed in place.
|
|
|
38 |
* @param queryparams The HTTP query parameters (?nm=value;..)
|
|
|
39 |
* @param[out] fetcher if we are proxying, the fetcher object used
|
|
|
40 |
* to get the data. Ownership is transferred to us.
|
|
|
41 |
* @return one of Error/Proxy/Redirect, dictating how the client request
|
|
|
42 |
* is to be satisfied (or not)
|
|
|
43 |
*/
|
33 |
enum UrlTransReturn {Error, Proxy, Redirect};
|
44 |
enum UrlTransReturn {Error, Proxy, Redirect};
|
34 |
typedef std::function<UrlTransReturn
|
45 |
typedef std::function<UrlTransReturn
|
35 |
(std::string& url,
|
46 |
(std::string& url,
|
36 |
const std::unordered_map<std::string, std::string>&)>
|
47 |
const std::unordered_map<std::string, std::string>& queryparams,
|
37 |
UrlTransFunc;
|
48 |
std::unique_ptr<NetFetch>& fetcher)> UrlTransFunc;
|
38 |
|
49 |
|
39 |
StreamProxy(int listenport, UrlTransFunc urltrans);
|
50 |
StreamProxy(int listenport, UrlTransFunc urltrans);
|
40 |
~StreamProxy();
|
51 |
~StreamProxy();
|
41 |
|
52 |
|
42 |
// Debug and experiments: kill connections after ms mS
|
53 |
// Debug and experiments: kill connections after ms mS
|