rfc2833.h

Go to the documentation of this file.
00001 /*
00002  * rfc2833.h
00003  *
00004  * Open Phone Abstraction Library (OPAL)
00005  * Formally known as the Open H323 project.
00006  *
00007  * Copyright (c) 2001 Equivalence Pty. Ltd.
00008  *
00009  * The contents of this file are subject to the Mozilla Public License
00010  * Version 1.0 (the "License"); you may not use this file except in
00011  * compliance with the License. You may obtain a copy of the License at
00012  * http://www.mozilla.org/MPL/
00013  *
00014  * Software distributed under the License is distributed on an "AS IS"
00015  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00016  * the License for the specific language governing rights and limitations
00017  * under the License.
00018  *
00019  * The Original Code is Open Phone Abstraction Library.
00020  *
00021  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
00022  *
00023  * Contributor(s): ______________________________________.
00024  *
00025  * $Log: rfc2833.h,v $
00026  * Revision 2.8  2007/09/30 17:46:46  dsandras
00027  * Added missing const.
00028  *
00029  * Revision 2.7  2007/07/26 00:38:56  csoutheren
00030  * Make transmission of RFC2833 independent of the media stream
00031  *
00032  * Revision 2.6  2007/03/12 23:36:23  csoutheren
00033  * Add support for Cisco NSE
00034  *
00035  * Revision 2.5  2005/11/30 13:35:26  csoutheren
00036  * Changed tags for Doxygen
00037  *
00038  * Revision 2.4  2002/09/16 02:52:33  robertj
00039  * Added #define so can select if #pragma interface/implementation is used on
00040  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00041  *
00042  * Revision 2.3  2002/09/04 06:01:46  robertj
00043  * Updated to OpenH323 v1.9.6
00044  *
00045  * Revision 2.2  2002/02/19 07:34:44  robertj
00046  * Added OpalRFC2833 as a OpalMediaFormat variable.
00047  *
00048  * Revision 2.1  2002/01/22 05:35:28  robertj
00049  * Added RFC2833 support
00050  *
00051  */
00052 
00053 #ifndef __OPAL_RFC2833_H
00054 #define __OPAL_RFC2833_H
00055 
00056 #ifdef P_USE_PRAGMA
00057 #pragma interface
00058 #endif
00059 
00060 
00061 #include <rtp/rtp.h>
00062 
00063 extern const char * OpalDefaultNTEString;
00064 
00065 #if OPAL_T38FAX
00066 extern const char * OpalDefaultNSEString;
00067 #endif
00068 
00070 
00071 class OpalRFC2833Info : public PObject {
00072     PCLASSINFO(OpalRFC2833Info, PObject);
00073   public:
00074     OpalRFC2833Info(
00075       char tone,
00076       unsigned duration = 0,
00077       unsigned timestamp = 0
00078     );
00079 
00080     char GetTone() const { return tone; }
00081     unsigned GetDuration() const { return duration; }
00082     unsigned GetTimestamp() const { return timestamp; }
00083     BOOL IsToneStart() const { return duration == 0; }
00084 
00085   protected:
00086     char     tone;
00087     unsigned duration;
00088     unsigned timestamp;
00089 };
00090 
00091 class OpalConnection;
00092 
00093 class OpalRFC2833Proto : public PObject {
00094     PCLASSINFO(OpalRFC2833Proto, PObject);
00095   public:
00096     OpalRFC2833Proto(
00097       OpalConnection & conn,
00098       const PNotifier & receiveNotifier
00099     );
00100     ~OpalRFC2833Proto();
00101 
00102     virtual BOOL SendToneAsync(
00103       char tone, 
00104       unsigned duration
00105     );
00106 
00107     virtual BOOL BeginTransmit(
00108       char tone  
00109     );
00110     virtual BOOL EndTransmit();
00111 
00112     virtual void OnStartReceive(
00113       char tone
00114     );
00115     virtual void OnEndReceive(
00116       char tone,
00117       unsigned duration,
00118       unsigned timestamp
00119     );
00120 
00121     RTP_DataFrame::PayloadTypes GetPayloadType() const { return payloadType; }
00122 
00123     void SetPayloadType(
00124       RTP_DataFrame::PayloadTypes type 
00125     ) { payloadType = type; }
00126 
00127     const PNotifier & GetReceiveHandler() const { return receiveHandler; }
00128 
00129   protected:
00130     void SendAsyncFrame();
00131     void TransmitPacket(RTP_DataFrame & frame);
00132 
00133     OpalConnection & conn;
00134 
00135     PDECLARE_NOTIFIER(RTP_DataFrame, OpalRFC2833Proto, ReceivedPacket);
00136     PDECLARE_NOTIFIER(PTimer, OpalRFC2833Proto, ReceiveTimeout);
00137     PDECLARE_NOTIFIER(PTimer, OpalRFC2833Proto, AsyncTimeout);
00138 
00139     RTP_DataFrame::PayloadTypes payloadType;
00140 
00141     PMutex mutex;
00142 
00143     PNotifier receiveNotifier;
00144     BOOL      receiveComplete;
00145     BYTE      receivedTone;
00146     unsigned  receivedDuration;
00147     unsigned  receiveTimestamp;
00148     PTimer    receiveTimer;
00149     PNotifier receiveHandler;
00150 
00151     enum {
00152       TransmitIdle,
00153       TransmitActive,
00154       TransmitEnding
00155     }         transmitState;
00156     BYTE      transmitCode;
00157 
00158     RTP_Session * rtpSession;
00159     PTimer        asyncTransmitTimer;
00160     PTimer        asyncDurationTimer;
00161     DWORD         transmitTimestamp;
00162     BOOL          transmitTimestampSet;
00163     PTimeInterval asyncStart;
00164 };
00165 
00166 
00167 #endif // __OPAL_RFC2833_H
00168 
00169 

Generated on Fri Mar 7 06:33:40 2008 for OPAL by  doxygen 1.5.1