reSIProcate/stack  9694
Classes | Defines | Functions | Variables
testRSP-2.cxx File Reference
#include "resip/stack/SipStack.hxx"
#include "resip/stack/SipMessage.hxx"
#include "rutil/Logger.hxx"
#include "rutil/Subsystem.hxx"
#include "resip/stack/Helper.hxx"
#include <pthread.h>
Include dependency graph for testRSP-2.cxx:

Go to the source code of this file.

Classes

class  TestSS

Defines

#define RESIPROCATE_SUBSYSTEM   TestSS::RSP2

Functions

TestSS resip::Subsystem RSP2 ("RSP2")
 TestSS (const resip::Data &rhs)
TestSSoperator= (const resip::Data &rhs)
void * poller (void *arg)
int main (int argc, char *argv[])

Variables

static const TestSS RSP2
bool g_stop_poller = false

Define Documentation

Definition at line 56 of file testRSP-2.cxx.


Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 58 of file testRSP-2.cxx.

References resip::SipStack::addTransport(), resip::Log::initialize(), poller(), StunDisabled, TCP, resip::SecurityTypes::TLSv1, UDP, and V4.

{
  resip::Log::initialize(Log::Cout, Log::Stack, *argv);
  SipStack stack1;  
  //pthread_t tid;
  stack1.addTransport(UDP, 5060, V4, StunDisabled, Data::Empty, Data::Empty, Data::Empty, SecurityTypes::TLSv1);
  stack1.addTransport(TCP, 5060, V4, StunDisabled, Data::Empty, Data::Empty, Data::Empty, SecurityTypes::TLSv1);
  //pthread_create(&tid, NULL, poller, &stack1);
  //pthread_join(tid, &retval);
  poller((void*)&stack1);
}

Here is the call graph for this function:

TestSS& RSP2::operator= ( const resip::Data rhs) [private]
void* poller ( void *  arg)

Definition at line 27 of file testRSP-2.cxx.

References resip::SipStack::buildFdSet(), g_stop_poller, resip::SipStack::process(), resip::SipStack::receive(), resip::FdSet::selectMilliSeconds(), and resip::SipStack::send().

Referenced by main().

{
  int i = 0;
  SipStack *stack1 = (SipStack*)arg;
  while (!g_stop_poller)
    {
      FdSet fdset;
      stack1->buildFdSet(fdset);
      fdset.selectMilliSeconds(100);
      stack1->process(fdset);
      SipMessage *msg = stack1->receive();
      if (msg)
        {
          cerr << "Got a message" << endl;
          SipMessage *resp = Helper::makeResponse(*msg,604);
          stack1->send(*resp);
          delete resp;
          delete msg;
        }
      else
        {
          ++i;
          if (!(i%10))
            cerr << "Nothing there " << i/10 << '\r';
        }
    }
  return NULL;
}

Here is the call graph for this function:

TestSS resip::Subsystem RSP2 ( "RSP2"  )
RSP2::TestSS ( const resip::Data rhs) [private]

Definition at line 24 of file testRSP-2.cxx.

{

Variable Documentation

bool g_stop_poller = false

Definition at line 25 of file testRSP-2.cxx.

Referenced by poller().

const TestSS RSP2 [static]

Definition at line 22 of file testRSP-2.cxx.