Пример #1
0
void RC4EAPOL::write_body(OutputMemoryStream& stream) {
    if (key_.size()) {
        header_.key_length = Endian::host_to_be(static_cast<uint16_t>(key_.size()));
    }
    stream.write(header_);
    stream.write(key_.begin(), key_.end());
}
Пример #2
0
void RSNEAPOL::write_body(OutputMemoryStream& stream) {
    if (key_.size()) {
        if (!header_.key_t && header_.install) {
            header_.key_length = Endian::host_to_be<uint16_t>(32);
            wpa_length(static_cast<uint16_t>(key_.size()));
        }
        else if (key_.size()) {
            wpa_length(static_cast<uint16_t>(key_.size()));
        }
    }
    stream.write(header_);
    stream.write(key_.begin(), key_.end());
}
Пример #3
0
Word BURGER_API Burger::Perforce::RevertIfUnchanged(const char *pFilename)
{
	Word uResult = Init();
	if (!uResult) {
		Filename Translate(pFilename);
		String Parameters("-s revert -a \"",Translate.GetNative(),"\"");
		OutputMemoryStream Capture;
		// Issue the command to Perforce
		uResult = static_cast<Word>(Globals::ExecuteTool(m_PerforceFilename.GetPtr(),Parameters.GetPtr(),&Capture));
		if (!uResult) {
			// If the filename was not found (An error)
			// it only mentions it in the stderr text. Detect it
			Capture.Save(&Parameters);
			const char *pHit = StringString(Parameters.GetPtr(),"error:");
			if (pHit) {
				// An error had occurred!
				uResult = 10;
			}
		}
	}
	return uResult;
}
Пример #4
0
void Dot11AssocRequest::write_fixed_parameters(OutputMemoryStream& stream) {
    stream.write(body_);
}
Пример #5
0
void Dot11Disassoc::write_fixed_parameters(OutputMemoryStream& stream) {
    stream.write(body_);
}
Пример #6
0
void Dot11ReAssocResponse::write_fixed_parameters(OutputMemoryStream& stream) {
    stream.write(body_);
}
Пример #7
0
static Word TestDeflateCompress(void)
{
	Word uFailure = FALSE;

	// Perform a simple Compression test and test for buffer overrun
	CompressDeflate *pTester = new CompressDeflate;

	Compress::eError Error = pTester->Process(RawData,sizeof(RawData));
	if (Error!=Compress::COMPRESS_OKAY) {
		ReportFailure("CompressDeflate::Process(RawData,sizeof(RawData)) = %d, expected Compress::COMPRESS_OKAY",TRUE,Error);
		uFailure = TRUE;
	}
	Error = pTester->Finalize();
	if (Error!=Compress::COMPRESS_OKAY) {
		ReportFailure("CompressDeflate::Finalize() = %d, expected Compress::COMPRESS_OKAY",TRUE,Error);
		uFailure = TRUE;
	}
	if (pTester->GetOutputSize()!=sizeof(DeflateCompressed)) {
		ReportFailure("CompressDeflate::GetOutputSize() = %u, expected %u",TRUE,static_cast<Word>(pTester->GetOutputSize()),static_cast<Word>(sizeof(DeflateCompressed)));
		uFailure = TRUE;
	}
	OutputMemoryStream *pOutput = pTester->GetOutput();
	if (pOutput->Compare(DeflateCompressed,sizeof(DeflateCompressed))) {
		ReportFailure("CompressDeflate::GetOutput() data mismatch",TRUE);
		uFailure = TRUE;
	}

	// Perform test where the Compression is bisected by decompression buffer

	WordPtr uSplit = 0;
	do {
		pTester->Init();
		Error = pTester->Process(RawData,uSplit);
		if (Error!=Compress::COMPRESS_OKAY) {
			NumberStringHex Hex(static_cast<Word32>(uSplit),LEADINGZEROS+4);
			ReportFailure("CompressDeflate::Process(RawData,0x%s) = %d, expected Compress::COMPRESS_OKAY",TRUE,Hex.GetPtr(),Error);
			uFailure = TRUE;
		}
		Error = pTester->Process(RawData+uSplit,sizeof(RawData)-uSplit);
		if (Error!=Compress::COMPRESS_OKAY) {
			NumberStringHex Hex(static_cast<Word32>(uSplit),LEADINGZEROS+4);
			ReportFailure("CompressDeflate::Process(RawData+0x%s,sizeof(RawData)-0x%s) = %d, expected Compress::COMPRESS_OKAY",TRUE,Hex.GetPtr(),Hex.GetPtr(),Error);
			uFailure = TRUE;
		}
		Error = pTester->Finalize();
		if (Error!=Compress::COMPRESS_OKAY) {
			ReportFailure("CompressDeflate::Finalize(uSplit %04X) = %d, expected Compress::COMPRESS_OKAY",TRUE,static_cast<Word32>(uSplit),Error);
			uFailure = TRUE;
		}
		if (pTester->GetOutputSize()!=sizeof(DeflateCompressed)) {
			ReportFailure("CompressDeflate::GetOutputSize(uSplit %04X) = %u, expected %u",TRUE,static_cast<Word32>(uSplit),static_cast<Word>(pTester->GetOutputSize()),static_cast<Word>(sizeof(DeflateCompressed)));
			uFailure = TRUE;
		}
		pOutput = pTester->GetOutput();
		if (pOutput->Compare(DeflateCompressed,sizeof(DeflateCompressed))) {
			ReportFailure("CompressDeflate::GetOutput(uSplit %04X) data mismatch",TRUE,static_cast<Word32>(uSplit));
			uFailure = TRUE;
		}
	} while (++uSplit<sizeof(RawData));

	// Perform single byte output

	uSplit = 0;
	pTester->Init();
	do {
		Error = pTester->Process(RawData+uSplit,1);
		if (Error!=Compress::COMPRESS_OKAY) {
			NumberStringHex Hex(static_cast<Word32>(uSplit),LEADINGZEROS+4);
			ReportFailure("CompressDeflate::Process(RawData+0x%s,1) = %d, expected Compress::COMPRESS_OKAY",TRUE,Hex.GetPtr(),Error);
			uFailure = TRUE;
		}
	} while (++uSplit<sizeof(RawData));
	Error = pTester->Finalize();
	if (Error!=Compress::COMPRESS_OKAY) {
		ReportFailure("CompressDeflate::Finalize(uSplit %04X) = %d, expected Compress::COMPRESS_OKAY",TRUE,static_cast<Word32>(uSplit),Error);
		uFailure = TRUE;
	}
	if (pTester->GetOutputSize()!=sizeof(DeflateCompressed)) {
		ReportFailure("CompressDeflate::GetOutputSize(uSplit %04X) = %u, expected %u",TRUE,static_cast<Word32>(uSplit),static_cast<Word>(pTester->GetOutputSize()),static_cast<Word>(sizeof(DeflateCompressed)));
		uFailure = TRUE;
	}
	pOutput = pTester->GetOutput();
	if (pOutput->Compare(DeflateCompressed,sizeof(DeflateCompressed))) {
		ReportFailure("CompressDeflate::GetOutput(uSplit %04X) data mismatch",TRUE,static_cast<Word32>(uSplit));
		uFailure = TRUE;
	}
	delete pTester;
	return uFailure;
}
Пример #8
0
void Dot11Authentication::write_fixed_parameters(OutputMemoryStream& stream) {
    stream.write(body_);
}
Пример #9
0
void IPv6::write_header(const ext_header& header, OutputMemoryStream& stream) {
    const uint8_t length = header.length_field() / 8;
    stream.write(header.option());
    stream.write(length);
    stream.write(header.data_ptr(), header.data_size());
}