2005-03-25 06:41:33 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2005-03-25 06:41:33 +03:00
|
|
|
|
|
|
|
#ifndef nsProxyInfo_h__
|
|
|
|
#define nsProxyInfo_h__
|
|
|
|
|
|
|
|
#include "nsIProxyInfo.h"
|
|
|
|
#include "nsString.h"
|
2012-06-06 07:18:25 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2005-03-25 06:41:33 +03:00
|
|
|
|
|
|
|
// Use to support QI nsIProxyInfo to nsProxyInfo
|
|
|
|
#define NS_PROXYINFO_IID \
|
|
|
|
{ /* ed42f751-825e-4cc2-abeb-3670711a8b85 */ \
|
|
|
|
0xed42f751, 0x825e, 0x4cc2, { \
|
|
|
|
0xab, 0xeb, 0x36, 0x70, 0x71, 0x1a, 0x8b, 0x85 \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2016-05-19 05:02:57 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
2005-03-25 06:41:33 +03:00
|
|
|
// This class is exposed to other classes inside Necko for fast access
|
|
|
|
// to the nsIProxyInfo attributes.
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsProxyInfo final : public nsIProxyInfo {
|
2005-03-25 06:41:33 +03:00
|
|
|
public:
|
2005-11-11 17:36:26 +03:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_PROXYINFO_IID)
|
2005-03-25 06:41:33 +03:00
|
|
|
|
2013-07-19 06:24:13 +04:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2005-03-25 06:41:33 +03:00
|
|
|
NS_DECL_NSIPROXYINFO
|
|
|
|
|
|
|
|
// Cheap accessors for use within Necko
|
|
|
|
const nsCString &Host() { return mHost; }
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t Port() { return mPort; }
|
2005-03-25 06:41:33 +03:00
|
|
|
const char *Type() { return mType; }
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t Flags() { return mFlags; }
|
2015-11-25 00:56:00 +03:00
|
|
|
const nsCString &Username() { return mUsername; }
|
|
|
|
const nsCString &Password() { return mPassword; }
|
2005-03-25 06:41:33 +03:00
|
|
|
|
2012-10-27 23:24:19 +04:00
|
|
|
bool IsDirect();
|
|
|
|
bool IsHTTP();
|
2014-04-16 02:16:41 +04:00
|
|
|
bool IsHTTPS();
|
2012-10-27 23:24:19 +04:00
|
|
|
bool IsSOCKS();
|
|
|
|
|
2005-03-25 06:41:33 +03:00
|
|
|
private:
|
|
|
|
friend class nsProtocolProxyService;
|
|
|
|
|
2014-08-05 17:20:50 +04:00
|
|
|
explicit nsProxyInfo(const char *type = nullptr)
|
2005-03-25 06:41:33 +03:00
|
|
|
: mType(type),
|
|
|
|
mPort(-1),
|
|
|
|
mFlags(0),
|
2011-05-13 21:53:27 +04:00
|
|
|
mResolveFlags(0),
|
2012-09-28 10:57:33 +04:00
|
|
|
mTimeout(UINT32_MAX),
|
2012-07-30 18:20:58 +04:00
|
|
|
mNext(nullptr) {}
|
2005-03-25 06:41:33 +03:00
|
|
|
|
|
|
|
~nsProxyInfo() { NS_IF_RELEASE(mNext); }
|
|
|
|
|
|
|
|
const char *mType; // pointer to statically allocated value
|
|
|
|
nsCString mHost;
|
2015-11-25 00:56:00 +03:00
|
|
|
nsCString mUsername;
|
|
|
|
nsCString mPassword;
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mPort;
|
|
|
|
uint32_t mFlags;
|
|
|
|
uint32_t mResolveFlags;
|
|
|
|
uint32_t mTimeout;
|
2005-03-25 06:41:33 +03:00
|
|
|
nsProxyInfo *mNext;
|
|
|
|
};
|
|
|
|
|
2005-11-11 17:36:26 +03:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsProxyInfo, NS_PROXYINFO_IID)
|
|
|
|
|
2016-05-19 05:02:57 +03:00
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2005-03-25 06:41:33 +03:00
|
|
|
#endif // nsProxyInfo_h__
|