Loading codec/c++/sip_codets.cpp +33 −14 Original line number Diff line number Diff line Loading @@ -192,6 +192,24 @@ bool decode_comma_separated(RecordOfSetOf * pRecordOf, Buffer & buffer) throw (D return true; } int detect_comma(RecordOfSetOf * pRecordOf, Buffer & buffer) throw (DecodeError) { static Regex reg_separator ("^" SIPREG_COMMA); static Regex reg_content ("^" SIPREG_ASCII_WITHOUT_COMMA); if (!buffer.GetBitsLeft()) return -1; bool bSeparated = reg_separator.Match(buffer); if (bSeparated) buffer.SetPosition(buffer.GetPosition() + reg_separator.GetMatchedLength()); if (pRecordOf->GetSize() == 0 || bSeparated) { reg_content.AssertMatch(buffer, pRecordOf); return reg_content.GetMatchedLength(); } return -1; } void SipUrl::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { Loading Loading @@ -682,6 +700,8 @@ private: SIP_HEADER_ADD (Authorization, , authorization, AUTHORIZATION_E); SIP_HEADER_ADD (Call-Info, , callInfo, CALL_INFO_E); SIP_HEADER_ADD (Content-Disposition, , contentDisposition, CONTENT_DISPOSITION_E); SIP_HEADER_ADD (Content-Encoding, , contentEncoding, CONTENT_ENCODING_E); SIP_HEADER_ADD (Content-Language, , contentLanguage, CONTENT_LANGUAGE_E); { mEntries.push_back(Entry("", "", MessageHeader::id_undefinedHeader_List, "")); Entry& e = *mEntries.rbegin(); Loading Loading @@ -946,19 +966,10 @@ void AcceptEncoding::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) void ContentCoding_List::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_separator ("^" SIPREG_COMMA); static Regex reg_content ("^" SIPREG_ASCII_WITHOUT_COMMA); if (!buffer.GetBitsLeft()) return; bool bSeparated = reg_separator.Match(buffer); if (bSeparated) buffer.SetPosition(buffer.GetPosition() + reg_separator.GetMatchedLength()); if (GetSize() == 0 || bSeparated) { reg_content.AssertMatch(buffer, this); SetHypFieldLength(reg_content.GetMatchedLength()); } else int nRes = detect_comma(this, buffer); if (nRes >= 0) SetHypFieldLength(nRes); else SetHypSize(-2); } Loading Loading @@ -1061,7 +1072,7 @@ void Allow::PreDecodeField (int id, Buffer& buffer) throw (DecodeError){ void Method_List::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_separator ("^" SIPREG_COMMA); static Regex reg_content ("^[]" SIPREG_TOKEN); static Regex reg_content ("^" SIPREG_TOKEN); if (!buffer.GetBitsLeft()) return; Loading Loading @@ -1166,6 +1177,14 @@ void ContentDisposition::PreDecodeField (int id, Buffer& buffer) throw (DecodeEr } } void LanguageTag_List::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { int nRes = detect_comma(this, buffer); if (nRes >= 0) SetHypFieldLength(nRes); else SetHypSize(-2); } void NameAddr::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { Loading Loading
codec/c++/sip_codets.cpp +33 −14 Original line number Diff line number Diff line Loading @@ -192,6 +192,24 @@ bool decode_comma_separated(RecordOfSetOf * pRecordOf, Buffer & buffer) throw (D return true; } int detect_comma(RecordOfSetOf * pRecordOf, Buffer & buffer) throw (DecodeError) { static Regex reg_separator ("^" SIPREG_COMMA); static Regex reg_content ("^" SIPREG_ASCII_WITHOUT_COMMA); if (!buffer.GetBitsLeft()) return -1; bool bSeparated = reg_separator.Match(buffer); if (bSeparated) buffer.SetPosition(buffer.GetPosition() + reg_separator.GetMatchedLength()); if (pRecordOf->GetSize() == 0 || bSeparated) { reg_content.AssertMatch(buffer, pRecordOf); return reg_content.GetMatchedLength(); } return -1; } void SipUrl::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { Loading Loading @@ -682,6 +700,8 @@ private: SIP_HEADER_ADD (Authorization, , authorization, AUTHORIZATION_E); SIP_HEADER_ADD (Call-Info, , callInfo, CALL_INFO_E); SIP_HEADER_ADD (Content-Disposition, , contentDisposition, CONTENT_DISPOSITION_E); SIP_HEADER_ADD (Content-Encoding, , contentEncoding, CONTENT_ENCODING_E); SIP_HEADER_ADD (Content-Language, , contentLanguage, CONTENT_LANGUAGE_E); { mEntries.push_back(Entry("", "", MessageHeader::id_undefinedHeader_List, "")); Entry& e = *mEntries.rbegin(); Loading Loading @@ -946,19 +966,10 @@ void AcceptEncoding::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) void ContentCoding_List::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_separator ("^" SIPREG_COMMA); static Regex reg_content ("^" SIPREG_ASCII_WITHOUT_COMMA); if (!buffer.GetBitsLeft()) return; bool bSeparated = reg_separator.Match(buffer); if (bSeparated) buffer.SetPosition(buffer.GetPosition() + reg_separator.GetMatchedLength()); if (GetSize() == 0 || bSeparated) { reg_content.AssertMatch(buffer, this); SetHypFieldLength(reg_content.GetMatchedLength()); } else int nRes = detect_comma(this, buffer); if (nRes >= 0) SetHypFieldLength(nRes); else SetHypSize(-2); } Loading Loading @@ -1061,7 +1072,7 @@ void Allow::PreDecodeField (int id, Buffer& buffer) throw (DecodeError){ void Method_List::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_separator ("^" SIPREG_COMMA); static Regex reg_content ("^[]" SIPREG_TOKEN); static Regex reg_content ("^" SIPREG_TOKEN); if (!buffer.GetBitsLeft()) return; Loading Loading @@ -1166,6 +1177,14 @@ void ContentDisposition::PreDecodeField (int id, Buffer& buffer) throw (DecodeEr } } void LanguageTag_List::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { int nRes = detect_comma(this, buffer); if (nRes >= 0) SetHypFieldLength(nRes); else SetHypSize(-2); } void NameAddr::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { Loading