reSIProcate/stack  9694
Classes | Defines | Functions
testServer.cxx File Reference
#include <sys/time.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <iostream>
#include <memory>
#include "resip/stack/Helper.hxx"
#include "resip/stack/SipMessage.hxx"
#include "resip/stack/Uri.hxx"
#include "resip/stack/SipStack.hxx"
#include "rutil/Logger.hxx"
#include "rutil/ThreadIf.hxx"
Include dependency graph for testServer.cxx:

Go to the source code of this file.

Classes

class  Server

Defines

#define RESIPROCATE_SUBSYSTEM   Subsystem::TEST

Functions

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

Define Documentation

#define RESIPROCATE_SUBSYSTEM   Subsystem::TEST

Definition at line 23 of file testServer.cxx.


Function Documentation

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

Definition at line 98 of file testServer.cxx.

References resip::SipStack::addTransport(), resip::Log::Cout, resip::Log::initialize(), resip::ThreadIf::join(), resip::ThreadIf::run(), server, resip::TCP, resip::Log::toLevel(), and resip::UDP.

{
   if (argc != 4)
   {
      cerr << argv[0] << " LOG_LEVEL NUM_CALLS PROTOCOL" << endl;
      exit(-1);
   } 
   Log::initialize(Log::Cout, Log::toLevel(argv[1]), argv[0]);
   SipStack stack;


   TransportType protocol = UDP;
   if (strcasecmp(argv[3], "UDP") == 0)
   {
      protocol = UDP;
   }
   else if (strcasecmp(argv[3], "TCP") == 0)
   {
      protocol = TCP;
   }
   else
   {
      cerr << argv[0] << " LOG_LEVEL TARGET_URI PROTOCOL" << endl;
   }

   stack.addTransport(protocol, 5070);


   int numCalls = atoi(argv[2]);

   if (numCalls == 0)
   {
      cerr << argv[0] << " LOG_LEVEL NUM_CALLS" << endl;
      exit(-1);
   } 

   ::Server server(stack, numCalls, protocol);
   
   server.run();
   server.join();
   return 0;
}

Here is the call graph for this function: