APPLEMAIL-24
Volker Birk 4 years ago
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;
}

@ -5,11 +5,12 @@ include Makefile.conf
-include local.conf
CXXFLAGS += -std=c++14 -O0 -g
LDFLAGS += -lboost_regex-mt -lboost_iostreams-mt -lboost_system-mt
SOURCE=$(wildcard *.cc)
HEADERS=$(wildcard *.hh *.hxx)
OBJECTS=$(subst .cc,.o,$(SOURCE))
WITHOUT_TESTS=$(patsubst test%.o,,$(OBJECTS))
WITHOUT_TESTS=$(patsubst test_%.o,,$(OBJECTS))
all: $(TARGET)
@ -23,6 +24,7 @@ $(TARGET): $(WITHOUT_TESTS)
clean:
rm -f $(TARGET) $(OBJECTS) *.a
rm -f test_split_url
install: $(TARGET)
-mkdir -p $(PEP)/include/pEp
@ -32,3 +34,9 @@ install: $(TARGET)
uninstall:
cd $(PEP)/include && rm -f $(HEADERS)
cd $(PEP)/lib && rm -f $(TARGET)
test_split_url: test_split_url.o HTTPSStream.o
$(CXX) $(LDFLAGS) $< HTTPSStream.o -o $@
test: test_split_url
./test_split_url

@ -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…
Cancel
Save