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

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

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

branches/b-identity-0505/dum/test/testIdentity.cxx revision 4564 by greg, Mon May 9 23:57:12 2005 UTC main/resip/dum/test/testIdentity.cxx revision 8838 by sgodin, Sat Oct 30 00:28:04 2010 UTC
# Line 1  Line 1 
1  #include "resiprocate/dum/ClientAuthManager.hxx"  #include "resip/dum/ClientAuthManager.hxx"
2  #include "resiprocate/dum/ClientRegistration.hxx"  #include "resip/dum/ClientRegistration.hxx"
3  #include "resiprocate/dum/DialogUsageManager.hxx"  #include "resip/dum/DialogUsageManager.hxx"
4  #include "resiprocate/dum/MasterProfile.hxx"  #include "resip/dum/MasterProfile.hxx"
5  #include "resiprocate/dum/Profile.hxx"  #include "resip/dum/Profile.hxx"
6  #include "resiprocate/dum/UserProfile.hxx"  #include "resip/dum/UserProfile.hxx"
7  #include "resiprocate/dum/RegistrationHandler.hxx"  #include "resip/dum/RegistrationHandler.hxx"
8  #include "resiprocate/dum/ClientPagerMessage.hxx"  #include "resip/dum/ClientPagerMessage.hxx"
9  #include "resiprocate/dum/ServerPagerMessage.hxx"  #include "resip/dum/ServerPagerMessage.hxx"
10    
11  #include "resiprocate/dum/DialogUsageManager.hxx"  #include "resip/dum/DialogUsageManager.hxx"
12  #include "resiprocate/dum/AppDialogSet.hxx"  #include "resip/dum/AppDialogSet.hxx"
13  #include "resiprocate/dum/AppDialog.hxx"  #include "resip/dum/AppDialog.hxx"
14  #include "resiprocate/dum/RegistrationHandler.hxx"  #include "resip/dum/RegistrationHandler.hxx"
15  #include "resiprocate/dum/PagerMessageHandler.hxx"  #include "resip/dum/PagerMessageHandler.hxx"
16  #include "resiprocate/PlainContents.hxx"  #include "resip/stack/PlainContents.hxx"
17    
18  #include "resiprocate/external/HttpGetMessage.hxx"  #include "resip/stack/external/HttpGetMessage.hxx"
19  #include "curlHttp/CurlHttpProvider.hxx"  #include "curlHttp/CurlHttpProvider.hxx"
20    
21  #include "resiprocate/os/Log.hxx"  #include "rutil/Log.hxx"
22  #include "resiprocate/os/Logger.hxx"  #include "rutil/Logger.hxx"
23  #include "resiprocate/os/Subsystem.hxx"  #include "rutil/Subsystem.hxx"
24    
25    #ifdef WIN32
26    #include "resip/stack/ssl/WinSecurity.hxx"
27    #endif
28    
29  #include <iostream>  #include <iostream>
30  #include <string>  #include <string>
# Line 66  Line 70 
70           InfoLog( << "ServerPagerMessageHandler::onMessageArrived: "           InfoLog( << "ServerPagerMessageHandler::onMessageArrived: "
71                    << *body << "\n" );                    << *body << "\n" );
72                    
73             const SecurityAttributes *attr = message.getSecurityAttributes();
74             InfoLog( << *attr );
75            
76           _rcvd = true;           _rcvd = true;
77        }        }
78    
# Line 137  Line 144 
144     bool first = true;     bool first = true;
145     NameAddr userAor(argv[1]);     NameAddr userAor(argv[1]);
146     Data passwd(argv[2]);     Data passwd(argv[2]);
    int port = 25060;  
147    
148     InfoLog(<< "user: " << userAor << ", passwd: " << passwd << "\n");     InfoLog(<< "user: " << userAor << ", passwd: " << passwd << "\n");
149    
150     Security* security = new Security("certs");  #ifdef WIN32
151       WinSecurity* security = new WinSecurity;
152     try  #else
153     {     Security* security = new Security;
154        assert(security != 0);  #endif
       security->preload();  
    }  
    catch( ... )  
    {  
       ErrLog( << "Got a exception loading certificates" );  
    }  
155    
156     assert( security );     assert( security );
157    
158     SipStack clientStack(security);     SipStack clientStack(security);
159     DialogUsageManager clientDum(clientStack);     DialogUsageManager clientDum(clientStack);
160     clientDum.addTransport(UDP, port);     clientDum.addTransport(UDP, 0, V4);
161       clientDum.addTransport(TCP, 0, V4);
162       clientDum.addTransport(TLS, 0, V4);
163       // clientDum.addTransport(UDP, 0, V6);
164       // clientDum.addTransport(TCP, 0, V6);
165       // clientDum.addTransport(TLS, 0, V6);
166    
167     MasterProfile clientProfile;       SharedPtr<MasterProfile> clientProfile(new MasterProfile);  
168     auto_ptr<ClientAuthManager> clientAuth(new ClientAuthManager());       auto_ptr<ClientAuthManager> clientAuth(new ClientAuthManager());  
169     TestIdentityHandler clientHandler;     TestIdentityHandler clientHandler;
170    
171     clientDum.setMasterProfile(&clientProfile);     clientDum.setMasterProfile(clientProfile);
172     clientDum.setClientAuthManager(clientAuth);     clientDum.setClientAuthManager(clientAuth);
173     clientDum.setClientRegistrationHandler(&clientHandler);     clientDum.setClientRegistrationHandler(&clientHandler);
174     clientDum.setClientPagerMessageHandler(&clientHandler);     clientDum.setClientPagerMessageHandler(&clientHandler);
# Line 172  Line 177 
177     clientDum.getMasterProfile()->addSupportedMethod(MESSAGE);     clientDum.getMasterProfile()->addSupportedMethod(MESSAGE);
178     clientDum.getMasterProfile()->addSupportedMimeType(MESSAGE, Mime("text", "plain"));     clientDum.getMasterProfile()->addSupportedMimeType(MESSAGE, Mime("text", "plain"));
179    
180     clientProfile.setDefaultFrom(userAor);     clientProfile->setDefaultFrom(userAor);
181    
182     InfoLog( << userAor.uri().host() << " " << userAor.uri().user()     InfoLog( << userAor.uri().host() << " " << userAor.uri().user()
183              << " " << passwd );              << " " << passwd );
184    
185     clientProfile.setDigestCredential(userAor.uri().host(),     clientProfile->setDigestCredential(userAor.uri().host(),
186                                       userAor.uri().user(),                                       userAor.uri().user(),
187                                       passwd);                                       passwd);
188                    
# Line 186  Line 191 
191     InfoLog( << regMessage << "Generated register: " << endl << regMessage );     InfoLog( << regMessage << "Generated register: " << endl << regMessage );
192     clientDum.send( regMessage );     clientDum.send( regMessage );
193    
    int n = 0;  
           
194     while (!clientHandler.isEnded() || !clientHandler.isRcvd() )     while (!clientHandler.isEnded() || !clientHandler.isRcvd() )
195     {     {
196        FdSet fdset;        FdSet fdset;

Legend:
Removed from v.4564  
changed lines
  Added in v.8838

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27