im.h

Go to the documentation of this file.
00001 /*
00002  * im_mf.h
00003  *
00004  * Media formats for Instant Messaging
00005  *
00006  * Open Phone Abstraction Library (OPAL)
00007  *
00008  * Copyright (c) 2008 Post Increment
00009  *
00010  * The contents of this file are subject to the Mozilla Public License
00011  * Version 1.0 (the "License"); you may not use this file except in
00012  * compliance with the License. You may obtain a copy of the License at
00013  * http://www.mozilla.org/MPL/
00014  *
00015  * Software distributed under the License is distributed on an "AS IS"
00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00017  * the License for the specific language governing rights and limitations
00018  * under the License.
00019  *
00020  * The Original Code is Open Phone Abstraction Library.
00021  *
00022  * The Initial Developer of the Original Code is Post Increment
00023  *
00024  * Contributor(s): ______________________________________.
00025  *
00026  * $Revision: 24298 $
00027  * $Author: csoutheren $
00028  * $Date: 2010-04-28 04:03:02 -0500 (Wed, 28 Apr 2010) $
00029  */
00030 
00031 #ifndef OPAL_IM_IM_H
00032 #define OPAL_IM_IM_H
00033 
00034 #include <ptlib.h>
00035 #include <opal/buildopts.h>
00036 
00037 #include <ptclib/url.h>
00038 #include <opal/transports.h>
00039 
00040 
00041 
00042 class OpalIM : public PObject
00043 {
00044   public:
00045     PURL    m_to;
00046     PURL    m_from;
00047     PString m_fromName;
00048     PString m_mimeType;
00049     PString m_body;
00050     PString m_conversationId;
00051 
00052     OpalTransportAddress m_fromAddr;
00053     OpalTransportAddress m_toAddr;
00054 };
00055 
00056 #if OPAL_HAS_IM
00057 
00058 #include <opal/mediastrm.h>
00059 
00060 #include <im/rfc4103.h>
00061 
00062 class OpalIMMediaType : public OpalMediaTypeDefinition 
00063 {
00064   public:
00065     OpalIMMediaType(
00066       const char * mediaType, 
00067       const char * sdpType    
00068     )
00069       : OpalMediaTypeDefinition(mediaType, sdpType, 0, OpalMediaType::DontOffer)
00070     { }
00071 
00072     PString GetRTPEncoding() const { return PString::Empty(); }
00073     RTP_UDP * CreateRTPSession(OpalRTPConnection & , unsigned , bool ) { return NULL; }
00074     virtual bool UsesRTP() const { return false; }
00075 };
00076 
00077 class RTP_IMFrame : public RTP_DataFrame
00078 {
00079   public:
00080     RTP_IMFrame();
00081     RTP_IMFrame(const PString & contentType);
00082     RTP_IMFrame(const PString & contentType, const T140String & content);
00083     RTP_IMFrame(const BYTE * data, PINDEX len, PBoolean dynamic = true);
00084 
00085     void SetContentType(const PString & contentType);
00086     PString GetContentType() const;
00087 
00088     void SetContent(const T140String & text);
00089     bool GetContent(T140String & text) const;
00090 
00091     PString AsString() const { return PString((const char *)GetPayloadPtr(), GetPayloadSize()); }
00092 };
00093 
00094 class OpalIMMediaStream : public OpalMediaStream
00095 {
00096   public:
00097     OpalIMMediaStream(
00098       OpalConnection & conn,
00099       const OpalMediaFormat & mediaFormat, 
00100       unsigned sessionID,                  
00101       bool isSource                        
00102     );
00103 
00104     virtual PBoolean IsSynchronous() const         { return false; }
00105     virtual PBoolean RequiresPatchThread() const   { return false; }
00106 
00107     bool ReadPacket(RTP_DataFrame & packet);
00108     bool WritePacket(RTP_DataFrame & packet);
00109 };
00110 
00111 #endif // OPAL_HAS_IM
00112 
00113 #endif // OPAL_IM_IM_H

Generated on Sun Nov 21 20:20:50 2010 for OPAL by  doxygen 1.4.7