net-cpp: /home/odroid/lomiri/net-cpp-git/src/net-cpp/include/core/net/http/streaming_request.h Source File

net-cpp .. C++11 library for networking purposes

streaming_request.h
Go to the documentation of this file.
1 /*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Thomas Voß <thomas.voss@canonical.com>
17 * Gary Wang <gary.wang@canonical.com>
18 */
19 #ifndef CORE_NET_HTTP_STREAMING_REQUEST_H_
20 #define CORE_NET_HTTP_STREAMING_REQUEST_H_
21
22 #include <core/net/http/request.h>
23
24 namespace core
25 {
26 namespace net
27 {
28 namespace http
29 {
34 class CORE_NET_DLL_PUBLIC StreamingRequest : public Request
35 {
36 public:
37
39 typedef std::function<void(const std::string&)> DataHandler;
40
47 virtual Response execute(const ProgressHandler& ph, const DataHandler& dh) = 0;
48
55 virtual void async_execute(const Handler& handler, const DataHandler& dh) = 0;
56
62 virtual void pause() = 0;
63
68 virtual void resume() = 0;
69
76 virtual void abort_request_if(std::uint64_t limit, const std::chrono::seconds& time) = 0;
77 };
78 }
79 }
80 }
81
82 #endif // CORE_NET_HTTP_STREAMING_REQUEST_H_
core::net::http::StreamingRequest::execute
virtual Response execute(const ProgressHandler &ph, const DataHandler &dh)=0
Synchronously executes the request.
core::net::http::StreamingRequest::abort_request_if
virtual void abort_request_if(std::uint64_t limit, const std::chrono::seconds &time)=0
Sets options for aborting the request. The request will be aborted if transfer speed belows limit byt...
core::net::http::StreamingRequest
The StreamingRequest class encapsulates a request for a web resource, streaming data to the receiver ...
Definition: streaming_request.h:35
core::net::http::Response
The Response struct models a response to a core::net::http::Request.
Definition: response.h:40
core::net::http::Request::Handler
Encapsulates callbacks that can happen during request execution.
Definition: request.h:120
core::net::http::StreamingRequest::async_execute
virtual void async_execute(const Handler &handler, const DataHandler &dh)=0
Asynchronously executes the request, reporting errors, progress and completion to the given handlers.
core
Definition: location.h:24
core::net::http::StreamingRequest::pause
virtual void pause()=0
Pause the request with options for aborting the request. The request will be aborted if transfer spee...
request.h
core::net::http::StreamingRequest::resume
virtual void resume()=0
Resume the request.
CORE_NET_DLL_PUBLIC
#define CORE_NET_DLL_PUBLIC
Definition: visibility.h:25
core::net::http::Request::ProgressHandler
std::function< Progress::Next(const Progress &)> ProgressHandler
ProgressHandler is invoked for progress updates while executing the request.
Definition: request.h:109
core::net::http::StreamingRequest::DataHandler
std::function< void(const std::string &)> DataHandler
Definition: streaming_request.h:39
core::net::http::Request
The Request class encapsulates a request for a web resource.
Definition: request.h:42