• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ LOG_BLOCK函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: switch

bool EnhancedVtoRouter::CheckIncomingVtoData(const VtoData& arData)
{
	switch(arData.GetType()) {
	case(VTODT_DATA):
		if(mInstRemoteConnected) return true;
		else {
			LOG_BLOCK(LEV_WARNING, "Discarding received data, because remote side is offline");
			this->HandleReceivingDataWhenRemoteClosed();
			return false;
		}
	case(VTODT_REMOTE_OPENED):
		if(mInstRemoteConnected) {
			LOG_BLOCK(LEV_WARNING, "Remote side opened, but it was already open");
			this->HandleDuplicateOpen();
			return false;
		}
		else {
			mInstRemoteConnected = true;
			return true;
		}
	case(VTODT_REMOTE_CLOSED):
		if(mInstRemoteConnected) {
			mInstRemoteConnected = false;
			return true;
		}
		else {
			LOG_BLOCK(LEV_WARNING, "Remote side closed, but it was already closed");
			this->HandleDuplicateClose();
			return false;
		}
	default:
		throw ArgumentException(LOCATION, "Unknown VtoData type");
	}
}
开发者ID:AlanMarshall,项目名称:dnp3-1,代码行数:34,代码来源:EnhancedVtoRouter.cpp


示例2: LOG_BLOCK

void MockAppLayer::SendUnsolicited(APDU& arAPDU)
{
	LOG_BLOCK(LEV_COMM, "=> " << toHex(arAPDU.GetBuffer(), arAPDU.Size(), true));
	LOG_BLOCK(LEV_INTERPRET, "=> " << arAPDU.ToString());
	mFragments.push_back(arAPDU);
	this->DoSendUnsol();
}
开发者ID:diverger,项目名称:dnp3,代码行数:7,代码来源:MockAppLayer.cpp


示例3: LOG_BLOCK

void AddressScanner::Run()
{
	mRouter.Start();

	LOG_BLOCK(LEV_INFO, "Scanning from " << mCurrent << " to " << mStop);
	mThread.Run();
	LOG_BLOCK(LEV_INFO, "Scan complete...");
}
开发者ID:PatrickOsborne,项目名称:dnp3,代码行数:8,代码来源:AddressScanner.cpp


示例4: LOG_BLOCK

void PhysicalLayerAsyncTCPClient::DoOpenSuccess()
{
	LOG_BLOCK(LEV_INFO, "Connected to: " << mRemoteEndpoint);
	if (mUseKeepAlives) {
		LOG_BLOCK(LEV_DEBUG, "Enabling keepalives on the socket connection to " << mRemoteEndpoint);
		boost::asio::socket_base::keep_alive option(true);
		mSocket.set_option(option);
	}
}
开发者ID:pjn7,项目名称:dnp3,代码行数:9,代码来源:PhysicalLayerAsyncTCPClient.cpp


示例5: LOG_BLOCK

void AsyncPort::Associate(const std::string& arStackName, AsyncStack* apStack, uint_16_t aLocalAddress)
{
	LOG_BLOCK(LEV_DEBUG, "Linking stack to port: " << aLocalAddress);	
	mStackMap[arStackName] = StackRecord(apStack, aLocalAddress);	
	apStack->mLink.SetRouter(&mRouter);
	mRouter.AddContext(&apStack->mLink, aLocalAddress);
	if(!mRouter.IsRunning()) {
		LOG_BLOCK(LEV_DEBUG, "Starting router");
		mRouter.Start();
	}
}
开发者ID:emezeske,项目名称:dnp3,代码行数:11,代码来源:AsyncPort.cpp


示例6: LOG_BLOCK

void Slave::OnUnsolFailure()
{
	// disable unsol responses until request is received from master
	if (mUnsolExpectCON) {
		LOG_BLOCK(LEV_WARNING, "Disable unsol response");
		mUnsolDisable = true;
	}

	mpState->OnUnsolFailure(this);
	LOG_BLOCK(LEV_WARNING, "Unsol response failure");
	this->FlushDeferredEvents();
}
开发者ID:sentient-energy,项目名称:emsw-opendnp3-mirror,代码行数:12,代码来源:Slave.cpp


示例7: catch

void IOServiceThread::Run()
{
	size_t num = 0;

	try {
		num = mpService->run();
	} catch(IOServiceExitException&) {
		LOG_BLOCK(LEV_INFO, "IOService exited via IOServiceExitException");
	} catch(const std::exception& ex) {
		LOG_BLOCK(LEV_ERROR, "Unexpected exception: " << ex.what());
	}

}
开发者ID:cmavr8,项目名称:dnp3,代码行数:13,代码来源:IOServiceThread.cpp


示例8: cs

size_t VtoWriter::Write(const boost::uint8_t* apData,
                        size_t aLength,
                        boost::uint8_t aChannelId)
{

	size_t num = 0;
	{
		CriticalSection cs(&mLock);

		/*
		 * Only write the maximum amount available or requested.  If the
		 * requested data size is larger than the available buffer space,
		 * only send what will fit.
		 */
		num = Min<size_t>(this->NumBytesAvailable(), aLength);

		/*
		 * Chop up the data into Max(255) segments and add it to the queue.
		 */
		this->Commit(apData, num, aChannelId);

		LOG_BLOCK(LEV_INTERPRET, "VtoWriter: " << this->NumBytesAvailable() << " available out of "
			<< (mMaxVtoChunks * VtoData::MAX_SIZE));
	}

	/* Tell any listeners that the queue has new data to be read. */
	if (num > 0) this->NotifyAll();

	/* Return the number of bytes from apData that were queued. */
	return num;
}
开发者ID:cverges,项目名称:dnp3,代码行数:31,代码来源:VtoWriter.cpp


示例9: switch

void Slave::HandleEnableUnsolicited(const APDU& arRequest, bool aIsEnable)
{
	mResponse.Set(FC_RESPONSE);

	if (mConfig.mDisableUnsol) {
		mRspIIN.SetFuncNotSupported(true);
	}
	else {
		if (aIsEnable) {
			this->mDeferredUnsol = true;
		}

		for (HeaderReadIterator hdr = arRequest.BeginRead(); !hdr.IsEnd(); ++hdr) {

			switch (MACRO_DNP_RADIX(hdr->GetGroup(), hdr->GetVariation())) {
			case (MACRO_DNP_RADIX(60, 2)):
				mConfig.mUnsolMask.class1 = aIsEnable;
				break;

			case (MACRO_DNP_RADIX(60, 3)):
				mConfig.mUnsolMask.class2 = aIsEnable;
				break;

			case (MACRO_DNP_RADIX(60, 4)):
				mConfig.mUnsolMask.class3 = aIsEnable;
				break;

			default:
				mRspIIN.SetFuncNotSupported(true);
				LOG_BLOCK(LEV_WARNING, "Cannot enable/disable unsol for " << hdr->GetBaseObject()->Name());
				break;
			}
		}
	}
}
开发者ID:sentient-energy,项目名称:emsw-opendnp3-mirror,代码行数:35,代码来源:Slave.cpp


示例10: LOG_BLOCK

void AppLayerChannel::ChangeState(ACS_Base* apState)
{
	if(apState != mpState) {
		LOG_BLOCK(LEV_DEBUG, "State changed from " << mpState->Name() << " to " << apState->Name());
		mpState = apState;
	}
}
开发者ID:diverger,项目名称:dnp3,代码行数:7,代码来源:AppLayerChannel.cpp


示例11: LOG_BLOCK

void PhysicalLayerMonitor::_OnLowerLayerUp()
{
	LOG_BLOCK(LEV_DEBUG, "_OnLowerLayerUp");
	this->mCurrentRetry = mMinOpenRetry;
	mpState->OnLayerOpen(this);
	this->OnPhysicalLayerOpenSuccessCallback();
}
开发者ID:AlanMarshall,项目名称:dnp3,代码行数:7,代码来源:PhysicalLayerMonitor.cpp


示例12: LOG_BLOCK

void VtoRouter::CheckForVtoWrite()
{
	if(!mVtoTxBuffer.empty()) {
		VtoMessage msg = mVtoTxBuffer.front();
		mVtoTxBuffer.pop_front();

		// type DATA means this is a buffer and we need to pull the data out and send it to the vto writer
		if(msg.type == VTODT_DATA) {
			size_t numWritten = mpVtoWriter->Write(msg.data.Buffer(), msg.data.Size(), this->GetChannelId());
			LOG_BLOCK(LEV_INTERPRET, "VtoWriter: " << numWritten << " of " << msg.data.Size());
			if(numWritten < msg.data.Size()) {
				size_t remainder = msg.data.Size() - numWritten;
				VtoMessage partial(VTODT_DATA, msg.data.Buffer() + numWritten, remainder);
				mVtoTxBuffer.push_front(partial);
			}
			else this->CheckForVtoWrite();
		}
		else {
			// if we have generated REMOTE_OPENED or REMOTE_CLOSED message we need to send the SetLocalVtoState
			// update to the vtowriter so it can be serialized in the correct order.
			mpVtoWriter->SetLocalVtoState(msg.type == VTODT_REMOTE_OPENED, this->GetChannelId());
			this->CheckForVtoWrite();
		}
	}

	this->CheckForPhysRead();
}
开发者ID:AlanMarshall,项目名称:dnp3,代码行数:27,代码来源:VtoRouter.cpp


示例13: LOG_BLOCK

void PhysicalLayerAsyncBase::OnOpenCallback(const boost::system::error_code& arErr)
{
	if(mState.mOpening) {
		mState.mOpening = false;

		this->DoOpenCallback();

		if(arErr) {
			LOG_BLOCK(LEV_WARNING, arErr.message());
			mState.CheckForClose();
			this->DoOpenFailure();
			if(mpHandler) mpHandler->OnOpenFailure();
		}
		else { // successful connection
			if(this->IsClosing()) { // but the connection was closed
				mState.CheckForClose();
				this->DoClose();
				if(mpHandler) mpHandler->OnOpenFailure();
			}
			else {
				mState.mOpen = true;
				this->DoOpenSuccess();
				if(mpHandler) mpHandler->OnLowerLayerUp();
			}
		}
	}
	else {
		MACRO_THROW_EXCEPTION_COMPLEX(InvalidStateException, "OnOpenCallback: " << this->ConvertStateToString());
	}
}
开发者ID:prakashnsm,项目名称:dnp3-1,代码行数:30,代码来源:PhysicalLayerAsyncBase.cpp


示例14: LOG_BLOCK

void IUpperLayer::OnReceive(const apl::byte_t* apData, size_t aNumBytes)
{
	if(this->LogReceive()) {
		LOG_BLOCK(LEV_COMM, RecvString() << " " << toHex(apData, aNumBytes, true));
	}
	this->_OnReceive(apData, aNumBytes); //call the implementation
}
开发者ID:emezeske,项目名称:dnp3,代码行数:7,代码来源:AsyncLayerInterfaces.cpp


示例15: LOG_BLOCK

void VtoTransmitTask::ConfigureRequest(APDU& arAPDU)
{
	/*
	 *  Masters never request confirmed data. The response from the
	 *  slave is all that's required for reliable delivery.
	 */
	arAPDU.Set(mUseNonStandardCode ? FC_PROPRIETARY_VTO_TRANSFER : FC_WRITE);

	const size_t MAX_VTO_EVENTS = 7;
	/* Get all of the data objects in the buffer. */
	size_t numObjects = this->mBuffer.Select(PC_ALL_EVENTS, MAX_VTO_EVENTS);

	LOG_BLOCK(LEV_INTERPRET, "VtoTransmitTask Sending: " << numObjects << " of " << this->mBuffer.Size());

	/* If there are no objects to write, skip the remainder. */
	if (numObjects == 0) {
		return;
	}

	/*
	 * Loop through the selected data and add corresponding objects to
	 * the arAPDU instance.
	 */
	VtoDataEventIter vto = this->mBuffer.Begin();

	for (size_t i = 0; i < numObjects; ++i) {
		/* Insert a new object into the APDU message. */
		IndexedWriteIterator itr = arAPDU.WriteIndexed(
		                               Group112Var0::Inst(),
		                               vto->mValue.GetSize(),
		                               vto->mIndex
		                           );

		/*
		 * Check to see if the APDU fragment has enough room for the
		 * data segment.  If the fragment is full, return out of this
		 * function and let the fragment send.
		 */
		if (itr.IsEnd()) {
			return;
		}

		/* Set the object index */
		itr.SetIndex(vto->mIndex);

		/* Write the data to the APDU message */
		Group112Var0::Inst()->Write(
		    *itr,
		    vto->mValue.GetSize(),
		    vto->mValue.mpData
		);

		/* Mark the data segment as being written */
		vto->mWritten = true;

		/* Move to the next data segment in the buffer */
		++vto;
	}
}
开发者ID:SandC,项目名称:dnp3,代码行数:59,代码来源:VtoTransmitTask.cpp


示例16: ERROR_BLOCK

bool LinkLayerReceiver::ValidateHeader()
{
	//first thing to do is check the CRC
	if(!DNPCrc::IsCorrectCRC(mBuffer.ReadBuff(), LI_CRC)) {
		mCrcFailures.Increment();
		ERROR_BLOCK(LEV_ERROR, "CRC failure in header", DLERR_CRC);
		return false;
	}

	if(!mHeader.ValidLength()) {
		ERROR_BLOCK(LEV_ERROR, "LENGTH out of range [5,255]: " << static_cast<int>(mHeader.GetLength()), DLERR_INVALID_LENGTH);
		return false;
	}

	LOG_BLOCK(LEV_INTERPRET, "<~ " << mHeader.ToString());

	// some combinations of these header parameters are invalid
	// check for them here

	//Now make sure that the function code is known and that the FCV is appropriate
	if(!this->ValidateFunctionCode()) return false;

	boost::uint8_t user_data_length = mHeader.GetLength() - LS_MIN_LENGTH;
	mFrameSize = LinkFrame::CalcFrameSize(user_data_length);
	FuncCodes func = mHeader.GetFuncEnum();

	// make sure that the presence/absence of user data
	// matches the function code
	if(func == FC_PRI_CONFIRMED_USER_DATA || func == FC_PRI_UNCONFIRMED_USER_DATA) {
		if(user_data_length > 0) {
			//mFrameSize = LinkFrame::CalcFrameSize(user_data_length);
		} else {
			ERROR_BLOCK(LEV_ERROR, "User data packet received with zero payload. FUNCTION: " << func, DLERR_NO_DATA);
			return false;
		}
	} else {
		if(user_data_length > 0) {
			ERROR_BLOCK(LEV_ERROR, "Unexpected LENGTH in frame: " << static_cast<int>(user_data_length) << " with FUNCTION: " << func, DLERR_UNEXPECTED_DATA);
			return false;
		}

	}

	if(user_data_length > 0) {
		if(func == FC_PRI_CONFIRMED_USER_DATA || func == FC_PRI_UNCONFIRMED_USER_DATA) {

		} else {
			ERROR_BLOCK(LEV_ERROR, "Unexpected LENGTH in frame: " << static_cast<int>(user_data_length) << " with FUNCTION: " << func, DLERR_UNEXPECTED_DATA);
			return false;
		}
	} else {
		if(func == FC_PRI_CONFIRMED_USER_DATA || func == FC_PRI_UNCONFIRMED_USER_DATA) {
			ERROR_BLOCK(LEV_ERROR, "User data packet received with zero payload. FUNCTION: " << func, DLERR_NO_DATA);
			return false;
		}
	}

	return true;
}
开发者ID:cmavr8,项目名称:dnp3,代码行数:59,代码来源:LinkLayerReceiver.cpp


示例17: LOG_BLOCK

TaskResult SimpleRspBase::_OnFinalResponse(const APDU& arAPDU)
{
	if(arAPDU.BeginRead().Count() > 0) {
		LOG_BLOCK(LEV_WARNING, "Unexpected object headers in response: " << this->Name());
	}

	return TR_SUCCESS;
}
开发者ID:prakashnsm,项目名称:dnp3-1,代码行数:8,代码来源:MasterTaskBase.cpp


示例18: LOG_BLOCK

void EnhancedVtoRouter::DoVtoRemoteConnectedChanged(bool aOpened)
{
	if(mRemoteConnected != aOpened) {
		LOG_BLOCK(LEV_INFO, "Remote connection: " << GetConnectionString(aOpened));
		mRemoteConnected = aOpened;
		this->HandleVtoRemoteConnectedChanged();
	}
}
开发者ID:AlanMarshall,项目名称:dnp3-1,代码行数:8,代码来源:EnhancedVtoRouter.cpp


示例19: LOG_BLOCK

void Database::_Update(const Binary& arPoint, size_t aIndex)
{
	if(UpdateValue<Binary>(mBinaryVec, arPoint, aIndex)) {
		LOG_BLOCK(LEV_DEBUG, "Binary Change: " << arPoint.ToString() << " Index: " << aIndex);
		BinaryInfo& v = mBinaryVec[aIndex];
		if(mpEventBuffer) mpEventBuffer->Update(v.mValue, v.mClass, aIndex);
	}
}
开发者ID:prakashnsm,项目名称:dnp3-1,代码行数:8,代码来源:Database.cpp


示例20: hs

void AsyncSlaveTestObject::SendToSlave(const std::string& arData, SequenceInfo aSeq)
{
	HexSequence hs(arData);
	mAPDU.Reset();
	mAPDU.Write(hs, hs.Size());
	mAPDU.Interpret();
	LOG_BLOCK(LEV_INTERPRET, "<= " << mAPDU.ToString());
	slave.OnRequest(mAPDU, aSeq);
}
开发者ID:emezeske,项目名称:dnp3,代码行数:9,代码来源:AsyncSlaveTestObject.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LOG_BUF函数代码示例发布时间:2022-05-30
下一篇:
C++ LOG_ASSERT函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap