示例#1
0
//========================================================================
// WingmanClient::attachSharedMemory()
//========================================================================
int WingmanClient::attachSharedMemory()
{
 char shmName[256];

 sprintf(shmName, "QRTS_WingmanServer_%s", getServerName());

	cout << shmName << endl;
 d_jsData = (WingmanData_t *)d_shm.attach(shmName, 2 * sizeof(WingmanData_t));
 if (!d_shm.d_status.isStatusOk())
 {
  d_status.setStatusError()
    << "[WingmanClient::attachSharedMemory] " 
    << d_shm.d_status.getMessageText() << endl;
  return -1;
 }
 return 0;
}
示例#2
0
void CGI::logCGIData(const QString& filename)
{
	// create a QFile object to do the file I/O
	QFile file(filename);

	// open the file
	if (file.open(QIODevice::WriteOnly))
	{
		// create a QTextStream object on the file
		Q3TextStream textFile(&file);

		// get the environment
		textFile << "REQUEST_METHOD=" << getenv("REQUEST_METHOD") << endl;
		textFile << "CONTENT_LENGTH=" << getenv("CONTENT_LENGTH") << endl;

		// write the query string to the file
		textFile << "QUERY_STRING=" << query_string << endl;

		// write misc. CGI environment pieces
		textFile << "AUTH_TYPE=" << getAuthType() << endl;
		textFile << "GATEWAY_INTERFACE=" << getGatewayInterface() << endl;
		textFile << "HTTP_ACCEPT=" << getHTTPAccept() << endl;
		textFile << "HTTP_ACCEPT_ENCODING=" << getHTTPAcceptEncoding() << endl;
		textFile << "HTTP_ACCEPT_LANGUAGE=" << getHTTPAcceptLanguage() << endl;
		textFile << "HTTP_CONNECTION=" << getHTTPConnection() << endl;
		textFile << "HTTP_REFERER=" << getHTTPReferer() << endl;
		textFile << "HTTP_USER_AGENT=" << getHTTPUserAgent() << endl;
		textFile << "REMOTE_HOST=" << getRemoteHost() << endl;
		textFile << "REMOTE_ADDRESS=" << getRemoteAddress() << endl;
		textFile << "REMOTE_PORT=" << getRemotePort() << endl;
		textFile << "REQUEST_URI=" << getRequestURI() << endl;
		textFile << "SCRIPT_NAME=" << getScriptName() << endl;
		textFile << "SERVER_ADMIN=" << getServerAdmin() << endl;
		textFile << "SERVER_NAME=" << getServerName() << endl;
		textFile << "SERVER_PORT=" << getServerPort() << endl;
		textFile << "SERVER_PROTOCOL=" << getServerProtocol() << endl;
		textFile << "SERVER_SOFTWARE=" << getServerSoftware() << endl;
	}

	// close the file
	file.close();

}
示例#3
0
void CurlClient::connect(const std::string& host, uint16_t port)
{
    LOG(INFO) << "connect !";
	//folly::EventBase* evb = folly::EventBaseManager::get()->getEventBase();
	HHWheelTimer::UniquePtr timer{
	    new HHWheelTimer(
	    	evb_,
	        std::chrono::milliseconds(HHWheelTimer::DEFAULT_TICK_INTERVAL),
	        AsyncTimeout::InternalEnum::NORMAL,
	        std::chrono::milliseconds(50000))};
	timer_ = std::move(timer);
	connector_ = std::make_shared<proxygen::HTTPConnector>(this, timer_.get());
	//URL url("https://newapi.mogujie.com/gw/mwp.Petstore.helloworld/2");
    URL url("https://newapi.mogujie.com/gw/mwp.PetStore.helloWorld/2/?data=123");
	SocketAddress addr(url.getHost(), url.getPort(), true);
	static const AsyncSocket::OptionMap opts{{{SOL_SOCKET, SO_REUSEADDR}, 1}};
	connector_->connectSSL(
		evb_, addr, getSSLContext(), nullptr,
	      std::chrono::milliseconds(1000), opts,
	      folly::AsyncSocket::anyAddress(), getServerName());
    LOG(INFO) << "after connect!";
    std::cout << "after connect!";
}
示例#4
0
/** Sets the loaded values to the given server configuration
  *
  * The given ServerConfiguration pointer \b must be valid.
  *
  * \param sc The ServerConfiguration structure pointer
  *
  * \return \c true if the operation successed
  *
  */
bool RainbruRPG::Server::xmlServerConf::load(ServerConfiguration* sc){
  LOGI("Getting saved server configuration :");

  LOGCATS("  name : '");
  LOGCATS( getServerName() );
  LOGCATS("'");
  LOGCAT();

  LOGCATS("  desc : '");
  LOGCATS( getServerDesc() );
  LOGCATS("'");
  LOGCAT();

  LOGCATS("  technote : '");
  LOGCATS( getTechNote() );
  LOGCATS("'");
  LOGCAT();

  LOGCATS("  Playmode : '");
  LOGCATB( getPlayMode() );
  LOGCATS("'");
  LOGCAT();

  LOGCATS("  Editmode : '");
  LOGCATB( getEditMode() );
  LOGCATS("'");
  LOGCAT();

  LOGCATS("  Floodmode : '");
  LOGCATB( getFloodMode() );
  LOGCATS("'");
  LOGCAT();

  LOGCATS("  Port : '");
  LOGCATI( getPort() );
  LOGCATS("'");
  LOGCAT();

  LOGCATS("  MaxClient : '");
  LOGCATI( getMaxClient() );
  LOGCATS("'");
  LOGCAT();

  LOGCATS("  Type : '");
  LOGCATI( getType());
  LOGCATS("'");
  LOGCAT();

  // Database debug
  LOGCATS("  dbHostName : '");
  LOGCATS( getDbHostName().c_str() );
  LOGCATS("'");
  LOGCAT();

  LOGCATS("  DbName : '");
  LOGCATS( getDbName().c_str() );
  LOGCATS("'");
  LOGCAT();

  LOGCATS(" DbUserName  : '******'");
  LOGCAT();

  LOGCATS(" DbUserPwd  : '");
  LOGCATS( getDbUserPwd().c_str() );
  LOGCATS("'");
  LOGCAT();

  sc->setName(getServerName());
  sc->setDesc(getServerDesc());
  sc->setType(getType());
  sc->setTechNote(getTechNote());
  sc->setPlayMode(getPlayMode());
  sc->setEditMode(getEditMode());
  sc->setFloodMode(getFloodMode());
  sc->setPort(getPort());
  sc->setFtpPort(getFtpPort());
  sc->setMaxClient(getMaxClient());
  sc->setIpAdress(getIpAdress());
  //database values
  sc->setHostName(getDbHostName().c_str());
  sc->setDatabaseName(getDbName().c_str());
  sc->setUserName(getDbUserName().c_str());
  sc->setPassword(getDbUserPwd().c_str());
}
示例#5
0
int CSettings::getServerID()
{
	return _EngineList->GetUploadEngineIndex(getServerName());
}