From 03335a7dcb48747298eb3392cb6049bdf1576abb Mon Sep 17 00:00:00 2001 From: marian Date: Wed, 9 Jan 2008 12:40:22 +0000 Subject: [PATCH] Added MIME for application/isup class. git-svn-id: http://voip.null.ro/svn/yate@1609 acf43c95-373e-0410-b603-e72c3f656dc1 --- engine/Mime.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++ yatemime.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) diff --git a/engine/Mime.cpp b/engine/Mime.cpp index bb68cdbd..dda7ad01 100644 --- a/engine/Mime.cpp +++ b/engine/Mime.cpp @@ -342,6 +342,8 @@ MimeBody* MimeBody::build(const char* buf, int len, const MimeHeaderLine& type) return new MimeLinesBody(type,buf,len); if (what.startsWith("text/") || (what == "application/dtmf")) return new MimeStringBody(type,buf,len); + if (what == "application/isup") + return new MimeIsupBody(type,buf,len); return new MimeBinaryBody(type,buf,len); } @@ -412,6 +414,9 @@ String* MimeBody::getUnfoldedLine(const char*& buf, int& len) } +/** + * MimeSdpBody + */ YCLASSIMP(MimeSdpBody,MimeBody) MimeSdpBody::MimeSdpBody() @@ -507,6 +512,9 @@ void MimeSdpBody::buildLines(const char* buf, int len) } +/** + * MimeBinaryBody + */ YCLASSIMP(MimeBinaryBody,MimeBody) MimeBinaryBody::MimeBinaryBody(const String& type, const char* buf, int len) @@ -543,6 +551,44 @@ MimeBody* MimeBinaryBody::clone() const } +/** + * MimeIsupBody + */ +YCLASSIMP(MimeIsupBody,MimeBinaryBody) + +MimeIsupBody::MimeIsupBody() + : MimeBinaryBody(String("application/isup"),0,0) +{ +} + +MimeIsupBody::MimeIsupBody(const String& type, const char* buf, int len) + : MimeBinaryBody(type,buf,len) +{ +} + +MimeIsupBody::MimeIsupBody(const MimeHeaderLine& type, const char* buf, int len) + : MimeBinaryBody(type,buf,len) +{ +} + +MimeIsupBody::MimeIsupBody(const MimeIsupBody& original) + : MimeBinaryBody(original) +{ +} + +MimeIsupBody::~MimeIsupBody() +{ +} + +MimeBody* MimeIsupBody::clone() const +{ + return new MimeIsupBody(*this); +} + + +/** + * MimeStringBody + */ YCLASSIMP(MimeStringBody,MimeBody) MimeStringBody::MimeStringBody(const String& type, const char* buf, int len) @@ -576,6 +622,9 @@ MimeBody* MimeStringBody::clone() const } +/** + * MimeLinesBody + */ YCLASSIMP(MimeLinesBody,MimeBody) MimeLinesBody::MimeLinesBody(const String& type, const char* buf, int len) diff --git a/yatemime.h b/yatemime.h index 7abf85a9..c7942615 100644 --- a/yatemime.h +++ b/yatemime.h @@ -488,6 +488,59 @@ protected: virtual void buildBody() const; }; +/** + * An object holding a binary block of an ISUP message + * @short MIME for application/isup + */ +class YATE_API MimeIsupBody : public MimeBinaryBody +{ +public: + /** + * Constructor + */ + MimeIsupBody(); + + /** + * Constructor from block of data + * @param type The line containing the Content-Type header value + * @param buf Pointer to buffer of data + * @param len Length of data in buffer + */ + MimeIsupBody(const String& type, const char* buf, int len); + + /** + * Constructor from block of data + * @param type The content type header line + * @param buf Pointer to buffer of data + * @param len Length of data in buffer + */ + MimeIsupBody(const MimeHeaderLine& type, const char* buf, int len); + + /** + * Destructor + */ + virtual ~MimeIsupBody(); + + /** + * RTTI method, get a pointer to a derived class given the class name + * @param name Name of the class we are asking for + * @return Pointer to the requested class or NULL if this object doesn't implement it + */ + virtual void* getObject(const String& name) const; + + /** + * Duplicate this MIME body + * @return Copy of this MIME body - a new MimeIsupBody + */ + virtual MimeBody* clone() const; + +protected: + /** + * Copy constructor + */ + MimeIsupBody(const MimeIsupBody& original); +}; + /** * An object holding MIME data as just one text string * @short MIME for one text string