00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
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