///////////////////////////////////////////////////////////////////////////////
//File Name: TRIPThread.h <Header>
//Description: This is used to launch an LSServer that routes with TRIP from
//within the SIPD.
///////////////////////////////////////////////////////////////////////////////

#ifndef TRIPThread_cpp
#define TRIPThread_cpp
#include <pthread.h>

/**
   Structure containing variables needed to start the thread.
*/
typedef struct trip_thread_arg{
  unsigned short port;
  char *host;
} trip_thread_arg;

/**
   Thread function for C program.
*/
#ifdef __cplusplus
extern "C" {
#endif

void *TRIPThread(void *arg);
char * get_trip_route(char * dest);

#ifdef __cplusplus
}
#endif

#if 0

/**
   Thread function.
*/
static void * TRIPThread(void *);

class tripthread : public THREAD{

  /**
     Friend function.
  */
  friend void * TRIPThread(void *);

 public:
  
  /**
    Default constructor takes no parameters.
  */
  triphread(void);

  /**
     Destructor.
  */
  virtual ~tripthread(void);

  /**
     Starts the thread.
  */
  int start(void * = NULL);

  /**
     Used to detach the thread.
  */
  void detach(void);

  /**
     Makes the thread wait.
  */
  void * wait(void);

  /**
     Stops the running of the thread.
  */
  void stop(void);
  
  /**
     Gets the thread's ID.
  */
  unsigned int getThreadID(void);

  /**
     Gets the thread's current ID.
  */
  static unsigned int getCurrentThreadID(void);

  /**
     Causes the thread to wait.
  */
  static void sleep(int);

 protected:
  
  /**
     The run method of the thread.
  */
  virtual void * run(void*);

 private:
  
  pthread_t threadHandle; //The thread handler.
  unsigned int threadID; //The thread's ID.
  int started; //Tells you if the thread has started.
  int detached; //Tells you if it is detached.
  void * param; //Parameters for the thread.

};
#endif

#endif



