当前位置: 首页>>代码示例>>C++>>正文


C++ OsConfigDb::set方法代码示例

本文整理汇总了C++中OsConfigDb::set方法的典型用法代码示例。如果您正苦于以下问题:C++ OsConfigDb::set方法的具体用法?C++ OsConfigDb::set怎么用?C++ OsConfigDb::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OsConfigDb的用法示例。


在下文中一共展示了OsConfigDb::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: testConstructor

   void testConstructor()
      {
         /*
          * This test exists to initialize the singleton plugin.
          * Doing it as a static ran into ordering problems.
          */
         CPPUNIT_ASSERT((xferctl=dynamic_cast<MSFT_ExchangeTransferHack*>(getAuthPlugin("msft"))));

         OsConfigDb xferConfigDb;
         xferConfigDb.set(MSFT_ExchangeTransferHack::RecognizerConfigKey, "^RTCC/");
         xferctl->readConfig(xferConfigDb);

         testUserAgent.setIsUserAgent(FALSE);

         testUserAgent.setUserAgentHeaderProperty("sipXecs/testproxy");

         testUserAgent.setForking(FALSE);  // Disable forking

         OsConfigDb configDb;
         configDb.set("SIPX_PROXY_AUTHENTICATE_ALGORITHM", "MD5");
         configDb.set("SIPX_PROXY_HOSTPORT", "sipx.example.edu");

         testSipRouter = new SipRouter(testUserAgent, mForwardingRules, configDb);
         xferctl->announceAssociatedSipRouter( testSipRouter );
      }
开发者ID:LordGaav,项目名称:sipxecs,代码行数:25,代码来源:MSFT_ExchangeTransferHackTest.cpp

示例2: startAgents

SipConfigServerAgent* SipConfigServerAgent::startAgents(const char* configFileName)
{
    int sipTcpPort;
    int sipUdpPort;
    int sipTlsPort;
    OsConfigDb configDb;

    if(configDb.loadFromFile(configFileName) == OS_SUCCESS)
    {
      osPrintf("Found config file: %s\n", configFileName);
    }
    else
    {
        configDb.set("SIP_SDS_UDP_PORT", "5090");
        configDb.set("SIP_SDS_TCP_PORT", "5090");
        configDb.set("SIP_SDS_TLS_PORT", "5091");
        configDb.set(CONFIG_SETTING_LOG_DIR, "");
        configDb.set(CONFIG_SETTING_LOG_LEVEL, "");
        configDb.set(CONFIG_SETTING_LOG_CONSOLE, "");

        if (configDb.storeToFile(configFileName) != OS_SUCCESS)
                      osPrintf("Could not store config file: %s\n", configFileName);
    }
    
    sipTcpPort = configDb.getPort("SIP_SDS_UDP_PORT") ;
    sipUdpPort = configDb.getPort("SIP_SDS_TCP_PORT") ;
    sipTlsPort = configDb.getPort("SIP_SDS_TLS_PORT") ;

    // Start the sip stack
    SipUserAgent* pAgent = new SipUserAgent(sipTcpPort,
        sipUdpPort,   
        sipTlsPort,
        NULL, // public IP address (nopt used in proxy)
        NULL, // default user (not used in proxy)
        NULL, // default SIP address (not used in proxy)
        NULL, // outbound proxy
        NULL, // directory server
        NULL, // registry server
        NULL, // auth scheme
        NULL, //auth realm
        NULL, // auth DB
        NULL, // auth user IDs
        NULL, // auth passwords
        NULL, // line mgr
        SIP_DEFAULT_RTT, // first resend timeout
        TRUE, // default to UA transaction
        SIPUA_DEFAULT_SERVER_UDP_BUFFER_SIZE, // socket layer read buffer size
        SIPUA_DEFAULT_SERVER_OSMSG_QUEUE_SIZE // OsServerTask message queue size
        );
    pAgent->start();

    // Start the SipConfigServerAgent
    SipConfigServerAgent* pConfigAgent = new SipConfigServerAgent(pAgent) ;
    pConfigAgent->start() ;

    return(pConfigAgent);
}
开发者ID:mranga,项目名称:sipxecs,代码行数:57,代码来源:SipConfigServerAgent.cpp

示例3: main

int main(int argc, char *argv[])
{
    OsConfigDb configDb;
    UtlString configDbFile = TEST_FILENAME;
    
    parseArgs(argc, argv);
    
    if (MemCheckDelay)
    {
        // Delay 45 seconds to allow memcheck start
        printf("Wating %d seconds for start of memcheck ...", MemCheckDelay);
        OsTask::delay(MemCheckDelay * 1000);
        printf("starting\n");
    }    
    
    initLogger(argv);

    // Reset database content an rewrite the file
    configDb.set("TestItem1", "Value1");
    configDb.set("TestItem2", "Value2");
    configDb.set("TestItem3", "Value3");
    configDb.set("TestItem3", "Value4");        

    configDb.storeToFile(configDbFile);
    
    ConfigRPC_Callback* confCallbacks;
    ConfigRPC*          configRPC;
    XmlRpcDispatch*     rpc;
 
    // start a simple XmlRpc test server
    rpc = new XmlRpcDispatch(HTTP_PORT, false);

    confCallbacks = new test_Callback();
    configRPC     = new ConfigRPC( TEST_DATASET,
                                   TEST_VERSION,
                                   configDbFile,
                                   confCallbacks);
    // enter the connector RPC methods in the XmlRpcDispatch table
    ConfigRPC::registerMethods(*rpc);
    
    printf("Server will be up for %d seconds on port %d\n", Duration/1000, HttpPort);
    OsTask::delay(Duration);
    
    if (MemCheckDelay)
    {
        // Delay 45 seconds to allow memcheck start
        printf("Wating %d seconds for stop of memcheck ...", MemCheckDelay);
        OsTask::delay(MemCheckDelay * 1000);
        printf("starting\n");
    }
 
    exit(0);
}
开发者ID:mranga,项目名称:sipxecs,代码行数:53,代码来源:configrpcsrv.cpp

示例4: testReadConfig

   void testReadConfig()
      {
         OsConfigDb configuration;

         configuration.set("READCONFIG_NOTPASSED_HOOK_LIBRARY.Error", PLUGIN_LIB_DIR "libfoo" PLUGIN_EXT);
         configuration.set("READCONFIG_OTHERPARAM", "DummyValue");

         // configure a hook
         configuration.set("READCONFIG_TEST_HOOK_LIBRARY.Only",
                           PLUGIN_LIB_DIR "libtestpluginA" PLUGIN_EXT);
         // with two configuration values
         configuration.set("READCONFIG_TEST.Only.VALUE1", "FirstValue");
         configuration.set("READCONFIG_TEST.Only.VALUE2", "SecondValue");

         PluginHooks testPlugins("getTestPlugin", "READCONFIG_TEST");
         testPlugins.readConfig(configuration);

         PluginIterator plugin(testPlugins);

         UtlString name;
         TestPlugin* thePlugin;

         // get the hook and confirm the name
         thePlugin = static_cast<TestPlugin*>(plugin.next(&name));
         CPPUNIT_ASSERT(thePlugin != NULL);
         CPPUNIT_ASSERT(!name.isNull());
         ASSERT_STR_EQUAL("Only",name.data());
         UtlString fullName;
         thePlugin->pluginName(fullName);
         ASSERT_STR_EQUAL("TestPluginA::Only",fullName.data());

         // read the two parameters and confirm that the hook got them
         UtlString pluginValue;
         CPPUNIT_ASSERT(thePlugin->getConfiguredValueFor("VALUE1", pluginValue));
         ASSERT_STR_EQUAL("FirstValue",pluginValue.data());

         CPPUNIT_ASSERT(thePlugin->getConfiguredValueFor("VALUE2", pluginValue));
         ASSERT_STR_EQUAL("SecondValue",pluginValue.data());

         // try some bogus parameter
         CPPUNIT_ASSERT(!thePlugin->getConfiguredValueFor("UNCONFIGURED", pluginValue));

         // confirm that this is the only hook
         CPPUNIT_ASSERT(plugin.next(&name) == NULL);
         CPPUNIT_ASSERT(name.isNull());
      }
开发者ID:astubbs,项目名称:sipxecs,代码行数:46,代码来源:PluginHooksTest.cpp

示例5: setUp

 void setUp()
 {
    UtlString name("ntap");
    RouteState::setSecret("fixed");
    pNatTraversalAgent = new NatTraversalAgent( name );
    
    OsConfigDb configuration;
    configuration.set("NATRULES", TEST_DATA_DIR "/NatTraversalAgent/nattraversalrules3.xml");
    pNatTraversalAgent->readConfig( configuration );
 }
开发者ID:mranga,项目名称:sipxecs,代码行数:10,代码来源:NatTraversalAgentTest.cpp

示例6: hostAliases

   RequestLinterTest() :
      identity(""),
      requestUri("sip:[email protected]")
   {
      
      testUserAgent.setIsUserAgent(FALSE);
      testUserAgent.setUserAgentHeaderProperty("sipXecs/testproxy");
      testUserAgent.setForking(FALSE);  // Disable forking
      UtlString hostAliases("mydomainalias.com mydomainotheralias.com");
      testUserAgent.setHostAliases(hostAliases);

      OsConfigDb configDb;
      configDb.set("SIPX_PROXY_AUTHENTICATE_ALGORITHM", "MD5");
      configDb.set("SIPX_PROXY_DOMAIN_NAME", "mydomain.com");
      configDb.set("SIPX_PROXY_AUTHENTICATE_REALM", "mydomain.com");
      configDb.set("SIPX_PROXY_HOSTPORT", "mydomain.com");

      testSipRouter = new SipRouter(testUserAgent, mForwardingRules, configDb);
      spLinter->announceAssociatedSipRouter( testSipRouter );

   }
开发者ID:chemeris,项目名称:sipxecs,代码行数:21,代码来源:RequestLinterTest.cpp

示例7: testNoHooks

   void testNoHooks()
      {
         OsConfigDb configuration;

         configuration.set("NOHOOKS_NOTPASSED_HOOK_LIBRARY.Error", PLUGIN_LIB_DIR "libfoo" PLUGIN_EXT);
         configuration.set("NOHOOKS_OTHERPARAM", "DummyValue");

         // there are no hooks configured for this prefix
         PluginHooks testPlugins("getTestPlugin", "NOHOOKS_PASSED");
         testPlugins.readConfig(configuration);

         PluginIterator shouldBeEmpty(testPlugins);

         UtlString name;

         // confirm that there are no hooks configured.
         CPPUNIT_ASSERT(shouldBeEmpty.next(&name) == NULL);
         CPPUNIT_ASSERT(name.isNull());

         CPPUNIT_ASSERT(shouldBeEmpty.next() == NULL);
      }
开发者ID:astubbs,项目名称:sipxecs,代码行数:21,代码来源:PluginHooksTest.cpp

示例8: testNoPermResponse

   // Test that a response message is allowed and is not modified
   void testNoPermResponse()
      {
         OsConfigDb configuration;
         configuration.set("RULES", TEST_DATA_DIR "/enforcerules.xml");

         enforcer->readConfig(configuration);

         UtlString identity; // no authenticated identity
         Url requestUri("sip:[email protected]");

         const char* message =
            "SIP/2.0 200 Ok\r\n"
            "Via: SIP/2.0/TCP 10.1.1.3:33855\r\n"
            "To: sip:[email protected]\r\n"
            "From: Caller <sip:[email protected]>; tag=99911983748\r\n"
            "Call-Id: b1373e736d7d359ead76fa5cd467d999\r\n"
            "Cseq: 2 ACK\r\n"
            "Max-Forwards: 20\r\n"
            "Contact: [email protected]\r\n"
            "Content-Length: 0\r\n"
            "Record-Route: <sip:example.com;lr;sipXecs-rs=enforce%2Aauth%7E%21d1e296555015a54cb746fa7ac5695cf7>\r\n"
            "\r\n";
         SipMessage testMsg(message, strlen(message));

         UtlSList noRemovedRoutes;
         UtlString routeName("example.com");
         RouteState routeState( testMsg, noRemovedRoutes, routeName );

         const char unmodifiedRejectReason[] = "unmodified";
         UtlString rejectReason(unmodifiedRejectReason);

         UtlString method("INVITE");
         const bool bSpiralingRequest = false;
         AuthPlugin::AuthResult priorResult = AuthPlugin::ALLOW; // SipRouter passes this for responses

         CPPUNIT_ASSERT(AuthPlugin::CONTINUE
                        == enforcer->authorizeAndModify(identity,
                                                        requestUri,
                                                        routeState,
                                                        method,
                                                        priorResult,
                                                        testMsg,
                                                        bSpiralingRequest,
                                                        rejectReason
                                                        ));
         ASSERT_STR_EQUAL(unmodifiedRejectReason, rejectReason.data());

         UtlString recordRoute;
         CPPUNIT_ASSERT(testMsg.getRecordRouteField(0, &recordRoute));
         ASSERT_STR_EQUAL( "<sip:example.com;lr;sipXecs-rs=enforce%2Aauth%7E%21d1e296555015a54cb746fa7ac5695cf7>", recordRoute );
      }
开发者ID:ciuc,项目名称:sipxecs,代码行数:52,代码来源:EnforceAuthRulesTest.cpp

示例9: testNoLibrary

   void testNoLibrary()
      {
         OsConfigDb configuration;

         configuration.set("NO_LIB_NOTPASSED_HOOK_LIBRARY.Error", PLUGIN_LIB_DIR "libfoo" PLUGIN_EXT);
         configuration.set("NO_LIB_OTHERPARAM", "DummyValue");

         // configure two instances of the same hook library, with different parameters
         configuration.set("NO_LIB_TEST_HOOK_LIBRARY.1-First",
                           PLUGIN_LIB_DIR "libtestpluginA" PLUGIN_EXT);
         configuration.set("NO_LIB_TEST.1-First.VALUE", "FirstValue");

         configuration.set("NO_LIB_TEST_HOOK_LIBRARY.2-EmptyLib", "");
         configuration.set("NO_LIB_TEST.2-EmptyLib.VALUE", "EmptyLibValue");

         configuration.set("NO_LIB_TEST_HOOK_LIBRARY.3-Third",
                           PLUGIN_LIB_DIR "libtestpluginB" PLUGIN_EXT);
         configuration.set("NO_LIB_TEST.3-Third.VALUE", "ThirdValue");

         // load up the hooks
         PluginHooks testPlugins("getTestPlugin", "NO_LIB_TEST");
         testPlugins.readConfig(configuration);
         PluginIterator plugin(testPlugins);

         UtlString name;
         TestPlugin* thePlugin;

         // get the first instance and check its name
         thePlugin = static_cast<TestPlugin*>(plugin.next(&name));
         CPPUNIT_ASSERT(thePlugin != NULL);
         CPPUNIT_ASSERT(!name.isNull());
         ASSERT_STR_EQUAL("1-First",name.data());
         UtlString fullName;
         thePlugin->pluginName(fullName);
         ASSERT_STR_EQUAL("TestPluginA::1-First",fullName.data());

         // get the second instance and confirm its name
         thePlugin = static_cast<TestPlugin*>(plugin.next(&name));
         CPPUNIT_ASSERT(thePlugin != NULL);
         CPPUNIT_ASSERT(!name.isNull());
         ASSERT_STR_EQUAL("3-Third",name.data());
         thePlugin->pluginName(fullName);
         ASSERT_STR_EQUAL("TestPluginB::3-Third",fullName.data());

         // and make sure that is the end of the iteration
         CPPUNIT_ASSERT(plugin.next(&name) == NULL);
         CPPUNIT_ASSERT(name.isNull());
      }
开发者ID:astubbs,项目名称:sipxecs,代码行数:48,代码来源:PluginHooksTest.cpp

示例10: testOneHook

   void testOneHook()
      {
         OsConfigDb configuration;

         configuration.set("ONEHOOK_NOTPASSED_HOOK_LIBRARY.Error", PLUGIN_LIB_DIR "libfoo" PLUGIN_EXT);
         configuration.set("ONEHOOK_OTHERPARAM", "DummyValue");

         // configure one hook, with no parameters
         configuration.set("ONEHOOK_TEST_HOOK_LIBRARY.Only",
                           PLUGIN_LIB_DIR "libtestpluginA" PLUGIN_EXT);

         PluginHooks testPlugins("getTestPlugin", "ONEHOOK_TEST");
         testPlugins.readConfig(configuration);

         PluginIterator plugin(testPlugins);

         UtlString name;
         TestPlugin* thePlugin;

         // get that one hook
         thePlugin = static_cast<TestPlugin*>(plugin.next(&name));

         // confirm that it is loaded and that it has the right instance name
         CPPUNIT_ASSERT(thePlugin != NULL);
         CPPUNIT_ASSERT(!name.isNull());
         ASSERT_STR_EQUAL("Only",name.data());

         // invoke the pluginName method from the hook to confirm that it's there
         UtlString fullName;
         thePlugin->pluginName(fullName);
         ASSERT_STR_EQUAL("TestPluginA::Only",fullName.data());

         // confirm that it is the only configured hook
         CPPUNIT_ASSERT(plugin.next(&name) == NULL);
         CPPUNIT_ASSERT(name.isNull());
      }
开发者ID:astubbs,项目名称:sipxecs,代码行数:36,代码来源:PluginHooksTest.cpp

示例11: testTwoInstances

   void testTwoInstances()
      {
         OsConfigDb configuration;

         configuration.set("TWO_INST_NOTPASSED_HOOK_LIBRARY.Error", PLUGIN_LIB_DIR "libfoo" PLUGIN_EXT);
         configuration.set("TWO_INST_OTHERPARAM", "DummyValue");

         // configure two instances of the same hook library, with different parameters
         configuration.set("TWO_INST_TEST_HOOK_LIBRARY.First",
                           PLUGIN_LIB_DIR "libtestpluginA" PLUGIN_EXT);
         configuration.set("TWO_INST_TEST.First.VALUE", "FirstValue");

         configuration.set("TWO_INST_TEST_HOOK_LIBRARY.Second",
                           PLUGIN_LIB_DIR "libtestpluginA" PLUGIN_EXT);
         configuration.set("TWO_INST_TEST.Second.VALUE", "SecondValue");

         // load up the hooks
         PluginHooks testPlugins("getTestPlugin", "TWO_INST_TEST");
         testPlugins.readConfig(configuration);
         PluginIterator plugin(testPlugins);

         UtlString name;
         TestPlugin* thePlugin;

         // get the first instance and check its name
         thePlugin = static_cast<TestPlugin*>(plugin.next(&name));
         CPPUNIT_ASSERT(thePlugin != NULL);
         CPPUNIT_ASSERT(!name.isNull());
         ASSERT_STR_EQUAL("First",name.data());
         UtlString fullName;
         thePlugin->pluginName(fullName);
         ASSERT_STR_EQUAL("TestPluginA::First",fullName.data());

         const UtlString ValueKey("VALUE");

         // check that the first instance is using the correct configuration value
         UtlString pluginValue;
         CPPUNIT_ASSERT(thePlugin->getConfiguredValueFor(ValueKey, pluginValue));
         ASSERT_STR_EQUAL("FirstValue",pluginValue.data());

         // get the second instance and confirm its name
         thePlugin = static_cast<TestPlugin*>(plugin.next(&name));
         CPPUNIT_ASSERT(thePlugin != NULL);
         CPPUNIT_ASSERT(!name.isNull());
         ASSERT_STR_EQUAL("Second",name.data());
         thePlugin->pluginName(fullName);
         ASSERT_STR_EQUAL("TestPluginA::Second",fullName.data());

         // check that the second instance is using the correct configuration value
         CPPUNIT_ASSERT(thePlugin->getConfiguredValueFor(ValueKey, pluginValue));
         ASSERT_STR_EQUAL("SecondValue",pluginValue.data());

         // and make sure that is the end of the iteration
         CPPUNIT_ASSERT(plugin.next(&name) == NULL);
         CPPUNIT_ASSERT(name.isNull());
      }
开发者ID:astubbs,项目名称:sipxecs,代码行数:56,代码来源:PluginHooksTest.cpp

示例12: while

void
StatusServer::parseList (
    const UtlString& keyPrefix,
    const UtlString& separatedList,
    OsConfigDb& list )
{
    if (!separatedList.isNull())
    {
        int index = 1;
        UtlString value;
        while( NameValueTokenizer::getSubField( separatedList.data(), index, ", \t", &value) )
        {
            char temp[10];
            sprintf(temp, "%d", index);
            UtlString key = temp;
            list.set(key, value);
            index ++;
        }
    }
}
开发者ID:edaniels,项目名称:sipxecs,代码行数:20,代码来源:StatusServer.cpp

示例13: testReconfigure

   void testReconfigure()
      {
         PluginHooks testPlugins("getTestPlugin", "RECONFIG_TEST");

         const UtlString ValueKey("VALUE");

         UtlString name;
         TestPlugin* thePlugin;
         UtlString pluginValue;
         UtlString fullName;


         {
            // Do the initial configuration of two instances of a hook
            OsConfigDb configuration;

            configuration.set("RECONFIG_TEST_HOOK_LIBRARY.First",
                              PLUGIN_LIB_DIR "libtestpluginA" PLUGIN_EXT);
            configuration.set("RECONFIG_TEST.First.VALUE", "FirstValue");

            configuration.set("RECONFIG_TEST_HOOK_LIBRARY.Second",
                              PLUGIN_LIB_DIR "libtestpluginA" PLUGIN_EXT);
            configuration.set("RECONFIG_TEST.Second.VALUE", "SecondValue");

            // load them up
            testPlugins.readConfig(configuration);

            PluginIterator plugin(testPlugins);

            // check the first instance
            thePlugin = static_cast<TestPlugin*>(plugin.next(&name));
            CPPUNIT_ASSERT(thePlugin != NULL);
            CPPUNIT_ASSERT(!name.isNull());
            ASSERT_STR_EQUAL("First",name.data());
            thePlugin->pluginName(fullName);
            ASSERT_STR_EQUAL("TestPluginA::First",fullName.data());
            CPPUNIT_ASSERT(thePlugin->getConfiguredValueFor(ValueKey, pluginValue));
            ASSERT_STR_EQUAL("FirstValue",pluginValue.data());

            // check the second instance
            thePlugin = static_cast<TestPlugin*>(plugin.next(&name));
            CPPUNIT_ASSERT(thePlugin != NULL);
            CPPUNIT_ASSERT(!name.isNull());
            ASSERT_STR_EQUAL("Second",name.data());
            thePlugin->pluginName(fullName);
            ASSERT_STR_EQUAL("TestPluginA::Second",fullName.data());
            CPPUNIT_ASSERT(thePlugin->getConfiguredValueFor(ValueKey, pluginValue));
            ASSERT_STR_EQUAL("SecondValue",pluginValue.data());

            // and confirm that is the end
            CPPUNIT_ASSERT(plugin.next(&name) == NULL);
            CPPUNIT_ASSERT(name.isNull());
         }

         {
            // Now create a new configuration that eliminates the First instance
            // and changes the configuration value for the Second instance
            OsConfigDb configuration;
            configuration.set("RECONFIG_TEST_HOOK_LIBRARY.Second",
                              PLUGIN_LIB_DIR "libtestpluginA" PLUGIN_EXT);
            configuration.set("RECONFIG_TEST.Second.VALUE", "NewValue");

            // reconfigure the plugins
            testPlugins.readConfig(configuration);

            PluginIterator plugin(testPlugins);

            // confirm that we still get the Second instance (but we get it first :-)
            thePlugin = static_cast<TestPlugin*>(plugin.next(&name));
            CPPUNIT_ASSERT(thePlugin != NULL);
            CPPUNIT_ASSERT(!name.isNull());
            ASSERT_STR_EQUAL("Second",name.data());
            thePlugin->pluginName(fullName);
            ASSERT_STR_EQUAL("TestPluginA::Second",fullName.data());

            // and check that it has the new configuration value
            CPPUNIT_ASSERT(thePlugin->getConfiguredValueFor(ValueKey, pluginValue));
            ASSERT_STR_EQUAL("NewValue",pluginValue.data());

            // and that it's the only hook configured now
            CPPUNIT_ASSERT(plugin.next(&name) == NULL);
            CPPUNIT_ASSERT(name.isNull());
         }

         {
            // Now create a third configuration that changes the library for the Second instance
            OsConfigDb configuration;
            configuration.set("RECONFIG_TEST_HOOK_LIBRARY.Second",
                              PLUGIN_LIB_DIR "libtestpluginB" PLUGIN_EXT);
            configuration.set("RECONFIG_TEST.Second.VALUE", "ChangedValue");

            // reconfigure the plugins
            testPlugins.readConfig(configuration);

            PluginIterator plugin(testPlugins);

            // confirm that we still get the Second instance (but we get it first :-)
            thePlugin = static_cast<TestPlugin*>(plugin.next(&name));
            CPPUNIT_ASSERT(thePlugin != NULL);
            CPPUNIT_ASSERT(!name.isNull());
//.........这里部分代码省略.........
开发者ID:astubbs,项目名称:sipxecs,代码行数:101,代码来源:PluginHooksTest.cpp

示例14: testTwoHookTypes

   void testTwoHookTypes()
      {
         OsConfigDb configuration;

         configuration.set("TWO_TYPE_NOTPASSED_HOOK_LIBRARY.Error", PLUGIN_LIB_DIR "libfoo" PLUGIN_EXT);
         configuration.set("TWO_TYPE_OTHERPARAM", "DummyValue");

         // Configure two different hook types - each in its own library
         //   (we cheat - it's the same source, modified by configuration
         //    switches; see comments in ../testplugin/TestPlugin.cpp)
         configuration.set("TWO_TYPE1_HOOK_LIBRARY.First",
                           PLUGIN_LIB_DIR "libtestpluginA" PLUGIN_EXT);
         configuration.set("TWO_TYPE1.First.VALUE", "FirstValue");

         configuration.set("TWO_TYPE2_HOOK_LIBRARY.Second",
                           PLUGIN_LIB_DIR "libtestpluginB" PLUGIN_EXT);
         configuration.set("TWO_TYPE2.Second.VALUE", "SecondValue");

         // load the first hook type
         PluginHooks test1Plugins("getTestPlugin", "TWO_TYPE1");
         test1Plugins.readConfig(configuration);

         // load the second hook type
         PluginHooks test2Plugins("getTestPlugin", "TWO_TYPE2");
         test2Plugins.readConfig(configuration);

         // create iterators for both hook types
         PluginIterator plugin1(test1Plugins);
         PluginIterator plugin2(test2Plugins);

         UtlString name;
         TestPlugin* thePlugin;
         UtlString fullName;

         // get the first instance of the first hook type and confirm the names
         thePlugin = static_cast<TestPlugin*>(plugin1.next(&name));
         CPPUNIT_ASSERT(thePlugin != NULL);
         thePlugin->pluginName(fullName);
         ASSERT_STR_EQUAL("TestPluginA::First",fullName.data());

         // confirm the first hook type is using the correct configuration value
         const UtlString ValueKey("VALUE");
         UtlString pluginValue;
         CPPUNIT_ASSERT(thePlugin->getConfiguredValueFor(ValueKey, pluginValue));
         ASSERT_STR_EQUAL("FirstValue",pluginValue.data());

         // get the first instance of the second hook type and confim its names
         thePlugin = static_cast<TestPlugin*>(plugin2.next(&name));
         CPPUNIT_ASSERT(thePlugin != NULL);
         thePlugin->pluginName(fullName);
         ASSERT_STR_EQUAL("TestPluginB::Second",fullName.data());

         // confirm the configuration of the second hook type
         CPPUNIT_ASSERT(thePlugin->getConfiguredValueFor(ValueKey, pluginValue));
         ASSERT_STR_EQUAL("SecondValue",pluginValue.data());

         // make sure each type only has the one instance
         CPPUNIT_ASSERT(plugin1.next(&name) == NULL);
         CPPUNIT_ASSERT(name.isNull());
         CPPUNIT_ASSERT(plugin2.next(&name) == NULL);
         CPPUNIT_ASSERT(name.isNull());
      }
开发者ID:astubbs,项目名称:sipxecs,代码行数:62,代码来源:PluginHooksTest.cpp

示例15: mpUserAgent

// Constructor
SipPresenceMonitor::SipPresenceMonitor(SipUserAgent* userAgent,
                                       SipSubscriptionMgr* subscriptionMgr,
                                       UtlString& domainName,
                                       int hostPort,
                                       OsConfigDb* configFile,
                                       bool toBePublished,
                                       const char* persistentFile) :
   mpUserAgent(userAgent),
   mDomainName(domainName),
   mToBePublished(toBePublished),
   mLock(OsBSem::Q_PRIORITY, OsBSem::FULL),
   mpSubscriptionMgr(subscriptionMgr),
   mPersistentFile(persistentFile),
   mPersistenceTimer(mPersistTask.getMessageQueue(), 0),
   mPersistTask(this)
{
   // Read the persistent file to initialize mPersenceEventList, if
   // one is supplied.
   if (!mPersistentFile.isNull())
   {
      readPersistentFile();
   }

   char buffer[80];
   sprintf(buffer, "@%s:%d", mDomainName.data(), hostPort);
   mHostAndPort = UtlString(buffer);

   UtlString localAddress;
   OsSocket::getHostIp(&localAddress);

   OsConfigDb configDb;
   configDb.set("PHONESET_MAX_ACTIVE_CALLS_ALLOWED", 2*MAX_CONNECTIONS);

#ifdef INCLUDE_RTCP
   CRTCManager::getRTCPControl();
#endif //INCLUDE_RTCP
   // Start the media processing tasks.
   mpStartTasks();

   // Instantiate the call processing subsystem
   mpCallManager = new CallManager(FALSE,
                                   NULL,
                                   TRUE,                              // early media in 180 ringing
                                   &mCodecFactory,
                                   RTP_START_PORT,                    // rtp start
                                   RTP_START_PORT + (2*MAX_CONNECTIONS), // rtp end
                                   localAddress,
                                   localAddress,
                                   mpUserAgent,
                                   0,                                 // sipSessionReinviteTimer
                                   NULL,                              // mgcpStackTask
                                   NULL,                              // defaultCallExtension
                                   Connection::RING,                  // availableBehavior
                                   NULL,                              // unconditionalForwardUrl
                                   -1,                                // forwardOnNoAnswerSeconds
                                   NULL,                              // forwardOnNoAnswerUrl
                                   Connection::BUSY,                  // busyBehavior
                                   NULL,                              // sipForwardOnBusyUrl
                                   NULL,                              // speedNums
                                   CallManager::SIP_CALL,             // phonesetOutgoingCallProtocol
                                   4,                                 // numDialPlanDigits
                                   CallManager::NEAR_END_HOLD,        // holdType
                                   5000,                              // offeringDelay
                                   "",                                // pLocal
                                   CP_MAXIMUM_RINGING_EXPIRE_SECONDS, // inviteExpiresSeconds
                                   QOS_LAYER3_LOW_DELAY_IP_TOS,       // expeditedIpTos
                                   MAX_CONNECTIONS,                   // maxCalls
                                   sipXmediaFactoryFactory(&configDb));    // CpMediaInterfaceFactory

   mpDialInServer = new PresenceDialInServer(mpCallManager, configFile);
   mpCallManager->addTaoListener(mpDialInServer);
   mpDialInServer->start();

   // Start the call processing system
   mpCallManager->start();

   // Add self to the presence dial-in server for state change notification
   mpDialInServer->addStateChangeNotifier("Presence_Dial_In_Server", this);

   if (mToBePublished)
   {
      // Create the SIP Subscribe Server
      mpSubscribeServer = new SipSubscribeServer(*mpUserAgent, mSipPublishContentMgr,
                                                 *mpSubscriptionMgr, mPolicyHolder);
      // Arrange to generate default content for presence events.
      mSipPublishContentMgr.publishDefault(PRESENCE_EVENT_TYPE, PRESENCE_EVENT_TYPE,
                                           new PresenceDefaultConstructor);
      mpSubscribeServer->enableEventType(PRESENCE_EVENT_TYPE);
      mpSubscribeServer->start();
   }

   // Enable the xmlrpc sign-in/sign-out
   int HttpPort;
   if (configDb.get(CONFIG_SETTING_HTTP_PORT, HttpPort) != OS_SUCCESS)
   {
      HttpPort = PRESENCE_DEFAULT_HTTP_PORT;
   }

   mpXmlRpcSignIn = new XmlRpcSignIn(this, HttpPort);
//.........这里部分代码省略.........
开发者ID:astubbs,项目名称:sipxecs,代码行数:101,代码来源:SipPresenceMonitor.cpp


注:本文中的OsConfigDb::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。