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: 24076 $
00027  * $Author: rjongbloed $
00028  * $Date: 2010-02-23 21:06:41 -0600 (Tue, 23 Feb 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 #if OPAL_HAS_IM
00038 
00039 #include <opal/mediastrm.h>
00040 
00041 #include <im/rfc4103.h>
00042 
00043 class OpalIMMediaType : public OpalMediaTypeDefinition 
00044 {
00045   public:
00046     OpalIMMediaType(
00047       const char * mediaType, 
00048       const char * sdpType    
00049     )
00050       : OpalMediaTypeDefinition(mediaType, sdpType, 0, OpalMediaType::DontOffer)
00051     { }
00052 
00053     PString GetRTPEncoding() const { return PString::Empty(); }
00054     RTP_UDP * CreateRTPSession(OpalRTPConnection & , unsigned , bool ) { return NULL; }
00055     virtual bool UsesRTP() const { return false; }
00056 };
00057 
00058 class RTP_IMFrame : public RTP_DataFrame
00059 {
00060   public:
00061     RTP_IMFrame();
00062     RTP_IMFrame(const PString & contentType);
00063     RTP_IMFrame(const PString & contentType, const T140String & content);
00064     RTP_IMFrame(const BYTE * data, PINDEX len, PBoolean dynamic = PTrue);
00065 
00066     void SetContentType(const PString & contentType);
00067     PString GetContentType() const;
00068 
00069     void SetContent(const T140String & text);
00070     bool GetContent(T140String & text) const;
00071 
00072     PString AsString() const { return PString((const char *)GetPayloadPtr(), GetPayloadSize()); }
00073 };
00074 
00075 class OpalIMMediaStream : public OpalMediaStream
00076 {
00077   public:
00078     OpalIMMediaStream(
00079       OpalConnection & conn,
00080       const OpalMediaFormat & mediaFormat, 
00081       unsigned sessionID,                  
00082       bool isSource                        
00083     );
00084 
00085     virtual PBoolean IsSynchronous() const         { return false; }
00086     virtual PBoolean RequiresPatchThread() const   { return false; }
00087 
00088     bool ReadPacket(RTP_DataFrame & packet);
00089     bool WritePacket(RTP_DataFrame & packet);
00090 };
00091 
00092 #endif // OPAL_HAS_IM
00093 
00094 #endif // OPAL_IM_IM_H

Generated on Mon Feb 21 20:19:21 2011 for OPAL by  doxygen 1.4.7