2020-12-30 22:07:54 -06:00
|
|
|
/*
|
|
|
|
* Copyright 2020, Jaidyn Levesque <jadedctrl@teknik.io>
|
|
|
|
* All rights reserved. Distributed under the terms of the MIT license.
|
|
|
|
*/
|
2020-06-19 17:54:41 -05:00
|
|
|
#ifndef PROTOCOL_LISTENER_H
|
|
|
|
#define PROTOCOL_LISTENER_H
|
|
|
|
|
2020-08-02 02:05:20 -05:00
|
|
|
#include <boost/uuid/detail/sha1.hpp>
|
2020-06-19 17:54:41 -05:00
|
|
|
|
2020-12-30 22:07:54 -06:00
|
|
|
#include <UrlProtocolListener.h>
|
|
|
|
|
|
|
|
|
2020-06-19 17:54:41 -05:00
|
|
|
class ProtocolListener : public BUrlProtocolListener
|
|
|
|
{
|
|
|
|
public:
|
2020-12-30 22:07:54 -06:00
|
|
|
ProtocolListener(bool);
|
2020-06-19 17:54:41 -05:00
|
|
|
virtual ~ProtocolListener();
|
2020-12-30 22:07:54 -06:00
|
|
|
|
2020-06-19 17:54:41 -05:00
|
|
|
virtual void DataReceived(BUrlRequest*, const char*, off_t, ssize_t);
|
2020-08-02 02:05:20 -05:00
|
|
|
|
2020-12-30 22:07:54 -06:00
|
|
|
void SetDownloadIO(BDataIO*);
|
|
|
|
BDataIO* GetDownloadIO();
|
2020-06-19 17:54:41 -05:00
|
|
|
|
2020-12-30 22:07:54 -06:00
|
|
|
void SetSha1(boost::uuids::detail::sha1*);
|
|
|
|
boost::uuids::detail::sha1* GetSha1();
|
|
|
|
BString GetHash();
|
2020-08-02 02:05:20 -05:00
|
|
|
|
2020-06-19 17:54:41 -05:00
|
|
|
private:
|
2020-12-30 22:07:54 -06:00
|
|
|
BDataIO* fDownloadIO;
|
2020-08-02 02:05:20 -05:00
|
|
|
boost::uuids::detail::sha1* fSha1;
|
2020-12-30 22:07:54 -06:00
|
|
|
bool fTraceLogging;
|
2020-06-19 17:54:41 -05:00
|
|
|
};
|
|
|
|
|
2020-12-30 22:07:54 -06:00
|
|
|
|
2020-06-19 17:54:41 -05:00
|
|
|
#endif
|
2020-12-30 22:07:54 -06:00
|
|
|
|