⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vaccountdata.hxx

📁 SIP(Session Initiation Protocol)是由IETF定义
💻 HXX
字号:
#ifndef VACCOUNTDATA_HXX#define VACCOUNTDATA_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 VAccountData_hxx_Version =    "$Id: VAccountData.hxx,v 1.5 2001/02/23 19:38:54 cktam Exp $";#include <stdio.h>#include <string>#include "VXmlParser.hxx"#include "VException.hxx"/// User account data containerclass VAccountData{    public:    ///        VAccountData()        { }    /// constructor taking an XML stream as input        VAccountData(const string& xmlData) throw (VException&)        {            parse(xmlData);        }    /// copy constructor        VAccountData(const VAccountData &copy)        {            deepCopy(copy);        };    /// assignment operator        VAccountData& operator=(const VAccountData& other)        {            if (this != &other)            {                deepCopy(other);            }            return (*this);        }    /// code to parse the input stream        void parse(const string& xmlData) throw (VException&)        {            VXmlParser parser(xmlData);            _userIP = parser.getContent("user", "ipaddr");            _marshalGroup = parser.getContent("user", "marshalgroup");	    	    xmlNode *theNode = parser.findNode(NULL, "user");            list < xmlNodePtr > listOfAliases;            parser.findNode(theNode, "alias", listOfAliases);            for (list < xmlNodePtr > ::iterator itr = listOfAliases.begin();                    itr != listOfAliases.end(); itr++)            {                xmlNodePtr aliasNode = (*itr);                // get value attribute from node                string val = parser.getAttribute(aliasNode, "value");                _aliases.push_back(val);            }            theNode = parser.findNode(NULL, "staticRegistration");            string retStr = parser.getAttribute(theNode, "value");            if (retStr == "true")            {                _staticReg = true;                theNode = parser.findNode(NULL, "user");                list < xmlNodePtr > listOfContacts;                parser.findNode(theNode, "contact", listOfContacts);                for (list < xmlNodePtr > ::iterator itr = listOfContacts.begin();                        itr != listOfContacts.end(); itr++)                {                    xmlNodePtr aliasNode = (*itr);                    // get value attribute from node                    string val = parser.getAttribute(aliasNode, "value");                    _contactList.push_back(val);                }            }            else            {                _staticReg = false;                _contactList.clear();            }            theNode = parser.findNode(NULL, "authenticationType");            _authType = parser.getAttribute(theNode, "value");            theNode = parser.findNode(NULL, "authenticationPassword");            _authPass = parser.getAttribute(theNode, "value");        }    ///    const string& getMarshalGroup() const    {        return _marshalGroup;    }	    ///    const string& getUserIP() const    {        return _userIP;    };        ///    void getAliases(list < string > &retVal) const        {            retVal.clear();            for (list < string > ::const_iterator itr = _aliases.begin();                    itr != _aliases.end(); itr++)            {                retVal.push_back(*itr);            }        }///    void getTermContactList(list < string > &retVal) const        {            retVal.clear();            for (list < string > ::const_iterator itr = _contactList.begin();                    itr != _contactList.end(); itr++)            {                retVal.push_back(*itr);            }        }///    const string& getAuthorizationType() const        {            return _authType;        };///    const string& getAuthorizationPassword() const        {            return _authPass;        };///    bool getStaticRegistration() const        {            return _staticReg;        };    ///    friend ostream& operator<<(ostream& os, const VAccountData& elem);    private:    /// copy operation to copy all elements (used by copy constructor and assign)    void deepCopy(const VAccountData &copy)        {            _userIP = copy._userIP;            _aliases = copy._aliases;            _contactList = copy._contactList;            _authType = copy._authType;            _authPass = copy._authPass;            _staticReg = copy._staticReg;        };            string _userIP;        list < string > _aliases;        list < string > _contactList;        string _marshalGroup;	string _authType;        string _authPass;        bool _staticReg;};///inline ostream& operator<<(ostream& os, const VAccountData& elem){    os << "User IP:                    " << elem._userIP << endl;    list < string > tempList;    os << "Aliases:                    " << endl;    elem.getAliases(tempList);    for (list < string > ::const_iterator itr = tempList.begin();            itr != tempList.end(); itr++)    {        os << "  " << *itr << endl;    }    os << "Terminating Contact List:   " << endl;    elem.getTermContactList(tempList);    for (list < string > ::const_iterator itr = tempList.begin();            itr != tempList.end(); itr++)    {        os << "  " << *itr << endl;    }    os << "Authorization Type:         " << elem._authType << endl;    os << "Authorization Password:     " << elem._authPass << endl;    os << "Static Registration:        " << elem._staticReg << endl;    return os;}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -