summaryrefslogtreecommitdiff
path: root/src/components/transport_manager/include/transport_manager/tcp/network_interface_listener_impl.h
blob: 272b28b6b208aa719b7fb61d3471742454853e59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_NETWORK_INTERFACE_LISTENER_IMPL_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_NETWORK_INTERFACE_LISTENER_IMPL_H_

#include <memory>
#include <string>

#include "transport_manager/tcp/network_interface_listener.h"
#include "utils/macro.h"

namespace transport_manager {
namespace transport_adapter {

class TcpClientListener;

/**
 * @brief Listener to detect various events on network interfaces
 */
class NetworkInterfaceListenerImpl : public NetworkInterfaceListener {
 public:
  /**
   * @brief Constructor
   *
   * @param tcp_client_listener  an instance of TcpClientListener which receives
   *                             status updates
   * @param designated_interface  if we want to listen only on a specific
   *                              network interface, specify its name
   */
  NetworkInterfaceListenerImpl(TcpClientListener* tcp_client_listener,
                               const std::string designated_interface);

  /**
   * @brief Destructor
   */
  virtual ~NetworkInterfaceListenerImpl();

  /**
   * @brief Initialize this listener
   */
  bool Init() OVERRIDE;

  /**
   * @brief Deinitialize this listener
   */
  void Deinit() OVERRIDE;

  /**
   * @brief Start this listener
   */
  bool Start() OVERRIDE;

  /**
   * @brief Stop this listener
   */
  bool Stop() OVERRIDE;

 private:
  std::unique_ptr<NetworkInterfaceListener> platform_specific_impl_;
};

}  // namespace transport_adapter
}  // namespace transport_manager

#endif  // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_NETWORK_INTERFACE_LISTENER_IMPL_H_