Loading codec/c++/sip_codets.cpp +44 −35 Original line number Diff line number Diff line Loading @@ -218,19 +218,25 @@ void SipUrl::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) reg_colon.AssertMatch(buffer, this); buffer.SetPosition(buffer.GetPosition() + 8); pszScheme = Get_scheme().GetValue(); SetHypFieldIsPresent (id, 0); // user-info is not decoded in case of absoluteURI if (is_sip_scheme(pszScheme) && reg_userinfo.Match (buffer)) { if (is_sip_scheme(pszScheme)) { if (reg_userinfo.Match (buffer)) { SetHypFieldIsPresent (id, 1); SetHypFieldLength (id, reg_userinfo.GetMatchedLength() - 8); } } // telephone numbers are decoded to the userInfo field else if (is_tel_scheme(pszScheme)){ reg_phone.AssertMatch(buffer, this); SetHypFieldIsPresent (id, 1); SetHypFieldLength (id, reg_phone.GetMatchedLength()); } else { SetHypFieldIsPresent (id, 0); else { // absoluteURI if (reg_absolute_uri.Match (buffer)) { SetHypFieldIsPresent (id, 1); SetHypFieldLength(id, reg_absolute_uri.GetMatchedLength()); } } break; Loading @@ -249,15 +255,8 @@ void SipUrl::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) } else { SetHypFieldIsPresent (id, 0); } } else if (is_tel_scheme(pszScheme)) { } else { // tel or absoluteURI SetHypFieldIsPresent(id, 0); } else { // absoluteURI if (reg_absolute_uri.Match (buffer)) { SetHypFieldIsPresent (id, 1); SetHypFieldLength(id, reg_absolute_uri.GetMatchedLength()); } else { SetHypFieldIsPresent (id, 0); } } break; Loading Loading @@ -293,16 +292,31 @@ void SipUrl::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) void UserInfo::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_username ("^([" SIPCHARS_UNRESERVED SIPCHARS_USER_UNRESERVED "]|" SIPREG_ESCAPED ")+:"); static Regex reg_username ("^([" SIPCHARS_UNRESERVED SIPCHARS_USER_UNRESERVED "]|" SIPREG_ESCAPED ")+"); static Regex reg_colon ("^[:]"); static Regex reg_password ("^([&=+$," SIPCHARS_UNRESERVED "]|" SIPREG_ESCAPED ")*"); static Regex reg_absolute_uri ("^" SIPREG_ABSOLUTE_URI); // absoluteURI is mapped into SipUrl.userInfo.userOrTelephoneSubscriber and requires special handling Variable* parent = GetParent(); bool bRequestUri = false; if (parent != NULL) { const char * pszParName = parent->GetTypeName(); if (strcmp(pszParName, "SipUrl") == 0) { SipUrl * pSipUrl = dynamic_cast<SipUrl*>(parent); const char * pszScheme = pSipUrl->Get_scheme().GetValue(); bRequestUri = !is_sip_scheme(pszScheme); } } Regex * pRegex; switch (id) { case id_userOrTelephoneSubscriber: if (reg_username.Match (buffer)) { SetHypFieldLength (id, reg_username.GetMatchedLength() - 8); } pRegex = bRequestUri ? ®_absolute_uri : ®_username; pRegex->AssertMatch (buffer, this); SetHypFieldLength(id, pRegex->GetMatchedLength()); break; case id_password: if(buffer.GetBitsLeft()) { if(!bRequestUri && reg_colon.Match(buffer)) { buffer.SetPosition(buffer.GetPosition() + 8); SetHypFieldIsPresent (id, 1); reg_password.AssertMatch (buffer, this); Loading @@ -316,29 +330,14 @@ void UserInfo::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) void HostPort::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_host ("^" SIPREG_HOST); static Regex reg_absolute_uri ("^" SIPREG_ABSOLUTE_URI); static Regex reg_colon ("^:"); // absoluteURI is mapped into SipUrl.hostPort.host and requires special handling Variable* parent = GetParent(); bool bRequestUri = false; if (parent != NULL) { const char * pszParName = parent->GetTypeName(); if (strcmp(pszParName, "SipUrl") == 0) { SipUrl * pSipUrl = dynamic_cast<SipUrl*>(parent); const char * pszScheme = pSipUrl->Get_scheme().GetValue(); bRequestUri = !is_sip_scheme(pszScheme); } } Regex * pRegex; switch (id) { case id_host: // host is always present SetHypFieldIsPresent(id, 1); pRegex = bRequestUri ? ®_absolute_uri : ®_host; pRegex->AssertMatch (buffer, this); SetHypFieldLength(id, pRegex->GetMatchedLength()); reg_host.AssertMatch (buffer, this); SetHypFieldLength(id, reg_host.GetMatchedLength()); break; case id_portField: Loading Loading @@ -867,13 +866,23 @@ void ContactBody::PreDecode (Buffer& buffer) throw (DecodeError) { static Regex reg_asterisk ("^[*]"); if (reg_asterisk.Match (buffer)) { if (GetChosenId() == id_contactAddresses) throw DecodeError (this, "cannot process wildcard; contactAddresses option is already selected"); SetHypChosenId (id_wildcard); SetHypFieldLength(id_wildcard, 8); } else { if (GetChosenId() == id_wildcard) throw DecodeError (this, "cannot process address list; wildcart option is already selected"); SetHypChosenId (id_contactAddresses); } } void ContactAddress_List::PreDecode (Buffer& buffer) throw (DecodeError) { SetHypSize (GetSize() + 1); SetHypAppend (1); } void ContactAddress_List::PostDecodeField (int id, Buffer& buffer) throw (DecodeError) { if (detect_comma (buffer)) Loading Loading
codec/c++/sip_codets.cpp +44 −35 Original line number Diff line number Diff line Loading @@ -218,19 +218,25 @@ void SipUrl::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) reg_colon.AssertMatch(buffer, this); buffer.SetPosition(buffer.GetPosition() + 8); pszScheme = Get_scheme().GetValue(); SetHypFieldIsPresent (id, 0); // user-info is not decoded in case of absoluteURI if (is_sip_scheme(pszScheme) && reg_userinfo.Match (buffer)) { if (is_sip_scheme(pszScheme)) { if (reg_userinfo.Match (buffer)) { SetHypFieldIsPresent (id, 1); SetHypFieldLength (id, reg_userinfo.GetMatchedLength() - 8); } } // telephone numbers are decoded to the userInfo field else if (is_tel_scheme(pszScheme)){ reg_phone.AssertMatch(buffer, this); SetHypFieldIsPresent (id, 1); SetHypFieldLength (id, reg_phone.GetMatchedLength()); } else { SetHypFieldIsPresent (id, 0); else { // absoluteURI if (reg_absolute_uri.Match (buffer)) { SetHypFieldIsPresent (id, 1); SetHypFieldLength(id, reg_absolute_uri.GetMatchedLength()); } } break; Loading @@ -249,15 +255,8 @@ void SipUrl::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) } else { SetHypFieldIsPresent (id, 0); } } else if (is_tel_scheme(pszScheme)) { } else { // tel or absoluteURI SetHypFieldIsPresent(id, 0); } else { // absoluteURI if (reg_absolute_uri.Match (buffer)) { SetHypFieldIsPresent (id, 1); SetHypFieldLength(id, reg_absolute_uri.GetMatchedLength()); } else { SetHypFieldIsPresent (id, 0); } } break; Loading Loading @@ -293,16 +292,31 @@ void SipUrl::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) void UserInfo::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_username ("^([" SIPCHARS_UNRESERVED SIPCHARS_USER_UNRESERVED "]|" SIPREG_ESCAPED ")+:"); static Regex reg_username ("^([" SIPCHARS_UNRESERVED SIPCHARS_USER_UNRESERVED "]|" SIPREG_ESCAPED ")+"); static Regex reg_colon ("^[:]"); static Regex reg_password ("^([&=+$," SIPCHARS_UNRESERVED "]|" SIPREG_ESCAPED ")*"); static Regex reg_absolute_uri ("^" SIPREG_ABSOLUTE_URI); // absoluteURI is mapped into SipUrl.userInfo.userOrTelephoneSubscriber and requires special handling Variable* parent = GetParent(); bool bRequestUri = false; if (parent != NULL) { const char * pszParName = parent->GetTypeName(); if (strcmp(pszParName, "SipUrl") == 0) { SipUrl * pSipUrl = dynamic_cast<SipUrl*>(parent); const char * pszScheme = pSipUrl->Get_scheme().GetValue(); bRequestUri = !is_sip_scheme(pszScheme); } } Regex * pRegex; switch (id) { case id_userOrTelephoneSubscriber: if (reg_username.Match (buffer)) { SetHypFieldLength (id, reg_username.GetMatchedLength() - 8); } pRegex = bRequestUri ? ®_absolute_uri : ®_username; pRegex->AssertMatch (buffer, this); SetHypFieldLength(id, pRegex->GetMatchedLength()); break; case id_password: if(buffer.GetBitsLeft()) { if(!bRequestUri && reg_colon.Match(buffer)) { buffer.SetPosition(buffer.GetPosition() + 8); SetHypFieldIsPresent (id, 1); reg_password.AssertMatch (buffer, this); Loading @@ -316,29 +330,14 @@ void UserInfo::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) void HostPort::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { static Regex reg_host ("^" SIPREG_HOST); static Regex reg_absolute_uri ("^" SIPREG_ABSOLUTE_URI); static Regex reg_colon ("^:"); // absoluteURI is mapped into SipUrl.hostPort.host and requires special handling Variable* parent = GetParent(); bool bRequestUri = false; if (parent != NULL) { const char * pszParName = parent->GetTypeName(); if (strcmp(pszParName, "SipUrl") == 0) { SipUrl * pSipUrl = dynamic_cast<SipUrl*>(parent); const char * pszScheme = pSipUrl->Get_scheme().GetValue(); bRequestUri = !is_sip_scheme(pszScheme); } } Regex * pRegex; switch (id) { case id_host: // host is always present SetHypFieldIsPresent(id, 1); pRegex = bRequestUri ? ®_absolute_uri : ®_host; pRegex->AssertMatch (buffer, this); SetHypFieldLength(id, pRegex->GetMatchedLength()); reg_host.AssertMatch (buffer, this); SetHypFieldLength(id, reg_host.GetMatchedLength()); break; case id_portField: Loading Loading @@ -867,13 +866,23 @@ void ContactBody::PreDecode (Buffer& buffer) throw (DecodeError) { static Regex reg_asterisk ("^[*]"); if (reg_asterisk.Match (buffer)) { if (GetChosenId() == id_contactAddresses) throw DecodeError (this, "cannot process wildcard; contactAddresses option is already selected"); SetHypChosenId (id_wildcard); SetHypFieldLength(id_wildcard, 8); } else { if (GetChosenId() == id_wildcard) throw DecodeError (this, "cannot process address list; wildcart option is already selected"); SetHypChosenId (id_contactAddresses); } } void ContactAddress_List::PreDecode (Buffer& buffer) throw (DecodeError) { SetHypSize (GetSize() + 1); SetHypAppend (1); } void ContactAddress_List::PostDecodeField (int id, Buffer& buffer) throw (DecodeError) { if (detect_comma (buffer)) Loading