//============================================================================= // METHOD: SPELLserverCif::setup //============================================================================= void SPELLserverCif::setup( const std::string& procId, const std::string& ctxName, int ctxPort, const std::string& timeId) { SPELLcif::setup(procId, ctxName, ctxPort, timeId); m_wrMessage.set( MessageField::FIELD_PROC_ID, getProcId() ); m_stMessage.set( MessageField::FIELD_PROC_ID, getProcId() ); m_lnMessage.set( MessageField::FIELD_PROC_ID, getProcId() ); m_ntMessage.set( MessageField::FIELD_PROC_ID, getProcId() ); DEBUG("[CIF] Setup server CIF"); m_ifc = new SPELLipcClientInterface( "CIF", "0.0.0.0", ctxPort ); m_buffer = new SPELLdisplayBuffer( procId, *this ); m_buffer->start(); // Initialize message sequencer m_sequence = 0; m_sequenceStack = 0; m_ifc->initialize( this ); DEBUG("[CIF] Connecting to context"); m_ifc->connectIfc(); // Perform login SPELLipcMessage* response = login(); processLogin(response); m_ready = true; m_useGUI = true; DEBUG("[CIF] Ready to go"); }
void HistoryManager::loop() { while(true) { boost::any polled = mpQueue->poll(); if(!polled.empty()) { if(polled.type() == typeid(spHistoryPack)) { spHistoryPack sphp = boost::any_cast<spHistoryPack>(polled); processPack(sphp); } else if(polled.type() == typeid(spHistoryRequest)) { spHistoryRequest request = boost::any_cast<spHistoryRequest>(polled); processRequest(request); } else if(polled.type() == typeid(LoginPackage)) { LoginPackage loginPackage = boost::any_cast<LoginPackage>(polled); processLogin(loginPackage); } else { } } } }
void on_write(int sock, short event, void* arg) { if (arg == 0) return; struct sock_ev* ev = (struct sock_ev*)arg; if (ev->packet == 0) return; netpackGetOpcode(ev->packet, &(ev->packet->opcode)); printf("protocolID = %d\n", ev->packet->opcode); switch (ev->packet->opcode) { case MSG_CS_LOGIN: processLogin(ev); break; case MSG_CS_GET_SCHEDULE: processGetSchedule(ev); break; case MSG_CS_DOMINO_UPLOAD_TILEMAP: processDominoUploadTilemap(ev); break; case MSG_CS_DOMINO_DOWNLOAD_TILEMAP: processDominoDownloadTilemap(ev); break; } //释放通信NetPacket以及内部buffer空间 //这部分空间在如下函数中申请 //函数gmsvproto_sv.c:gmsvproto_sv_callback() NET_PACKET_END(ev->packet); ev->packet = 0; }
bool LoginController::process(MsgPacket* request, MsgPacket* response) { switch(request->getMsgID()) { case ROBOTV_LOGIN: return processLogin(request, response); case ROBOTV_GETCONFIG: return processGetConfig(request, response); } return false; }
bool HTTPCookieAuth::handleRequest(HTTPRequestPtr& request, TCPConnectionPtr& tcp_conn) { if (processLogin(request,tcp_conn)) { return false; // we processed login/logout request, no future processing for this request permitted } if (!needAuthentication(request)) { return true; // this request does not require authentication } // check if it is redirection page.. If yes, then do not test its credentials ( as used for login) if (!m_redirect.empty() && m_redirect==request->getResource()) { return true; // this request does not require authentication } // check cache for expiration PionDateTime time_now(boost::posix_time::second_clock::universal_time()); expireCache(time_now); // if we are here, we need to check if access authorized... const std::string auth_cookie(request->getCookie(AUTH_COOKIE_NAME)); if (! auth_cookie.empty()) { // check if this cookie is in user cache boost::mutex::scoped_lock cache_lock(m_cache_mutex); PionUserCache::iterator user_cache_itr=m_user_cache.find(auth_cookie); if (user_cache_itr != m_user_cache.end()) { // we find those credential in our cache... // we can approve authorization now! request->setUser(user_cache_itr->second.second); // and update cache timeout user_cache_itr->second.first = time_now; return true; } } // user not found handleUnauthorized(request,tcp_conn); return false; }
void TomographyIfacePresenter::notify( ITomographyIfacePresenter::Notification notif) { switch (notif) { case ITomographyIfacePresenter::SetupResourcesAndTools: processSetup(); break; case ITomographyIfacePresenter::CompResourceChanged: processCompResourceChange(); break; case ITomographyIfacePresenter::ToolChanged: processToolChange(); break; case ITomographyIfacePresenter::TomoPathsChanged: processTomoPathsChanged(); break; case ITomographyIfacePresenter::LogInRequested: processLogin(); break; case ITomographyIfacePresenter::LogOutRequested: processLogout(); break; case ITomographyIfacePresenter::SetupReconTool: processSetupReconTool(); break; case ITomographyIfacePresenter::RunReconstruct: processRunRecon(); break; case ITomographyIfacePresenter::RefreshJobs: processRefreshJobs(); break; case ITomographyIfacePresenter::CancelJobFromTable: processCancelJobs(); break; case ITomographyIfacePresenter::VisualizeJobFromTable: processVisualizeJobs(); break; case ITomographyIfacePresenter::ViewImg: processViewImg(); break; case ITomographyIfacePresenter::LogMsg: processLogMsg(); break; case ITomographyIfacePresenter::ShutDown: processShutDown(); break; } }