Commit 7a6f2865 authored by baire's avatar baire
Browse files

improved the messages displayed

parent f890c388
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ public:
		} else {
			message.append (mStart, mStop);
		}
		message += "'";
		message += "'\n";
		throw DecodeError (v, message);
	}

@@ -452,7 +452,7 @@ void GenericParam::PreDecodeField (int id, Buffer& buffer) throw (DecodeError)

	Variable* parent = GetParent();
	if (parent == NULL)
		throw DecodeError (this, "Parent type cannot be null");
		throw DecodeError (this, "Parent type cannot be null\n");
	const char * pszParName = parent->GetTypeName();
	if (strcmp(pszParName, "SemicolonParam_List") == 0){
		parent = parent->GetParent();
@@ -485,6 +485,7 @@ void GenericParam::PreDecodeField (int id, Buffer& buffer) throw (DecodeError)
	else {
		std::string message ("Unexpected parent type of parameter record: '");
		message += pszParName;
		message += '\n';
		throw DecodeError (this, message);
	}
	
@@ -589,6 +590,7 @@ void Method::Encode (Buffer& buffer) throw (EncodeError)
	if (*(ppMethod[i]) == 0) {
		std::string message ("unsupported enum value '");
		message += val;
		message += '\n';
		throw EncodeError (this, message);
	}

@@ -997,12 +999,12 @@ void ContactBody::PreDecode (Buffer& buffer) throw (DecodeError)
	static Regex reg_asterisk ("^[*]");
	if (reg_asterisk.Match (buffer)) {
		if (GetChosenId() == id_contactAddresses)
			throw DecodeError (this, "cannot process wildcard; contactAddresses option is already selected");
			throw DecodeError (this, "cannot process wildcard; contactAddresses option is already selected\n");
		SetHypChosenId (id_wildcard);
		SetHypFieldLength(id_wildcard, 8);
	} else {
		if (GetChosenId() == id_wildcard)
			throw DecodeError (this, "cannot process address list; wildcart option is already selected");
			throw DecodeError (this, "cannot process address list; wildcart option is already selected\n");
		SetHypChosenId (id_contactAddresses);
	}
}
@@ -1321,12 +1323,12 @@ void Credentials::PreDecode (Buffer& buffer) throw (DecodeError)
	static Regex reg_digest ("^[Dd][Ii][Gg][Ee][Ss][Tt]" SIPREG_LWS);
	if (reg_digest.Match (buffer)) {
		if (GetChosenId() == id_otherResponse)
			throw DecodeError (this, "cannot process digest credentials; otherResponse option is already selected");
			throw DecodeError (this, "cannot process digest credentials; otherResponse option is already selected\n");
		buffer.SetPosition(buffer.GetPosition() + reg_digest.GetMatchedLength());
		SetHypChosenId (id_digestResponse);		
	} else {
		if (GetChosenId() == id_digestResponse)
			throw DecodeError (this, "cannot process custom credentials; digestResponse option is already selected");
			throw DecodeError (this, "cannot process custom credentials; digestResponse option is already selected\n");
		SetHypChosenId (id_otherResponse);
	}
}
@@ -1863,13 +1865,13 @@ void msgname::PostDecodeField (int id, Buffer& buffer) throw (DecodeError) \
#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; \
	std::cerr << "###################################################################################" << std::endl; \
	std::cerr << "###  INVALID SIP MESSAGE RECEIVED                                               ###" << std::endl; \
	std::cerr << "###                                                                             ###" << std::endl; \
	e.Dump(std::cerr); \
	std::cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; \
	std::cerr << "###################################################################################" << std::endl; \
	std::cerr.write (reinterpret_cast<const char*>(buffer.GetValueBin()), buffer.GetLength()/8); \
	std::cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; \
	std::cerr << "###################################################################################" << std::endl; \
}

SIP_MESSAGE_CODET (Response)
@@ -1917,7 +1919,7 @@ void Payload::PreDecode(Buffer& buffer) throw (DecodeError)
	// 	  -> should provide a way to skip a field in the decoder
	int offset=buffer.GetPosition() - Get_payloadlength().GetLength();
	if (offset < 0)
		throw DecodeError (this, "Unable to decode Payload");
		throw DecodeError (this, "Unable to decode Payload\n");
	buffer.SetPosition(offset);
}