void StatisticsWindow::scrollContent(int i) { if(i > 0 && _scrollOffset.at(_activeProtocol) <= MAXSHIFT - SHIFTCU) { _scrollOffset.at(_activeProtocol) += SHIFTCU; updateProtocol(_activeProtocol); } else if(i < 0 && _scrollOffset.at(_activeProtocol) >= SHIFTCU) { _scrollOffset.at(_activeProtocol) -= SHIFTCU; updateProtocol(_activeProtocol); } }
void SslContext::setProtocol(int method) { if (method == m_iMethod) return; if ((method & SSL_ALL) == 0) return; m_iMethod = method; updateProtocol(method); }
void LoginRecv::processServerVersion(Net::MessageIn &msg) { packetVersion = 0; const uint8_t b1 = msg.readUInt8("b1"); // -1 const uint8_t b2 = msg.readUInt8("b2"); const uint8_t b3 = msg.readUInt8("b3"); msg.readUInt8("b4"); if (b1 == 255) { // old TMWA const unsigned int options = msg.readInt32("options"); Ea::LoginRecv::mRegistrationEnabled = options & FLAG_REGISTRATION; serverVersion = 0; tmwServerVersion = 0; } else if (b1 >= 0x0d) { // new TMWA const unsigned int options = msg.readInt32("options"); Ea::LoginRecv::mRegistrationEnabled = options & FLAG_REGISTRATION; serverVersion = 0; tmwServerVersion = (b1 << 16) | (b2 << 8) | b3; } else { // eAthena const unsigned int options = msg.readInt32("options"); Ea::LoginRecv::mRegistrationEnabled = options & FLAG_REGISTRATION; serverVersion = 0; tmwServerVersion = 0; } if (serverVersion > 0) logger->log("Evol server version: %d", serverVersion); else if (tmwServerVersion > 0) logger->log("Tmw server version: x%06x", tmwServerVersion); else logger->log("Server without version"); updateProtocol(); if (serverVersion < 5) { if (client->getState() != STATE_LOGIN) client->setState(STATE_LOGIN); } // Leave this last Ea::LoginRecv::mVersionResponse = true; }
void StatisticsWindow::resize(MainWindow& m) { if(_window != nullptr) { destroy(); } int tmp_size = STATISTICS::DEFAULT_LINES; if(_activeProtocol != nullptr) { tmp_size = _activeProtocol->getAmount() + 2 * BORDER_SIZE + 2 * EMPTY_LINE + STATISTICS::PROTOCOLS_LINE + _activeProtocol->getGroups() * EMPTY_LINE * _activeProtocol->getGroups(); } if(m._window != nullptr && m._window->_maxy > GUI_HEADER_HEIGHT) { _window = subwin(m._window, std::min(static_cast<int>(m._window->_maxy - GUI_HEADER_HEIGHT), tmp_size), std::min(static_cast<int>(m._window->_maxx), GUI_LENGTH), GUI_HEADER_HEIGHT - BORDER_SIZE, 0); updateProtocol(_activeProtocol); } }
int SslContext::init(int iMethod) { if (m_pCtx != NULL) return 0; SSL_METHOD *meth; if (initSSL()) return LS_FAIL; m_iMethod = iMethod; m_iEnableSpdy = 0; meth = (SSL_METHOD *)SSLv23_method(); m_pCtx = SSL_CTX_new(meth); if (m_pCtx) { #ifdef SSL_OP_NO_COMPRESSION /* OpenSSL >= 1.0 only */ SSL_CTX_set_options(m_pCtx, SSL_OP_NO_COMPRESSION); #endif setOptions(SSL_OP_SINGLE_DH_USE | SSL_OP_ALL); //setOptions( SSL_OP_NO_SSLv2 ); updateProtocol(iMethod); setOptions(SSL_OP_CIPHER_SERVER_PREFERENCE); SSL_CTX_set_mode(m_pCtx, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER #ifdef SSL_MODE_RELEASE_BUFFERS | SSL_MODE_RELEASE_BUFFERS #endif ); if (m_iRenegProtect) { setOptions(SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION); SSL_CTX_set_info_callback(m_pCtx, SslConnection_ssl_info_cb); } //initECDH(); return 0; } else { //TODO: log ssl error return LS_FAIL; } }