📄 vcdrserverdata.hxx
字号:
#ifndef VCDRSERVERDATA_HXX#define VCDRSERVERDATA_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 VCdrServerData_hxx_Version = "$Id: VCdrServerData.hxx,v 1.11 2001/01/25 22:52:21 dabryan Exp $";#include <stdio.h>#include <string>#include "VXmlParser.hxx"#include "VException.hxx"/// CDR Server data containerclass VCdrServerData{ public: /// VCdrServerData() { } /// Constructor from XML string input VCdrServerData(const string& xmlData) throw (VException&) { parse(xmlData); } /// Copy constructor VCdrServerData(const VCdrServerData ©) { deepCopy(copy); }; /// assignment operator VCdrServerData& operator=(const VCdrServerData& other) { if (this != &other) { deepCopy(other); } return (*this); } /// code to parse the input stream void parse(const string& xmlData) throw (VException&) { VXmlParser parser(xmlData); xmlNode *theNode = parser.findNode(NULL, "cdrServer"); _serverHost = parser.getAttribute(theNode, "host"); _serverPort = atoi(parser.getAttribute(theNode, "port").c_str()); _serverName = _serverHost + ":" + (parser.getAttribute(theNode, "port")); theNode = parser.findNode(NULL, "group"); _serverGroup = parser.getAttribute(theNode, "value"); theNode = parser.findNode(NULL, "radiusServer"); _radiusHost = parser.getAttribute(theNode, "host"); _radiusRetries = atoi( parser.getAttribute(theNode, "retries").c_str()); _radiusKey = parser.getAttribute(theNode, "secretKey"); theNode = parser.findNode(NULL, "billing"); _billingFreq = atoi( parser.getAttribute(theNode, "frequency").c_str()); _billingDir = parser.getAttribute(theNode, "dirPath"); _billingLockFile = parser.getAttribute(theNode, "lockFile"); _billingDataFile = parser.getAttribute(theNode, "dataFile"); _billingUnsentExt = parser.getAttribute(theNode, "unsentExtension"); _rolloverSize = atoi( parser.getAttribute(theNode, "rolloverSize").c_str()); _rolloverPeriod = atoi( parser.getAttribute(theNode, "rolloverPeriod").c_str()); string temp = parser.getAttribute(theNode, "billForRingtime"); if (temp == "true" ) { _billForRingtime = true; } else { _billForRingtime = false; } } /// const string& getName() const { return _serverName; };/// const string& getHost() const { return _serverHost; };/// int getPort() const { return _serverPort; };/// const string& getGroup() const { return _serverGroup; }; /// const string& getRadiusHost() const { return _radiusHost; }; /// int getRadiusRetries() const { return _radiusRetries; };/// const string& getRadiusKey() const { return _radiusKey; }; /// int getBillingFreq() const { return _billingFreq; }; /// const string& getBillingDir() const { return _billingDir; }; /// const string& getBillingDataFile() const { return _billingDataFile; }; /// const string& getBillingUnsentExt() const { return _billingUnsentExt; }; /// const string& getBillingLockFile() const { return _billingLockFile; }; /// int getRolloverSize() const { return _rolloverSize; }; /// int getRolloverPeriod() const { return _rolloverPeriod; };/// bool getBillForRingtime() const { return _billForRingtime; };/// friend ostream& operator<<(ostream& os, const VCdrServerData& elem); private: /// copy operation to copy all elements (used by copy constructor and assign) void deepCopy(const VCdrServerData ©) { _serverName = copy._serverName; _serverHost = copy._serverHost; _serverPort = copy._serverPort; _serverGroup = copy._serverGroup; _radiusHost = copy._radiusHost; _radiusRetries = copy._radiusRetries; _radiusKey = copy._radiusKey; _billingFreq = copy._billingFreq; _billingDir = copy._billingDir; _billingDataFile = copy._billingDataFile; _billingUnsentExt = copy._billingUnsentExt; _billingLockFile = copy._billingLockFile; _rolloverSize = copy._rolloverSize; _rolloverPeriod = copy._rolloverPeriod; _billForRingtime = copy._billForRingtime; }; string _serverName; string _serverHost; int _serverPort; string _serverGroup; string _radiusHost; int _radiusRetries; string _radiusKey; int _billingFreq; string _billingDir; string _billingDataFile; string _billingUnsentExt; string _billingLockFile; int _rolloverSize; int _rolloverPeriod; bool _billForRingtime;};///inline ostream& operator<<(ostream& os, const VCdrServerData& elem){ os << "Server Name: " << elem._serverName << endl; os << "Server Host: " << elem._serverHost << endl; os << "Server port: " << elem._serverPort << endl; os << "Server group: " << elem._serverGroup << endl; os << "Radius Host: " << elem._radiusHost << endl; os << "Radius Retries: " << elem._radiusRetries << endl; os << "Radius Key: " << elem._radiusKey << endl; os << "Billing Freq: " << elem._billingFreq << endl; os << "Billing Dir: " << elem._billingDir << endl; os << "Billing Data file: " << elem._billingDataFile << endl; os << "Billing Unsent ext: " << elem._billingUnsentExt << endl; os << "Billing Lock file: " << elem._billingLockFile << endl; os << "File Rollover Size: " << elem._rolloverSize << endl; os << "File Rollover Period: " << elem._rolloverPeriod << endl; os << "File Rollover Period: " << elem._rolloverPeriod << endl; os << "Bill for Ring Time? : " << elem._billForRingtime << endl; return os;}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -