# receiver.h

Go to the documentation of this file.

    00001 /*
    00002  *
    00003  *
    00004  * Inter Asterisk Exchange 2
    00005  *
    00006  * The entity which receives all packets for all calls.
    00007  *
    00008  * Open Phone Abstraction Library (OPAL)
    00009  *
    00010  * Copyright (c) 2005 Indranet Technologies Ltd.
    00011  *
    00012  * The contents of this file are subject to the Mozilla Public License
    00013  * Version 1.0 (the "License"); you may not use this file except in
    00014  * compliance with the License. You may obtain a copy of the License at
    00015  * http://www.mozilla.org/MPL/
    00016  *
    00017  * Software distributed under the License is distributed on an "AS IS"
    00018  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
    00019  * the License for the specific language governing rights and limitations
    00020  * under the License.
    00021  *
    00022  * The Original Code is Open Phone Abstraction Library.
    00023  *
    00024  * The Initial Developer of the Original Code is Indranet Technologies Ltd.
    00025  *
    00026  * The author of this code is Derek J Smithies
    00027  *
    00028  *  $Log: receiver.h,v $
    00029  *  Revision 1.5  2007/04/19 06:17:21  csoutheren
    00030  *  Fixes for precompiled headers with gcc
    00031  *
    00032  *  Revision 1.4  2007/01/09 03:32:23  dereksmithies
    00033  *  Tidy up and improve the close down process - make it more robust.
    00034  *  Alter level of several PTRACE statements. Add Terminate() method to transmitter and receiver.
    00035  *
    00036  *  Revision 1.3  2006/08/09 03:46:39  dereksmithies
    00037  *  Add ability to register to a remote Asterisk box. The iaxProcessor class is split
    00038  *  into a callProcessor and a regProcessor class.
    00039  *  Big thanks to Stephen Cook, (sitiveni@gmail.com) for this work.
    00040  *
    00041  *  Revision 1.2  2005/08/26 03:07:38  dereksmithies
    00042  *  Change naming convention, so all class names contain the string "IAX2"
    00043  *
    00044  *  Revision 1.1  2005/07/30 07:01:32  csoutheren
    00045  *  Added implementation of IAX2 (Inter Asterisk Exchange 2) protocol
    00046  *  Thanks to Derek Smithies of Indranet Technologies Ltd. for
    00047  *  writing and contributing this code
    00048  *
    00049  *
    00050  *
    00051  *
    00052  *
    00053  */
    00054
    00055 #ifndef RECEIVER_H
    00056 #define RECEIVER_H
    00057
    00058 #ifndef _PTLIB_H
    00059 #include <ptlib.h>
    00060 #endif
    00061
    00062 #include <opal/buildopts.h>
    00063
    00064 #include <ptlib/sockets.h>
    00065
    00066 #ifdef P_USE_PRAGMA
    00067 #pragma interface
    00068 #endif
    00069
    00070 class IAX2EndPoint;
    00071 class IAX2Frame;
    00072 class IAX2FrameList;
    00073 class IAX2PacketIdList;
    00074
    00075 #include <iax2/frame.h>
    00076
    00080 class IAX2Receiver : public PThread
    00081 {
    00082   PCLASSINFO(IAX2Receiver, PThread);
    00083  public:
    00087   IAX2Receiver(IAX2EndPoint & _newEndpoint, PUDPSocket & _newSocket);
    00088
    00090   ~IAX2Receiver();
    00092
    00095   /*The method which the receiver thread invokes*/
    00096   virtual void Main();
    00097
    00102   virtual void Terminate();
    00103
    00105   PBoolean ReadNetworkSocket();
    00106
    00115   void AddNewReceivedFrame(IAX2Frame *newFrame);
    00116
    00118   PINDEX GetSize() { return fromNetworkFrames.GetSize(); }
    00119
    00121  protected:
    00123   IAX2EndPoint &endpoint;
    00124
    00126   PUDPSocket & sock;
    00127
    00130   IAX2FrameList      fromNetworkFrames;
    00131
    00133   PBoolean           keepGoing;
    00134 };
    00135
    00136 #endif // RECEIVER_H
    00137 /* The comment below is magic for those who use emacs to edit this file. */
    00138 /* With the comment below, the tab key does auto indent to 2 spaces.     */
    00139
    00140 /*
    00141  * Local Variables:
    00142  * mode:c
    00143  * c-basic-offset:2
    00144  * End:
    00145  */
    00146