michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set sw=2 ts=8 et tw=80 : */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_net_BaseWebSocketChannel_h michael@0: #define mozilla_net_BaseWebSocketChannel_h michael@0: michael@0: #include "nsIWebSocketChannel.h" michael@0: #include "nsIWebSocketListener.h" michael@0: #include "nsIProtocolHandler.h" michael@0: #include "nsIThread.h" michael@0: #include "nsIThreadRetargetableRequest.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsString.h" michael@0: michael@0: namespace mozilla { michael@0: namespace net { michael@0: michael@0: const static int32_t kDefaultWSPort = 80; michael@0: const static int32_t kDefaultWSSPort = 443; michael@0: michael@0: class BaseWebSocketChannel : public nsIWebSocketChannel, michael@0: public nsIProtocolHandler, michael@0: public nsIThreadRetargetableRequest michael@0: { michael@0: public: michael@0: BaseWebSocketChannel(); michael@0: michael@0: NS_DECL_NSIPROTOCOLHANDLER michael@0: NS_DECL_NSITHREADRETARGETABLEREQUEST michael@0: michael@0: NS_IMETHOD QueryInterface(const nsIID & uuid, void **result) = 0; michael@0: NS_IMETHOD_(MozExternalRefCountType ) AddRef(void) = 0; michael@0: NS_IMETHOD_(MozExternalRefCountType ) Release(void) = 0; michael@0: michael@0: // Partial implementation of nsIWebSocketChannel michael@0: // michael@0: NS_IMETHOD GetOriginalURI(nsIURI **aOriginalURI); michael@0: NS_IMETHOD GetURI(nsIURI **aURI); michael@0: NS_IMETHOD GetNotificationCallbacks(nsIInterfaceRequestor **aNotificationCallbacks); michael@0: NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor *aNotificationCallbacks); michael@0: NS_IMETHOD GetLoadGroup(nsILoadGroup **aLoadGroup); michael@0: NS_IMETHOD SetLoadGroup(nsILoadGroup *aLoadGroup); michael@0: NS_IMETHOD GetExtensions(nsACString &aExtensions); michael@0: NS_IMETHOD GetProtocol(nsACString &aProtocol); michael@0: NS_IMETHOD SetProtocol(const nsACString &aProtocol); michael@0: NS_IMETHOD GetPingInterval(uint32_t *aSeconds); michael@0: NS_IMETHOD SetPingInterval(uint32_t aSeconds); michael@0: NS_IMETHOD GetPingTimeout(uint32_t *aSeconds); michael@0: NS_IMETHOD SetPingTimeout(uint32_t aSeconds); michael@0: michael@0: protected: michael@0: nsCOMPtr mOriginalURI; michael@0: nsCOMPtr mURI; michael@0: nsCOMPtr mListener; michael@0: nsCOMPtr mContext; michael@0: nsCOMPtr mCallbacks; michael@0: nsCOMPtr mLoadGroup; michael@0: nsCOMPtr mTargetThread; michael@0: michael@0: nsCString mProtocol; michael@0: nsCString mOrigin; michael@0: michael@0: nsCString mNegotiatedExtensions; michael@0: michael@0: uint32_t mEncrypted : 1; michael@0: uint32_t mWasOpened : 1; michael@0: uint32_t mClientSetPingInterval : 1; michael@0: uint32_t mClientSetPingTimeout : 1; michael@0: michael@0: uint32_t mPingInterval; /* milliseconds */ michael@0: uint32_t mPingResponseTimeout; /* milliseconds */ michael@0: }; michael@0: michael@0: } // namespace net michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_net_BaseWebSocketChannel_h