forked from pEp.foundation/downloadclient
parent
2008d7192c
commit
547a9c6fde
@ -0,0 +1,38 @@
|
||||
// this file is under GNU General Public License 3.0
|
||||
// see LICENSE.txt
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <boost/asio/connect.hpp>
|
||||
#include <iostream>
|
||||
#include <boost/iostreams/stream.hpp>
|
||||
|
||||
namespace pEp {
|
||||
using namespace std;
|
||||
namespace io = boost::iostreams;
|
||||
|
||||
struct url_split {
|
||||
string protocol;
|
||||
string login;
|
||||
string password;
|
||||
string host;
|
||||
string port;
|
||||
string path;
|
||||
string hash;
|
||||
};
|
||||
|
||||
url_split split_url(string url);
|
||||
|
||||
class HTTPSDevice : public io::device< io::bidirectional > {
|
||||
boost::asio::io_context _ioc;
|
||||
|
||||
public:
|
||||
void open(string url);
|
||||
|
||||
streamsize read(char* s, streamsize n);
|
||||
streamsize write(const char* s, streamsize n);
|
||||
};
|
||||
|
||||
typedef io::stream< HTTPSDevice > HTTPSStream;
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
// this file is under GNU General Public License 3.0
|
||||
// see LICENSE.txt
|
||||
|
||||
#include "UpdateStream.hh"
|
||||
|
||||
#include <cryptopp/ripemd.h>
|
||||
#include <cryptopp/hmac.h>
|
||||
#include <cryptopp/filters.h>
|
||||
#include <cryptopp/hex.h>
|
||||
#include <cryptopp/rsa.h>
|
||||
#include <cryptopp/gcm.h>
|
||||
#include <cryptopp/osrng.h>
|
||||
#include <cryptopp/files.h>
|
||||
|
||||
namespace pEp {
|
||||
namespace UpdateClient {
|
||||
UpdateDevice::UpdateDevice(const product& p)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
// this file is under GNU General Public License 3.0
|
||||
// see LICENSE.txt
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <boost/iostreams/stream.hpp>
|
||||
|
||||
#include "HTTPSStream.hh"
|
||||
|
||||
namespace pEp {
|
||||
namespace UpdateClient {
|
||||
using namespace std;
|
||||
namespace io = boost::iostreams;
|
||||
|
||||
struct NoUpdateAvailable : runtime_error { };
|
||||
|
||||
struct product {
|
||||
string name;
|
||||
string url;
|
||||
string serial;
|
||||
};
|
||||
|
||||
class UpdateDevice
|
||||
{
|
||||
HTTPSStream _https;
|
||||
|
||||
public:
|
||||
UpdateDevice(const product& p);
|
||||
|
||||
typedef char char_type;
|
||||
typedef io::bidirectional_device_tag category;
|
||||
|
||||
streamsize read(char* s, streamsize n);
|
||||
streamsize write(const char* s, streamsize n);
|
||||
};
|
||||
|
||||
typedef io::stream< UpdateDevice > UpdateStream;
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,25 @@
|
||||
// this file is under GNU General Public License 3.0
|
||||
// see LICENSE.txt
|
||||
|
||||
#include "downloadclient.hh"
|
||||
#include "UpdateStream.hh"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <cryptopp/ripemd.h>
|
||||
#include <cryptopp/hmac.h>
|
||||
#include <cryptopp/filters.h>
|
||||
#include <cryptopp/hex.h>
|
||||
#include <cryptopp/rsa.h>
|
||||
#include <cryptopp/gcm.h>
|
||||
#include <cryptopp/osrng.h>
|
||||
#include <cryptopp/files.h>
|
||||
|
||||
namespace pEp {
|
||||
namespace UpdateClient {
|
||||
/*
|
||||
istream update(const product& p)
|
||||
{
|
||||
try {
|
||||
return UpdateStream(p);
|
||||
}
|
||||
catch (NoUpdateAvailable&) {
|
||||
return stringstream(string(""));
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,16 @@
|
||||
// this file is under GNU General Public License 3.0
|
||||
// see LICENSE.txt
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include "UpdateStream.hh"
|
||||
|
||||
namespace pEp {
|
||||
namespace UpdateClient {
|
||||
using namespace std;
|
||||
|
||||
istream update(const product& p);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue