reSIProcate/repro  9694
Public Member Functions | Protected Attributes
repro::ProxyConfig Class Reference

#include <ProxyConfig.hxx>

Inheritance diagram for repro::ProxyConfig:
Inheritance graph
[legend]
Collaboration diagram for repro::ProxyConfig:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ProxyConfig ()
 ProxyConfig (int argc, char **argv, const resip::Data &defaultConfigFilename)
virtual ~ProxyConfig ()
virtual void printHelpText (int argc, char **argv)
void createDataStore (AbstractDb *db)
StoregetDataStore ()
bool getConfigValue (const resip::Data &name, resip::Uri &value)
resip::Uri getConfigUri (const resip::Data &name, const resip::Uri defaultValue, bool useDefaultIfEmpty=false)

Protected Attributes

StoremStore

Detailed Description

Definition at line 13 of file ProxyConfig.hxx.


Constructor & Destructor Documentation

repro::ProxyConfig::ProxyConfig ( )

Definition at line 26 of file ProxyConfig.cxx.

                         : mStore(0)
{
}
repro::ProxyConfig::ProxyConfig ( int  argc,
char **  argv,
const resip::Data defaultConfigFilename 
)

Definition at line 22 of file ProxyConfig.cxx.

                                                                                      : ConfigParse(argc, argv, defaultConfigFilename), mStore(0)
{
}
repro::ProxyConfig::~ProxyConfig ( ) [virtual]

Definition at line 30 of file ProxyConfig.cxx.

{
   delete mStore; 
   mStore=0;
}

Member Function Documentation

void repro::ProxyConfig::createDataStore ( AbstractDb db)

Definition at line 99 of file ProxyConfig.cxx.

{
   assert(db);
   mStore = new Store(*db);
}
resip::Uri repro::ProxyConfig::getConfigUri ( const resip::Data name,
const resip::Uri  defaultValue,
bool  useDefaultIfEmpty = false 
)

Definition at line 78 of file ProxyConfig.cxx.

{
   Uri ret(defaultValue);
   if(getConfigValue(name, ret) && ret.host().empty() && useDefaultIfEmpty)
   {
      return defaultValue;
   }
   return ret;
}
bool repro::ProxyConfig::getConfigValue ( const resip::Data name,
resip::Uri value 
)

Definition at line 37 of file ProxyConfig.cxx.

{
   Data lowerName(name);  lowerName.lowercase();
   ConfigValuesMap::iterator it = mConfigValues.find(lowerName);
   if(it != mConfigValues.end())
   {
      try
      {
         if(!it->second.empty())
         {
            NameAddr tempNameAddr(it->second);
            value = tempNameAddr.uri();
            return true;
         }
         else
         {
            value = Uri();  // return an empty Uri
            return true;
         }
      }
      catch(resip::BaseException& e)
      {
         // Try adding sip: to value to see if it will be valid
         try
         {
            NameAddr tempNameAddr(Data("sip:" + it->second));
            value = tempNameAddr.uri();
            return true;
         }
         catch(resip::BaseException&)
         {
            cerr << "Invalid Uri setting:  " << name << " = " << it->second << ": " << e << endl;
            return false;
         }
      }  
   }
   // Not found
   return false;
}
Store* repro::ProxyConfig::getDataStore ( ) [inline]

Definition at line 23 of file ProxyConfig.hxx.

{ return mStore; }
void repro::ProxyConfig::printHelpText ( int  argc,
char **  argv 
) [virtual]

Implements resip::ConfigParse.

Definition at line 89 of file ProxyConfig.cxx.

{
   cout << "Command line format is:" << endl;
   cout << "  " << argv[0] << " [<ConfigFilename>] [--<ConfigValueName>=<ConfigValue>] [--<ConfigValueName>=<ConfigValue>] ..." << endl;
   cout << "Sample Command lines:" << endl;
   cout << "  " << argv[0] << "repro.config --RecordRouteUri=sip:proxy.sipdomain.com --ForceRecordRouting=true" << endl;
   cout << "  " << argv[0] << "repro.config /RecordRouteUri:sip:proxy.sipdomain.com /ForceRecordRouting:true" << endl;
}

Member Data Documentation

Definition at line 32 of file ProxyConfig.hxx.


The documentation for this class was generated from the following files: