blob: e99c547ee7c5ca7a7ede14b28d024a99e604e8c6 [file] [log] [blame]
wubf975eac2019-08-19 19:41:01 -07001// Copyright (c) 2019 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef QUICHE_QUIC_QBONE_BONNET_TUN_DEVICE_INTERFACE_H_
6#define QUICHE_QUIC_QBONE_BONNET_TUN_DEVICE_INTERFACE_H_
7
8#include <vector>
9
10namespace quic {
11
12// An interface with methods for interacting with a TUN device.
13class TunDeviceInterface {
14 public:
15 virtual ~TunDeviceInterface() {}
16
17 // Actually creates/reopens and configures the device.
18 virtual bool Init() = 0;
19
20 // Marks the interface up to start receiving packets.
21 virtual bool Up() = 0;
22
23 // Marks the interface down to stop receiving packets.
24 virtual bool Down() = 0;
25
26 // Gets the file descriptor that can be used to send/receive packets.
27 // This returns -1 when the TUN device is in an invalid state.
28 virtual int GetFileDescriptor() const = 0;
29};
30
31} // namespace quic
32
33#endif // QUICHE_QUIC_QBONE_BONNET_TUN_DEVICE_INTERFACE_H_