📄 provisioninterface.hxx
字号:
#ifndef ProvisionInterface_hxx#define ProvisionInterface_hxx/* ==================================================================== * The Vovida Software License, Version 1.0 * * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The names "VOCAL", "Vovida Open Communication Application Library", * and "Vovida Open Communication Application Library (VOCAL)" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact vocal@vovida.org. * * 4. Products derived from this software may not be called "VOCAL", nor * may "VOCAL" appear in their name, without prior written * permission of Vovida Networks, Inc. * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. * * ==================================================================== * * This software consists of voluntary contributions made by Vovida * Networks, Inc. and many individuals on behalf of Vovida Networks, * Inc. For more information on Vovida Networks, Inc., please see * <http://www.vovida.org/>. * */static const char* const ProvisionInterface_hxx_Version = "$Id: ProvisionInterface.hxx,v 1.56 2002/09/26 01:14:02 bko Exp $";#include <memory>#include <list>#include <map>#include <string>#include <vector>// class forward definitions// server list containers#include "VFeatureServerGroupContainer.hxx"#include "VMarshalServerGroupContainer.hxx"#include "VRedirectServerGroupContainer.hxx"#include "VCdrServerGroupContainer.hxx"#include "VHeartbeatServerGroupContainer.hxx"#include "VJtapiServerGroupContainer.hxx"#include "VPolicyServerGroupContainer.hxx"// dialplan element#include "VPlanElement.hxx"// server data containers#include "VRedirectServerData.hxx"#include "VFeatureServerData.hxx"#include "VJtapiServerData.hxx"#include "VMarshalServerData.hxx"#include "VLocationServerData.hxx"#include "VLocationRouteData.hxx"#include "VPolicyServerData.hxx"#include "VGlobalConfigData.hxx"#include "VCdrServerData.hxx"#include "VSuavmServerData.hxx"#include "VOspServerData.hxx"#include "VAccountData.hxx"#include "PSInterface.hxx"#include "Data.hxx"class NetworkAddress;class VException;class PSListener;/**Function prototype, a client would define the callback function as. data: Contents of the item updated name: Name of the data item updated*/typedef void (*CallBackFunc)(const string& data, const string& name, bool delFlag);/** Singelton class - Only one instance is available per application. Implements the communications to the provision server and notify content update as it happens on the Provision server. In order to receive notification client has to register itself with the class with a callback function along with the item name for which update notification is requested. Whenever the item changes on the provision server, the callback function is called with the content of the item passed as the argument.*/class ProvisionInterface{ public: enum PContext { VNONE = 1, VFEATURE, VFEATUREX, VREDIRECT, VPOLICY, VMARSHAL, VCONFIG, VCDR, VJTAPI, VLOCATION, VMAX } ; /// Interface to get the Singelton ProvisonInterface instance static ProvisionInterface& instance(const char* primHost = 0, const int primPort = 0, const char* altHost = 0, const int altPort = 0, const char* readSecretFile = 0, const char* writeSecretFile = 0) throw (VException&); /** Frees the memory associated the Instance.Gets register with atexit(), so that when program exits, it will be called automatically. */ static void destroy(); /// Destructor ~ProvisionInterface(); // ***************************************************************** // Item reading functions // ***************************************************************** /// Reads an item from provision server string readItem(const string &group, const string &item) throw (VException&); /// Get an Item from server -- backward compatibility (hence "file") string readFile(const string& host, int port, PContext context, const string& file) throw (VException&); /// Reads a list of items in given group from provision server void getList(const string& group, vector < Data > & retList) throw (VException&); /// Write an item to provision server void writeItem(const string& group, const string &name, const string& contents) throw (VException&); // ***************************************************************** // Server functions and data functions // ***************************************************************** // All of these are by reference (rather than returning) for // efficency reasons (per Surendra) even though it makes things // uglier /// Get global coniguration data from server void getConfigData(VGlobalConfigData &retVal) throw(VException&); /// Get OspServer data from server void getOspServer(VOspServerData &retVal) throw(VException&); // get lists of the servers /** * Get a listing of all the Jtapi servers in the form * host:port:port * * Pass in an empty list of strings, which will be filled * any elements in the list when passed in are deleted */ void getJtapiServers(list < string > &retList) throw(VException&); /** * Get a listing of all the Feature servers in the form * host:port:port * * Pass in an empty list of strings, which will be filled * any elements in the list when passed in are deleted */ void getFeatureServers(list < string > &retList) throw(VException&); /** * Get a listing of all the Marshall servers in the form * host:port:port * * Pass in an empty list of strings, which will be filled * any elements in the list when passed in are deleted */ void getMarshalServers(list < string > &retList) throw(VException&); /** * Get a listing of all the Cdr servers in the form * host:port:port * * Pass in an empty list of strings, which will be filled * any elements in the list when passed in are deleted */ void getCdrServers(list < string > &retList) throw(VException&); /** * Get a listing of all the Heartbeat servers in the form * host:port * * Pass in an empty list of strings, which will be filled * any elements in the list when passed in are deleted */ void getHeartbeatServers(list < string > &retList) throw(VException&); /** * Get a listing of all the Redirect servers in the form * host:port:port * * Pass in an empty list of strings, which will be filled * any elements in the list when passed in are deleted */ void getRedirectServers(list < string > &retList) throw(VException&); /** * Get a listing of all the Policy servers in the form * host:port:port * * Pass in an empty list of strings, which will be filled * any elements in the list when passed in are deleted */ void getPolicyServers(list < string > &retList) throw(VException&); // get the groups each server is in /** Returns all the groups defined in the Jtapi server list * config file. */ void getJtapiGroups(list < string > &retList) throw(VException&); /** Returns all the groups defined in the Feature server list * config data. */ void getFeatureGroups(list < string > &retList) throw(VException&); /** Returns all the groups defined in the Marshal server list * config data. */ void getMarshalGroups(list < string > &retList) throw(VException&); /** Returns all the groups defined in the Cdr server list * config data. */ void getCdrGroups(list < string > &retList) throw(VException&); /** Returns all the groups defined in the Heartbeat server list * config data. */ void getHeartbeatGroups(list < string > &retList) throw(VException&); /** Returns all the groups defined in the Redirect server list * config data. */ void getRedirectGroups(list < string > &retList) throw(VException&); /** Returns all the groups defined in the Policy server list * config data. */ void getPolicyGroups(list < string > &retList) throw(VException&); // get host to group maps /** Return a map of host to group for the Jtapi servers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -