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.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim:set ts=2 sw=2 sts=2 et cindent: */ |
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 nsProxyInfo_h__ |
michael@0 | 8 | #define nsProxyInfo_h__ |
michael@0 | 9 | |
michael@0 | 10 | #include "nsIProxyInfo.h" |
michael@0 | 11 | #include "nsString.h" |
michael@0 | 12 | #include "mozilla/Attributes.h" |
michael@0 | 13 | |
michael@0 | 14 | // Use to support QI nsIProxyInfo to nsProxyInfo |
michael@0 | 15 | #define NS_PROXYINFO_IID \ |
michael@0 | 16 | { /* ed42f751-825e-4cc2-abeb-3670711a8b85 */ \ |
michael@0 | 17 | 0xed42f751, \ |
michael@0 | 18 | 0x825e, \ |
michael@0 | 19 | 0x4cc2, \ |
michael@0 | 20 | {0xab, 0xeb, 0x36, 0x70, 0x71, 0x1a, 0x8b, 0x85} \ |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | // This class is exposed to other classes inside Necko for fast access |
michael@0 | 24 | // to the nsIProxyInfo attributes. |
michael@0 | 25 | class nsProxyInfo MOZ_FINAL : public nsIProxyInfo |
michael@0 | 26 | { |
michael@0 | 27 | public: |
michael@0 | 28 | NS_DECLARE_STATIC_IID_ACCESSOR(NS_PROXYINFO_IID) |
michael@0 | 29 | |
michael@0 | 30 | NS_DECL_THREADSAFE_ISUPPORTS |
michael@0 | 31 | NS_DECL_NSIPROXYINFO |
michael@0 | 32 | |
michael@0 | 33 | // Cheap accessors for use within Necko |
michael@0 | 34 | const nsCString &Host() { return mHost; } |
michael@0 | 35 | int32_t Port() { return mPort; } |
michael@0 | 36 | const char *Type() { return mType; } |
michael@0 | 37 | uint32_t Flags() { return mFlags; } |
michael@0 | 38 | |
michael@0 | 39 | bool IsDirect(); |
michael@0 | 40 | bool IsHTTP(); |
michael@0 | 41 | bool IsSOCKS(); |
michael@0 | 42 | |
michael@0 | 43 | private: |
michael@0 | 44 | friend class nsProtocolProxyService; |
michael@0 | 45 | |
michael@0 | 46 | nsProxyInfo(const char *type = nullptr) |
michael@0 | 47 | : mType(type) |
michael@0 | 48 | , mPort(-1) |
michael@0 | 49 | , mFlags(0) |
michael@0 | 50 | , mResolveFlags(0) |
michael@0 | 51 | , mTimeout(UINT32_MAX) |
michael@0 | 52 | , mNext(nullptr) |
michael@0 | 53 | {} |
michael@0 | 54 | |
michael@0 | 55 | ~nsProxyInfo() |
michael@0 | 56 | { |
michael@0 | 57 | NS_IF_RELEASE(mNext); |
michael@0 | 58 | } |
michael@0 | 59 | |
michael@0 | 60 | const char *mType; // pointer to statically allocated value |
michael@0 | 61 | nsCString mHost; |
michael@0 | 62 | nsCString mUsername; |
michael@0 | 63 | nsCString mPassword; |
michael@0 | 64 | int32_t mPort; |
michael@0 | 65 | uint32_t mFlags; |
michael@0 | 66 | uint32_t mResolveFlags; |
michael@0 | 67 | uint32_t mTimeout; |
michael@0 | 68 | nsProxyInfo *mNext; |
michael@0 | 69 | }; |
michael@0 | 70 | |
michael@0 | 71 | NS_DEFINE_STATIC_IID_ACCESSOR(nsProxyInfo, NS_PROXYINFO_IID) |
michael@0 | 72 | |
michael@0 | 73 | #endif // nsProxyInfo_h__ |