Esempio n. 1
0
void CallbackHandler::mapping_callback(OSyncMappingUpdate *update, void *data)
{
    CallbackHandler *handler = static_cast<CallbackHandler *>(data);

    SyncMappingUpdate mapping(update, handler->engine()->mEngine);

    QApplication::postEvent(handler, new MappingEvent(mapping));
}
Esempio n. 2
0
void MonitorCallback()
{
    while (true)
    {
	    if( ! Nova::ConnectToNovad() )
	    {
	        LOG(ERROR, "CLI Unable to connect to Novad right now. Trying again in 3 seconds...","");
	        sleep(3);
	        continue;
	    }


		CallbackChange cb;
		CallbackHandler callbackHandler;
	    Suspect s;

		do
		{
			cb = callbackHandler.ProcessCallbackMessage();
			switch( cb.m_type )
			{
			case CALLBACK_NEW_SUSPECT:
				cout << "Got new suspect: " << cb.m_suspect->GetIdString() << + " with classification of " << cb.m_suspect->GetClassification() << endl;

				// We get a suspect pointer and are responsible for deleting it
				delete cb.m_suspect;
				break;

			case CALLBACK_ERROR:
				cout << "WARNING: Recieved a callback error message!" << endl;
				break;

			case CALLBACK_ALL_SUSPECTS_CLEARED:
				cout << "Got notice that all suspects were cleared" << endl;
				break;

			case CALLBACK_SUSPECT_CLEARED:
				s.SetIdentifier(cb.m_suspectIP);
				cout << "Got a notice that suspect was cleared: " + s.GetIdString() << endl;
				break;
			case CALLBACK_HUNG_UP:
				cout << "Got CALLBACK_HUNG_UP" << endl;
				break;
			default:
				cout << "WARNING: Got a callback message we don't know what to do with. Type " << cb.m_type << endl;
				break;
			}
		}
		while(cb.m_type != CALLBACK_HUNG_UP);
		cout << "Novad hung up, closing callback processing and trying again in 3 seconds" << endl;
		sleep(3);
   }
}
Esempio n. 3
0
File: hget.cpp Progetto: Pastor/iv
int
main(int argc, char **argv)
{
    HRESULT hr;
    CallbackHandler callbackHandler;
    IBindStatusCallback* pBindStatusCallback = nullptr;

    callbackHandler.QueryInterface(IID_IBindStatusCallback, reinterpret_cast<void**>(&pBindStatusCallback));
    DeleteUrlCacheEntryA(argv[1]);
    std::cout << "Resource: " << argv[1] << std::endl;
    hr = URLDownloadToFileA(nullptr, argv[1], argv[2], 0, pBindStatusCallback);
    return hr == S_OK ? EXIT_SUCCESS : EXIT_FAILURE;
}
Esempio n. 4
0
void NovaNode::NovaCallbackHandling(eio_req*)
{
	using namespace Nova;
	CallbackChange cb;

	LOG(DEBUG, "Initializing Novad callback processing","");

	CallbackHandler callbackHandler;

	m_callbackRunning = true;
	do
	{
		Suspect *s;
		cb = callbackHandler.ProcessCallbackMessage();
		switch( cb.m_type )
		{
		case CALLBACK_NEW_SUSPECT:
			HandleNewSuspect(cb.m_suspect);
			break;

		case CALLBACK_ERROR:
			HandleCallbackError();
			break;

		case CALLBACK_ALL_SUSPECTS_CLEARED:
			HandleAllSuspectsCleared();
			break;

		case CALLBACK_SUSPECT_CLEARED:
			s = new Suspect();
			s->SetIdentifier(cb.m_suspectIP);
			LOG(DEBUG, "Got a clear callback request for a suspect on interface " + cb.m_suspectIP.m_interface, "");
			HandleSuspectCleared(s);
			break;

		default:
			break;
		}
	}
	while(cb.m_type != CALLBACK_HUNG_UP);         
	LOG(DEBUG, "Novad hung up, closing callback processing","");
	m_callbackRunning = false;
}
Esempio n. 5
0
void NovaNode::NovaCallbackHandling(eio_req*)
{
	using namespace Nova;
	CallbackChange cb;

	LOG(DEBUG, "Initializing Novad callback processing","");

	CallbackHandler callbackHandler;

	m_callbackRunning = true;
	do
	{
		cb = callbackHandler.ProcessCallbackMessage();
		//            LOG(DEBUG,"callback type " + cb.type,"");
		switch( cb.m_type )
		{
		case CALLBACK_NEW_SUSPECT:
			HandleNewSuspect(cb.m_suspect);
			break;

		case CALLBACK_ERROR:
			HandleCallbackError();
			break;

		case CALLBACK_ALL_SUSPECTS_CLEARED:
			HandleAllSuspectsCleared();
			break;

		default:
			break;
		}
	}
	while(cb.m_type != CALLBACK_HUNG_UP);         
	LOG(DEBUG, "Novad hung up, closing callback processing","");
	m_callbackRunning = false;
}