| 1 | // Copyright (C) Microsoft Corporation. All rights reserved. |
| 2 | // SPDX-License-Identifier: MIT |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include <stdint.h> |
| 7 | #include <thread> |
| 8 | #include <memory> |
| 9 | |
| 10 | #include "Packet.h" |
| 11 | |
| 12 | class IForwarder |
| 13 | { |
| 14 | public: |
| 15 | virtual ~IForwarder() {}; |
| 16 | }; |
| 17 | |
| 18 | template <typename ProcessingFunction, typename ExceptionHandler> |
| 19 | class Forwarder : public IForwarder |
| 20 | { |
| 21 | public: |
| 22 | Forwarder(int SourceFd, int DestinationFd, ProcessingFunction Handler, ExceptionHandler exceptionHandler); |
| 23 | ~Forwarder() override; |
| 24 | |
| 25 | private: |
| 26 | std::thread Worker; |
| 27 | int SourceFd; |
| 28 | int DestinationFd; |
| 29 | int TerminateFd; |
| 30 | }; |
| 31 | |
| 32 | #include "Forwarder.hxx" |