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 #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