Commit c3251c3a authored by baire's avatar baire
Browse files

partial support of UndefinedHeader

parent 806d1977
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -768,5 +768,36 @@ void ViaBody_List::PreDecode (Buffer& buffer) throw (DecodeError)
	SetHypAppend (1);
}

void UndefinedHeader_List::PreDecode (Buffer& buffer) throw (DecodeError)
{
	// we assume that we are decoding one field at onece 
	// multiple fields are handled by successively decoding
	// the via field several times in MessageHeader
	SetHypSize (GetSize() + 1);
	SetHypAppend (1);
}

void UndefinedHeader::PreDecodeField (int id, Buffer& buffer) throw (DecodeError)
{
	static Regex reg_header_name ("^" SIPREG_TOKEN);

	// TODO: match multiple-line extension header value
	static Regex reg_header_value ("^(" SIPREG_HCOLON ")([^\\r\\n]+)");

	switch (id) {
	case id_headerName:
		reg_header_name.AssertMatch (buffer, this);
		SetHypFieldLength (id, reg_header_name.GetMatchedLength());
		break;
	case id_headerValue:
		reg_header_value.AssertMatch (buffer, this);
		buffer.SetPosition(buffer.GetPosition() + reg_header_value.GetMatchedLength(1));
		SetHypFieldLength (id, reg_header_value.GetMatchedLength(2));
		break;
	default:
		;
	}
}


}} // namespaces