Switch to unified view

a/src/mediaserver/cdplugins/curlfetch.h b/src/mediaserver/cdplugins/curlfetch.h
...
...
44
class CurlFetch : public NetFetch {
44
class CurlFetch : public NetFetch {
45
public:
45
public:
46
    CurlFetch(const std::string& url);
46
    CurlFetch(const std::string& url);
47
    ~CurlFetch();
47
    ~CurlFetch();
48
48
49
    const std::string& url();
50
    
51
    void setTimeout(int secs);
52
    
53
    /// Start the transfer to the output queue.
49
    /// Start the transfer to the output queue.
54
    bool start(BufXChange<ABuffer*> *queue, uint64_t offset = 0);
50
    bool start(BufXChange<ABuffer*> *queue, uint64_t offset = 0) override;
55
51
56
    // Wait for HTTP headers. This allows, e.g. doing stuff depending
52
    // Wait for HTTP headers. This allows, e.g. doing stuff depending
57
    // on content-type before proceeding with the actual data transfer
53
    // on content-type before proceeding with the actual data transfer
58
    bool waitForHeaders(int maxSecs = 0);
54
    bool waitForHeaders(int maxSecs = 0) override;
59
    // Retrieve header value (after a successful waitForHeaders).
55
    // Retrieve header value (after a successful waitForHeaders).
60
    bool headerValue(const std::string& nm, std::string& val);
56
    bool headerValue(const std::string& nm, std::string& val) override;
61
57
62
    // Check if the curl thread is done and retrieve the results if it
58
    // Check if the curl thread is done and retrieve the results if it
63
    // is. This does not wait, it returns false if the transfer is
59
    // is. This does not wait, it returns false if the transfer is
64
    // still running.
60
    // still running.
65
    bool fetchDone(FetchStatus *code, int *http_code) override;
61
    bool fetchDone(FetchStatus *code, int *http_code) override;
66
62
67
    /// Reset after transfer done, for retrying for exemple.
63
    /// Reset after transfer done, for retrying for exemple.
68
    void reset();
64
    bool reset() override;
69
65
70
    // Callbacks
71
72
    // A function to create the first buffer (typically for prepending
73
    // a wav header to a raw pcm stream. If set this is called from
74
    // the first curl write callback, before processing the curl data,
75
    // so this happens at a point where the client may have had a look
76
    // at the headers).
77
    void setBuf1GenCB(std::function<bool(std::string& buf,void*,int)>);
78
    // Called after curl_easy_perform returns
79
    void setEOFetchCB(std::function<void(bool ok, u_int64_t count)> eofcb);
80
    // Called every time we get new data from curl
81
    void setFetchBytesCB(std::function<void(u_int64_t count)> fbcb);
82
    
83
    class Internal;
66
    class Internal;
84
private:
67
private:
85
    std::unique_ptr<Internal> m;
68
    std::unique_ptr<Internal> m;
86
};
69
};
87
70