void PolypeerServer::initConnections() { // liste des déploiements vector<File*>* files = sData->getDeployFiles(); ConnectionManager* cm = sData->getConnectionManager(); set<Entity*> myHostSet; for (vector<File*>::iterator itFile = files->begin(); itFile != files->end(); itFile++) { if(((*itFile)->getFileState() == READY) || ((*itFile)->getFileState() == DEPLOYMENT)) { vector<Entity*>* hosts = (*itFile)->getDeploysOn(); for (vector<Entity*>::iterator itHost = hosts->begin(); itHost != hosts->end(); itHost++) { myHostSet.insert((*itHost)); } } } for (set<Entity*>::iterator itHost = myHostSet.begin(); itHost != myHostSet.end(); itHost++) { pthread_t myThread; if(cm->getConnection((*itHost)->getIP()) == NULL) { pthread_create(&myThread, NULL, thread_initConnection, (*itHost)); } } }
bool RedundantDataPath::IsAValidConfiguration( U32 &errorString ){ // the connection # check if( (GetChildCount() > 2) || (GetChildCount() < 1 ) ){ errorString = CTS_SSAPI_CM_INVALID_CONN_COUNT_FOR_RDP; return false; } // must belong to the same host HostManager *pHM = (HostManager *)GetObjectManager( GetManager(), SSAPI_MANAGER_CLASS_TYPE_HOST_MANAGER ); if( !pHM->DoConnectionsBelongToSameHost( m_children ) ){ errorString = CTS_SSAPI_CM_CONN_MUST_BELONG_2_SAME_HOST; return false; } // must map to a single primary/fail-over IOP pair if( GetChildCount() == 2 ){ DeviceManager *pDM = (DeviceManager *)GetObjectManager(GetManager(), SSAPI_MANAGER_CLASS_TYPE_DEVICE_MANAGER ); ConnectionManager *pCM = (ConnectionManager *)GetManager(); DesignatorId id1 = GetChildIdAt( 0 ), id2 = GetChildIdAt( 1 ); id1 = ((ConnectionBase *)pCM->GetManagedObject( &id1 ))->GetGeminiPortId(); id2 = ((ConnectionBase *)pCM->GetManagedObject( &id2 ))->GetGeminiPortId(); if( !pDM->AreThesePortsOnPartneredNacs( id1, id2 ) ){ errorString = CTS_SSAPI_CM_CONN_MUST_BE_ON_PARTNER_NACS; return false; } } // we made it to here? Gee, it's good then!!! return true; }
//When a connection changes to encrypted void ConnectionManager::ConnectionEncryptedHandler(ble_evt_t* bleEvent) { ConnectionManager* cm = ConnectionManager::getInstance(); Connection* c = cm->GetConnectionFromHandle(bleEvent->evt.gap_evt.conn_handle); logt("CM", "Connection id %u is now encrypted", c->connectionId); c->encryptionState = Connection::EncryptionState::ENCRYPTED; //We are peripheral if(c->direction == Connection::CONNECTION_DIRECTION_IN) { if(!cm->doHandshake){ c->connectionState = Connection::ConnectionState::HANDSHAKE_DONE; } } //We are central else if(c->direction == Connection::CONNECTION_DIRECTION_OUT) { if(cm->doHandshake) { c->StartHandshake(); } //If the handshake is disabled, we just set the variable else { c->connectionState = Connection::ConnectionState::HANDSHAKE_DONE; } } }
curl_socket_t ConnectionManager::CurlOpenSocketCallback(void* clientp, curlsocktype socket_type, curl_sockaddr* address) { ConnectionManager* manager = static_cast<ConnectionManager*>(clientp); return manager->OpenSocket(socket_type, address); }
//Is called whenever a connection had been established and is now disconnected //due to a timeout, deliberate disconnection by the localhost, remote, etc,... void ConnectionManager::DisconnectionHandler(ble_evt_t* bleEvent) { ConnectionManager* cm = ConnectionManager::getInstance(); Connection* connection = cm->GetConnectionFromHandle(bleEvent->evt.gap_evt.conn_handle); if(connection == NULL) return; //Save disconnction reason connection->disconnectionReason = bleEvent->evt.gap_evt.params.disconnected.reason; //LOG disconnection reason Logger::getInstance().logError(Logger::errorTypes::HCI_ERROR, bleEvent->evt.gap_evt.params.disconnected.reason, cm->node->appTimerMs); logt("CM", "Connection %u to %u DISCONNECTED", connection->connectionId, connection->partnerId); //Check if the connection should be sustained (If it's been handshaked for more than 10 seconds and ran into a timeout) if( cm->node->appTimerMs - connection->connectionHandshakedTimestamp > 10 * 1000 && bleEvent->evt.gap_evt.params.disconnected.reason == BLE_HCI_CONNECTION_TIMEOUT && cm->node->currentDiscoveryState != discoveryState::HANDSHAKE && cm->node->currentDiscoveryState != discoveryState::REESTABLISHING_CONNECTION ){ logt("CM", "Connection should be sustained"); //TODO: implement /*connection->connectionState = Connection::REESTABLISHING; cm->node->ChangeState(discoveryState::REESTABLISHING_CONNECTION); //We assume the same role as before the connection loss if(connection->direction == Connection::ConnectionDirection::CONNECTION_DIRECTION_IN){ //We advertise AdvertisingController::SetAdvertisingState(advState::ADV_STATE_HIGH); } else { //We try to initiate the connection GAPController::connectToPeripheral(&connection->partnerAddress, Config->meshExtendedConnectionTimeout); }*/ } if (connection->direction == Connection::CONNECTION_DIRECTION_IN) cm->freeInConnections++; else cm->freeOutConnections++; //If this was the pending connection, we clear it if(cm->pendingConnection == connection) cm->pendingConnection = NULL; //Notify the connection itself connection->DisconnectionHandler(bleEvent); //Notify the callback of the disconnection (The Node probably) cm->connectionManagerCallback->DisconnectionHandler(bleEvent); //Reset connection variables connection->ResetValues(); }
int main(int argc, char **argv) { qInstallMsgHandler(messageOutput); QCoreApplication app(argc, argv); ConnectionManager manager; manager.init(); return app.exec(); }
int ConnectionManager::CurlSocketCallback(CURL* easy_handle, curl_socket_t socket, int action, void* user_pointer, void* socket_pointer) { ConnectionManager* manager = static_cast<ConnectionManager*>(user_pointer); manager->WatchSocket(socket, action, socket_pointer); return 0; }
/*! Updates the connection information and notifies the UI of the changes. */ void TicTacEngine::updateConnectionInformation() { ConnectionManager *connectionManager = mServer->connectionManager(); if (connectionManager) { mSSID = connectionManager->accessPoint(); mIpAndPort = connectionManager->myIp() + ":" + QString::number(SERVER_PORT); emit ssidChanged(mSSID); emit ipAndPortChanged(mIpAndPort); } }
//When the mesh handle has been discovered void ConnectionManager::handleDiscoveredCallback(u16 connectionHandle, u16 characteristicHandle) { ConnectionManager* cm = ConnectionManager::getInstance(); Connection* connection = cm->GetConnectionFromHandle(connectionHandle); if (connection != NULL) { connection->writeCharacteristicHandle = characteristicHandle; if(cm->doHandshake) connection->StartHandshake(); else { cm->connectionManagerCallback->ConnectionSuccessfulHandler(NULL); } } }
RESULTCODE GetDataSourceResponse::Write(WebWriter* pWriter) { if(pWriter==NULL) { return AG_FAILURE; } GLogger* pLogger = augeGetLoggerInstance(); Workspace* pWorkspace = NULL; ConnectionManager* pConnManager = augeGetConnectionManagerInstance(); XDocument *pxDoc = new XDocument(); XElement *pxRoot = pxDoc->CreateRootNode("IMS_DataSources", NULL, NULL); const char* name = m_pRequest->GetName(); if(name==NULL) { g_uint count = pConnManager->GetCount(); for(g_uint i=0; i<count; i++) { pWorkspace = pConnManager->GetWorkspace(i); AddDataSourceNode(pxRoot, pWorkspace); } } else { pWorkspace = pConnManager->GetWorkspace(name); if(pWorkspace!=NULL) { AddDataSourceNode(pxRoot, pWorkspace); } } int len = 0; g_uchar* buffer = NULL; pxDoc->WriteToString(&buffer, len, "GBK",0); pWriter->WriteHead(m_pRequest->GetMimeType()); pWriter->Write(buffer, len); pWriter->WriteTail(); pLogger->Info((g_char*)buffer); pxDoc->Close(); AUGE_SAFE_RELEASE(pxDoc); return AG_SUCCESS; }
postgis_datasource::~postgis_datasource() { if (is_bound_ && ! persist_connection_) { ConnectionManager* mgr = ConnectionManager::instance(); shared_ptr< Pool<Connection,ConnectionCreator> > pool = mgr->getPool(creator_.id()); if (pool) { shared_ptr<Connection> conn = pool->borrowObject(); if (conn) { conn->close(); } } } }
int main(int argc, char *argv[]) { ConnectionManager connection; SOCKET connect_socket = connection.CreateClientConnection(); #pragma region WYSYLANIE #define DEFAULT_BUFLEN 512 int recvbuflen = DEFAULT_BUFLEN; char *sendbuf = new char[DEFAULT_BUFLEN]; char recvbuf[DEFAULT_BUFLEN]; int result = 0; do { printf("Wiadomosc do wyslania: \n"); scanf("%s", sendbuf); //printf("Wiadomosc jaka wysle: %s\n", sendbuf); if (strcmp(sendbuf, "quit") == 0) break; // Send an initial buffer result = send(connect_socket, sendbuf, static_cast<int>(strlen(sendbuf)), 0); if (result == SOCKET_ERROR) { printf("send failed: %d\n", WSAGetLastError()); closesocket(connect_socket); WSACleanup(); // getch(); // return 1; } } while (true); #pragma endregion blok odpowiedzialny za komunikacje z serwerem connection.ShutdownConnection(connect_socket); printf("Client exit.\n"); getch(); return 0; }
void WaveExplorerUi::InitConnector() { connect(xyz_rbtn_, SIGNAL(clicked()), this, SLOT(OnXYZAction())); connect(x_rbtn_, SIGNAL(clicked()), this, SLOT(OnXAction())); connect(y_rbtn_, SIGNAL(clicked()), this, SLOT(OnYAction())); connect(z_rbtn_, SIGNAL(clicked()), this, SLOT(OnZAction())); connect(tilt_to_dc_cbox_, SIGNAL(clicked(bool)), this, SLOT(OnTiltToDcAction(bool))); connect(bandpass_cbox_, SIGNAL(clicked(bool)), this, SLOT(OnBandPassAction(bool))); connect(notch_cbox_, SIGNAL(clicked(bool)), this, SLOT(OnNotchAction(bool))); // connect(min_dsbox_, SIGNAL(editingFinished()), this, SLOT(OnFreqValueChanged())); // connect(max_dsbox_, SIGNAL(editingFinished()), this, SLOT(OnFreqValueChanged())); connect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(WaveItemClicked(QModelIndex))); ConnectionManager* mgr = ConnectionManager::GetInstance(); if (mgr != NULL) { mgr->RegisterSignal(TYPE_WAVEEXPLORER_TOP_LAYER_TIME_EXPAND, this, SIGNAL(ExpandTimeSignal())); } }
void ConnectionManager::addConnection(ManagedConnection* connection, bool timeout) { CHECK_NOTNULL(connection); ConnectionManager* oldMgr = connection->getConnectionManager(); if (oldMgr != this) { if (oldMgr) { // 'connection' was being previously managed in a different thread. // We must remove it from that manager before adding it to this one. oldMgr->removeConnection(connection); } conns_.push_back(*connection); connection->setConnectionManager(this); if (callback_) { callback_->onConnectionAdded(*this); } } if (timeout) { scheduleTimeout(connection); } }
FeatureClass* DescribeFeatureTypeHandler::GetFeatureClassBySource(WebRequest* pWebRequest, WebContext* pWebContext, User* pUser) { const char* typeName = NULL; Layer* pLayer = NULL; GLogger *pLogger = augeGetLoggerInstance(); DescribeFeatureTypeRequest* pRequest = static_cast<DescribeFeatureTypeRequest*>(pWebRequest); typeName = pRequest->GetTypeName(); const char* sourceName = pRequest->GetSourceName(); if(sourceName==NULL) { GError* pError = augeGetErrorInstance(); pError->SetError("No Source is attached"); return NULL; } ConnectionManager* pConnManager = augeGetConnectionManagerInstance(); Workspace* pWorkspace = pConnManager->GetWorkspace(pUser->GetID(), sourceName); if(pWorkspace==NULL) { char msg[AUGE_MSG_MAX]; g_sprintf(msg, "No DataSource Named [%s]", sourceName); GError* pError = augeGetErrorInstance(); pError->SetError(msg); return NULL; } FeatureWorkspace* pFeatureWorkspace = dynamic_cast<FeatureWorkspace*>(pWorkspace); FeatureClass* pFeatureClass = pFeatureWorkspace->OpenFeatureClass(typeName); if(pFeatureClass==NULL) { char msg[AUGE_MSG_MAX]; g_sprintf(msg, "Cannot Get FeatureType %s",typeName); pLogger->Error(msg, __FILE__, __LINE__); GError* pError = augeGetErrorInstance(); pError->SetError(msg); return NULL; } return pFeatureClass; }
int HttpServerMsgHandler::processMessage(void *arg) { struct evhttp_request *req = (struct evhttp_request *)arg; const char *cmdtype; struct evkeyvalq *headers; struct evkeyval *header; switch (evhttp_request_get_command(req)) { case EVHTTP_REQ_GET: cmdtype = "GET"; break; case EVHTTP_REQ_POST: cmdtype = "POST"; break; case EVHTTP_REQ_HEAD: cmdtype = "HEAD"; break; case EVHTTP_REQ_PUT: cmdtype = "PUT"; break; case EVHTTP_REQ_DELETE: cmdtype = "DELETE"; break; case EVHTTP_REQ_OPTIONS: cmdtype = "OPTIONS"; break; case EVHTTP_REQ_TRACE: cmdtype = "TRACE"; break; case EVHTTP_REQ_CONNECT: cmdtype = "CONNECT"; break; case EVHTTP_REQ_PATCH: cmdtype = "PATCH"; break; default: cmdtype = "unknown"; break; } printf("Received a %s request for %s\nHeaders:\n", cmdtype, evhttp_request_get_uri(req)); headers = evhttp_request_get_input_headers(req); for (header = headers->tqh_first; header; header = header->next.tqe_next) { printf(" %s: %s\n", header->key, header->value); } ConnectionManager *conn = ConnectionManager::getInstance(); struct evbuffer *return_buffer=evbuffer_new(); long long total_req = conn->getTotalRequests(); long long total_res = conn->getTotalResponses(); unsigned int conns = conn->getConnections(); long long timeouts = conn->getTimeoutRequests(); long long err_res = conn->getErrorResponses(); long long conn_except = conn->getConnExceptions(); long long ok_res = conn->getOkResponses(); evbuffer_add_printf(return_buffer," total request: %lld<br> total response: %lld<br> connnections: %u<br><br><hr><br> ok: %lld \ <br> timeout: %lld<br> http error: %lld<br> connExcept: %u<br>" , total_req, total_res, conns, ok_res, timeouts, err_res, conn_except); evhttp_send_reply(req, HTTP_OK, "OK", return_buffer); evbuffer_free(return_buffer); return 0; }
int callbackRemoveHost(Packet& p) { PacketRemoveHost pp(p); //cout << "callbackRemoveHost" << endl; ClientData* cd = PolypeerClient::getInstance()->getClientData(); if(cd!=NULL) { ConnectionManager* cm = cd->getConnectionManager(); //cout <<"getCM"<<endl; if(cm!=NULL) { cm->removeConnection(pp.getIpAddress()); } } return 1; }
int main(int argc, char *argv[]) { ConnectionManager connection; SOCKET listen_socket = connection.CreateServerConnection(); SOCKET client_socket; ProcessesAndThreadsManager process_manager; while (client_socket = connection.AcceptingConnection(listen_socket)) { // in there should be process_manager.SetPathToProcess function char *sciezka = new char[256]; strcpy(sciezka, "F:\\dropbox\\myftp\\MyFTP - ClientsManager\\ClientsManager\\debug\\ClientsManager"); strcat(sciezka, " "); // copy socket handle to argument list of new process char str_to_socket[10]; itoa(client_socket, str_to_socket, 10); strcat(sciezka, str_to_socket); printf("Sciezka do procesu tuz przed wyslaniem:\n%s\n", sciezka); USES_CONVERSION; TCHAR* dziecko = A2T(sciezka); process_manager.path_to_process_ = dziecko; process_manager.CreateNewProcess(); } process_manager.WaitForProcessToEnd(); process_manager.CloseHandles(); printf("Client disconnect.\n"); connection.ShutdownConnection(client_socket); closesocket(listen_socket); printf("Server exit.\n"); return 0; }
void* thread_initConnection(void* data) { ConnectionManager* cm = (PolypeerServer::instance)->getServerData().getConnectionManager(); Host* myHost = (Host*)data; try { Socket* socket = new Socket(myHost->getIP(), (PolypeerServer::instance)->getServerData().getClientPort()); cm->addConnection(myHost->getIP(), socket); myHost->setHostState(WAIT); } catch(ConnectionException) { //(PolypeerServer::instance)->getLogger()<<"Connection to " << myHost->getIP() << " failed" <<endlog; /*A tester en condition réelle!!*/ //si on n'arrive pas à se connecter au client on essaye de l'allumer ConnectionManager::WOL(myHost->getMac().c_str(), myHost->getMask().c_str()); } return NULL; }
virtual CORBA::Object_ptr resolve_(ConnectionManager& manager) { return manager.resolveDomainObject(type_, name_); }
virtual CORBA::Object_ptr resolve_(ConnectionManager& manager) { return manager.resolveFindByNamingService(name_); }
virtual CORBA::Object_ptr resolve_(ConnectionManager& manager) { return manager.resolveDeviceUsedByThisComponentRef(componentIdentifier_, usesIdentifier_); }
virtual CORBA::Object_ptr resolve_(ConnectionManager& manager) { return manager.resolveDeviceThatLoadedThisComponentRef(identifier_); }
virtual CORBA::Object_ptr resolve_(ConnectionManager& manager) { return manager.resolveComponent(identifier_); }
/*******************处理MCU发送的指令的内容**********************/ int McuMesageHandler::Handleissuedinfo() { //McuMessageHandler(); unsigned char buf_tmp1[31]; unsigned char buf_tmp2[31]; unsigned char buf_tmp3[31]; unsigned char buf_tmp4[31]; unsigned char buf_tmp5[31]; unsigned int i=0; unsigned char flag=0; unsigned char command[155]; memset(command,0,sizeof(command)); printf("enter Handleissuedinfo \n "); i2c_read_issued_information(buf_tmp1,31); i2c_read_issued_information(buf_tmp2,31); i2c_read_issued_information(buf_tmp3,31); i2c_read_issued_information(buf_tmp4,31); i2c_read_issued_information(buf_tmp5,31); for(i=0;i<31;i++) { printf("buf_tmp1[1]=%02x \n",i,buf_tmp1[1]); if (buf_tmp1[1]==0x00) return 0; command[i]=buf_tmp1[i+1]; printf("buf_tmp1[%d]=%02x \n",i,buf_tmp1[i]); if(command[i]==0x7e) { flag=1; printf("Handleissuedinfo1::flag %d i %d \n",flag,i); } if((i!=0)&&(command[i]==0x7e)&&(flag==1)) { flag=0; printf("Handleissuedinfo2::flag %d i %d \n",flag,i); break; } } for(i=0;i<31;i++) { command[i+30]=buf_tmp2[i]; if((buf_tmp2[i]==0x7e)&&(flag==1)) break; } for(i=0;i<31;i++) { command[i+61]=buf_tmp3[i]; if((buf_tmp3[i]==0x7e)&&(flag==1)) break; } for(i=0;i<31;i++) { command[i+92]=buf_tmp4[i]; if((buf_tmp4[i]==0x7e)&&(flag==1)) break; } for(i=0;i<31;i++) { command[i+123]=buf_tmp5[i]; if((buf_tmp5[i]==0x7e)&&(flag==1)) break; } int ret=count_buf(command); if (ret>150) return 0; printf("ret ====================%d \n",ret); for (int i=0;i<ret;i++) { printf("%02x ",command[i]); } connection.HandleReceiveBuf(command,ret); //mcu_packetHandler->PacketHandler(command, ret); }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void ConnectionManager::run_worker (ConnectionManager& cm) { cm.fds_size = 8; cm.fds = new struct pollfd[cm.fds_size]; cm.fds_rx_more = new bool[cm.fds_size]; cm.fds_tx_more = new bool[cm.fds_size]; int nfds; bool done = false; DEBUG_TRACE (THIS_FILE, "Worker thread started"); // Setup the command pipe in the poller // cm.fds[0].fd = cm.cmd_pipe[pipe_rx]; cm.fds[0].events = POLLIN; cm.fds[0].revents = 0; cm.fds_rx_more[0] = false; cm.fds_tx_more[0] = false; nfds = 1; int poll_timeout = WHILE_HELL_BURNS; while (!done) { // Poll file descriptors // DEBUG_TRACE (THIS_FILE, "Poll ", nfds, " file descriptors, timeout: ", poll_timeout); auto result = poll (cm.fds, nfds, poll_timeout); if (result <= 0) { // Check for errors or timeout // if (result<0 || poll_timeout!=FASTER_THAN_LIGHT) { if (result==0 || errno==EINTR) continue; uxmpp_log_error (THIS_FILE, "poll failed"); continue; } } // Check the command pipe first // if (cm.fds[0].revents & POLLIN) done = cm.dispatch_command (nfds); // Check file descriptors // int new_timeout = WHILE_HELL_BURNS; for (auto i=1; i<nfds; ++i) { bool have_tx = cm.fds_tx_more[i] || ((cm.fds[i].revents & POLLOUT) != 0); bool have_rx = cm.fds_rx_more[i] || ((cm.fds[i].revents & POLLIN) != 0); if (have_tx && cm.handle_poll_io(cm.fds[i], nfds, false) == FASTER_THAN_LIGHT) { cm.fds_tx_more[i] = true; new_timeout = FASTER_THAN_LIGHT; }else{ cm.fds_tx_more[i] = false; } if (have_rx && cm.handle_poll_io(cm.fds[i], nfds, true) == FASTER_THAN_LIGHT) { cm.fds_rx_more[i] = true; new_timeout = FASTER_THAN_LIGHT; }else{ cm.fds_rx_more[i] = false; } } poll_timeout = new_timeout; } delete[] cm.fds; delete[] cm.fds_rx_more; delete[] cm.fds_tx_more; cm.fds = nullptr; cm.fds_rx_more = cm.fds_tx_more = nullptr; cm.fds_size = 0; DEBUG_TRACE (THIS_FILE, "Worker thread ending"); }
Gobby::Browser::Browser(Gtk::Window& parent, StatusBar& status_bar, ConnectionManager& connection_manager): m_parent(parent), m_status_bar(status_bar), m_connection_manager(connection_manager), m_expander(_("_Direct Connection"), true), m_hbox(false, 6), m_label_hostname(_("Host Name:")), m_entry_hostname(config_filename("recent_hosts"), 5) { m_label_hostname.show(); m_entry_hostname.get_entry()->signal_activate().connect( sigc::mem_fun(*this, &Browser::on_hostname_activate)); m_entry_hostname.show(); m_hbox.pack_start(m_label_hostname, Gtk::PACK_SHRINK); m_hbox.pack_start(m_entry_hostname, Gtk::PACK_EXPAND_WIDGET); m_hbox.show(); m_expander.add(m_hbox); m_expander.show(); m_expander.property_expanded().signal_changed().connect( sigc::mem_fun(*this, &Browser::on_expanded_changed)); m_browser_store = inf_gtk_browser_store_new( connection_manager.get_io(), connection_manager.get_communication_manager()); m_sort_model = inf_gtk_browser_model_sort_new( INF_GTK_BROWSER_MODEL(m_browser_store)); gtk_tree_sortable_set_default_sort_func( GTK_TREE_SORTABLE(m_sort_model), compare_func, NULL, NULL); if(m_connection_manager.get_discovery() != NULL) { inf_gtk_browser_store_add_discovery( m_browser_store, m_connection_manager.get_discovery()); } Glib::ustring known_hosts_file = config_filename("known_hosts"); m_cert_checker = inf_gtk_certificate_manager_new( parent.gobj(), m_connection_manager.get_xmpp_manager(), known_hosts_file.c_str()); m_browser_view = INF_GTK_BROWSER_VIEW( inf_gtk_browser_view_new_with_model( INF_GTK_BROWSER_MODEL(m_sort_model))); gtk_widget_show(GTK_WIDGET(m_browser_view)); gtk_container_add(GTK_CONTAINER(m_scroll.gobj()), GTK_WIDGET(m_browser_view)); m_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); m_scroll.set_shadow_type(Gtk::SHADOW_IN); m_scroll.show(); g_signal_connect( m_browser_store, "set-browser", G_CALLBACK(&on_set_browser_static), this ); g_signal_connect( m_browser_view, "activate", G_CALLBACK(&on_activate_static), this ); set_spacing(6); pack_start(m_scroll, Gtk::PACK_EXPAND_WIDGET); pack_start(m_expander, Gtk::PACK_SHRINK); init_accessibility(); set_focus_child(m_expander); }
int ConnectionManager::CurlTimerCallback(CURLM* multi_handle, long timeout_ms, void* user_pointer) { ConnectionManager* manager = static_cast<ConnectionManager*>(user_pointer); manager->SetTimer(timeout_ms); return 0; }
WebResponse* TransactionHandler::ExecuteBySource(WebRequest* pWebRequest, WebContext* pWebContext, User* pUser) { GLogger *pLogger = augeGetLoggerInstance(); TransactionRequest* pRequest = static_cast<TransactionRequest*>(pWebRequest); const char* sourceName = pRequest->GetSourceName(); if(sourceName==NULL) { char msg[AUGE_MSG_MAX]; WebExceptionResponse* pExpResponse = augeCreateWebExceptionResponse(); g_sprintf(msg, "No DataSource is Defined"); pExpResponse->SetMessage(msg); return pExpResponse; } ConnectionManager* pConnManager = augeGetConnectionManagerInstance(); FeatureWorkspace* pWorkspace = dynamic_cast<FeatureWorkspace*>(pConnManager->GetWorkspace(pUser->GetID(), sourceName)); if(pWorkspace==NULL) { char msg[AUGE_MSG_MAX]; g_sprintf(msg, "No DataSource Named [%s]", sourceName); GError* pError = augeGetErrorInstance(); pError->SetError(msg); WebExceptionResponse* pExpResponse = augeCreateWebExceptionResponse(); pExpResponse->SetMessage(msg); return pExpResponse; } const char* typeName = NULL; Layer* pLayer = NULL; XDocument* pxDoc = NULL; pxDoc = pRequest->GetXmlDoc(); if(pxDoc==NULL) { WebExceptionResponse* pExpResponse = augeCreateWebExceptionResponse(); pExpResponse->SetMessage("transaction xml parse error"); return pExpResponse; } XNodeSet *pxNodeSet = NULL; XElement *pxRoot = pxDoc->GetRootNode(); pxNodeSet = pxRoot->GetChildren("Insert"); g_uint num_insert = Insert(pxNodeSet, pWebContext, pWorkspace); pxNodeSet->Release(); pxNodeSet = pxRoot->GetChildren("Update"); g_uint num_update = Update(pxNodeSet, pWebContext, pWorkspace); pxNodeSet->Release(); pxNodeSet = pxRoot->GetChildren("Delete"); g_uint num_delete = Delete(pxNodeSet, pWebContext, pWorkspace); pxNodeSet->Release(); TransactionResponse *pResponse = new TransactionResponse(pRequest); pResponse->SetInsertCount(num_insert); pResponse->SetUpdateCount(num_update); pResponse->SetDeleteCount(num_delete); return pResponse; }
int ConnectionManager::CurlCloseSocketCallback(void* clientp, curl_socket_t socket) { ConnectionManager* manager = static_cast<ConnectionManager*>(clientp); return manager->CloseSocket(socket); }