当前位置: 首页>>代码示例>>C++>>正文


C++ BBWinNet类代码示例

本文整理汇总了C++中BBWinNet的典型用法代码示例。如果您正苦于以下问题:C++ BBWinNet类的具体用法?C++ BBWinNet怎么用?C++ BBWinNet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BBWinNet类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: bbwincmd

void		bbwincmd(int argc, char *argv[]) {
	string 	bbdisparg;
	
	BBWinNet	bbobj;
	if (strcmp(argv[1], "$") == 0) {
		cout << "will use environment variable BBDISPLAY" << endl;
		bbdisparg = getBBDisplaySetting();
	} else {
		bbdisparg = argv[1];
	}
	bbobj.SetBBDisplay(bbdisparg);
	cout << "bbdisplay defined to : " << bbobj.GetBBDisplay() << "\n";
	cout << "port defined to : " << bbobj.GetPort() << "\n";
	bbobj.SetDebug(true);
	string message = argv[2];
	bool	unkownMessage = false;
	for (int inc = 0; messTable[inc].callBack != NULL; ++inc) {
		int res = message.find(messTable[inc].argument);
		if (res >= 0 && (unsigned int)res <= message.size()) {
			unkownMessage = true;
			if (argc >= messTable[inc].minArg) {
				messTable[inc].callBack(argc, argv, bbobj);
			} else {
				cout << "\n";
				cout << "Error : not enough arguments for : \"" << message << "\"" << "\n\n";
			}
			break ;
		}
	}
	if (unkownMessage == false) {
		cout << "\n";
		cout << "Error : unknown Xymon message type : \"" << message << "\"" << "\n\n";
	}
}
开发者ID:CodeAndLoathing,项目名称:bbwin,代码行数:34,代码来源:BBWinCmd.cpp

示例2: assert

void 			BBWinAgentManager::Status(LPCTSTR testName, LPCTSTR color, LPCTSTR text, LPCTSTR lifeTime) {
	bbdisplay_t::iterator			itr;
	BBWinNet	hobNet;
	
	assert(testName != NULL);
	assert(color != NULL);
	assert(text != NULL);
	assert(lifeTime != NULL);
	Pager(testName, color, text, lifeTime);
	PrepareBBWinNetObj(hobNet);
	for ( itr = m_bbdisplay.begin(); itr != m_bbdisplay.end(); ++itr) {
		hobNet.SetBBDisplay((*itr));
		try {
			hobNet.Status(testName, color, text, lifeTime);
		} catch (BBWinNetException ex) {
			if (m_logReportFailure) {
				string mes;
						
				mes = "Sending report to " + (*itr) + " failed.";
				LPCTSTR		arg[] = {m_agentName.c_str(), mes.c_str(), NULL};
				m_log->reportWarnEvent(BBWIN_AGENT, EVENT_MESSAGE_AGENT, 2, arg);
			}
			continue ; 
		}
	}
}
开发者ID:tjyang,项目名称:abmon,代码行数:26,代码来源:BBWinAgentManager.cpp

示例3: Data

void 	Data(int argc, char *argv[], BBWinNet & bbobj)
{
	cout << "Sending data ...\n";
	bbobj.SetHostName(argv[3]);
	cout << "hostname defined to: " << argv[3] << "\n";
	try {
		bbobj.Data(argv[4], argv[5]);
	} catch (BBWinNetException ex) {
		cout << "Error : " << ex.getMessage() << "\n";
	}
}
开发者ID:CodeAndLoathing,项目名称:bbwin,代码行数:11,代码来源:BBWinCmd.cpp

示例4: Drop

void 	Drop(int argc, char *argv[], BBWinNet & bbobj)
{
	bbobj.SetHostName(argv[3]);
	cout << "hostname defined to: " << argv[3] << "\n";
	cout << "Sending drop ...\n";
	try {
		if (argc > 4)
			bbobj.Drop(argv[4]);
		else
			bbobj.Drop();
	} catch (BBWinNetException ex) {
		cout << "Error : " << ex.getMessage() << "\n";
	}
}
开发者ID:CodeAndLoathing,项目名称:bbwin,代码行数:14,代码来源:BBWinCmd.cpp

示例5: Query

void 	Query(int argc, char *argv[], BBWinNet & bbobj)
{
	cout << "Sending query ...\n";
	bbobj.SetHostName(argv[3]);
	cout << "hostname defined to: " << argv[3] << "\n";
	try {
		string res;
		
		bbobj.Query(argv[4], res);
		cout << "\n" << res << "\n\n";
	} catch (BBWinNetException ex) {
		cout << "Error : " << ex.getMessage() << "\n";
	}
}
开发者ID:CodeAndLoathing,项目名称:bbwin,代码行数:14,代码来源:BBWinCmd.cpp

示例6: Status

void 	Status(int argc, char *argv[], BBWinNet & bbobj)
{
	
	bbobj.SetHostName(argv[3]);
	cout << "hostname defined to: " << argv[3] << "\n";
	cout << "Sending status ...\n";
	try {
		if (argc > 7)
			bbobj.Status(argv[4], argv[5], argv[6], argv[7]);
		else
			bbobj.Status(argv[4], argv[5], argv[6]);
	} catch (BBWinNetException ex) {
		cout << "Error : " << ex.getMessage() << "\n";
	}
}
开发者ID:CodeAndLoathing,项目名称:bbwin,代码行数:15,代码来源:BBWinCmd.cpp

示例7: Rename

void 	Rename(int argc, char *argv[], BBWinNet & bbobj)
{
	bbobj.SetHostName(argv[3]);
	cout << "hostname defined to: " << argv[3] << "\n";
	try {
		if (argc > 5) {
			cout << "Sending test rename ...\n";
			bbobj.Rename(argv[4], argv[5]);
		} else {
			cout << "Sending test rename ...\n";
			bbobj.Rename(argv[4]);
		}
	} catch (BBWinNetException ex) {
		cout << "Error : " << ex.getMessage() << "\n";
	}
}
开发者ID:CodeAndLoathing,项目名称:bbwin,代码行数:16,代码来源:BBWinCmd.cpp

示例8: UploadMessage

void 	UploadMessage(int argc, char *argv[], BBWinNet & bbobj)
{
	cout << "Uploading message ...\n";
	try {
		string res;
		ostringstream 	tosend;
        string line;

		ifstream myfile ( argv[3] );

		if (myfile.is_open())
		{
			while (! myfile.eof() )
			{
				getline (myfile,line);
				tosend << line << endl;
			}
			myfile.close();
		}
		else cout << "Unable to open file"; 

		bbobj.Message(tosend.str(), res);
		cout << "Uploading message done !" ;
		cout << "\n" << res << "\n\n";
		
	} catch (BBWinNetException ex) {
		cout << "Error : " << ex.getMessage() << "\n";
	}
}
开发者ID:CodeAndLoathing,项目名称:bbwin,代码行数:29,代码来源:BBWinCmd.cpp

示例9: Message

void 	Message(int argc, char *argv[], BBWinNet & bbobj)
{
	cout << "Sending message ...\n";
	try {
		string res;
		
		bbobj.Message(argv[3], res);
		cout << "\n" << res << "\n\n";
	} catch (BBWinNetException ex) {
		cout << "Error : " << ex.getMessage() << "\n";
	}
}
开发者ID:CodeAndLoathing,项目名称:bbwin,代码行数:12,代码来源:BBWinCmd.cpp

示例10: PrepareBBWinNetObj

void		BBWinAgentManager::Drop()  {
	bbdisplay_t::iterator			itr;
	BBWinNet						hobNet;
		
	PrepareBBWinNetObj(hobNet);
	for ( itr = m_bbdisplay.begin(); itr != m_bbdisplay.end(); ++itr) {
		hobNet.SetBBDisplay((*itr));
		try {
			hobNet.Drop();
		} catch (BBWinNetException ex) {
			if (m_logReportFailure) {
				string mes;
			
				mes = "Sending report to " + (*itr) + " failed.";
				LPCTSTR		arg[] = {m_agentName.c_str(), mes.c_str(), NULL};
				m_log->reportWarnEvent(BBWIN_AGENT, EVENT_MESSAGE_AGENT, 2, arg);
			}
			continue ; 
		}
	}
}
开发者ID:tjyang,项目名称:abmon,代码行数:21,代码来源:BBWinAgentManager.cpp

示例11: Download

void 	Download(int argc, char *argv[], BBWinNet & bbobj)
{
	cout << "Sending download ...\n";
	try {
		string res;
		
		res = argv[3];
		if (argc > 4)
			res = argv[4];
		bbobj.Download(argv[3], res);
		cout << "\nDownloaded file has been stored to " << res << "\n\n";
	} catch (BBWinNetException ex) {
		cout << "Error : " << ex.getMessage() << "\n";
	}
}
开发者ID:CodeAndLoathing,项目名称:bbwin,代码行数:15,代码来源:BBWinCmd.cpp

示例12: report

void BBWinCentralHandler::run() {
	DWORD 		dwWait;
	std::list<BBWinHandler *>::iterator		itr;
	
	clientLocalCfgPath = m_data.setting["tmppath"] + (string)"\\clientlocal.cfg";
	for (;;) {
		std::ofstream	report(reportPath.c_str(), std::ios_base::trunc | ios_base::binary);
		bool		created = false;

		if (report) {
			report << "client " << m_data.setting["hostname"] << ".bbwin " << m_data.setting["configclass"] << "\n";
			report.close();
			created = true;
			GetClock();
			string		osversion;
			uname(osversion);
			bbwinClientData_callback("osversion", osversion);
		} else {
			string mess, err;

			mess = (string)"failed to create the report file " + reportPath;
			GetLastErrorString(err);
			LPCTSTR		args[] = {mess.c_str(), err.c_str(), NULL};
			m_log->reportErrorEvent(BBWIN_SERVICE, EVENT_HOBBIT_FAILED_CLIENTDATA, 2, args);
		}

		for (itr = m_agents.begin(); itr != m_agents.end(); ++itr) {
			(*itr)->Run();
			dwWait = WaitForMultipleObjects(m_hCount, m_hEvents , FALSE, 0);
			if (( dwWait >= WAIT_OBJECT_0 && dwWait <= (WAIT_OBJECT_0 + m_hCount - 1) ) || (dwWait >= WAIT_ABANDONED_0 && dwWait <= (WAIT_ABANDONED_0 + m_hCount - 1) )) {
				DeleteFile(reportPath.c_str());
				return ;
			}
		}
		if (created) {
			bbdisplay_t::iterator			itr;
			
			string		result;

			for (itr = m_bbdisplay.begin(); itr != m_bbdisplay.end(); ++itr) {
				BBWinNet	hobNet;
				hobNet.SetBBDisplay((*itr));
				try {
					hobNet.ClientData(reportPath, clientLocalCfgPath);
				} catch (BBWinNetException ex) {
					string mess, err;

					GetLastErrorString(err);
					mess = ex.getMessage();
					LPCTSTR		args[] = {mess.c_str(), err.c_str(), NULL};
					m_log->reportErrorEvent(BBWIN_SERVICE, EVENT_HOBBIT_FAILED_CLIENTDATA, 2, args);
				}
			}
			DeleteFile(reportSavePath.c_str());
			MoveFile(reportPath.c_str(), reportSavePath.c_str());
			DeleteFile(reportPath.c_str());
		}
		dwWait = WaitForMultipleObjects(m_hCount, m_hEvents , FALSE, m_timer * 1000 );
		if ( dwWait >= WAIT_OBJECT_0 && dwWait <= (WAIT_OBJECT_0 + m_hCount - 1) ) {    
			break ;
		} else if (dwWait >= WAIT_ABANDONED_0 && dwWait <= (WAIT_ABANDONED_0 + m_hCount - 1) ) {
			break ;
		}
	}
}
开发者ID:tjyang,项目名称:bbwin,代码行数:65,代码来源:BBWinCentralHandler.cpp

示例13:

void			BBWinAgentManager::PrepareBBWinNetObj(BBWinNet & hobNet) {
	hobNet.SetHostName(m_setting["hostname"]);
	if (m_setting["useproxy"] == "true")
		hobNet.SetProxy(m_setting["proxy"]);
}
开发者ID:tjyang,项目名称:abmon,代码行数:5,代码来源:BBWinAgentManager.cpp


注:本文中的BBWinNet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。