blob: f72c2758f6419d296f9225327ca415977841a35b [file] [log] [blame]
Jordan Bayles1c785bd2019-08-15 10:32:33 -07001// 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 Bayles8f0e0432021-02-01 12:07:16 -08005#ifndef PLATFORM_IMPL_SOCKET_STATE_H_
6#define PLATFORM_IMPL_SOCKET_STATE_H_
Jordan Bayles1c785bd2019-08-15 10:32:33 -07007
8#include <cstdint>
9#include <memory>
10#include <string>
11
12namespace openscreen {
Jordan Bayles1c785bd2019-08-15 10:32:33 -070013
Jordan Bayles8f0e0432021-02-01 12:07:16 -080014// TcpSocketState should be used by TCP and TLS sockets for indicating
Jordan Bayles1c785bd2019-08-15 10:32:33 -070015// current state. NOTE: socket state transitions should only happen in
16// the listed order. New states should be added in appropriate order.
Jordan Bayles8f0e0432021-02-01 12:07:16 -080017enum class TcpSocketState {
Jordan Bayles1c785bd2019-08-15 10:32:33 -070018 // Socket is not connected.
19 kNotConnected = 0,
20
btolschc48f5ba2020-10-01 13:41:40 -070021 // Socket is actively listening for incoming connections.
22 kListening,
23
Jordan Bayles1c785bd2019-08-15 10:32:33 -070024 // 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 Bayles1c785bd2019-08-15 10:32:33 -070035} // namespace openscreen
36
Jordan Bayles8f0e0432021-02-01 12:07:16 -080037#endif // PLATFORM_IMPL_SOCKET_STATE_H_