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

📄 sdp.hxx

📁 一个SIP协议栈
💻 HXX
字号:
#ifndef SDP_HXX_#define SDP_HXX_// $Id: sdp.hxx,v 1.3 1999/08/31 01:53:27 cullen Exp $/*This library is free software; you can redistribute it and/or modifyit under the terms of the GNU Lesser General Public License aspublished by the Free Software Foundation; either version 2 of theLicense, or (at your option) any later version.This library is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNULesser General Public License for more details.You should have received a copy of the GNU Lesser General PublicLicense along with this library; if not; write to the Free SoftwareFoundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA.*/// $Log: sdp.hxx,v $// Revision 1.3  1999/08/31 01:53:27  cullen// Cullen check in some code from Luan that has things needed to compile//// Revision 1.11  1999/07/23 23:57:25  bogawa//// the mgcp/examples/gateway Makefile was changed to use the new make file system.//// improve the global makefiles.  Now, most targets use these makefiles// which should simplify the lives of the users, we hope.//// Key features include support for nested object directories as well as// a more coherent install strategy (so that installs are less likely to// produce error messages)//// in addition, the code was cleaned up to add a few new features and to// remove some warnings.//// Revision 1.10  1999/07/12 23:12:15  bogawa// fix for CVS commit.//// Revision 1.9  1999/07/12 23:08:59  bogawa//// change the code to actually work (I hope).//// Revision 1.8  1999/07/12 22:05:43  bogawa//// Fixes for two bugs.//// 1.  trying to read an empty SDP will work OK (it will return an invalid// SDP).// 2.  the OKResponse char is now an extern in the .h file and so should// work ok.//// Revision 1.7  1999/06/30 06:09:08  bogawa//// update copyright and license//// Revision 1.6  1999/06/29 23:42:03  bogawa//// Updated copyright notice.//// Revision 1.5  1999/06/28 21:30:37  bogawa//// Update to the latest version of the MGCP stack.//// Revision 1.4  1999/06/09 08:16:44  bogawa//// Add copyright notices.//// Revision 1.3  1999/06/09 04:09:46  bogawa//// This makefile now correctly does diving makes.//// In addition, the code has been cleaned up and adds some comments for doc++.//// doc++ can be invoked by using make doc -- the current version will be shipped// with  appropriate html documentation.//// Revision 1.2  1999/06/09 01:04:59  bogawa//// Changes to make the new structure compile correctly, and to allow the// code to use the new hardware structure.  gateway1 is now using the// new structure fully, while gateway2 is using it partially (actually// not very much).//// A future version should be much cleaner.//#include "global.h"#include <string>#include <vector>#include "mstring.h"#include <sys/types.h>///enum NetworkType{    NetworkTypeInternet,};///enum AddressType{    AddressTypeIPV4,};///enum TransportType{    TransportTypeRTP,    TransportTypeUDP,};///enum MediaType{    MediaTypeAudio,};/// implement simple session description protocolclass SDPDescriptor{public:    ///    SDPDescriptor() : 	protocolVersion(0),	username("-"),	networkType(NetworkTypeInternet),	addressType(AddressTypeIPV4),	address("0.0.0.0"),	sessionName("no session name"),	portCount(0),	transportType(TransportTypeRTP),	mediaType(MediaTypeAudio),	isValid(false)	{ 	    formatList.clear();	    formatList.push_back(0);	    buf[0] = '\0';	    isValid = false;	}    ///    SDPDescriptor(const SDPDescriptor& x) :	protocolVersion(x.protocolVersion),	username(x.username),	sessionId(x.sessionId),	version(x.version),	networkType(x.networkType),	addressType(x.addressType),	address(x.address),	sessionName(x.sessionName),	port(x.port),	portCount(x.portCount),	transportType(x.transportType),	formatList(x.formatList),	mediaType(x.mediaType),	isValid(x.isValid)	{	    buf[0] = '\0';	};    ///    bool isValidDescriptor() { return isValid; }    ///    void setValidDescriptor(bool valid) { isValid = valid; }    ///    void setSessionName(char* name) { sessionName = name; isValid = true; }    ///    void setSessionName(const std::mstring& name) { sessionName = name;  isValid = true; }    ///    std::mstring* getSessionName() { return &sessionName; }    ///    void setAddress(char* addr) { address = addr;  isValid = true; }    ///    void setAddress(const std::mstring& addr) { address = addr;   isValid = true;}    ///    std::mstring* getAddress() { return &address; }    ///    void setUserName(char* name) { username = name;  isValid = true; }    ///    void setUserName(const std::mstring& name) { username = name;  isValid = true; }    ///    std::mstring* getUserName() { return &username; }    ///    void setSessionId(int session) { sessionId = session;  isValid = true; }    ///    int getSessionId() { return sessionId; }    ///    void setVersion(int vers) { version = vers;  isValid = true; }    ///    int getVersion() { return version; }    ///    void setPort(int p) { port = p;  isValid = true;}    ///    int getPort() { return port; }    ///    void addFormat(int fmt) { formatList.push_back(fmt);  isValid = true; }    ///    vector<int>* getFormatList() { return &formatList; }    ///    std::mstring* encode();    ///    bool decode(const std::mstring& buffer);    ///    bool decode(const vector<std::mstring>& parms);    ///    bool decode(vector<std::mstring>& lines);    ///    ///    SDPDescriptor& operator= (const SDPDescriptor& x) { 	this->protocolVersion = x.protocolVersion;	this->username = x.username;	this->sessionId = x.sessionId;	this->version = x.version;	this->networkType = x.networkType;	this->addressType = x.addressType;	this->address = x.address;	this->sessionName = x.sessionName;	this->port = x.port;	this->portCount = x.portCount;	this->transportType = x.transportType;	this->formatList = x.formatList;	this->mediaType = x.mediaType;	this->buf[0] = '\0';	this->isValid = x.isValid;	return *this;     }private:    ///    int protocolVersion;    ///    std::mstring username;    ///    int sessionId;    ///    int version;    ///    NetworkType networkType;    ///    AddressType addressType;    ///    std::mstring address;    ///    std::mstring sessionName;    ///    int port;    ///    int portCount;    ///    TransportType transportType;    ///    vector<int> formatList;    ///    MediaType mediaType;    ///    char buf[4096];    ///    std::mstring myEncoding;    /// this bool is set to true if this is a valid session descriptor    bool isValid;};typedef SDPDescriptor SessionDescriptor;#endif

⌨️ 快捷键说明

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