Commit f890c388 authored by baire's avatar baire
Browse files

dump a warning and the raw message if the codec is unable to decode a message

parent b0c488f5
Loading
Loading
Loading
Loading
+29 −1
Original line number Diff line number Diff line
@@ -1860,22 +1860,50 @@ void msgname::PostDecodeField (int id, Buffer& buffer) throw (DecodeError) \
	} \
}

SIP_MESSAGE_CODET (Response);
#define SIP_MESSAGE_CODET_ERROR(msgname) \
void msgname::PostDecode (Buffer& buffer, DecodeError& e) throw (DecodeError) \
{ \
	std::cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; \
	std::cerr << "!!! received an invalid SIP message !!!" << std::endl; \
	std::cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; \
	e.Dump(std::cerr); \
	std::cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; \
	std::cerr.write (reinterpret_cast<const char*>(buffer.GetValueBin()), buffer.GetLength()/8); \
	std::cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; \
}

SIP_MESSAGE_CODET (Response)
SIP_MESSAGE_CODET_ERROR (Response)
SIP_MESSAGE_CODET (Request)
SIP_MESSAGE_CODET_ERROR (Request)
SIP_MESSAGE_CODET (REGISTER_Request)
SIP_MESSAGE_CODET_ERROR (REGISTER_Request)
SIP_MESSAGE_CODET (INVITE_Request)
SIP_MESSAGE_CODET_ERROR (INVITE_Request)
SIP_MESSAGE_CODET (OPTIONS_Request)
SIP_MESSAGE_CODET_ERROR (OPTIONS_Request)
SIP_MESSAGE_CODET (BYE_Request)
SIP_MESSAGE_CODET_ERROR (BYE_Request)
SIP_MESSAGE_CODET (CANCEL_Request)
SIP_MESSAGE_CODET_ERROR (CANCEL_Request)
SIP_MESSAGE_CODET (ACK_Request)
SIP_MESSAGE_CODET_ERROR (ACK_Request)
SIP_MESSAGE_CODET (PRACK_Request)
SIP_MESSAGE_CODET_ERROR (PRACK_Request)
SIP_MESSAGE_CODET (NOTIFY_Request)
SIP_MESSAGE_CODET_ERROR (NOTIFY_Request)
SIP_MESSAGE_CODET (SUBSCRIBE_Request)
SIP_MESSAGE_CODET_ERROR (SUBSCRIBE_Request)
SIP_MESSAGE_CODET (PUBLISH_Request)
SIP_MESSAGE_CODET_ERROR (PUBLISH_Request)
SIP_MESSAGE_CODET (UPDATE_Request)
SIP_MESSAGE_CODET_ERROR (UPDATE_Request)
SIP_MESSAGE_CODET (REFER_Request)
SIP_MESSAGE_CODET_ERROR (REFER_Request)
SIP_MESSAGE_CODET (MESSAGE_Request)
SIP_MESSAGE_CODET_ERROR (MESSAGE_Request)
SIP_MESSAGE_CODET (INFO_Request)
SIP_MESSAGE_CODET_ERROR (INFO_Request)

void MessageBody::PreDecode (Buffer& buffer) throw (DecodeError)
{