本文整理汇总了C++中GetProxy函数的典型用法代码示例。如果您正苦于以下问题:C++ GetProxy函数的具体用法?C++ GetProxy怎么用?C++ GetProxy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetProxy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConnectSocket
bool ConnectSocket(const CService &addrDest, SOCKET& hSocketRet, int nTimeout)
{
proxyType proxy;
// no proxy needed
if (!GetProxy(addrDest.GetNetwork(), proxy))
return ConnectSocketDirectly(addrDest, hSocketRet, nTimeout);
SOCKET hSocket = INVALID_SOCKET;
// first connect to proxy server
if (!ConnectSocketDirectly(proxy.first, hSocket, nTimeout))
return false;
// do socks negotiation
switch (proxy.second) {
case 4:
if (!Socks4(addrDest, hSocket))
return false;
break;
case 5:
if (!Socks5(addrDest.ToStringIP(), addrDest.GetPort(), hSocket))
return false;
break;
default:
closesocket(hSocket);
return false;
}
hSocketRet = hSocket;
return true;
}
示例2: getProxySettings
bool OptionsModel::getProxySettings(QNetworkProxy& proxy) const
{
// Directly query current base proxy, because
// GUI settings can be overridden with -proxy.
proxyType curProxy;
if (GetProxy(NET_IPV4, curProxy)) {
if (curProxy.second == 5) {
proxy.setType(QNetworkProxy::Socks5Proxy);
proxy.setHostName(QString::fromStdString(curProxy.first.ToStringIP()));
proxy.setPort(curProxy.first.GetPort());
return true;
}
else
return false;
}
else
proxy.setType(QNetworkProxy::NoProxy);
return true;
}
示例3: ASSERT
void Debugger::Interrupt(int type, const char *program,
InterruptSite *site /* = NULL */,
const char *error /* = NULL */) {
ASSERT(RuntimeOption::EnableDebugger);
RequestInjectionData &rjdata = ThreadInfo::s_threadInfo->m_reqInjectionData;
if (rjdata.debuggerIdle > 0 && type == BreakPointReached) {
--rjdata.debuggerIdle;
return;
}
DebuggerProxyPtr proxy = GetProxy();
if (proxy) {
if (proxy->needInterrupt() || type != BreakPointReached) {
// Interrupts may execute some PHP code, causing another interruption.
std::stack<void *> &interrupts = rjdata.interrupts;
CmdInterrupt cmd((InterruptType)type, program, site, error);
interrupts.push(&cmd);
proxy->interrupt(cmd);
interrupts.pop();
}
rjdata.debuggerIdle = proxy->needInterrupt() ? 0 : 1000;
} else {
// debugger clients are disconnected abnormally
if (type == SessionStarted || type == SessionEnded) {
// for command line programs, we need this exception to exit from
// the infinite execution loop
throw DebuggerClientExitException();
}
}
}
示例4: VALIDATE_NOT_NULL
ECode Proxy::GetPreferredHttpHost(
/* [in] */ IContext* context,
/* [in] */ const String& url,
/* [out] */ IHttpHost** httpHost)
{
VALIDATE_NOT_NULL(httpHost);
AutoPtr<Elastos::Net::IProxyHelper> helper;
Elastos::Net::CProxyHelper::AcquireSingleton((Elastos::Net::IProxyHelper**)&helper);
AutoPtr<Elastos::Net::IProxy> noproxy;
helper->GetNO_PROXY((Elastos::Net::IProxy**)&noproxy);
AutoPtr<Elastos::Net::IProxy> prefProxy;
GetProxy(context, url, (Elastos::Net::IProxy**)&prefProxy);
if (prefProxy == noproxy) {
*httpHost = NULL;
return NOERROR;
} else {
AutoPtr<ISocketAddress> socketaddress;
prefProxy->GetAddress((ISocketAddress**)&socketaddress);
AutoPtr<IInetSocketAddress> sa = IInetSocketAddress::Probe(socketaddress);
String hostName;
sa->GetHostName(&hostName);
Int32 portNum;
sa->GetPort(&portNum);
return CHttpHost::New(hostName, portNum, String("http"), httpHost);
}
return NOERROR;
}
示例5: GetProcessPath
void CIceClientBase::InitIce(void)
{
string strBasePath = "";
strBasePath = GetProcessPath();
try
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties();
//
// Set a default value for "Hello.Proxy" so that the demo will
// run without a configuration file.
//
//initData.properties->setProperty("SHMIAlarm.Proxy", "SHMIAlarm:tcp -p 11888");
//
// Now, load the configuration file if present. Under WinCE we
// use "config.txt" since it can be edited with pocket word.
//
std::string strConfigfile = "";
try
{
strConfigfile =strBasePath + "../config/";
strConfigfile += m_strConfigFileName;
initData.properties->load(strConfigfile);
}
catch(const Ice::FileException& ex)
{
std::cout<< ex.what() << endl;
std::cout<< "Maybe cannot find the config file: " << strConfigfile << endl;
Sleep(1000);
return;
}
int argc = 0;
m_communicator = Ice::initialize(argc, 0, initData);
string strProxy = m_strProxy;
strProxy += ".Proxy";
m_objPrx = m_communicator->stringToProxy(initData.properties->getProperty(strProxy));
//IceInternal::ProxyHandle<T>
//AlarmViewer =
//IceInternal::ProxyHandle::checkedCast(m_objPrx);
GetProxy();
}
catch(const Ice::Exception& ex)
{
//MessageBox(NULL, CString(ex.ice_name().c_str()), L"Exception", MB_ICONEXCLAMATION | MB_OK);
string strMsg;
strMsg = ex.ice_name();
//printf("%s \n", strMsg.c_str());
LOG_ERROR("%s", strMsg.c_str());
return;
}
}
示例6: parser
int HttpConnectProxyHttpSocket::ConnectImpl(const char *address)
{
ProxyHttpSocket::ConnectImpl(GetProxy());
Util::AddressParser parser(address);
Util::AddressParser proxyParser(GetProxy());
std::ostringstream request;
request << "CONNECT " << parser.GetHost() << ":" << parser.GetPort() << " HTTP/1.0\r\n";
request << "Host: " << proxyParser.GetHost() << ":" << proxyParser.GetPort() << "\r\n";
request << "User-Agent: " << GetAgent() << "\r\n";
const char *user = proxyParser.GetUser();
const char *password = proxyParser.GetPassword();
if (*user || *password) {
// Encode user:password
std::string auth = user;
auth += ':';
auth += password;
auth = Util::BinToBase64(auth.c_str(), auth.length());
request << "Proxy-Authorization: Basic " << auth << "\r\n";
}
request << "\r\n";
Send(request.str().c_str());
std::string response = Receive();
if (response.length() < 12)
throw ProxyError("Invalid response");
if (response[9] != '2' || response[10] != '0' || response[11] != '0') {
// Proxy responded with error
std::ostringstream msg;
int err = (response[9] - '0') * 100 + (response[10] - '0') * 10 + (response[11] - '0');
msg << "Responded with error " << err;
throw ProxyError(msg.str().c_str());
}
return 0;
}
示例7: GetProxy
void OptionsDialog::updateDefaultProxyNets()
{
proxyType proxy;
std::string strProxy;
QString strDefaultProxyGUI;
GetProxy(NET_IPV4, proxy);
strProxy = proxy.proxy.ToStringIP() + ":" + proxy.proxy.ToStringPort();
strDefaultProxyGUI = ui->proxyIp->text() + ":" + ui->proxyPort->text();
(strProxy == strDefaultProxyGUI.toStdString()) ? ui->proxyReachIPv4->setChecked(true) : ui->proxyReachIPv4->setChecked(false);
GetProxy(NET_IPV6, proxy);
strProxy = proxy.proxy.ToStringIP() + ":" + proxy.proxy.ToStringPort();
strDefaultProxyGUI = ui->proxyIp->text() + ":" + ui->proxyPort->text();
(strProxy == strDefaultProxyGUI.toStdString()) ? ui->proxyReachIPv6->setChecked(true) : ui->proxyReachIPv6->setChecked(false);
GetProxy(NET_TOR, proxy);
strProxy = proxy.proxy.ToStringIP() + ":" + proxy.proxy.ToStringPort();
strDefaultProxyGUI = ui->proxyIp->text() + ":" + ui->proxyPort->text();
(strProxy == strDefaultProxyGUI.toStdString()) ? ui->proxyReachTor->setChecked(true) : ui->proxyReachTor->setChecked(false);
}
示例8: Start
void KX_PythonComponent::Update()
{
if (!m_init) {
Start();
m_init = true;
}
PyObject *pycomp = GetProxy();
if (!PyObject_CallMethod(pycomp, "update", "")) {
PyErr_Print();
}
}
示例9: PyObject_CallMethod
void KX_PythonComponent::Start()
{
PyObject *arg_dict = (PyObject *)BKE_python_component_argument_dict_new(m_pc);
PyObject *ret = PyObject_CallMethod(GetProxy(), "start", "O", arg_dict);
if (PyErr_Occurred()) {
PyErr_Print();
}
Py_XDECREF(arg_dict);
Py_XDECREF(ret);
}
示例10: Py_BuildValue
void KX_LibLoadStatus::RunFinishCallback()
{
#ifdef WITH_PYTHON
if (m_finish_cb) {
PyObject* args = Py_BuildValue("(O)", GetProxy());
if (!PyObject_Call(m_finish_cb, args, NULL)) {
PyErr_Print();
PyErr_Clear();
}
Py_DECREF(args);
}
#endif
}
示例11: KX_PythonComponent
CValue *KX_PythonComponent::GetReplica()
{
KX_PythonComponent *replica = new KX_PythonComponent(*this);
replica->ProcessReplica();
// Subclass the python component.
PyTypeObject *type = Py_TYPE(GetProxy());
if (!py_base_new(type, PyTuple_Pack(1, replica->GetProxy()), NULL)) {
CM_Error("failed replicate component: \"" << m_name << "\"");
delete replica;
return NULL;
}
return replica;
}
示例12: VALIDATE_NOT_NULL
/**
* Return the proxy host set by the user.
* @param ctx A Context used to get the settings for the proxy host.
* @return String containing the host name. If the user did not set a host
* name it returns the default host. A null value means that no
* host is to be used.
* @deprecated Use standard java vm proxy values to find the host, port
* and exclusion list. This call ignores the exclusion list.
*/
ECode CProxy::GetHost(
/* [in] */ IContext* ctx,
/* [out] */ String* host)
{
VALIDATE_NOT_NULL(host);
AutoPtr<Elastos::Net::IProxy> proxy;
AutoPtr<Elastos::Net::IProxy> noproxy;
proxyhelper->GetNO_PROXY((Elastos::Net::IProxy**)&noproxy);
String str;
GetProxy(ctx, str, (Elastos::Net::IProxy**)&proxy);
if (proxy == noproxy) {
*host = NULL;
return NOERROR;
}
AutoPtr<ISocketAddress> socketAddress;
proxy->GetAddress((ISocketAddress**)&socketAddress);
AutoPtr<IInetSocketAddress> address = IInetSocketAddress::Probe(socketAddress);
return address->GetHostName(host);
}
示例13: GetNetworksInfo
static UniValue GetNetworksInfo()
{
UniValue networks(UniValue::VARR);
for(int n=0; n<NET_MAX; ++n)
{
enum Network network = static_cast<enum Network>(n);
if(network == NET_UNROUTABLE || network == NET_INTERNAL)
continue;
proxyType proxy;
UniValue obj(UniValue::VOBJ);
GetProxy(network, proxy);
obj.pushKV("name", GetNetworkName(network));
obj.pushKV("limited", IsLimited(network));
obj.pushKV("reachable", IsReachable(network));
obj.pushKV("proxy", proxy.IsValid() ? proxy.proxy.ToStringIPPort() : std::string());
obj.pushKV("proxy_randomize_credentials", proxy.randomize_credentials);
networks.push_back(obj);
}
return networks;
}
示例14: proxy
HRESULT
AccessibleHandler::ResolveIA2()
{
if (mIA2PassThru) {
return S_OK;
}
RefPtr<IUnknown> proxy(GetProxy());
if (!proxy) {
return E_UNEXPECTED;
}
HRESULT hr = proxy->QueryInterface(NEWEST_IA2_IID,
reinterpret_cast<void**>(&mIA2PassThru));
if (SUCCEEDED(hr)) {
// mIA2PassThru is a weak reference (see comments in AccesssibleHandler.h)
mIA2PassThru->Release();
}
return hr;
}
示例15: static_assert
HRESULT
AccessibleHandler::QueryService(REFGUID aServiceId, REFIID aIid,
void** aOutInterface)
{
static_assert(&NEWEST_IA2_IID == &IID_IAccessible2_3,
"You have modified NEWEST_IA2_IID. This code needs updating.");
/* We're taking advantage of the fact that we are implementing IA2 as part
of our own object to implement this just like a QI. */
if (aIid == IID_IAccessible2_3 || aIid == IID_IAccessible2_2 ||
aIid == IID_IAccessible2) {
RefPtr<NEWEST_IA2_INTERFACE> ia2(this);
ia2.forget(aOutInterface);
return S_OK;
}
for (uint32_t i = 0; i < ArrayLength(kUnsupportedServices); ++i) {
if (aServiceId == kUnsupportedServices[i]) {
return E_NOINTERFACE;
}
}
if (!mServProvPassThru) {
RefPtr<IUnknown> proxy(GetProxy());
if (!proxy) {
return E_UNEXPECTED;
}
HRESULT hr = proxy->QueryInterface(IID_IServiceProvider,
reinterpret_cast<void**>(&mServProvPassThru));
if (FAILED(hr)) {
return hr;
}
// mServProvPassThru is a weak reference (see comments in
// AccessibleHandler.h)
mServProvPassThru->Release();
}
return mServProvPassThru->QueryService(aServiceId, aIid, aOutInterface);
}