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 * $Revision: 21293 $ 00029 * $Author: rjongbloed $ 00030 * $Date: 2008-10-12 18:24:41 -0500 (Sun, 12 Oct 2008) $ 00031 */ 00032 00033 #ifndef OPAL_IAX2_RECEIVER_H 00034 #define OPAL_IAX2_RECEIVER_H 00035 00036 #ifndef _PTLIB_H 00037 #include <ptlib.h> 00038 #endif 00039 00040 #include <opal/buildopts.h> 00041 00042 #if OPAL_IAX2 00043 00044 #include <ptlib/sockets.h> 00045 00046 #ifdef P_USE_PRAGMA 00047 #pragma interface 00048 #endif 00049 00050 class IAX2EndPoint; 00051 class IAX2Frame; 00052 class IAX2FrameList; 00053 class IAX2PacketIdList; 00054 00055 #include <iax2/frame.h> 00056 00060 class IAX2Receiver : public PThread 00061 { 00062 PCLASSINFO(IAX2Receiver, PThread); 00063 public: 00067 IAX2Receiver(IAX2EndPoint & _newEndpoint, PUDPSocket & _newSocket); 00068 00070 ~IAX2Receiver(); 00072 00075 /*The method which the receiver thread invokes*/ 00076 virtual void Main(); 00077 00082 virtual void Terminate(); 00083 00085 PBoolean ReadNetworkSocket(); 00086 00095 void AddNewReceivedFrame(IAX2Frame *newFrame); 00096 00098 PINDEX GetSize() { return fromNetworkFrames.GetSize(); } 00099 00101 protected: 00103 IAX2EndPoint &endpoint; 00104 00106 PUDPSocket & sock; 00107 00110 IAX2FrameList fromNetworkFrames; 00111 00113 PBoolean keepGoing; 00114 }; 00115 00116 00117 #endif // OPAL_IAX2 00118 00119 #endif // OPAL_IAX2_RECEIVER_H 00120 00121 /* The comment below is magic for those who use emacs to edit this file. */ 00122 /* With the comment below, the tab key does auto indent to 2 spaces. */ 00123 00124 /* 00125 * Local Variables: 00126 * mode:c 00127 * c-basic-offset:2 00128 * End: 00129 */