📄 sipmsg.hxx
字号:
#ifndef SIPMSG_HXX_#define SIPMSG_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 SipMsgVersion = "$Id: SipMsg.hxx,v 1.118.2.4 2003/02/21 03:44:58 bko Exp $";#include "Data.hxx"#include "NetworkAddress.h"#include "SipCallLeg.hxx"#include "SipContentDataContainer.hxx"#include "SipHeaderList.hxx"#include "SipRawHeaderContainer.hxx"#include "symbols.hxx"#include "VException.hxx"#if USE_HASH_MAP #if defined(__linux__)#include <hash_map>#else#undef USE_HASH_MAP#endif#endifnamespace Vocal{class SipAccept;class SipAcceptEncoding;class SipAcceptLanguage;class SipAllow;class SipAlso;class SipCallId;class SipCSeq;class SipContact;class SipContentData;class SipContentLanguage;class SipContentLength;class SipDate;class SipDiversion;class SipEncryption;class SipExpires;class SipFrom;class SipMimeVersion;class SipRecordRoute;class SipReferTo;class SipReferredBy;class SipReplaces;class SipRetryAfter;class SipSubsNotifyEvent;class SipSupported;class SipTimestamp;class SipTo;class SipTransferTo;class SipUserAgent;class SipVia;class SipParserException : public VException{ public: /// SipParserException( const string& msg, const string& file, const int line, const int error = 0 ); string getName( void ) const;};typedef SipHeaderList <SipRecordRoute> SipRecordRouteList;typedef SipHeaderList <SipVia> SipViaList;typedef SipHeaderList <SipContact> SipContactList;typedef SipHeaderList <SipDiversion> SipDiversionList;/** This class is the base class for all SIP Messages. It is just a container class of all SIP Headers, common to SIP Requests and SIP responses. */class SipMsg{ public: ///SipMsg constructor SipMsg(); ///SipMsg copy constructor SipMsg(const SipMsg&); ///SipMsg destructor virtual ~SipMsg(); /// SipMsg& operator=(const SipMsg& newSipMsg); /// bool operator<(const SipMsg& src) const; /// bool operator ==(const SipMsg& src) const; /// //returns the type of the object in the sub classes. virtual Method getType() const = 0; /**@name general header methods */ //@{ /// copy an arbitrary header from the src message void copyHeader(const SipMsg& src, SipHeaderType type); /// checks to see if an arbitrary header exists in the message bool containsHeader(SipHeaderType type); //@} /**@name Accept Header Methods */ //@{ /// get the number of Accept items int getNumAccept() const; /// Get the i'th Accept item. If i is -1, it gets the last one const SipAccept& getAccept( int i=-1) const; /** set or add another Accept item, if the index is -1, it is * appended to the current list */ void setAccept(const SipAccept& item, int index=-1); /** set or add another Accept item, if the index is -1, it is * appended to the current list */ void setAccept(const Data&item, int index=-1); /** Set number of Accept items. If i is less than current number then the extras are deleted. */ void setNumAccept(int i); ///returns the encoded accept list. Data encodeAcceptList() const; ///compare the Accept objects in this SipMsg, to the src SipMsg object. bool compareAccept(const SipMsg& src) const; ///copies the accept list from srcObject to this object. void copyAcceptList(const SipMsg& srcObject); /// void flushAcceptList(); /// void addAccept(SipAccept*); /// const vector<SipAccept*>& getAcceptList() const; //@} /**@name AcceptEncoding Header Methods */ //@{ /// get the number of AcceptEncoding items int getNumAcceptEncoding() const; /// Get the i'th AcceptEncoding item. If i is -1, it gets the last one const SipAcceptEncoding& getAcceptEncoding( int i=-1) const; /** set or add another AcceptEncoding item, if the index is -1, * it is appended to the current list. */ void setAcceptEncoding(const SipAcceptEncoding& item, int index=-1); /** set or add another AcceptEncoding item, if the index is * -1, it is appended to the current list. */ void setAcceptEncoding(const Data& item, int index=-1); /** Set number of AcceptEncoding items.If i is less than * current number then the extras are deleted. */ void setNumAcceptEncoding(int i); ///return the entire acceptencoding list. const vector<SipAcceptEncoding*>& getAcceptEncodingList() const; ///add another item into the acceptEncoding list. void addAcceptEncoding(SipAcceptEncoding* acceptEncoding); ///returns the encoded acceptEncoding list. Data encodeAcceptEncodingList() const; ///copies the acceptencoding list from srcObject to this object. void copyAcceptEncodingList(const SipMsg& srcObject); ///compare accept encoding items of this object to the src object bool compareAcceptEncoding(const SipMsg& src) const; /// void flushAcceptEncodingList(); //@} /**@name AcceptLanguage Header Methods */ //@{ /// get the number of AcceptLanguage items int getNumAcceptLanguage() const; /// Get the i'th AcceptLanguage item. If i is -1, it gets the last one const SipAcceptLanguage& getAcceptLanguage( int i=-1) const; /** set or add another AcceptLanguage item, if the index is * -1, it is appended to the current list */ void setAcceptLanguage(const SipAcceptLanguage& item, int index=-1); /** set or add another AcceptLanguage item, if the index is * -1, it is appended to the current list */ void setAcceptLanguage(const Data& item, int index=-1); /** Set number of AcceptLanguage items. If i is less than * current number then the extras are deleted. */ void setNumAcceptLanguage(int i); /// returns the encoded accept language list. Data encodeAcceptLangList() const; /// copies the acceptlanguage list from srcObject to this object. void copyAcceptLangList(const SipMsg& srcObject); /// returns the entire acceptlanguage list. const vector<SipAcceptLanguage*>& getAcceptLangList() const; /// allows addition of another acceptlanguage object. void addAcceptLang(SipAcceptLanguage* sipacceptlang); /// removes all acceptlanguage objects from the list. void flushAcceptLanguageList(); /// compare acceptlanguage objects of this object to the src object bool compareAcceptLanguage(const SipMsg& src) const; //@} /**@name CSeq Header Methods */ //@{ /// Get the current CSeq header const SipCSeq& getCSeq() const; /// Set the CSeq header void setCSeq( const SipCSeq& ); /// void setCSeq( const Data& ); /// increments the cseq, if none there, void incrementCSeq(); //@} /**@name CallId Header Methods */ //@{ /// Get the current CallId header const SipCallId& getCallId() const; /// Set the CallId header void setCallId( const SipCallId& ); /// void setCallId( const Data& ); //@} // ----------------- CallLeg Header Methods ------------------ /// Get the current CallLeg header SipCallLeg computeCallLeg() const; /**@name Contact Header Methods */ //@{ /// get the number of Contact items int getNumContact() const; /// Get the i'th Contact item. If i is -1, it gets the last one const SipContact& getContact( int i=-1) const; /** set or add another Contact item, if the index is -1, it is * appended to the current list */ void setContact(const SipContact& item, int index=-1); /** set or add another Contact item, if the index is -1, it is * appended to the current list */ void setContact(const Data& item, int index=-1); /** Set number of Contact item. If i is less than current * number then the extras are deleted. */ void removeContact(int index = -1); /** Set number of Contact items. If i is less than current * number then the extras are deleted. */ void setNumContact(int i); /// remove all contact objects from the list. void flushContact(); /// return the encoded contact list. Data encodeContact() const; /// copy contact object from srcObject to this object. void copyContact(const SipMsg& srcObject); /// return the entire contact list SipContactList getContactList() const; /// compare contact objects of this object to src object. bool compareContact(const SipMsg& src) const; //@} /**@name ContentLength Header Methods */ //@{ ///return the contentlength object. const SipContentLength& getContentLength() const;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -