📄 testclient.cxx
字号:
#include "ProvisionInterface.hxx"#include <list>#include <string>void rs(){ vector < Data > subscriberList; ProvisionInterface::instance().getSubscribers(subscriberList); vector < Data > aliasList; ProvisionInterface::instance().getAllAliases(aliasList); Data hostName = "172.19.175.173"; int localPort = 5060; LocalScopeAllocator lo; string withOutXml = "1000"; vector < Data > calling; ProvisionInterface::instance().getCallingList( hostName.getData(lo), localPort, withOutXml, calling);}void updateMarshal( const string& data, const string& fileName, const bool deletedFlag ){}void junk(){ Data hostName = "172.19.175.173"; int localPort = 5060; LocalScopeAllocator lo; string withOutXml = "2000"; vector < Data > calling; ProvisionInterface::instance().getCallingList( hostName.getData(lo), localPort, withOutXml, calling);}void r(){ list<string> marshalServers; ProvisionInterface::instance().getMarshalServers(marshalServers); list<string> redirectServers; ProvisionInterface::instance().getRedirectServers(redirectServers); list<string> fServers; ProvisionInterface::instance().getFeatureServers(fServers); ProvisionInterface::instance().registerDirForUpdate( updateMarshal, "Marshals" );}void user(){ // Get info from ps and create. ProvisionInterface& pif = ProvisionInterface::instance(); // Need to do a look up in provisioning to find out the master user // using the given user name... it is possible that the given user // name is an alias. string masterUser = "1000"; try { if ( !pif.isAccount( masterUser ) ) { // reuse the masterUser to store the result. masterUser = pif.getMasterUser( masterUser ); } } catch( VException &e ) { // Got an exception. User must already be the master user. cpLog(LOG_DEBUG, "User %s is already a master", masterUser.c_str() ); } // Now get provisioning info for this user based on the master user. try { VAccountData accountData; cpLog(LOG_DEBUG, "Getting user %s info from prov...", masterUser.c_str() ); pif.getAccountData( masterUser, accountData ); // Create new userData and copy accountData before inserting // into cache. // userData members realm and nonce are set when user authenicates } catch ( VException &e ) { throw VMissingDataException( "*** User not found in provisioning ***", __FILE__, __LINE__, 0 ); }}int main(){// cpLogSetPriority(LOG_DEBUG_STACK); list < string > test; ProvisionInterface::instance("172.19.175.173", 6005, "172.19.175.173", 6005).getMarshalServers(test); list < string >::iterator i;#if 1 for(i = test.begin() ; i != test.end() ; ++i) { cout << *i << endl; VMarshalServerData marshalData; try { ProvisionInterface::instance().getMarshalData( ( i->c_str()), marshalData); } catch(...) { } }#endif list < string > cdrHosts; VCdrServerData cdrDat; ProvisionInterface& pif = ProvisionInterface::instance(); pif.getCdrServers(cdrHosts); list < string > ::iterator cdrItr = cdrHosts.begin(); if ( cdrItr != cdrHosts.end() ) { pif.getCdrData( *cdrItr, cdrDat ); cdrDat.getHost(); cdrDat.getPort(); cdrItr++; if ( cdrItr != cdrHosts.end() ) { pif.getCdrData( *cdrItr, cdrDat ); cdrDat.getHost(); cdrDat.getPort(); } } VGlobalConfigData globalConfigData; try { pif.getConfigData( globalConfigData ); } catch ( VException &e ) { } vector < Data > subscriberList; ProvisionInterface::instance().getSubscribers(subscriberList); vector <Data>::iterator j; for(j = subscriberList.begin(); j != subscriberList.end(); ++j) { cout << *j << endl; } r(); user(); rs(); junk(); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -