Commit f432215d authored by baire's avatar baire
Browse files

store the message body into the messageBody field and put the raw message into the payload field

parent 1c78be4b
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -1846,13 +1846,16 @@ void ContentType::PreDecodeField (int id, Buffer& buffer) throw (DecodeError)
}

#define SIP_MESSAGE_CODET(msgname) \
void msgname::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) \
void msgname::PostDecodeField (int id, Buffer& buffer) throw (DecodeError) \
{ \
	switch (id) { \
	case id_messageBody: \
	/* TODO: decode SDP payload in messageBody instead of payload */ \
		SetHypFieldIsPresent (id_messageBody, 0); \
		SetHypFieldIsPresent (id_payload, buffer.GetBitsLeft() ? 1 : 0); \
	case id_msgHeader: \
		SetHypFieldIsPresent (id_messageBody, buffer.GetBitsLeft() ? 1 : 0); \
		SetHypFieldIsPresent (id_payload, 0); \
		break; \
	case id_payload: \
		Get_payload().Get_payloadlength().SetValue(buffer.GetLength() / 8); \
		Get_payload().Get_payloadvalue().SetValueBin(buffer.GetValueBin(), buffer.GetLength()); \
		break; \
	} \
}
@@ -1874,6 +1877,12 @@ SIP_MESSAGE_CODET (REFER_Request)
SIP_MESSAGE_CODET (MESSAGE_Request)
SIP_MESSAGE_CODET (INFO_Request)

void MessageBody::PreDecode (Buffer& buffer) throw (DecodeError)
{
	// TODO: decode SDP payload
	SetHypChosenId (id_textplain);
}

void Payload::PreDecode(Buffer& buffer) throw (DecodeError)
{
	// FIXME: this is not very clean