27#ifndef FICHIER_LIBCURL_HPP
28#define FICHIER_LIBCURL_HPP
31#include "../my_config.h"
43#ifdef LIBTHREADAR_AVAILABLE
44#include <libthreadar/libthreadar.hpp>
58#if defined ( LIBCURL_AVAILABLE ) && defined ( LIBTHREADAR_AVAILABLE )
62 class fichier_libcurl :
public fichier_global,
protected libthreadar::thread
67 fichier_libcurl(
const std::shared_ptr<user_interaction> & dialog,
68 const std::string & chemin,
69 mycurl_protocol proto,
70 const std::shared_ptr<mycurl_easyhandle_node> & handle,
73 bool force_permission,
80 fichier_libcurl(
const fichier_libcurl & ref) =
delete;
83 fichier_libcurl(fichier_libcurl && ref) =
delete;
87 fichier_libcurl & operator = (
const fichier_libcurl & ref) =
delete;
90 fichier_libcurl & operator = (fichier_libcurl && ref) =
delete;
93 ~fichier_libcurl() noexcept { kill(); join(); detruit(); };
96 virtual void change_permission(U_I perm)
override;
99 virtual void change_ownership(
const std::string & user,
const std::string & group)
override
100 {
throw Efeature(gettext(
"user/group ownership not supported for this repository")); };
103 virtual infinint get_size()
const override;
106 virtual void fadvise(advise adv)
const override {};
109 virtual bool skippable(skippability direction,
const infinint & amount)
override;
110 virtual bool skip(
const infinint & pos)
override;
111 virtual bool skip_to_eof()
override;
112 virtual bool skip_relative(S_I x)
override;
113 virtual bool truncatable(
const infinint & pos)
const override {
return pos == get_position(); };
114 virtual infinint get_position()
const override {
return current_offset; };
118 virtual void inherited_read_ahead(
const infinint & amount)
override;
119 virtual void inherited_truncate(
const infinint & pos)
override;
120 virtual void inherited_sync_write()
override;
121 virtual void inherited_flush_read()
override;
122 virtual void inherited_terminate()
override;
125 virtual U_I fichier_global_inherited_write(
const char *a, U_I size)
override;
126 virtual bool fichier_global_inherited_read(
char *a, U_I size, U_I & read, std::string & message)
override;
129 virtual void inherited_run()
override;
132 static const U_I tampon_size = CURL_MAX_WRITE_SIZE;
157 bool sync_write_asked;
159 std::shared_ptr<mycurl_easyhandle_node> ehandle;
161 infinint current_offset;
167 infinint network_block;
168 infinint subthread_net_offset;
169 infinint subthread_cur_offset;
170 libthreadar::fast_tampon<char> interthread;
171 libthreadar::barrier synchronize;
174 void set_range(
const infinint & begin,
const infinint & range_size);
176 void switch_to_metadata(
bool mode);
180 void relaunch_thread(
const infinint & block_size);
181 void initialize_subthread();
182 void finalize_subthread();
183 void set_subthread(U_I & needed_bytes);
184 bool still_data_to_write();
186 static size_t write_data_callback(
char *buffer,
size_t size,
size_t nmemb,
void *userp);
187 static size_t read_data_callback(
char *bufptr,
size_t size,
size_t nitems,
void *userp);
188 static size_t write_meta_callback(
char *buffer,
size_t size,
size_t nmemb,
void *userp);
189 static size_t read_meta_callback(
char *bufptr,
size_t size,
size_t nitems,
void *userp);
class fichier_global definition. This class is a pure virtual class class fichier_global is an abstra...
mycurl_protocol
libcurl protocols supported by libdar
are defined here basic integer types that tend to be portable
used to optimize session creation done by libcurl
datastructure defining the network protocols available for entrepot_libcurl class
libdar namespace encapsulate all libdar symbols
defines the interaction interface between libdar and users.