summaryrefslogtreecommitdiff
path: root/Servers/ProtocolServer/Protocol.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-11-23 21:45:33 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-11-23 21:50:32 +0100
commitfd4349a9f21b5e5eab660dd5c375e4bdf3413fd7 (patch)
treee4a17b017725a47669da53ff8737b4ce05b3cbc5 /Servers/ProtocolServer/Protocol.h
parent61f611bf3cbdaa726a86c14524912ebff591d868 (diff)
downloadserenity-fd4349a9f21b5e5eab660dd5c375e4bdf3413fd7.zip
ProtocolServer+LibProtocol: Introduce a server for handling downloads
This patch adds ProtocolServer, a server that handles network requests on behalf of its clients. The first protocol implemented is HTTP. The idea here is to use a plug-in architecture where any number of protocols can be added and implemented without having to mess around with each client program that wants to use the protocol. A simple client API is provided through LibProtocol::Client. :^)
Diffstat (limited to 'Servers/ProtocolServer/Protocol.h')
-rw-r--r--Servers/ProtocolServer/Protocol.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/Servers/ProtocolServer/Protocol.h b/Servers/ProtocolServer/Protocol.h
new file mode 100644
index 0000000000..d828352bbc
--- /dev/null
+++ b/Servers/ProtocolServer/Protocol.h
@@ -0,0 +1,23 @@
+#pragma once
+
+#include <AK/RefPtr.h>
+#include <AK/URL.h>
+
+class Download;
+class PSClientConnection;
+
+class Protocol {
+public:
+ virtual ~Protocol();
+
+ const String& name() const { return m_name; }
+ virtual RefPtr<Download> start_download(PSClientConnection&, const URL&) = 0;
+
+ static Protocol* find_by_name(const String&);
+
+protected:
+ explicit Protocol(const String& name);
+
+private:
+ String m_name;
+};