Loading codec/c++/sip_codets.cpp +122 −3 Original line number Diff line number Diff line Loading @@ -721,6 +721,11 @@ private: SIP_HEADER_ADD (Proxy-Authorization, , proxyAuthorization, PROXY_AUTHORIZATION_E); SIP_HEADER_ADD (Reply-To, , replyTo, REPLY_TO_E); SIP_HEADER_ADD (Retry-After, , retryAfter, RETRY_AFTER_E); SIP_HEADER_ADD (Route, , route, ROUTE_E); SIP_HEADER_ADD (Server, , server, SERVER_E); SIP_HEADER_ADD (Supported, , supported, SUPPORTED_E); SIP_HEADER_ADD (Subject, s, subject, SUBJECT_E); SIP_HEADER_ADD (Timestamp, , timestamp, TIMESTAMP_E); { mEntries.push_back(Entry("", "", MessageHeader::id_undefinedHeader_List, "")); Entry& e = *mEntries.rbegin(); Loading Loading @@ -767,7 +772,23 @@ void MessageHeader::PreDecodeField (Buffer& buffer) throw (DecodeError) if (IsPresent(id)) { switch (id) { case id_accept: case id_acceptEncoding: case id_acceptLanguage: case id_alertInfo: case id_allow: case id_authorization: case id_contact: case id_contentEncoding: case id_contentLanguage: case id_errorInfo: case id_inReplyTo: case id_proxyAuthorization: case id_proxyRequire: case id_recordRoute: case id_require: case id_route: case id_supported: case id_unsupported: case id_via: case id_undefinedHeader_List: // these fields can appear multiple times Loading Loading @@ -1459,7 +1480,7 @@ void MimeVersion::PreDecode (Buffer& buffer) throw (DecodeError) } void MimeVersion::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_separator ("^[.]+"); static Regex reg_separator ("^[.]"); if (id == id_minorNumber) { reg_separator.AssertMatch (buffer, this); buffer.SetPosition(buffer.GetPosition() + 8); Loading Loading @@ -1538,6 +1559,50 @@ void RetryAfter::PostDecodeField (int id, Buffer& buffer) throw (DecodeError) } } void Subject::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_summary ("^(" SIPREG_TEXT_UTF8_TRIM ")*"); switch (id) { case id_summary: reg_summary.AssertMatch (buffer, this); SetHypFieldLength (id, reg_summary.GetMatchedLength()); break; } } void ServerVal_List::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_content ("^" SIPREG_TOKEN); reg_content.AssertMatch(buffer, this); SetHypFieldLength(reg_content.GetMatchedLength()); } void ServerVal_List::PostDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_separator ("^" SIPREG_LWS); if (reg_separator.Match (buffer)) { reg_separator.MovePast (buffer); SetHypSize (GetSize() + 1); } else SetHypSize (-2); } void Supported::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_content ("^" SIPREG_TOKEN); switch (id){ case id_optionsTags: if (reg_content.Match (buffer) || Get_optionsTags().GetSize() > 0) SetHypFieldIsPresent(id, 1); else SetHypFieldIsPresent(id, 0); break; } } void NameAddr::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { Loading Loading @@ -1764,13 +1829,28 @@ void OptionTag_List::PreDecode (Buffer& buffer) throw (DecodeError) void OptionTag_List::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_content ("^" SIPREG_TOKEN); bool bMandatory = true; Variable* parent = GetParent(); if (parent != NULL) { const char * pszParName = parent->GetTypeName(); if (strcmp(pszParName, "Supported") == 0) bMandatory = false; } if (bMandatory || GetSize() == 0) reg_content.AssertMatch(buffer, this); else if (!reg_content.Match (buffer)) { SetHypSize (-2); return; } SetHypFieldLength(reg_content.GetMatchedLength()); } void OptionTag_List::PostDecodeField (int id, Buffer& buffer) throw (DecodeError) { if (detect_comma (buffer)) static Regex reg_content ("^" SIPREG_TOKEN); if (detect_comma (buffer) && reg_content.Match (buffer)) SetHypSize (GetSize() + 1); else SetHypSize (-2); Loading Loading @@ -1799,5 +1879,44 @@ void RouteBody::PreDecodeField(int id, Buffer& buffer) throw (DecodeError) } } void Timestamp::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_separator ("^" SIPREG_LWS); switch (id) { case id_timeValue: SetHypFieldIsPresent (id, 1); //always present (mandatory in BNF) break; case id_delay: if (reg_separator.Match (buffer)) { reg_separator.MovePast (buffer); SetHypFieldIsPresent (id, 1); } else SetHypFieldIsPresent (id, 0); break; } } void TimeValue::PreDecode (Buffer& buffer) throw (DecodeError) { Get_majorDigit().SetFormat(Integer::AsciiDecimal); Get_minorDigit().SetFormat(Integer::AsciiDecimal); } void TimeValue::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_separator ("^[.]"); static Regex reg_digits ("^[0-9]+"); switch (id) { case id_minorDigit: SetHypFieldIsPresent (id, 0); if (reg_separator.Match (buffer)) { reg_separator.MovePast( buffer); if (reg_digits.Match (buffer)) SetHypFieldIsPresent(id, 1); } break; } } }} // namespaces Loading
codec/c++/sip_codets.cpp +122 −3 Original line number Diff line number Diff line Loading @@ -721,6 +721,11 @@ private: SIP_HEADER_ADD (Proxy-Authorization, , proxyAuthorization, PROXY_AUTHORIZATION_E); SIP_HEADER_ADD (Reply-To, , replyTo, REPLY_TO_E); SIP_HEADER_ADD (Retry-After, , retryAfter, RETRY_AFTER_E); SIP_HEADER_ADD (Route, , route, ROUTE_E); SIP_HEADER_ADD (Server, , server, SERVER_E); SIP_HEADER_ADD (Supported, , supported, SUPPORTED_E); SIP_HEADER_ADD (Subject, s, subject, SUBJECT_E); SIP_HEADER_ADD (Timestamp, , timestamp, TIMESTAMP_E); { mEntries.push_back(Entry("", "", MessageHeader::id_undefinedHeader_List, "")); Entry& e = *mEntries.rbegin(); Loading Loading @@ -767,7 +772,23 @@ void MessageHeader::PreDecodeField (Buffer& buffer) throw (DecodeError) if (IsPresent(id)) { switch (id) { case id_accept: case id_acceptEncoding: case id_acceptLanguage: case id_alertInfo: case id_allow: case id_authorization: case id_contact: case id_contentEncoding: case id_contentLanguage: case id_errorInfo: case id_inReplyTo: case id_proxyAuthorization: case id_proxyRequire: case id_recordRoute: case id_require: case id_route: case id_supported: case id_unsupported: case id_via: case id_undefinedHeader_List: // these fields can appear multiple times Loading Loading @@ -1459,7 +1480,7 @@ void MimeVersion::PreDecode (Buffer& buffer) throw (DecodeError) } void MimeVersion::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_separator ("^[.]+"); static Regex reg_separator ("^[.]"); if (id == id_minorNumber) { reg_separator.AssertMatch (buffer, this); buffer.SetPosition(buffer.GetPosition() + 8); Loading Loading @@ -1538,6 +1559,50 @@ void RetryAfter::PostDecodeField (int id, Buffer& buffer) throw (DecodeError) } } void Subject::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_summary ("^(" SIPREG_TEXT_UTF8_TRIM ")*"); switch (id) { case id_summary: reg_summary.AssertMatch (buffer, this); SetHypFieldLength (id, reg_summary.GetMatchedLength()); break; } } void ServerVal_List::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_content ("^" SIPREG_TOKEN); reg_content.AssertMatch(buffer, this); SetHypFieldLength(reg_content.GetMatchedLength()); } void ServerVal_List::PostDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_separator ("^" SIPREG_LWS); if (reg_separator.Match (buffer)) { reg_separator.MovePast (buffer); SetHypSize (GetSize() + 1); } else SetHypSize (-2); } void Supported::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_content ("^" SIPREG_TOKEN); switch (id){ case id_optionsTags: if (reg_content.Match (buffer) || Get_optionsTags().GetSize() > 0) SetHypFieldIsPresent(id, 1); else SetHypFieldIsPresent(id, 0); break; } } void NameAddr::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { Loading Loading @@ -1764,13 +1829,28 @@ void OptionTag_List::PreDecode (Buffer& buffer) throw (DecodeError) void OptionTag_List::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_content ("^" SIPREG_TOKEN); bool bMandatory = true; Variable* parent = GetParent(); if (parent != NULL) { const char * pszParName = parent->GetTypeName(); if (strcmp(pszParName, "Supported") == 0) bMandatory = false; } if (bMandatory || GetSize() == 0) reg_content.AssertMatch(buffer, this); else if (!reg_content.Match (buffer)) { SetHypSize (-2); return; } SetHypFieldLength(reg_content.GetMatchedLength()); } void OptionTag_List::PostDecodeField (int id, Buffer& buffer) throw (DecodeError) { if (detect_comma (buffer)) static Regex reg_content ("^" SIPREG_TOKEN); if (detect_comma (buffer) && reg_content.Match (buffer)) SetHypSize (GetSize() + 1); else SetHypSize (-2); Loading Loading @@ -1799,5 +1879,44 @@ void RouteBody::PreDecodeField(int id, Buffer& buffer) throw (DecodeError) } } void Timestamp::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_separator ("^" SIPREG_LWS); switch (id) { case id_timeValue: SetHypFieldIsPresent (id, 1); //always present (mandatory in BNF) break; case id_delay: if (reg_separator.Match (buffer)) { reg_separator.MovePast (buffer); SetHypFieldIsPresent (id, 1); } else SetHypFieldIsPresent (id, 0); break; } } void TimeValue::PreDecode (Buffer& buffer) throw (DecodeError) { Get_majorDigit().SetFormat(Integer::AsciiDecimal); Get_minorDigit().SetFormat(Integer::AsciiDecimal); } void TimeValue::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_separator ("^[.]"); static Regex reg_digits ("^[0-9]+"); switch (id) { case id_minorDigit: SetHypFieldIsPresent (id, 0); if (reg_separator.Match (buffer)) { reg_separator.MovePast( buffer); if (reg_digits.Match (buffer)) SetHypFieldIsPresent(id, 1); } break; } } }} // namespaces