Commit ea1b4303 authored by urbant's avatar urbant
Browse files

decoding support for RFC 3323

parent e921cc9b
Loading
Loading
Loading
Loading
+30 −5
Original line number Diff line number Diff line
@@ -191,14 +191,24 @@ bool is_tel_scheme (const char * pszScheme) {
#define SIPREG_M_PARAMETER	SIPREG_TOKEN SIPREG_EQUAL "(?:" SIPREG_TOKEN "|" SIPREG_QUOTED_STRING ")"


bool detect_comma(Buffer & buffer) throw (DecodeError)
bool detect_separator(Regex & reg_separator, Buffer & buffer)
{
	Regex reg_comma ("^" SIPREG_COMMA);
	bool bRes;
	if (bRes = reg_comma.Match(buffer))
		reg_comma.MovePast(buffer);
	if (bRes = reg_separator.Match(buffer))
		reg_separator.MovePast(buffer);
	return bRes;
}
bool detect_comma(Buffer & buffer)
{
	Regex reg_comma ("^" SIPREG_COMMA);
	return detect_separator(reg_comma, buffer);
}

bool detect_semi(Buffer & buffer) throw (DecodeError)
{
	Regex reg_semi ("^" SIPREG_SEMI);
	return detect_separator(reg_semi, buffer);
}

void SipUrl::PreDecodeField (int id, Buffer& buffer) throw (DecodeError)
{
@@ -742,7 +752,7 @@ private:
		SIP_HEADER_ADD (Event,		o,	event,		EVENT_E);
		SIP_HEADER_ADD (Subscription-State,		,	subscriptionState,	SUBSCRIPTION_STATE_E);
		SIP_HEADER_ADD (P-Media-Authorization,	,	pMediaAuthorization,	P_MEDIA_AUTHORIZATION_E);
		
		SIP_HEADER_ADD (Privacy,	,	privacy,	PRIVACY_E);
		{
			mEntries.push_back(Entry("", "", MessageHeader::id_undefinedHeader_List, ""));
			Entry& e = *mEntries.rbegin();
@@ -2106,4 +2116,19 @@ void PMediaAuthorization_List::PostDecodeField (int id, Buffer& buffer) throw (D
		SetHypSize (-2);
}

void PrivacyValue_List::PreDecodeField (int id, Buffer& buffer) throw (DecodeError)
{
	static Regex reg_privacy ("^" SIPREG_TOKEN);
	reg_privacy.AssertMatch (buffer, this);
	SetHypFieldLength (reg_privacy.GetMatchedLength());
}

void PrivacyValue_List::PostDecodeField (int id, Buffer& buffer) throw (DecodeError)
{
	if (detect_semi (buffer))
		SetHypSize (GetSize() + 1);
	else
		SetHypSize (-2);
}

}} // namespaces