Instrumented libraries: overhaul RPATH handling.
[chromium-blink-merge.git] / ppapi / thunk / ppb_websocket_api.h
blob546ed99b7c851b8e97c6eaef4eca98e9f8dde4c5
1 // Copyright (c) 2012 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.
5 #ifndef PPAPI_THUNK_WEBSOCKET_API_H_
6 #define PPAPI_THUNK_WEBSOCKET_API_H_
8 #include "base/memory/ref_counted.h"
9 #include "ppapi/c/pp_completion_callback.h"
10 #include "ppapi/c/ppb_websocket.h"
11 #include "ppapi/thunk/ppapi_thunk_export.h"
13 namespace ppapi {
15 class TrackedCallback;
17 namespace thunk {
19 // Some arguments and attributes are based on The WebSocket Protocol and The
20 // WebSocket API. See also following official specifications.
21 // - The WebSocket Protocol http://tools.ietf.org/html/rfc6455
22 // - The WebSocket API http://dev.w3.org/html5/websockets/
23 class PPAPI_THUNK_EXPORT PPB_WebSocket_API {
24 public:
25 virtual ~PPB_WebSocket_API() {}
27 // Connects to the specified WebSocket server with |protocols| argument
28 // defined by the WebSocket API. Returns an int32_t error code from
29 // pp_errors.h.
30 virtual int32_t Connect(const PP_Var& url,
31 const PP_Var protocols[],
32 uint32_t protocol_count,
33 scoped_refptr<TrackedCallback> callback) = 0;
35 // Closes the established connection with specified |code| and |reason|.
36 // Returns an int32_t error code from pp_errors.h.
37 virtual int32_t Close(uint16_t code,
38 const PP_Var& reason,
39 scoped_refptr<TrackedCallback> callback) = 0;
41 // Receives a message from the WebSocket server. Caller must keep specified
42 // |message| object as valid until completion callback is invoked. Returns an
43 // int32_t error code from pp_errors.h.
44 virtual int32_t ReceiveMessage(PP_Var* message,
45 scoped_refptr<TrackedCallback> callback) = 0;
47 // Sends a message to the WebSocket server. Returns an int32_t error code
48 // from pp_errors.h.
49 virtual int32_t SendMessage(const PP_Var& message) = 0;
51 // Returns the bufferedAmount attribute of The WebSocket API.
52 virtual uint64_t GetBufferedAmount() = 0;
54 // Returns the CloseEvent code attribute of The WebSocket API. Returned code
55 // is valid if the connection is already closed and wasClean attribute is
56 // true.
57 virtual uint16_t GetCloseCode() = 0;
59 // Returns the CloseEvent reason attribute of The WebSocket API. Returned
60 // code is valid if the connection is already closed and wasClean attribute
61 // is true.
62 virtual PP_Var GetCloseReason() = 0;
64 // Returns the CloseEvent wasClean attribute of The WebSocket API. Returned
65 // code is valid if the connection is already closed.
66 virtual PP_Bool GetCloseWasClean() = 0;
68 // Returns the extensions attribute of The WebSocket API.
69 virtual PP_Var GetExtensions() = 0;
71 // Returns the protocol attribute of The WebSocket API.
72 virtual PP_Var GetProtocol() = 0;
74 // Returns the readState attribute of The WebSocket API.
75 virtual PP_WebSocketReadyState GetReadyState() = 0;
77 // Returns the url attribute of The WebSocket API.
78 virtual PP_Var GetURL() = 0;
81 } // namespace thunk
82 } // namespace ppapi
84 #endif // PPAPI_THUNK_WEBSOCKET_API_H_