WPILibC++  2020.3.2
PortForwarder.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2019 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #ifndef WPIUTIL_WPI_PORTFORWARDER_H_
9 #define WPIUTIL_WPI_PORTFORWARDER_H_
10 
11 #pragma once
12 
13 #include <memory>
14 
15 #include "wpi/Twine.h"
16 
17 namespace wpi {
18 
24  public:
25  PortForwarder(const PortForwarder&) = delete;
26  PortForwarder& operator=(const PortForwarder&) = delete;
27 
34  static PortForwarder& GetInstance();
35 
44  void Add(unsigned int port, const Twine& remoteHost, unsigned int remotePort);
45 
51  void Remove(unsigned int port);
52 
53  private:
54  PortForwarder();
55 
56  struct Impl;
57  std::unique_ptr<Impl> m_impl;
58 };
59 
60 } // namespace wpi
61 
62 #endif // WPIUTIL_WPI_PORTFORWARDER_H_
wpi
WPILib C++ utilities (wpiutil) namespace.
Definition: EventLoopRunner.h:17
wpi::PortForwarder::Add
void Add(unsigned int port, const Twine &remoteHost, unsigned int remotePort)
Forward a local TCP port to a remote host and port.
wpi::PortForwarder::Remove
void Remove(unsigned int port)
Stop TCP forwarding on a port.
wpi::PortForwarder::GetInstance
static PortForwarder & GetInstance()
Get an instance of the PortForwarder class.
wpi::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:85
wpi::PortForwarder
Forward ports to another host.
Definition: PortForwarder.h:23