Base class for Boost Device implementations allowing to access remote (ftp://, http://, https://) URLs as stdio streams, similar to fstream. More...
#include <WebStream.hpp>
Classes | |
union | handle_t |
Public Member Functions | |
WebStreambufBase (const char *url, URLMode mode, int bufsize) | |
Open URL device using the given URL and flags. More... | |
virtual | ~WebStreambufBase () |
Clean up resources occupied by device, e.g. More... | |
Protected Member Functions | |
void | loop () |
loop to fetch/send more data | |
Protected Attributes | |
URLMode | mode |
handle_t | handle |
CURLM * | multi_handle |
int | running_handles |
char * | buffer |
internal buffer for storing data from last read | |
int | buffer_size |
allocated buffer size | |
char * | buffer_position |
cURL position in buffer (when sending/receiving data) | |
bool | finishing |
indicate if device is already finishing transfer (i.e. no more reads/writes) | |
bool | waiting |
indicate if the device is still waiting for more data | |
Base class for Boost Device implementations allowing to access remote (ftp://, http://, https://) URLs as stdio streams, similar to fstream.
Remote files are partly buffered in main memory.
The class is implemented using the Boost IOStreams library and uses the cURL library in the background to a access remote files.
mico::io::WebStreambufBase::WebStreambufBase | ( | const char * | url, |
URLMode | mode, | ||
int | bufsize | ||
) |
Open URL device using the given URL and flags.
Uses cURL internally to access the server.
url | the full URL to the file (either starting with http://, https:// or ftp://) |
mode | open mode, like for fopen; supported modes: read, write |
Uses cURL internally to access the server.
url | the full URL to the file (either starting with http://, https:// or ftp://) |
mode | open mode, like for fopen; supported modes: r, w; remote files cannot be opened for reading and writing at the same time |
|
virtual |
Clean up resources occupied by device, e.g.
file handles and connections.