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

📄 sipmessage.hxx

📁 这是国外的resip协议栈
💻 HXX
📖 第 1 页 / 共 2 页
字号:
#if !defined(RESIP_SIPMESSAGE_HXX)#define RESIP_SIPMESSAGE_HXX #include <sys/types.h>#include <list>#include <vector>#include <utility>#include <memory> #include "resip/stack/Contents.hxx"#include "resip/stack/Headers.hxx"#include "resip/stack/TransactionMessage.hxx"#include "resip/stack/ParserContainer.hxx"#include "resip/stack/ParserCategories.hxx"#include "resip/stack/SecurityAttributes.hxx"#include "resip/stack/Tuple.hxx"#include "resip/stack/Uri.hxx"#include "resip/stack/MessageDecorator.hxx"#include "rutil/BaseException.hxx"#include "rutil/Data.hxx"#include "rutil/Timer.hxx"#include "rutil/HeapInstanceCounter.hxx"namespace resip{class Contents;class ExtensionHeader;class SecurityAttributes;class Transport;/**   @ingroup resip_crit   @brief Represents a SIP message.   This is the class that your app will spend the most time working with. This   is because, in the UA core/Transaction User architecture, the vast majority   of interaction is carried out through SIP messaging.   When you get a SipMessage, generally the first thing you want to know is    whether it is a request or a response. This is done by calling    SipMessage::isRequest() or SipMessage::isResponse().      Next, it is usually important to determine what the SIP method of the message    is. This is done by calling SipMessage::method() (this is a convenience    function that checks the method of the Request-Line if the message is a    request, or the method of the CSeq if a response).      At this point, it may become useful to examine the start-line of the message.   If the message is a request, you can get the Request-Line (represented by a    RequestLine&) by calling   @code      RequestLine& rLine = sip.header(h_RequestLine);   @endcode   If the message is a response, you can get the Status-Line (represented by a StatusLine&) by calling   @code      StatusLine& sLine = sip.header(h_StatusLine);   @endcode   From here, examination of the various headers is in order. Each header type   has an associated h_HeaderName access token that we use to retrieve the    value/values of that header. Generally speaking, the access token    h_HeaderName is named in a predictable fashion; all non-alphanumeric    characters are omitted, the first letter of each word is capitalized, and the    name is pluralized if the header is multi-valued. Examples include h_To,    h_From, h_CSeq, h_CallId, h_Routes, h_Contacts, h_RecordRoutes, etc.*/class SipMessage : public TransactionMessage{   public:      RESIP_HeapCount(SipMessage);      typedef std::list< std::pair<Data, HeaderFieldValueList*> > UnknownHeaders;      explicit SipMessage(const Transport* fromWire = 0);      // .dlb. public, allows pass by value to compile.      SipMessage(const SipMessage& message);      // .dlb. sure would be nice to have overloaded return value here..      virtual Message* clone() const;      SipMessage& operator=(const SipMessage& rhs);            // returns the transaction id from the branch or if 2543, the computed hash      virtual const Data& getTransactionId() const;      const Data& getRFC2543TransactionId() const;      void setRFC2543TransactionId(const Data& tid);            virtual ~SipMessage();      static SipMessage* make(const Data& buffer, bool isExternal = false);      void parseAllHeaders();            static bool checkContentLength;      class Exception : public BaseException      {         public:            Exception(const Data& msg, const Data& file, const int line)               : BaseException(msg, file, line) {}            const char* name() const { return "SipMessage::Exception"; }      };      void setFromTU()       {         mIsExternal = false;      }      void setFromExternal()      {         mIsExternal = true;      }            bool isExternal() const      {         return mIsExternal;      }      virtual bool isClientTransaction() const;            virtual std::ostream& encode(std::ostream& str) const;            //sipfrags will not output Content Length if there is no body--introduce      //friendship to hide this?      virtual std::ostream& encodeSipFrag(std::ostream& str) const;      std::ostream& encodeEmbedded(std::ostream& str) const;            virtual std::ostream& encodeBrief(std::ostream& str) const;      bool isRequest() const;      bool isResponse() const;      bool isInvalid() const{return mInvalid;}            resip::MethodTypes method() const;            const resip::Data& getReason() const{return mReason;}            const RequestLine&       header(const RequestLineType& l) const;      RequestLine&       header(const RequestLineType& l);      const StatusLine&       header(const StatusLineType& l) const;      StatusLine&       header(const StatusLineType& l);      bool exists(const HeaderBase& headerType) const;      bool empty(const HeaderBase& headerType) const;      void remove(const HeaderBase& headerType);#define defineHeader(_header, _name, _type, _rfc)                       \      const H_##_header::Type& header(const H_##_header& headerType) const; \            H_##_header::Type& header(const H_##_header& headerType)      #define defineMultiHeader(_header, _name, _type, _rfc)                  \      const H_##_header##s::Type& header(const H_##_header##s& headerType) const; \            H_##_header##s::Type& header(const H_##_header##s& headerType)            defineHeader(ContentDisposition, "Content-Disposition", Token, "RFC 3261");      defineHeader(ContentEncoding, "Content-Encoding", Token, "RFC 3261");      defineHeader(MIMEVersion, "Mime-Version", Token, "RFC 3261");      defineHeader(Priority, "Priority", Token, "RFC 3261");      defineHeader(Event, "Event", Token, "RFC 3265");      defineHeader(SubscriptionState, "Subscription-State", Token, "RFC 3265");      defineHeader(SIPETag, "SIP-ETag", Token, "RFC 3903");      defineHeader(SIPIfMatch, "SIP-If-Match", Token, "RFC 3903");      defineHeader(ContentId, "Content-ID", Token, "RFC 2045");      defineMultiHeader(AllowEvents, "Allow-Events", Token, "RFC 3265");      defineHeader(Identity, "Identity", StringCategory, "draft-sip-identity-03");      defineMultiHeader(AcceptEncoding, "Accept-Encoding", Token, "RFC 3261");      defineMultiHeader(AcceptLanguage, "Accept-Language", Token, "RFC 3261");      defineMultiHeader(Allow, "Allow", Token, "RFC 3261");      defineMultiHeader(ContentLanguage, "Content-Language", Token, "RFC 3261");      defineMultiHeader(ProxyRequire, "Proxy-Require", Token, "RFC 3261");      defineMultiHeader(Require, "Require", Token, "RFC 3261");      defineMultiHeader(Supported, "Supported", Token, "RFC 3261");      defineMultiHeader(Unsupported, "Unsupported", Token, "RFC 3261");      defineMultiHeader(SecurityClient, "Security-Client", Token, "RFC 3329");      defineMultiHeader(SecurityServer, "Security-Server", Token, "RFC 3329");      defineMultiHeader(SecurityVerify, "Security-Verify", Token, "RFC 3329");      defineMultiHeader(RequestDisposition, "Request-Disposition", Token, "RFC 3841");      defineMultiHeader(Reason, "Reason", Token, "RFC 3326");      defineMultiHeader(Privacy, "Privacy", Token, "RFC 3323");      defineMultiHeader(PMediaAuthorization, "P-Media-Authorization", Token, "RFC 3313");      defineHeader(ReferSub, "Refer-Sub", Token, "draft-ietf-sip-refer-with-norefersub-03");      defineHeader(AnswerMode, "Answer-Mode", Token, "draft-ietf-answermode-01");      defineHeader(PrivAnswerMode, "Priv-Answer-Mode", Token, "draft-ietf-answermode-01");      defineMultiHeader(Accept, "Accept", Mime, "RFC 3261");      defineHeader(ContentType, "Content-Type", Mime, "RFC 3261");      defineMultiHeader(CallInfo, "Call-Info", GenericUri, "RFC 3261");      defineMultiHeader(AlertInfo, "Alert-Info", GenericUri, "RFC 3261");      defineMultiHeader(ErrorInfo, "Error-Info", GenericUri, "RFC 3261");      defineHeader(IdentityInfo, "Identity-Info", GenericUri, "draft-sip-identity-03");      defineMultiHeader(RecordRoute, "Record-Route", NameAddr, "RFC 3261");      defineMultiHeader(Route, "Route", NameAddr, "RFC 3261");      defineMultiHeader(Contact, "Contact", NameAddr, "RFC 3261");      defineHeader(From, "From", NameAddr, "RFC 3261");      defineHeader(To, "To", NameAddr, "RFC 3261");      defineHeader(ReplyTo, "Reply-To", NameAddr, "RFC 3261");      defineHeader(ReferTo, "Refer-To", NameAddr, "RFC 3515");      defineHeader(ReferredBy, "Referred-By", NameAddr, "RFC 3892");      defineMultiHeader(Path, "Path", NameAddr, "RFC 3327");      defineMultiHeader(AcceptContact, "Accept-Contact", NameAddr, "RFC 3841");      defineMultiHeader(RejectContact, "Reject-Contact", NameAddr, "RFC 3841");      defineMultiHeader(PAssertedIdentity, "P-Asserted-Identity", NameAddr, "RFC 3325");      defineMultiHeader(PPreferredIdentity, "P-Preferred-Identity", NameAddr, "RFC 3325");      defineHeader(PCalledPartyId, "P-Called-Party-ID", NameAddr, "RFC 3455");      defineMultiHeader(PAssociatedUri, "P-Associated-URI", NameAddr, "RFC 3455");      defineMultiHeader(ServiceRoute, "Service-Route", NameAddr, "RFC 3608");      defineHeader(RemotePartyId, "Remote-Party-ID", NameAddr, "draft-ietf-sip-privacy-04");      defineHeader(ContentTransferEncoding, "Content-Transfer-Encoding", StringCategory, "RFC ?");      defineHeader(Organization, "Organization", StringCategory, "RFC 3261");      defineHeader(Server, "Server", StringCategory, "RFC 3261");      defineHeader(Subject, "Subject", StringCategory, "RFC 3261");      defineHeader(UserAgent, "User-Agent", StringCategory, "RFC 3261");      defineHeader(Timestamp, "Timestamp", StringCategory, "RFC 3261");      defineHeader(ContentLength, "Content-Length", UInt32Category, "RFC 3261");      defineHeader(MaxForwards, "Max-Forwards", UInt32Category, "RFC 3261");      defineHeader(MinExpires, "Min-Expires", UInt32Category, "RFC 3261");      defineHeader(RSeq, "RSeq", UInt32Category, "RFC 3261");// !dlb! this one is not quite right -- can have (comment) after field value      defineHeader(RetryAfter, "Retry-After", UInt32Category, "RFC 3261");      defineHeader(Expires, "Expires", ExpiresCategory, "RFC 3261");      defineHeader(SessionExpires, "Session-Expires", ExpiresCategory, "RFC 4028");

⌨️ 快捷键说明

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