void vmsBtSupport::ApplyAdditionalTorrentSettings(){ if (is_Initialized () == FALSE) return; vmsBtSession *pBtSession = get_Session (); if (_App.Bittorrent_EnableLocalPeerDiscovery()) { pBtSession->LocalPeers_start (); } else { pBtSession->LocalPeers_stop (); } if (_App.Bittorrent_EnableUPnP()) { pBtSession->UPNP_start (); } else { pBtSession->UPNP_stop (); } if (_App.Bittorrent_EnableNATPMP()) { pBtSession->NATPMP_start (); } else { pBtSession->NATPMP_stop (); } }
EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name) { eglRecordError(EGL_SUCCESS); if (EGL_TRUE != is_Initialized(dpy)) { return EGL_FALSE; } eglRecordError(EGL_SUCCESS); switch (name) { case EGL_CLIENT_APIS: return EGL_CLIENT_STRING; case EGL_VENDOR: return EGL_CONFIG_VENDOR; case EGL_VERSION: return EGL_VERSION_NUMBER; case EGL_EXTENSIONS: return ""; default: eglRecordError(EGL_BAD_PARAMETER); return NULL; } return NULL; }
void vmsBtSupport::Shutdown() { if (is_Initialized () == FALSE) return; m_bWasShutdown = true; typedef void (WINAPI *FNS)(); FNS pfn = (FNS) GetProcAddress (m_hBtDll, "vmsBt_Shutdown"); if (pfn) pfn (); }
void vmsBtSupport::ApplyListenPortSettings() { if (is_Initialized ()) { vmsBtSession *pBtSession = get_Session (); int portFrom = _App.Bittorrent_ListenPort_From (), portTo = _App.Bittorrent_ListenPort_To (); if (pBtSession->IsListening () == FALSE || pBtSession->get_ListenPort () > portTo || pBtSession->get_ListenPort () < portFrom) pBtSession->ListenOn (portFrom, portTo); } }
void vmsBtSupport::ApplyDHTSettings() { if (is_Initialized () == FALSE) return; vmsBtSession *pBtSession = get_Session (); if (_App.Bittorrent_EnableDHT ()) { if (pBtSession->DHT_isStarted () == FALSE){ pBtSession->DHT_start (m_pbDHTstate, m_dwDHTstateSize); } } else { if (pBtSession->DHT_isStarted ()) pBtSession->DHT_stop (); } }
void vmsBtSupport::ApplyProxySettings() { if (is_Initialized () == FALSE) return; fsString strIp, strUser, strPwd; int nPort = 0; switch (_App.InternetAccessType ()) { case IATE_PRECONFIGPROXY: GetIeProxySettings (strIp, strUser, strPwd, nPort); break; case IATE_NOPROXY: break; case IATE_MANUALPROXY: strIp = _App.HttpProxy_Name (); strUser = _App.HttpProxy_UserName (); strPwd = _App.HttpProxy_UserName (); if (strIp.IsEmpty () == FALSE) { char sz [1000]; strcpy (sz, strIp); LPSTR pszPort = strrchr (sz, ':'); if (pszPort) { *pszPort++ = 0; nPort = atoi (pszPort); strIp = sz; } } break; case IATE_FIREFOXPROXY: GetFirefoxProxySettings (strIp, strUser, strPwd, nPort); break; } get_Session ()->SetProxySettings (strIp, nPort, strUser, strPwd); }
BOOL vmsBtSupport::SaveState() { if (is_Initialized () == FALSE) return TRUE; vmsBtSession *pBtSession = get_Session (); vmsBtPersistObject *pBtPO = NULL; pBtSession->getPersistObject (&pBtPO); assert (pBtPO != NULL); if (!pBtPO) return FALSE; if (!pBtPO->isDirty()) return TRUE; if (pBtSession->DHT_isStarted ()) { SAFE_DELETE_ARRAY (m_pbDHTstate); pBtPO->getStateBuffer(0, &m_dwDHTstateSize, false); m_pbDHTstate = new BYTE [m_dwDHTstateSize]; pBtPO->getStateBuffer(m_pbDHTstate, &m_dwDHTstateSize, true); } if (m_pbDHTstate == NULL) return TRUE; HANDLE hFile = CreateFile (fsGetDataFilePath ("btdht.sav"), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_HIDDEN, NULL); if (hFile == INVALID_HANDLE_VALUE) return FALSE; DWORD dw; WriteFile (hFile, m_pbDHTstate, m_dwDHTstateSize, &dw, NULL); CloseHandle (hFile); return TRUE; }