/[resiprocate]/main/resip/stack/test/testIdentity.cxx
ViewVC logotype

Diff of /main/resip/stack/test/testIdentity.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 6561 by fluffy, Sat Sep 9 20:41:57 2006 UTC revision 6900 by fluffy, Thu Jan 11 06:59:28 2007 UTC
# Line 1  Line 1 
   
1  #include <cassert>  #include <cassert>
2  #include <fstream>  #include <fstream>
3  #include <ostream>  #include <ostream>
# Line 128  Line 127 
127          ErrLog( << "\n\nStarting test three - conect iden - invite(2) " );          ErrLog( << "\n\nStarting test three - conect iden - invite(2) " );
128    
129        Data txt1 =        Data txt1 =
130    
131  "INVITE sip:Carol@ua2.example.com SIP/2.0\r\n"  "INVITE sip:Carol@ua2.example.com SIP/2.0\r\n"
132  "Via: SIP/2.0/TLS proxy.example.com;branch=z9hG4bK776asdhds\r\n"  "Via: SIP/2.0/TLS proxy.example.com;branch=z9hG4bK776asdhds\r\n"
133  "Via: SIP/2.0/TLS ua1.example.com;branch=z9hG4bKnashds8;received=192.0.2.1\r\n"  "Via: SIP/2.0/TLS ua1.example.com;branch=z9hG4bKnashds8;received=192.0.2.1\r\n"
# Line 135  Line 135 
135  "From: Alice <sip:alice@example.com>;tag=13adc987\r\n"  "From: Alice <sip:alice@example.com>;tag=13adc987\r\n"
136  "Call-ID: 12345600@ua1.example.com\r\n"  "Call-ID: 12345600@ua1.example.com\r\n"
137  "CSeq: 1 INVITE\r\n"  "CSeq: 1 INVITE\r\n"
138  "Max-Forwards: 70\r\n"  "Max-Forwards: 69\r\n"
139  "Date: Thu, 21 Feb 2002 13:02:03 GMT\r\n"  "Date: Thu, 21 Feb 2002 13:02:03 GMT\r\n"
140  "Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, UPDATE\r\n"  "Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, UPDATE\r\n"
141  "Supported: id-change\r\n"  "Supported: from-change\r\n"
142  "Contact: <sip:alice@ua1.example.com>\r\n"  "Contact: <sip:alice@ua1.example.com>\r\n"
143  "Record-Route: <sip:proxy.example.com;lr>\r\n"  "Record-Route: <sip:proxy.example.com;lr>\r\n"
144  "Identity-Info: <https://example.com/example.cer>;alg=rsa-sha1\r\n"  "Identity-Info: <https://example.com/example.cer>;alg=rsa-sha1\r\n"
# Line 151  Line 151 
151  "c=IN IP4 ua1.example.com\r\n"  "c=IN IP4 ua1.example.com\r\n"
152  "t=0 0\r\n"  "t=0 0\r\n"
153  "m=audio 49172 RTP/AVP 0\r\n"  "m=audio 49172 RTP/AVP 0\r\n"
154  "a=rtpmap:0 PCMU/8000\r\n";  "a=rtpmap:0 PCMU/8000\r\n"
155             ;
156          
157            
158        auto_ptr<SipMessage> msg(TestSupport::makeMessage(txt1));        auto_ptr<SipMessage> msg(TestSupport::makeMessage(txt1));
159    
# Line 177  Line 179 
179          ErrLog( << "\n\nStarting test four - connected-id update(8) " );          ErrLog( << "\n\nStarting test four - connected-id update(8) " );
180    
181        Data txt2 =        Data txt2 =
182    
183  "UPDATE sip:Alice@ua1.example.com SIP/2.0\r\n"  "UPDATE sip:Alice@ua1.example.com SIP/2.0\r\n"
184  "Via: SIP/2.0/TLS proxy.example.com;branch=z9hG4bK776asdhdu\r\n"  "Via: SIP/2.0/TLS proxy.example.com;branch=z9hG4bK776asdhdu\r\n"
185  "Via: SIP/2.0/TLS ua2.example.com;branch=z9hG4bKnashdt1;received=192.0.2.3\r\n"  "Via: SIP/2.0/TLS ua2.example.com;branch=z9hG4bKnashdt1;received=192.0.2.3\r\n"
# Line 184  Line 187 
187  "To: Alice <sip:Alice@example.com>;tag=13adc987\r\n"  "To: Alice <sip:Alice@example.com>;tag=13adc987\r\n"
188  "Call-ID: 12345600@ua1.example.com\r\n"  "Call-ID: 12345600@ua1.example.com\r\n"
189  "CSeq: 2 UPDATE\r\n"  "CSeq: 2 UPDATE\r\n"
190  "Max-Forwards: 70\r\n"  "Max-Forwards: 69\r\n"
191  "Date: Thu, 21 Feb 2002 13:02:15 GMT\r\n"  "Date: Thu, 21 Feb 2002 13:02:15 GMT\r\n"
192  "Contact: <sip:Carol@ua2.example.com>\r\n"  "Contact: <sip:Carol@ua2.example.com>\r\n"
193  "Identity-Info: <https://example.com/cert>;alg=rsa-sha1\r\n"  "Identity-Info: <https://example.com/cert>;alg=rsa-sha1\r\n"
194  "Content-Length: 0\r\n"  "Content-Length: 0\r\n"
195           "\r\n";  "\r\n"
196             ;
197          
198                            
199        auto_ptr<SipMessage> msg(TestSupport::makeMessage(txt2));        auto_ptr<SipMessage> msg(TestSupport::makeMessage(txt2));
200                
# Line 214  Line 219 
219    
220    
221     {     {
222          ErrLog( << "\n\nStarting test five - connected-id update(4) " );          ErrLog( << "\n\nStarting test five - connected-id reinvite 6  " );
223    
224        Data txt2 =        Data txt2 =
 "UPDATE sip:alice@ua1.example.com SIP/2.0\r\n"  
 "Via: SIP/2.0/TLS b2bua.example.com;branch=z9hG4bKnashdt1\r\n"  
 "From: Bob <sip:Bob@example.com>;tag=2ge46ab5\r\n"  
 "To: Alice <sip:Alice@example.com>;tag=13adc987\r\n"  
 "Call-ID: 12345600@ua1.example.com\r\n"  
 "CSeq: 2 UPDATE\r\n"  
 "Max-Forwards: 70\r\n"  
 "Date: Thu, 21 Feb 2002 13:02:12 GMT\r\n"  
 "Contact: <sip:xyz@b2bua.example.com>\r\n"  
 "Identity-Info: <https://example.com/cert>;alg=rsa-sha1\r\n"  
 "Content-Length: 0\r\n"  
          "\r\n";  
               
       auto_ptr<SipMessage> msg(TestSupport::makeMessage(txt2));  
225                
       try  
       {  
          const Data& domain = msg->header(h_From).uri().host();  
   
          Data identString = msg->getCanonicalIdentityString();  
           
          msg->header(h_Identity).value() = security->computeIdentity( domain, identString );  
       }  
       catch (Security::Exception& e)  
       {  
          ErrLog (<< "Couldn't add identity header: " << e);  
          msg->remove(h_Identity);  
       }  
        ErrLog( << "base64 identity is " <<  msg->header(h_Identity).value() );  
 }      
     
   
   
    {  
         ErrLog( << "\n\nStarting test six - connected-id reinvite(6) " );  
   
       Data txt2 =  
226  "INVITE sip:alice@ua1.example.com SIP/2.0\r\n"  "INVITE sip:alice@ua1.example.com SIP/2.0\r\n"
227  "Via: SIP/2.0/TLS b2bua.example.com;branch=z9hG4bKnashdxy\r\n"  "Via: SIP/2.0/TLS b2bua.example.com;branch=z9hG4bKnashdxy\r\n"
228  "From: Carol <sip:Carol@example.com>;tag=2ge46ab5\r\n"  "From: Carol <sip:Carol@example.com>;tag=2ge46ab5\r\n"

Legend:
Removed from v.6561  
changed lines
  Added in v.6900

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27