Hello,

 

I just committed Peter's patch (I let the current behaviour as the default one) 
and updated the doc accordingly.

Thanks a lot Peter.

 

Regards,

Olivier Boulkroune

 

________________________________

De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Peter Higginson
Envoyé : mercredi 14 février 2007 23:00
À : 'Charles P Wright'; 'Olivier Jacques'
Cc : [EMAIL PROTECTED]; [email protected]; 'Thomas Rosenblatt'
Objet : Re: [Sipp-users] Route and Record-Route...

 

Charles,

 

I took the view that I should not change the current behaviour and I also found 
a very common sequence we had that relied on matching any point in the line - 
so it was best for me to leave the default as it was. (We have many tests that 
pass values from CA to UA using a User-Agent header with Parameter1=xxxxx, 
Parameter2=yyyyy, etc. So we match header="Parameter1" etc. and I did not want 
to find them all and edit them.)

 

The current interpretation of "hdr" is just to look in the rest of the line 
following the match (it is not even limited to the header - SDP is included).

 

If the consensus was to make start_line the default, an easy way is to change 
!= to == and && to || in this statement:


           if ( 0 != ( ptr = xp_get_value((char *)"start_line") ) && 
               0 == strcmp(ptr, "true")) tmpAction.setHeadersOnly(true);
           else tmpAction.setHeadersOnly(false);

 

Regards,

Peter

 

Peter Higginson

Newport Networks Ltd,

Direct line 01494 470694

http://www.newport-networks.com/

________________________________

From: Charles P Wright [mailto:[EMAIL PROTECTED] 
Sent: 14 February 2007 19:56
To: Olivier Jacques
Cc: Peter Higginson; [email protected]; [EMAIL PROTECTED]; 
Thomas Rosenblatt
Subject: Re: [Sipp-users] Route and Record-Route...

 


Peter/Olivier, 

I think instead of adding a start_line attribute, that behavior should be the 
default (as most people probably expect it to work that way). 

Charles 



"Olivier Jacques" <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED] 

02/14/2007 02:15 PM 

To

"Peter Higginson" <[EMAIL PROTECTED]> 

cc

[email protected], Thomas Rosenblatt <[EMAIL PROTECTED]> 

Subject

Re: [Sipp-users] Route and Record-Route...

 

 

 




Peter,

thanks for the heads up, I'll have a look tonight.

Olivier.

On 2/13/07, Peter Higginson < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > 
wrote: 

I did submit these suggested changes a long time ago. Either occurrence or 
start_line would do what you want. (I cannot remember why they did not get
put in the main version - there may have been a good reason.)

Peter

Peter Higginson
Newport Networks Ltd,
Direct line 01494 470694 
http://www.newport-networks.com/

=========================================================================

From: Peter Higginson [mailto: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ]
Sent: 26 August 2005 10:07
To: 'Siddharth Angrish'; '[email protected]'
Subject: RE: [Sipp-users] Query regarding sipp regexp 

Some changes we have made in our local copy to meet this requirement are to
add the following functionality to regexp for the "hdr" matching case:

1)      case_indep="true" to look for a header ignoring case 
2)      occurrence="n" to find the nth occurrence of a header
3)      start_line="true" to look only at start of line

The occurrence option will allow you to set different variables to each of 
the headers you are looking for.

I have also fixed a bug which might crash SIPp for packets longer than 1024
bytes (this may be already incorporated). Note that the current hdr match
looks anywhere in the message and I have left this as the default (with 
start of line as the option).

The code changes are below (I've done them based on the version we use, but
I think they match up with the current versions):

In scenario.cpp, change this section of code: 

           tmpAction.setVarType(CAction::E_VT_REGEXP);
           tmpAction.setActionType(CAction::E_AT_ASSIGN_FROM_REGEXP);

           if(ptr = xp_get_value((char *)"search_in")){
             if(!strcmp(ptr, (char *)"msg")) { 
               tmpAction.setLookingPlace(CAction::E_LP_MSG);
               tmpAction.setLookingChar(NULL);
             } else if (!strcmp(ptr, (char *)"hdr")) {
               if(ptr = xp_get_value((char *)"header")) { 
                 if(strlen(ptr) > 0) {
                   tmpAction.setLookingPlace(CAction::E_LP_HDR);
                   tmpAction.setLookingChar(ptr);
                 } else {
                    tmpAction.setLookingPlace(CAction::E_LP_MSG);
                   tmpAction.setLookingChar(NULL);
                 }

To:

           tmpAction.setVarType(CAction::E_VT_REGEXP);
           tmpAction.setActionType (CAction::E_AT_ASSIGN_FROM_REGEXP);

           // warning - although these are detected for both msg and hdr
           // they are only implemented for search_in="hdr"
           if ( 0 != ( ptr = xp_get_value((char *)"case_indep") ) && 
               0 == strcmp(ptr, "true")) tmpAction.setCaseIndep(true);
           else tmpAction.setCaseIndep(false);

           if ( 0 != ( ptr = xp_get_value((char *)"start_line") ) && 
               0 == strcmp(ptr, "true")) tmpAction.setHeadersOnly(true);
           else tmpAction.setHeadersOnly(false);

           if ( 0 != ( ptr = xp_get_value((char *)"search_in") ) ) { 
             tmpAction.setOccurrence(1);

             if ( 0 == strcmp(ptr, (char *)"msg") ) {
               tmpAction.setLookingPlace(CAction::E_LP_MSG);
               tmpAction.setLookingChar (NULL);
             } else if (!strcmp(ptr, (char *)"hdr")) {
               if ( 0 != ( ptr = xp_get_value((char *)"header") ) ) {
                 if ( 0 < strlen(ptr) ) {
                    tmpAction.setLookingPlace(CAction::E_LP_HDR);
                   tmpAction.setLookingChar(ptr);
                   if (0 != (ptr = xp_get_value((char *)"occurrence"))) {
                     tmpAction.setOccurrence (atol(ptr));
                   }
                 } else {
                   tmpAction.setLookingPlace(CAction::E_LP_MSG);
                   tmpAction.setLookingChar(NULL);
                 }

In actions.hpp, after

   char*          getLookingChar();

Add:
   bool           getCaseIndep();
   int            getOccurrence();
   bool           getHeadersOnly();

After:
   void setAction       (CAction        P_action); 

Add:
   void setCaseIndep    (bool           P_value);
   void setOccurrence   (int            P_value);
   void setHeadersOnly  (bool           P_value);

and after:
     int            M_varId; 

Add:
     bool           M_caseIndep;
     int            M_occurrence;
     bool           M_headersOnly;

In actions.cpp, after:

char*          CAction::getLookingChar()  { return(M_lookingChar);  } 

Add:
bool           CAction::getCaseIndep()    { return(M_caseIndep);    }
int            CAction::getOccurrence()   { return(M_occurrence);    }
bool           CAction::getHeadersOnly()  { return(M_headersOnly);  } 

After:
void CAction::setVarId        (int            P_value)
{ M_varId        = P_value; }

Add:
void CAction::setCaseIndep    (bool           P_value)
{ M_caseIndep    = P_value; }
void CAction::setOccurrence   (int            P_value) 
{ M_occurrence    = P_value; }
void CAction::setHeadersOnly  (bool           P_value)
{ M_headersOnly  = P_value; }

After:
 setCheckIt      ( P_action.getCheckIt()      );

Add:
 setCaseIndep    ( P_action.getCaseIndep()    ); 
 setOccurrence   ( P_action.getOccurrence()   );
 setHeadersOnly  ( P_action.getHeadersOnly()  );

After:
 M_lookingChar  = NULL;

Add:
 M_caseIndep    = false;
 M_occurrence    = 1;
 M_headersOnly  = true; 

After:
 setCheckIt      ( P_action.M_checkIt      );

Add:
 setCaseIndep    ( P_action.M_caseIndep    );
 setOccurrence   ( P_action.M_occurrence   );
 setHeadersOnly  ( P_action.M_headersOnly  ); 

In call.hpp, change:

  void  extractSubMessage(char * msg, char * matchingString, char* result);

To:
  void  extractSubMessage(char * msg, char * matchingString, char* result,
                       bool case_indep, int occurrence, bool headers); 

In call.cpp, change the call to extractSubMessage to become:

                         extractSubMessage
                           (msg,
                            currentAction->getLookingChar(), 
                            msgPart,
                            currentAction->getCaseIndep(),
                            currentAction->getOccurrence(),
                            currentAction->getHeadersOnly()); 

and then replace the existing routine extractSubMessage with this:

void CallContext::extractSubMessage(char * msg, char * matchingString, char*
result,
               bool case_indep, int occurrence, bool headers) { 
 char *ptr, *ptr1;
 int sizeOf;
 int i = 0;
 int len = strlen(matchingString);
 char mat1 = tolower(*matchingString);
 char mat2 = toupper(*matchingString);

 ptr = msg;
 while (*ptr) { 
   if (!case_indep) {
     ptr = strstr(ptr, matchingString);
     if (ptr == NULL) break;
     if (headers == true && ptr != msg && *(ptr-1) != '\n') {
       ++ptr;
       continue; 
     }
   } else {
     if (headers) {
       if (ptr != msg) {
         ptr = strchr(ptr, '\n');
         if (ptr == NULL) break;
         ++ptr;
         if (*ptr == 0) break;
       }
     } else {
       ptr1 = strchr(ptr, mat1);
       ptr = strchr(ptr, mat2);
       if (ptr == NULL) {
         if (ptr1 == NULL) break;
         ptr = ptr1;
       } else {
         if (ptr1 != NULL && ptr1 < ptr) ptr = ptr1; 
       }
     }
     if (strncasecmp(ptr, matchingString, len) != 0) {
       ++ptr;
       continue;
     }
   }
   // here with ptr pointing to a matching string
   if (occurrence <= 1) break; 
   --occurrence;
   ++ptr;
 }

 if(ptr != NULL && *ptr != 0) {
   strncpy(result, ptr+len, MAX_SUB_MESSAGE_LENGTH);
   sizeOf = strlen(result);
   if(sizeOf >= MAX_SUB_MESSAGE_LENGTH) 
       sizeOf = MAX_SUB_MESSAGE_LENGTH-1;
   while((i<sizeOf) && (result[i] != '\n') && (result[i] != '\r'))
       i++;
   result[i] = '\0';
 } else {
   result[0] = '\0'; 
 }
}

Hopefully Olivier will add this to the main version. Let me know of any
issues or problems.

Regards,
Peter


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Thomas
Rosenblatt
Sent: 13 February 2007 09:40 
To: [email protected]
Subject: [Sipp-users] Route and Record-Route...

Hi everyone,

In my sipp scenario, I need to parse Route and Record-Route using 
header="Route" and header="Record-Route".
The problem is that record-route is inserted before route in my SIP
request, so when I use the header="Route", it retrieves the Record-Route 
field...
I've read the source file and it seems that the problem comes out from
xp_get_value and the strstr search.
This comment is added :
// FIXME: potential BUG in parser: we must retrieve full word, 
// so the use of strstr as it is is not enough.
// we should check that the retrieved word is not a piece of another one.


Has somebody fixed it ?

Thank you,

Thomas Rosenblatt.

------------------------------------------------------------------------- 
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo 
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ 
Sipp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sipp-users 



---------------------------------------------------------------------------------------------
This e-mail may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this e-mail in error) 
please 
notify the sender immediately and delete this e-mail. Any unauthorized copying,
disclosure or distribution of the contents in this e-mail is strictly forbidden.
---------------------------------------------------------------------------------------------
 
Newport Networks Limited is registered in England. Registration number 4067591.
Registered office: 6 St. Andrew Street, London EC4A 3LX
---------------------------------------------------------------------------------------------
 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier. 
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 
_______________________________________________
Sipp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sipp-users 



-- 
HP OpenCall Software
http://www.hp.com/go/opencall/ 
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
Sipp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sipp-users

 

________________________________

---------------------------------------------------------------------------------------------
This e-mail may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this e-mail in error) 
please
notify the sender immediately and delete this e-mail. Any unauthorized copying,
disclosure or distribution of the contents in this e-mail is strictly forbidden.
---------------------------------------------------------------------------------------------
Newport Networks Limited is registered in England. Registration number 4067591.
Registered office: 6 St. Andrew Street, London EC4A 3LX
---------------------------------------------------------------------------------------------

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sipp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sipp-users

Reply via email to