Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: ppapi/shared_impl/ppb_tcp_socket_shared.h

Issue 24195004: PPB_TCPSocket: add support for TCP server socket operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/tcp_socket_resource_base.cc ('k') | ppapi/shared_impl/ppb_tcp_socket_shared.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 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 PPAPI_SHARED_IMPL_PPB_TCP_SOCKET_SHARED_H_
6 #define PPAPI_SHARED_IMPL_PPB_TCP_SOCKET_SHARED_H_
7
8 #include "ppapi/shared_impl/ppapi_shared_export.h"
9
10 namespace ppapi {
11
12 class PPAPI_SHARED_EXPORT TCPSocketState {
13 public:
14 enum StateType {
15 // The socket hasn't been bound or connected.
16 INITIAL,
17 // The socket has been bound.
18 BOUND,
19 // A connection has been established.
20 CONNECTED,
21 // An SSL connection has been established.
22 SSL_CONNECTED,
23 // The socket is listening.
24 LISTENING,
25 // The socket has been closed.
26 CLOSED
27 };
28
29 // Transitions that will change the socket state. Please note that
30 // read/write/accept are not included because they don't change the socket
31 // state.
32 enum TransitionType {
33 NONE,
34 BIND,
35 CONNECT,
36 SSL_CONNECT,
37 LISTEN,
38 CLOSE
39 };
40
41 explicit TCPSocketState(StateType state);
42 ~TCPSocketState();
43
44 StateType state() const { return state_; }
45
46 void SetPendingTransition(TransitionType pending_transition);
47 void CompletePendingTransition(bool success);
48
49 void DoTransition(TransitionType transition, bool success);
50
51 bool IsValidTransition(TransitionType transition) const;
52 bool IsPending(TransitionType transition) const;
53
54 bool IsConnected() const;
55 bool IsBound() const;
56
57 private:
58 StateType state_;
59 TransitionType pending_transition_;
60 };
61
62 // TCP socket API versions.
63 enum PPAPI_SHARED_EXPORT TCPSocketVersion {
64 // PPB_TCPSocket_Private.
65 TCP_SOCKET_VERSION_PRIVATE,
66 // PPB_TCPSocket v1.0.
67 TCP_SOCKET_VERSION_1_0,
68 // PPB_TCPSocket v1.1 or above.
69 TCP_SOCKET_VERSION_1_1_OR_ABOVE
70 };
71
72 } // namespace ppapi
73
74 #endif // PPAPI_SHARED_IMPL_PPB_TCP_SOCKET_SHARED_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/tcp_socket_resource_base.cc ('k') | ppapi/shared_impl/ppb_tcp_socket_shared.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698