OPAL  Version 3.14.3
receiver.h
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Inter Asterisk Exchange 2
5  *
6  * The entity which receives all packets for all calls.
7  *
8  * Open Phone Abstraction Library (OPAL)
9  *
10  * Copyright (c) 2005 Indranet Technologies Ltd.
11  *
12  * The contents of this file are subject to the Mozilla Public License
13  * Version 1.0 (the "License"); you may not use this file except in
14  * compliance with the License. You may obtain a copy of the License at
15  * http://www.mozilla.org/MPL/
16  *
17  * Software distributed under the License is distributed on an "AS IS"
18  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
19  * the License for the specific language governing rights and limitations
20  * under the License.
21  *
22  * The Original Code is Open Phone Abstraction Library.
23  *
24  * The Initial Developer of the Original Code is Indranet Technologies Ltd.
25  *
26  * The author of this code is Derek J Smithies
27  *
28  * $Revision: 29536 $
29  * $Author: rjongbloed $
30  * $Date: 2013-04-19 18:55:15 +1000 (Fri, 19 Apr 2013) $
31  */
32 
33 #ifndef OPAL_IAX2_RECEIVER_H
34 #define OPAL_IAX2_RECEIVER_H
35 
36 #ifndef _PTLIB_H
37 #include <ptlib.h>
38 #endif
39 
40 #include <opal_config.h>
41 
42 #if OPAL_IAX2
43 
44 #include <ptlib/sockets.h>
45 
46 #ifdef P_USE_PRAGMA
47 #pragma interface
48 #endif
49 
50 class IAX2EndPoint;
51 class IAX2Frame;
52 class IAX2FrameList;
53 class IAX2PacketIdList;
54 
55 #include <iax2/frame.h>
56 
60 class IAX2Receiver : public PThread
61 {
62  PCLASSINFO(IAX2Receiver, PThread);
63  public:
67  IAX2Receiver(IAX2EndPoint & _newEndpoint, PUDPSocket & _newSocket);
68 
70  ~IAX2Receiver();
72 
75  /*The method which the receiver thread invokes*/
76  virtual void Main();
77 
82  virtual void Terminate();
83 
85  PBoolean ReadNetworkSocket();
86 
95  void AddNewReceivedFrame(IAX2Frame *newFrame);
96 
98  PINDEX GetSize() { return fromNetworkFrames.GetSize(); }
99 
101  protected:
104 
106  PUDPSocket & sock;
107 
111 
113  PBoolean keepGoing;
114 };
115 
116 
117 #endif // OPAL_IAX2
118 
119 #endif // OPAL_IAX2_RECEIVER_H
120 
121 /* The comment below is magic for those who use emacs to edit this file.
122  * With the comment below, the tab key does auto indent to 2 spaces.
123  *
124  * Local Variables:
125  * mode:c
126  * c-basic-offset:2
127  * End:
128  */