Example #1
0
	bool OnFile(
		OnFileStruct *onFileStruct)
	{
		printf("OnFile: %i. (100%%) %i/%i %s %ib / %ib\n",
			onFileStruct->setID,
			onFileStruct->fileIndex+1,
			onFileStruct->numberOfFilesInThisSet,
			onFileStruct->fileName,
			onFileStruct->byteLengthOfThisFile,
			onFileStruct->byteLengthOfThisSet);


		FILE *fp = fopen(fileCopy.C_String(), "wb");
		fwrite(onFileStruct->fileData, onFileStruct->byteLengthOfThisFile, 1, fp);
		fclose(fp);

		// Make sure it worked
		unsigned int hash1 = SuperFastHashFile(file.C_String());
		if (RakNet::BitStream::DoEndianSwap())
			RakNet::BitStream::ReverseBytesInPlace((unsigned char*) &hash1, sizeof(hash1));
		unsigned int hash2 = SuperFastHashFile(fileCopy.C_String());
		if (RakNet::BitStream::DoEndianSwap())
			RakNet::BitStream::ReverseBytesInPlace((unsigned char*) &hash2, sizeof(hash2));
		RakAssert(hash1==hash2);

		// Return true to have RakNet delete the memory allocated to hold this file.
		// False if you hold onto the memory, and plan to delete it yourself later
		return true;
	}
bool AutopatcherMySQLRepository::GetChangelistSinceDate(const char *applicationName, FileList *addedFiles, FileList *deletedFiles, const char *sinceDate, char currentDate[64])
{
	char query[512];
	if (sinceDate != 0 && strlen(sinceDate)>63)
		return false;
	RakNet::RakString escapedApplicationName = GetEscapedString(applicationName);
	RakNet::RakString escapedSinceDate = GetEscapedString(sinceDate);
	sprintf(query, "SELECT applicationID FROM Applications WHERE applicationName='%s';", escapedApplicationName.C_String());

	int applicationID;
	if (!ExecuteQueryReadInt(query, &applicationID))
	{
		sprintf(lastError,"ERROR: %s not found in UpdateApplicationFiles\n",escapedApplicationName.C_String());
		return false;
	}

	if (sinceDate && sinceDate[0])
		sprintf(query,
		"SELECT filename, fileLength, contentHash, createFile, fileId FROM FileVersionHistory "
		"JOIN (SELECT max(fileId) maxId FROM FileVersionHistory WHERE applicationId=%i AND modificationDate > '%s' GROUP BY fileName) MaxId "
		"ON FileVersionHistory.fileId = MaxId.maxId "
		"ORDER BY filename DESC;", applicationID,escapedSinceDate.C_String());
	else
		sprintf(query,
		"SELECT filename, fileLength, contentHash, createFile, fileId FROM FileVersionHistory "
		"JOIN (SELECT max(fileId) maxId FROM FileVersionHistory WHERE applicationId=%i GROUP BY fileName) MaxId "
		"ON FileVersionHistory.fileId = MaxId.maxId "
		"ORDER BY filename DESC;", applicationID);

	MYSQL_RES * result = 0;
	if (!ExecuteBlockingCommand (query, &result))
		return false;

	MYSQL_ROW row;
	while ((row = mysql_fetch_row (result)) != 0)
	{
		const char * createFileResult = row [3]; 
		const char * hardDriveFilename = row [0];
		if (createFileResult[0]=='1')
		{
			const char * hardDriveHash = row [2]; 
			int fileLength = atoi (row [1]);
			addedFiles->AddFile(hardDriveFilename, hardDriveFilename, hardDriveHash, HASH_LENGTH, fileLength, FileListNodeContext(0,0), false);
		}
		else
		{
			deletedFiles->AddFile(hardDriveFilename,hardDriveFilename,0,0,0,FileListNodeContext(0,0), false);
		}
	}
	mysql_free_result (result);

	char *localTimestamp =GetLocalTimestamp ();
	if (localTimestamp)
		strcpy(currentDate, localTimestamp);;

	return true;
}
Example #3
0
void Rackspace::CreateServer(RakNet::RakString name, RakNet::RakString imageId, RakNet::RakString flavorId)
{
	RakNet::RakString xml(
		"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
		"<server xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" name=\"%s\" imageId=\"%s\" flavorId=\"%s\">"
		"</server>"
		,name.C_String() ,imageId.C_String(), flavorId.C_String());
	AddOperation(RO_CREATE_SERVER, "POST", "servers", xml);
}
Example #4
0
void Rackspace::CreateImage(RakNet::RakString serverId, RakNet::RakString imageName)
{
	RakNet::RakString xml(
		"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
		"<image xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" name=\"%s\" serverId=\"%s\""
		"/>",
		imageName.C_String(),serverId.C_String());

	AddOperation(RO_CREATE_IMAGE, "POST", "images", xml);
}
Example #5
0
void Rackspace::ResizeServer(RakNet::RakString serverId, RakNet::RakString flavorId)
{
	RakNet::RakString xml(
		"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
		"<resize xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" flavorId=\"%s\""
		"/>",
		flavorId.C_String());

	AddOperation(RO_RESIZE_SERVER, "POST", RakNet::RakString("servers/%s/action", serverId.C_String()), xml);
}
Example #6
0
void Rackspace::RebuildServer(RakNet::RakString serverId, RakNet::RakString imageId)
{
	RakNet::RakString xml(
		"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
		"<rebuild xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" imageId=\"%s\""
		"/>",
		imageId.C_String());

	AddOperation(RO_REBUILD_SERVER, "POST", RakNet::RakString("servers/%s/action", serverId.C_String()), xml);
}
Example #7
0
void Rackspace::RebootServer(RakNet::RakString serverId, RakNet::RakString rebootType)
{
	RakNet::RakString xml(
		"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
		"<reboot xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" type=\"%s\""
		"/>",
		rebootType.C_String());

	AddOperation(RO_REBOOT_SERVER, "POST", RakNet::RakString("servers/%s/action", serverId.C_String()), xml);
}
Example #8
0
void Rackspace::UpdateServerNameOrPassword(RakNet::RakString serverId, RakNet::RakString newName, RakNet::RakString newPassword)
{
	if (newName.IsEmpty() && newPassword.IsEmpty())
		return;
	RakNet::RakString xml(
		"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
		"<server xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\""
		);
	if (newName.IsEmpty()==false)
		xml += RakNet::RakString(" name=\"%s\"", newName.C_String());
	if (newPassword.IsEmpty()==false)
		xml += RakNet::RakString(" adminPass=\"%s\"", newPassword.C_String());
	xml += " />";
	AddOperation(RO_UPDATE_SERVER_NAME_OR_PASSWORD, "PUT", RakNet::RakString("servers/%s", serverId.C_String()), xml);
}
Example #9
0
void Network::receive_version(){
    RakNet::BitStream bitstream(packet->data,packet->length,false);
    stat_counter_bytes_received+=bitstream.GetNumberOfBytesUsed();

    RakNet::MessageID type_id;
    bitstream.Read(type_id);

    RakNet::RakString rstring;

    bitstream.ReadCompressed(rstring);
    string game_title=rstring.C_String();

    bitstream.ReadCompressed(rstring);
    string version=rstring.C_String();

    bitstream.ReadCompressed(rstring);
    string checksum=rstring.C_String();

    string our_game_title=engine_interface.game_title;
    if(game_title!=our_game_title){
        Log::add_log("Game mismatch: "+string(packet->systemAddress.ToString(true))+"\nOur game: "+our_game_title+"\nServer game: "+game_title);

        engine_interface.button_events_manager.handle_button_event("stop_game");
        engine_interface.make_notice("Server is running a different game.");
    }
    else{
        string our_version=engine_interface.get_version();
        if(version!=our_version){
            Log::add_log("Version mismatch: "+string(packet->systemAddress.ToString(true))+"\nOur version: "+our_version+"\nServer version: "+version);

            engine_interface.button_events_manager.handle_button_event("stop_game");
            engine_interface.make_notice("Version mismatch with server.");
        }
        else{
            if(checksum.length()>0 && checksum!=CHECKSUM){
                Log::add_log("Checksum mismatch: "+string(packet->systemAddress.ToString(true))+"\nOur checksum: "+CHECKSUM+"\nServer checksum: "+checksum);

                engine_interface.button_events_manager.handle_button_event("stop_game");
                engine_interface.make_notice("Checksum mismatch with server.");
            }
            else{
                engine_interface.get_window("network_connecting")->toggle_on(true,false);

                send_client_data(true);
            }
        }
    }
}
	// client / slave code
	bool DynamicActorReplicaComponent::deserializeConstruction(RakNet::BitStream *constructionBitstream)	{
		RakNet::BitStream& bitStream(*constructionBitstream);
		if (bitStream.GetNumberOfBitsUsed()==0)
			return false;

		RakNet::RakString rakString;
		bitStream.Read(rakString);

#if NL_DYNAMICACTOREPLICA_HAS_SERIALIZE_CONSTRUCTION_LOG
		getReplica()->getPeer()->log(ELogType_Info, "deserializeConstruction %s ", rakString.C_String());
#endif

		setConstructionDictionary(CCJSONConverter::dictionaryFrom(rakString.C_String()));
		createActorSprite(getConstructionDictionary());
		return true;
	}
Example #11
0
void Server::ReadCmd( RakNet::Packet* packet, char* buffer, int bufferSize )
{
	RakNet::RakString rs;
	RakNet::BitStream bsIn( packet->data, packet->length, false );
	bsIn.IgnoreBytes( sizeof( RakNet::MessageID ) );
	bsIn.Read( rs );
	strncpy( buffer, rs.C_String(), bufferSize );
	buffer[bufferSize - 1] = '\0';
	std::string cmd( buffer );
	Client& c = m_network->FindClient( packet->guid );
	int pid = c.idx;
	if( pid == -1 ) return;
	if( cmd.compare( "kill" ) == 0 )
	{
		char buffer[32];
		sprintf( buffer, "%s suicided", c.name );
		Log::Get()->Print( buffer );
		m_network->SendMsg( buffer, m_network->m_peer->GetMyGUID(), false, true );
		GameEvent ge;
		ge.type = GameEvent::PLAYER_SUICIDE;
		ge.id0 = pid;
		Game::FireEvent( ge );
	}

}
void ModifyTrustedIPList_PostgreSQLImpl::Process(void *context)
{
	RakAssert(rankingServer);
	PGresult *result;
	RakNet::RakString query;
	RakNet::RakString paramTypeStr;
	RakNet::RakString valueStr;
	int numParams=0;
	char *paramData[512];
	int paramLength[512];
	int paramFormat[512];

	PostgreSQLInterface::EncodeQueryInput("ip", ip, paramTypeStr, valueStr, numParams, paramData, paramLength, paramFormat, false );

	if (addToList)
	{
		query = "INSERT INTO trustedIPs (ip, gameDbId_primaryKey_fk, gameDbId_secondaryKey_fk) VALUES ($1::text, ";
		query+=FormatString("%i", gameDbId.primaryKey);
		query+=",";
		query+=FormatString("%i", gameDbId.secondaryKey);
		query+=");";

	}
	else
	{
		query = "DELETE FROM trustedIPs where (ip=$1::text);";
	}

	result = PQexecParams(rankingServer->pgConn, query.C_String(),numParams,0,paramData,paramLength,paramFormat,PQEXECPARAM_FORMAT_BINARY);
	dbQuerySuccess=rankingServer->IsResultSuccessful(result, true);
}
void SimpleAnimatedEntity::StatusDeserialize(RakNet::BitStream *stream) {
	SimpleObject::StatusDeserialize(stream);
	RakNet::RakString state;
	if(stream->Read(state))
		_animator->SwitchState(state.C_String());

}
Example #14
0
void characterData::readCharacterData(RakNet::BitStream &data) {
		RakNet::RakString characterName;
		data.Read<RakNet::RakString>(characterName); //Read the ID
		charName = characterName.C_String();

		
		readCharacterCustomization(data); //Read customization components
	}
void TwoWayAuthentication::Hash(char thierNonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH], RakNet::RakString password, char out[HASHED_NONCE_AND_PW_LENGTH])
{
#if LIBCAT_SECURITY==1
	cat::Skein hash;
	if (!hash.BeginKey(HASH_BITS)) return;
	hash.Crunch(thierNonce, TWO_WAY_AUTHENTICATION_NONCE_LENGTH);
	hash.Crunch(password.C_String(), (int) password.GetLength());
	hash.End();
	hash.Generate(out, HASH_BYTES, STRENGTHENING_FACTOR);
#else
	CSHA1 sha1;
	sha1.Update((unsigned char *) thierNonce, TWO_WAY_AUTHENTICATION_NONCE_LENGTH);
	sha1.Update((unsigned char *) password.C_String(), (unsigned int) password.GetLength());
	sha1.Final();
	sha1.GetHash((unsigned char *) out);
#endif
}
Example #16
0
	void PrintStringInBitstream(RakNet::BitStream *bs)
	{
		if (bs->GetNumberOfBitsUsed()==0)
			return;
		RakNet::RakString rakString;
		bs->Read(rakString);
		printf("Receive: %s\n", rakString.C_String());
	}
Example #17
0
	void ACUploadContacts::doWork()
	{
		RakNet::RakString Clientuser = MainServer::Instance().GetUserAdressTable()->GetUser(mpket->guid);
		Common::SendContacts sc(mpket->data , mpket->bitSize);
		for(unsigned int i = 0; i < sc.Contacts.size(); i ++)
		{
			DB::ContactDB::Insert(Clientuser.C_String(),sc.Contacts[i].C_String());
		}
	}
Example #18
0
void loginServer::receiveGameServerConnectionInfo(RakNet::Packet *packet) {//Receive data for connecting to game server
    RakNet::BitStream data(packet->data+sizeof(RakNet::MessageID),packet->length-sizeof(RakNet::MessageID),false);
    unsigned char ticket[8];
    for(char i=0; i<8; i++) {
        data.Read<unsigned char>(ticket[i]); //Read byte of the ticket
    }
    RakNet::RakString connectIP;
    short connectPort;
    data.Read<RakNet::RakString>(connectIP); //Read game server IP
    gameEngine::logger::logStream << "Connecting to server: " << connectIP.C_String() << endl;
    data.Read<short>(connectPort); //Read game serverPort
    //Now we need to try and connect to the game server
    networking::gameServer::parentWorld = networking::loginServer::parentWorld; //Set the parent world to the main menu world
    for(char i=0; i<8; i++) {
        networking::gameServer::ticket[i] = ticket[i]; //Set the ticket data
    }
    networking::gameServer::connect(connectIP.C_String(),connectPort); //Connect
}
Example #19
0
void CFunc2( RakNet::BitStream *bitStream, Packet *packet )
{
	printf("CFunc2 ");
	RakNet::RakString data;
	int offset=bitStream->GetReadOffset();
	bool read = bitStream->ReadCompressed(data);
	RakAssert(read);
	printf("%s\n", data.C_String());
};
Example #20
0
void PlayerChat(RakNet::BitStream * pBitStream, RakNet::Packet * pPacket)
{
	// Get the playerid
	EntityId playerId = (EntityId) pPacket->guid.systemIndex;

	// Read if this is a command
	bool bIsCommand = pBitStream->ReadBit();

	// Read the input
	RakNet::RakString strInput;
	pBitStream->Read(strInput);

	// Is the player active?
	if (CServer::GetInstance()->GetPlayerManager()->DoesExists(playerId))
	{
		// Get a pointer to the player
		CPlayerEntity * pPlayer = CServer::GetInstance()->GetPlayerManager()->GetAt(playerId);

		// Is the pointer valid?
		if (pPlayer)
		{
			// Is this not a command?
			if (!bIsCommand)
			{
				CLogFile::Printf("[chat] %s: %s", pPlayer->GetName().Get(), strInput.C_String());

				// Send the RPC back to other players
				RakNet::BitStream bitStream;
				bitStream.Write(playerId);
				bitStream.Write(strInput);
				CServer::GetInstance()->GetNetworkModule()->Call(GET_RPC_CODEX(RPC_PLAYER_CHAT), &bitStream, HIGH_PRIORITY, RELIABLE_ORDERED, -1, true);
			}
			else
			{
				CLogFile::Printf("[command] %s: %s", pPlayer->GetName().Get(), strInput.C_String());

				CScriptArguments args;
				args.push(strInput);
				args.push(pPlayer->GetScriptPlayer());
				CEvents::GetInstance()->Call("playerCommand", &args, CEventHandler::eEventType::NATIVE_EVENT, nullptr);
			}
		}
	}
}
Example #21
0
void CFunc3( RakNet::BitStream *bitStream, RakNet::BitStream *returnData, Packet *packet )
{
	printf("CFunc3 ");
	RakNet::RakString data;
	int offset=bitStream->GetReadOffset();
	bool read = bitStream->ReadCompressed(data);
	RakAssert(read);
	printf("%s\n", data.C_String());
	returnData->WriteCompressed("CFunc3 returnData");
};
Example #22
0
	virtual void MessageResult(RakNet::Console_SearchRooms *message)
	{
		RakNet::Console_SearchRooms_Steam *msgSteam = (RakNet::Console_SearchRooms_Steam *) message;
		RakNet::RakString msg;
		msgSteam->DebugMsg(msg);
		printf("%s\n", msg.C_String());
		if (msgSteam->roomIds.GetSize()>0)
		{
			lastRoom=msgSteam->roomIds[0];
		}
	}
Example #23
0
void Rackspace::CreateSharedIPGroup(RakNet::RakString name, RakNet::RakString optionalServerId)
{
	RakNet::RakString xml(
		"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
		"<sharedIpGroup xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\" name=\"%s\">", name.C_String());
		if (optionalServerId.IsEmpty()==false)
			xml+=RakNet::RakString("<server id=\"%s\"/>", optionalServerId.C_String());
		xml+="</sharedIpGroup>";

	AddOperation(RO_CREATE_SHARED_IP_GROUP, "POST", "shared_ip_groups", xml);
}
Example #24
0
void PrintFieldColumns(void)
{
	unsigned int colIndex;
	RakNet::RakString columnName;
	RakNet::RakString value;
	for (colIndex=0; colIndex < phpDirectoryServer2->GetFieldCount(); colIndex++)
	{
		phpDirectoryServer2->GetField(colIndex, columnName, value);
		printf("%i. %s\n", colIndex+1, columnName.C_String());
	}
}
Example #25
0
// File RPC's
void NewFile( RakNet::BitStream * pBitStream, RakNet::Packet * pPacket )
{
	// Read the file type
	bool bIsScript;
	pBitStream->Read( bIsScript );

	// Read the file name
	RakNet::RakString strFileName;
	pBitStream->Read( strFileName );

	// Read the file path
	RakNet::RakString strFilePath;
	pBitStream->Read( strFilePath );

	// Read the file checksum
	CFileChecksum fileChecksum;
	pBitStream->Read( (char *)&fileChecksum, sizeof(CFileChecksum) );

	// Add the file to the transfer manager
	pCore->GetFileTransferManager()->Add ( strFileName.C_String (), strFilePath.C_String (), fileChecksum, bIsScript );
}
Example #26
0
void Network::receive_sound(){
    RakNet::BitStream bitstream(packet->data,packet->length,false);
    stat_counter_bytes_received+=bitstream.GetNumberOfBytesUsed();

    RakNet::MessageID type_id;
    bitstream.Read(type_id);

    RakNet::RakString rstring;
    bitstream.ReadCompressed(rstring);

    sound_system.play_sound(rstring.C_String());
}
	void RakNetNetwork::HandlePackets() {
		if (m_Peer != nullptr) {
			RakNet::Packet *packet;

			// Iterate through all incoming packets
			for (packet = m_Peer->Receive(); packet; m_Peer->DeallocatePacket(packet), packet = m_Peer->Receive()) {
				bool valid = true;

				// Log any useful packet that we can log
				switch (packet->data[0]) {
				case ID_CONNECTION_REQUEST_ACCEPTED:
					// World server accepted our connection
					m_Logger.LogInfo("Connection request accepted!");
					m_WorldServerGUID = packet->guid;
					break;
				case (int) GamePacketIDType::ClientLog: {
					// Set up BitStream
					RakNet::BitStream bs(packet->data, packet->length, false);
					bs.IgnoreBytes(sizeof(RakNet::MessageID));

					// Read Logging Level from BitStream
					Utils::LoggingLevel level;
					bs.Read(level);

					// Read String from BitStream
					RakNet::RakString rs;
					bs.Read(rs);

					// Send String to Logger
					char buff[400];
					sprintf_s(buff, 400, "Server: %s", rs.C_String());
					m_Logger.LogLevel(buff, level);
					} break;
				default:
					// Packet not found, gonna mark it invalid for now
					valid = false;
					break;
				}

				// Send Packet to Packet Handlers
				for (IRakNetPacketHandler* packetHandler : m_PacketHandlers)
					valid |= packetHandler->HandlePacket(*packet);

				if (!valid) {
					// Invalid Packet, Log it
					char buff[400];
					sprintf_s(buff, "Message with invalid identifier %i has arrived!", packet->data[0]);
					m_Logger.LogWarning(buff);
				}
			}
		}
	}
Example #28
0
void NetworkEngine::showMessageFromServer(RakNet::Packet * packet )
{
	RakNet::RakString message;
	RakNet::BitStream bsIn(packet->data,packet->length,false);
	bsIn.IgnoreBytes(sizeof(RakNet::MessageID)); //En otros sitios esta como bsIn.IgnoreBytes(1), es lo mismo
	bsIn.Read(message);

	std::string string = message.C_String();
	std::wstring text = std::wstring(string.begin(), string.end());
	const wchar_t *textWchar = text.c_str();
	//En un futuro aparecera en el chat o donde salgan los mensajes pero no estos no son de Debug
	GameManager::getInstance()->getGraphicsEngine()->setDebugText(textWchar);
}
PluginReceiveResult TwoWayAuthentication::OnHashedNonceAndPassword(Packet *packet)
{
	RakNet::BitStream bsIn(packet->data, packet->length, false);
	bsIn.IgnoreBytes(sizeof(MessageID)*2);

	char remoteHashedNonceAndPw[HASHED_NONCE_AND_PW_LENGTH];
	unsigned short requestId;
	bsIn.Read(requestId);
	RakNet::RakString passwordIdentifier;
	bsIn.Read(passwordIdentifier);
	bsIn.ReadAlignedBytes((unsigned char *) remoteHashedNonceAndPw,HASHED_NONCE_AND_PW_LENGTH);

	// Look up used nonce from requestId
	char usedNonce[TWO_WAY_AUTHENTICATION_NONCE_LENGTH];
	if (nonceGenerator.GetNonceById(usedNonce, requestId, packet, true)==false)
		return RR_STOP_PROCESSING_AND_DEALLOCATE;

	DataStructures::HashIndex skhi = passwords.GetIndexOf(passwordIdentifier.C_String());
	if (skhi.IsInvalid()==false)
	{
		char hashedThisNonceAndPw[HASHED_NONCE_AND_PW_LENGTH];
		Hash(usedNonce, passwords.ItemAtIndex(skhi), hashedThisNonceAndPw);
		if (memcmp(hashedThisNonceAndPw, remoteHashedNonceAndPw,HASHED_NONCE_AND_PW_LENGTH)==0)
		{
			// Pass
			RakNet::BitStream bsOut;
			bsOut.Write((MessageID)ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_SUCCESS);
			bsOut.WriteAlignedBytes((const unsigned char*) usedNonce,TWO_WAY_AUTHENTICATION_NONCE_LENGTH);
			bsOut.WriteAlignedBytes((const unsigned char*) remoteHashedNonceAndPw,HASHED_NONCE_AND_PW_LENGTH);
			bsOut.Write(passwordIdentifier);
			SendUnified(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,packet,false);

			// Incoming success, modify packet header to tell user
			PushToUser(ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_SUCCESS, passwordIdentifier, packet);

			return RR_STOP_PROCESSING_AND_DEALLOCATE;
		}
	}

	// Incoming failure, modify arrived packet header to tell user
	packet->data[0]=(MessageID) ID_TWO_WAY_AUTHENTICATION_INCOMING_CHALLENGE_FAILURE;
	
	RakNet::BitStream bsOut;
	bsOut.Write((MessageID)ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_FAILURE);
	bsOut.WriteAlignedBytes((const unsigned char*) usedNonce,TWO_WAY_AUTHENTICATION_NONCE_LENGTH);
	bsOut.WriteAlignedBytes((const unsigned char*) remoteHashedNonceAndPw,HASHED_NONCE_AND_PW_LENGTH);
	bsOut.Write(passwordIdentifier);
	SendUnified(&bsOut,HIGH_PRIORITY,RELIABLE_ORDERED,0,packet,false);

	return RR_CONTINUE_PROCESSING;
}
Example #30
0
RakString HTTPConnection::Read(void)
{
    if (results.IsEmpty())
        return RakString();

    RakNet::RakString resultStr = results.Pop();
    // const char *start_of_body = strstr(resultStr.C_String(), "\r\n\r\n");
    const char *start_of_body = strpbrk(resultStr.C_String(), "\001\002\003%");

    if(start_of_body)
        return RakNet::RakString::NonVariadic(start_of_body);
    else
        return resultStr;
}