netwerk/protocol/websocket/BaseWebSocketChannel.h

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

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

mercurial