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 <ptlib/sockets.h> 00063 00064 #ifdef P_USE_PRAGMA 00065 #pragma interface 00066 #endif 00067 00068 class IAX2EndPoint; 00069 class IAX2Frame; 00070 class IAX2FrameList; 00071 class IAX2PacketIdList; 00072 00073 #include <iax2/frame.h> 00074 00078 class IAX2Receiver : public PThread 00079 { 00080 PCLASSINFO(IAX2Receiver, PThread); 00081 public: 00085 IAX2Receiver(IAX2EndPoint & _newEndpoint, PUDPSocket & _newSocket); 00086 00088 ~IAX2Receiver(); 00090 00093 /*The method which the receiver thread invokes*/ 00094 virtual void Main(); 00095 00100 virtual void Terminate(); 00101 00103 PBoolean ReadNetworkSocket(); 00104 00113 void AddNewReceivedFrame(IAX2Frame *newFrame); 00114 00116 PINDEX GetSize() { return fromNetworkFrames.GetSize(); } 00117 00119 protected: 00121 IAX2EndPoint &endpoint; 00122 00124 PUDPSocket & sock; 00125 00128 IAX2FrameList fromNetworkFrames; 00129 00131 PBoolean keepGoing; 00132 }; 00133 00134 #endif // RECEIVER_H 00135 /* The comment below is magic for those who use emacs to edit this file. */ 00136 /* With the comment below, the tab key does auto indent to 2 spaces. */ 00137 00138 /* 00139 * Local Variables: 00140 * mode:c 00141 * c-basic-offset:2 00142 * End: 00143 */ 00144