2021-01-06 21:43:48 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-01-09 10:17:50 +00:00
|
|
|
#include "api.h"
|
2021-01-06 21:43:48 +00:00
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
namespace http {
|
|
|
|
|
|
|
|
#define HTTPProxyInterfaceIID "bigsnitch.api.HTTPProxyInterface/100"
|
|
|
|
|
|
|
|
//! Interface for implementing proxies
|
|
|
|
/*!
|
|
|
|
Interface for implementing proxies
|
2021-03-19 16:40:33 +00:00
|
|
|
|
2021-03-20 16:04:13 +00:00
|
|
|
You need to implement the following signals:
|
|
|
|
|
|
|
|
void process(std::string path); // called in a separate thread, has to block, will not be called again
|
|
|
|
void finished(); // thread finished and can be deleted
|
|
|
|
void error(QString err); // an error occured
|
|
|
|
void message(http::Flow flow); // a http::Flow was received
|
|
|
|
|
2021-01-06 21:43:48 +00:00
|
|
|
*/
|
2021-03-19 16:40:33 +00:00
|
|
|
class ProxyInterface {
|
2021-01-06 21:43:48 +00:00
|
|
|
public:
|
2021-03-20 21:56:03 +00:00
|
|
|
// the path the proxy listens on
|
2021-03-20 16:04:13 +00:00
|
|
|
std::string path;
|
2021-01-06 21:43:48 +00:00
|
|
|
virtual ~ProxyInterface() = default;
|
2021-03-20 21:56:03 +00:00
|
|
|
//! returns name of the plugin
|
|
|
|
virtual QString getName() = 0;
|
2021-01-06 21:43:48 +00:00
|
|
|
//! returns, whether the proxy is currently connected
|
|
|
|
virtual bool connected() = 0;
|
|
|
|
//! disconnects the handle
|
|
|
|
virtual void disconnect() = 0;
|
|
|
|
// options/settings
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Q_DECLARE_INTERFACE(http::ProxyInterface, HTTPProxyInterfaceIID)
|