Jordan Bayles | 1c785bd | 2019-08-15 10:32:33 -0700 | [diff] [blame] | 1 | // Copyright 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 | |
Jordan Bayles | 8f0e043 | 2021-02-01 12:07:16 -0800 | [diff] [blame^] | 5 | #ifndef PLATFORM_IMPL_SOCKET_STATE_H_ |
| 6 | #define PLATFORM_IMPL_SOCKET_STATE_H_ |
Jordan Bayles | 1c785bd | 2019-08-15 10:32:33 -0700 | [diff] [blame] | 7 | |
| 8 | #include <cstdint> |
| 9 | #include <memory> |
| 10 | #include <string> |
| 11 | |
| 12 | namespace openscreen { |
Jordan Bayles | 1c785bd | 2019-08-15 10:32:33 -0700 | [diff] [blame] | 13 | |
Jordan Bayles | 8f0e043 | 2021-02-01 12:07:16 -0800 | [diff] [blame^] | 14 | // TcpSocketState should be used by TCP and TLS sockets for indicating |
Jordan Bayles | 1c785bd | 2019-08-15 10:32:33 -0700 | [diff] [blame] | 15 | // current state. NOTE: socket state transitions should only happen in |
| 16 | // the listed order. New states should be added in appropriate order. |
Jordan Bayles | 8f0e043 | 2021-02-01 12:07:16 -0800 | [diff] [blame^] | 17 | enum class TcpSocketState { |
Jordan Bayles | 1c785bd | 2019-08-15 10:32:33 -0700 | [diff] [blame] | 18 | // Socket is not connected. |
| 19 | kNotConnected = 0, |
| 20 | |
btolsch | c48f5ba | 2020-10-01 13:41:40 -0700 | [diff] [blame] | 21 | // Socket is actively listening for incoming connections. |
| 22 | kListening, |
| 23 | |
Jordan Bayles | 1c785bd | 2019-08-15 10:32:33 -0700 | [diff] [blame] | 24 | // Socket is currently being connected. |
| 25 | kConnecting, |
| 26 | |
| 27 | // Socket is actively connected to a remote address. |
| 28 | kConnected, |
| 29 | |
| 30 | // The socket connection has been terminated, either by Close() or |
| 31 | // by the remote side. |
| 32 | kClosed |
| 33 | }; |
| 34 | |
Jordan Bayles | 1c785bd | 2019-08-15 10:32:33 -0700 | [diff] [blame] | 35 | } // namespace openscreen |
| 36 | |
Jordan Bayles | 8f0e043 | 2021-02-01 12:07:16 -0800 | [diff] [blame^] | 37 | #endif // PLATFORM_IMPL_SOCKET_STATE_H_ |