netwerk/base/src/nsProxyInfo.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial