michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim:set ts=2 sw=2 sts=2 et cindent: */ 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 nsProxyInfo_h__ michael@0: #define nsProxyInfo_h__ michael@0: michael@0: #include "nsIProxyInfo.h" michael@0: #include "nsString.h" michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: // Use to support QI nsIProxyInfo to nsProxyInfo michael@0: #define NS_PROXYINFO_IID \ michael@0: { /* ed42f751-825e-4cc2-abeb-3670711a8b85 */ \ michael@0: 0xed42f751, \ michael@0: 0x825e, \ michael@0: 0x4cc2, \ michael@0: {0xab, 0xeb, 0x36, 0x70, 0x71, 0x1a, 0x8b, 0x85} \ michael@0: } michael@0: michael@0: // This class is exposed to other classes inside Necko for fast access michael@0: // to the nsIProxyInfo attributes. michael@0: class nsProxyInfo MOZ_FINAL : public nsIProxyInfo michael@0: { michael@0: public: michael@0: NS_DECLARE_STATIC_IID_ACCESSOR(NS_PROXYINFO_IID) michael@0: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSIPROXYINFO michael@0: michael@0: // Cheap accessors for use within Necko michael@0: const nsCString &Host() { return mHost; } michael@0: int32_t Port() { return mPort; } michael@0: const char *Type() { return mType; } michael@0: uint32_t Flags() { return mFlags; } michael@0: michael@0: bool IsDirect(); michael@0: bool IsHTTP(); michael@0: bool IsSOCKS(); michael@0: michael@0: private: michael@0: friend class nsProtocolProxyService; michael@0: michael@0: nsProxyInfo(const char *type = nullptr) michael@0: : mType(type) michael@0: , mPort(-1) michael@0: , mFlags(0) michael@0: , mResolveFlags(0) michael@0: , mTimeout(UINT32_MAX) michael@0: , mNext(nullptr) michael@0: {} michael@0: michael@0: ~nsProxyInfo() michael@0: { michael@0: NS_IF_RELEASE(mNext); michael@0: } michael@0: michael@0: const char *mType; // pointer to statically allocated value michael@0: nsCString mHost; michael@0: nsCString mUsername; michael@0: nsCString mPassword; michael@0: int32_t mPort; michael@0: uint32_t mFlags; michael@0: uint32_t mResolveFlags; michael@0: uint32_t mTimeout; michael@0: nsProxyInfo *mNext; michael@0: }; michael@0: michael@0: NS_DEFINE_STATIC_IID_ACCESSOR(nsProxyInfo, NS_PROXYINFO_IID) michael@0: michael@0: #endif // nsProxyInfo_h__