diff options
| author | Joel Klinghed <the_jk@yahoo.com> | 2017-03-28 22:36:44 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@yahoo.com> | 2017-03-28 22:36:44 +0200 |
| commit | d01e13c9dee53c3ab4faf70a215f4d1dcfed9e87 (patch) | |
| tree | 90975d8502a6c610a58f5d3cd8014bcf8443c0e9 /src/mitm.hh | |
| parent | 87774d8981ae7a079492d8949e205065ba72a8e4 (diff) | |
MITM SSL Interception support using mbedtls
Diffstat (limited to 'src/mitm.hh')
| -rw-r--r-- | src/mitm.hh | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/mitm.hh b/src/mitm.hh new file mode 100644 index 0000000..6d79e8f --- /dev/null +++ b/src/mitm.hh @@ -0,0 +1,66 @@ +// -*- mode: c++; c-basic-offset: 2; -*- + +#ifndef MITM_HH +#define MITM_HH + +#include <cstddef> +#include <string> + +class Buffer; +class Config; +class Logger; + +class Mitm { +public: + virtual ~Mitm() {} + + static Mitm* create(Logger* logger, Config* config, std::string const& cwd); + + virtual bool reload(Config* config, std::string const& cwd) = 0; + + enum DetectResult { + SSL, + OTHER, + NEED_MORE, + }; + virtual DetectResult detect(void const* data, size_t avail) = 0; + + class Monitor { + public: + virtual ~Monitor() {} + + virtual void local2remote(void const* data, size_t size) = 0; + virtual void remote2local(void const* data, size_t size) = 0; + + protected: + Monitor() {} + }; + + class Connection { + public: + virtual ~Connection() {} + + virtual bool transfer( + Buffer* local_in, Buffer* local_out, + Buffer* remote_in, Buffer* remote_out, + Monitor* monitor) = 0; + + virtual bool local_eof() const = 0; + virtual bool remote_eof() const = 0; + + virtual void close_local() = 0; + virtual void close_remote() = 0; + + protected: + Connection() {} + Connection(Connection const&) = delete; + }; + + virtual Connection* open(std::string const& host) = 0; + +protected: + Mitm() {} + Mitm(Mitm const&) = delete; +}; + +#endif // MITM_HH |
