reSIProcate/DialogUsageManager  9694
Defines | Functions | Variables
basicClient.cxx File Reference
#include <cstring>
#include <cassert>
#include "basicClientUserAgent.hxx"
#include <resip/stack/SipStack.hxx>
#include <resip/stack/Uri.hxx>
#include <rutil/Logger.hxx>
#include <signal.h>
Include dependency graph for basicClient.cxx:

Go to the source code of this file.

Defines

#define RESIPROCATE_SUBSYSTEM   Subsystem::TEST

Functions

static void signalHandler (int signo)
int main (int argc, char *argv[])

Variables

bool TRUE = true
bool FALSE = false
static bool exitSignalDetected = false

Define Documentation

#define RESIPROCATE_SUBSYSTEM   Subsystem::TEST

Definition at line 27 of file basicClient.cxx.


Function Documentation

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

Definition at line 39 of file basicClient.cxx.

References ErrLog, exitSignalDetected, InfoLog, resip::BasicClientUserAgent::process(), resip::BasicClientUserAgent::shutdown(), signalHandler(), resip::BasicClientUserAgent::startup(), and WarningLog.

{
#ifndef _WIN32
   if ( signal( SIGPIPE, SIG_IGN) == SIG_ERR)
   {
      cerr << "Couldn't install signal handler for SIGPIPE" << endl;
      exit(-1);
   }
#endif

   if ( signal( SIGINT, signalHandler ) == SIG_ERR )
   {
      cerr << "Couldn't install signal handler for SIGINT" << endl;
      exit( -1 );
   }

   if ( signal( SIGTERM, signalHandler ) == SIG_ERR )
   {
      cerr << "Couldn't install signal handler for SIGTERM" << endl;
      exit( -1 );
   }

   try
   {
      BasicClientUserAgent ua(argc, argv);
      ua.startup();
      
      InfoLog(<< argv[0] << " starting");

      while(ua.process(1000))  // Look for exit key every 1 second
      {
         if(exitSignalDetected)
         {
            ua.shutdown();
            exitSignalDetected = false;
         }
      }
   }
#ifdef USE_SSL
   catch (BaseSecurity::Exception& e)
   {
      WarningLog (<< "Couldn't set up security object: " << e);
      exit(-1);
   }
#endif
   catch (BaseException& e)
   {
      ErrLog (<< "Caught: " << e);
      exit(-1);
   }
   catch( ... )
   {
      ErrLog( << "Caught non-resip exception" );
      exit(-1);
   }

   return 0;
}

Here is the call graph for this function:

static void signalHandler ( int  signo) [static]

Definition at line 32 of file basicClient.cxx.

References exitSignalDetected.

Referenced by main().

{
   std::cerr << "Shutting down" << endl;
   exitSignalDetected = true;
}

Variable Documentation

bool exitSignalDetected = false [static]

Definition at line 29 of file basicClient.cxx.

Referenced by main(), and signalHandler().

bool FALSE = false

Definition at line 10 of file basicClient.cxx.

bool TRUE = true

Definition at line 9 of file basicClient.cxx.