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

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

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

revision 9119 by bcampen, Mon Apr 25 17:43:24 2011 UTC revision 9367 by sgodin, Wed Feb 1 16:12:20 2012 UTC
# Line 20  Line 20 
20  #include "resip/stack/SecurityAttributes.hxx"  #include "resip/stack/SecurityAttributes.hxx"
21  #include "resip/stack/Helper.hxx"  #include "resip/stack/Helper.hxx"
22    
23    #include "rutil/FdPoll.hxx"
24  #include "rutil/Log.hxx"  #include "rutil/Log.hxx"
25  #include "rutil/Logger.hxx"  #include "rutil/Logger.hxx"
26    
# Line 87  Line 88 
88    
89        SdpContents* generateBody()        SdpContents* generateBody()
90        {        {
          HeaderFieldValue* hfv;        
91           Data* txt = new Data("v=0\r\n"           Data* txt = new Data("v=0\r\n"
92                                "o=1900 369696545 369696545 IN IP4 192.168.2.15\r\n"                                "o=1900 369696545 369696545 IN IP4 192.168.2.15\r\n"
93                                "s=X-Lite\r\n"                                "s=X-Lite\r\n"
# Line 99  Line 99 
99                                "a=rtpmap:101 telephone-event/8000\r\n"                                "a=rtpmap:101 telephone-event/8000\r\n"
100                                "a=fmtp:101 0-15\r\n");                                "a=fmtp:101 0-15\r\n");
101                    
102           hfv = new HeaderFieldValue(txt->data(), txt->size());           HeaderFieldValue hfv(txt->data(), txt->size());
103           SdpContents *sdp = new SdpContents(hfv, Mime("application", "sdp"));           SdpContents *sdp = new SdpContents(hfv, Mime("application", "sdp"));
104           return sdp;           return sdp;
105        }        }
# Line 247  Line 247 
247    
248     TestSMIMEInviteHandler handler(security);     TestSMIMEInviteHandler handler(security);
249    
250       // Shared FdPollGrp
251       std::auto_ptr<FdPollGrp> pollGrp(FdPollGrp::create());
252    
253     // set up UAC     // set up UAC
254     SipStack clientStack(security);     SipStack clientStack(security,
255                            DnsStub::EmptyNameserverList,
256                            0,
257                            false,
258                            0,
259                            0,
260                            pollGrp.get());
261     DialogUsageManager clientDum(clientStack);     DialogUsageManager clientDum(clientStack);
262     srand(time(NULL));     srand(time(NULL));
263     clientDum.addTransport(UDP, 0, V4);     clientDum.addTransport(UDP, 0, V4);
# Line 277  Line 286 
286     clientDum.setMasterProfile(clientProfile);     clientDum.setMasterProfile(clientProfile);
287    
288     //set up UAS     //set up UAS
289     SipStack serverStack(security);     SipStack serverStack(security,
290                            DnsStub::EmptyNameserverList,
291                            0,
292                            false,
293                            0,
294                            0,
295                            pollGrp.get());
296     DialogUsageManager serverDum(serverStack);     DialogUsageManager serverDum(serverStack);
297     //serverDum.addTransport(UDP, 0, V4);     //serverDum.addTransport(UDP, 0, V4);
298     serverDum.addTransport(TCP, 0, V4);     serverDum.addTransport(TCP, 0, V4);
# Line 320  Line 335 
335    
336     while (state != Finished)     while (state != Finished)
337     {     {
338        FdSet fdset;        // This waits on IO for both stacks; this is the canonical way to drive
339          // multiple stacks with the same thread. We could make two calls to
340        clientStack.buildFdSet(fdset);        // process(), but this requires more calls to epoll_wait/select.
341        serverStack.buildFdSet(fdset);        pollGrp->waitAndProcess(resipMin(clientStack.getTimeTillNextProcessMS(),
342                                                 serverStack.getTimeTillNextProcessMS()));
343        int err = fdset.selectMilliSeconds(resipMin((int)clientStack.getTimeTillNextProcessMS(), 50));        clientStack.processTimers();
344        assert ( err != -1 );        serverStack.processTimers();
345    
       clientStack.process(fdset);  
       serverStack.process(fdset);  
346        while(clientDum.process() || serverDum.process());        while(clientDum.process() || serverDum.process());
347    
348        switch (state)        switch (state)

Legend:
Removed from v.9119  
changed lines
  Added in v.9367

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27