#include <iostream>
#include <string>
#include <sstream>
#include <unistd.h>
#include <stdlib.h>
#ifdef __linux__
    #include <getopt.h>
#endif
#include "LSLocator.hxx"
#include "ProvisionInterface.hxx"
#include "LSSessionManager.hxx"
#include "cpLog.h"

int main(){

  LSSessionManager& manager = LSSessionManager::instance();
  manager.init("cairo.clic.cs.columbia.edu");
  manager.threadRun();

  //This is to keep the thread alive.   
  while(1){
    string destination("+1800");
    cpLogSetPriority(cpLogStrToPriority("LOG_DEBUG")); 
    cout << "In LSTest, want to look up the following prefix in TRIB: " << destination << endl;
    string gatewayFound = LSSessionManager::instance().findSIPGateway(destination);
    cout << "In LSTest, the gateway found was: " << gatewayFound << endl;
    sleep(2);
  }//End of while.                                                              
}
