34 lines
919 B
C++
34 lines
919 B
C++
#pragma once
|
|
|
|
#include "api.h"
|
|
#include <QObject>
|
|
|
|
namespace http {
|
|
|
|
#define HTTPProxyInterfaceIID "bigsnitch.api.HTTPProxyInterface/100"
|
|
|
|
//! Interface for implementing proxies
|
|
/*!
|
|
Interface for implementing proxies
|
|
|
|
There are no signals, because apparently Qt Plugins do not support interfaces, which inherit from QObject.
|
|
(it will fail upon loading the plugin)
|
|
*/
|
|
class ProxyInterface {
|
|
public:
|
|
virtual ~ProxyInterface() = default;
|
|
//! called in a custom thread, may block.
|
|
virtual void process(std::string path) = 0;
|
|
//! returns, whether the proxy is currently connected
|
|
virtual bool connected() = 0;
|
|
//! disconnects the handle
|
|
virtual void disconnect() = 0;
|
|
// options/settings
|
|
std::function<void()> finished;
|
|
std::function<void(QString)> error;
|
|
std::function<void(http::Flow flow)> message;
|
|
};
|
|
|
|
}
|
|
|
|
Q_DECLARE_INTERFACE(http::ProxyInterface, HTTPProxyInterfaceIID)
|