Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 ts=8 et tw=80 : */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_net_BaseWebSocketChannel_h
8 #define mozilla_net_BaseWebSocketChannel_h
10 #include "nsIWebSocketChannel.h"
11 #include "nsIWebSocketListener.h"
12 #include "nsIProtocolHandler.h"
13 #include "nsIThread.h"
14 #include "nsIThreadRetargetableRequest.h"
15 #include "nsCOMPtr.h"
16 #include "nsString.h"
18 namespace mozilla {
19 namespace net {
21 const static int32_t kDefaultWSPort = 80;
22 const static int32_t kDefaultWSSPort = 443;
24 class BaseWebSocketChannel : public nsIWebSocketChannel,
25 public nsIProtocolHandler,
26 public nsIThreadRetargetableRequest
27 {
28 public:
29 BaseWebSocketChannel();
31 NS_DECL_NSIPROTOCOLHANDLER
32 NS_DECL_NSITHREADRETARGETABLEREQUEST
34 NS_IMETHOD QueryInterface(const nsIID & uuid, void **result) = 0;
35 NS_IMETHOD_(MozExternalRefCountType ) AddRef(void) = 0;
36 NS_IMETHOD_(MozExternalRefCountType ) Release(void) = 0;
38 // Partial implementation of nsIWebSocketChannel
39 //
40 NS_IMETHOD GetOriginalURI(nsIURI **aOriginalURI);
41 NS_IMETHOD GetURI(nsIURI **aURI);
42 NS_IMETHOD GetNotificationCallbacks(nsIInterfaceRequestor **aNotificationCallbacks);
43 NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor *aNotificationCallbacks);
44 NS_IMETHOD GetLoadGroup(nsILoadGroup **aLoadGroup);
45 NS_IMETHOD SetLoadGroup(nsILoadGroup *aLoadGroup);
46 NS_IMETHOD GetExtensions(nsACString &aExtensions);
47 NS_IMETHOD GetProtocol(nsACString &aProtocol);
48 NS_IMETHOD SetProtocol(const nsACString &aProtocol);
49 NS_IMETHOD GetPingInterval(uint32_t *aSeconds);
50 NS_IMETHOD SetPingInterval(uint32_t aSeconds);
51 NS_IMETHOD GetPingTimeout(uint32_t *aSeconds);
52 NS_IMETHOD SetPingTimeout(uint32_t aSeconds);
54 protected:
55 nsCOMPtr<nsIURI> mOriginalURI;
56 nsCOMPtr<nsIURI> mURI;
57 nsCOMPtr<nsIWebSocketListener> mListener;
58 nsCOMPtr<nsISupports> mContext;
59 nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
60 nsCOMPtr<nsILoadGroup> mLoadGroup;
61 nsCOMPtr<nsIThread> mTargetThread;
63 nsCString mProtocol;
64 nsCString mOrigin;
66 nsCString mNegotiatedExtensions;
68 uint32_t mEncrypted : 1;
69 uint32_t mWasOpened : 1;
70 uint32_t mClientSetPingInterval : 1;
71 uint32_t mClientSetPingTimeout : 1;
73 uint32_t mPingInterval; /* milliseconds */
74 uint32_t mPingResponseTimeout; /* milliseconds */
75 };
77 } // namespace net
78 } // namespace mozilla
80 #endif // mozilla_net_BaseWebSocketChannel_h