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 | |
| 5 | #ifndef PLATFORM_BASE_SOCKET_STATE_H_ |
| 6 | #define PLATFORM_BASE_SOCKET_STATE_H_ |
| 7 | |
| 8 | #include <cstdint> |
| 9 | #include <memory> |
| 10 | #include <string> |
| 11 | |
| 12 | namespace openscreen { |
| 13 | namespace platform { |
| 14 | |
| 15 | // SocketState should be used by TCP and TLS sockets for indicating |
| 16 | // current state. NOTE: socket state transitions should only happen in |
| 17 | // the listed order. New states should be added in appropriate order. |
| 18 | enum class SocketState { |
| 19 | // Socket is not connected. |
| 20 | kNotConnected = 0, |
| 21 | |
| 22 | // Socket is currently being connected. |
| 23 | kConnecting, |
| 24 | |
| 25 | // Socket is actively connected to a remote address. |
| 26 | kConnected, |
| 27 | |
| 28 | // The socket connection has been terminated, either by Close() or |
| 29 | // by the remote side. |
| 30 | kClosed |
| 31 | }; |
| 32 | |
| 33 | } // namespace platform |
| 34 | } // namespace openscreen |
| 35 | |
| 36 | #endif // PLATFORM_BASE_SOCKET_STATE_H_ |