sipXcallLib home page


TaoListenerClient.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 
12 #ifndef _TaoListenerClient_h_
13 #define _TaoListenerClient_h_
14 
15 #if _MSC_VER >= 1000
16 #pragma once
17 #endif // _MSC_VER >= 1000
18 
19 // SYSTEM INCLUDES
20 //#define TAO_TIME_DEBUG
21 
22 #ifdef TAO_TIME_DEBUG
23 #include "os/OsTimeLog.h"
24 #endif
25 
26 
27 // APPLICATION INCLUDES
28 #include "os/OsServerTask.h"
29 #include "os/OsBSem.h"
30 #include "tao/TaoObject.h"
31 #include "tao/TaoObjectMap.h"
32 #include "tao/TaoMessage.h"
33 #include "tao/TaoDefs.h" // Added by ClassView
34 
35 // DEFINES
36 //#define TAO_TIME_DEBUG
37 //#define NUM_INITIAL_LISTENERS 20
38 // MACROS
39 // EXTERNAL FUNCTIONS
40 // EXTERNAL VARIABLES
41 // CONSTANTS
42 // STRUCTS
43 // TYPEDEFS
44 // FORWARD DECLARATIONS
45 class TaoClientTask;
46 class PtEventListener;
50 class PtCallListener;
51 class PtTerminalListener;
52 class PtCallEvent;
53 class PtConnectionEvent;
55 
56 //:Used to build the call originating part, establishes connection with the server
57 // through the TaoTransport. Maintains a db of listeners the client has registered.
58 class TaoListenerClientTask : public OsServerTask
59 {
60 /* //////////////////////////// PUBLIC //////////////////////////////////// */
61 public:
62 /* ============================ CREATORS ================================== */
63  TaoListenerClientTask(TaoClientTask* pClient = NULL,
64  const UtlString& name="TaoListenerClientTask-%d",
65  const int maxRequestQMsgs=DEF_MAX_MSGS);
66  //:Constructor
67 
68  TaoListenerClientTask(const int priority,
69  const UtlString& name="TaoListenerClientTask-%d",
70  void* pArg=NULL,
71  const int maxRequestQMsgs=DEF_MAX_MSGS,
72  const int options=DEF_OPTIONS,
73  const int stackSize=DEF_STACKSIZE);
74  //:Constructor
75 
76  TaoListenerClientTask(const int maxIncomingQMsgs);
77  //:Constructor
78 
79  TaoListenerClientTask(const TaoListenerClientTask& rTaoListenerClientTask);
80  //:Copy constructor (not implemented for this class)
81 
82  virtual ~TaoListenerClientTask();
83 /* ============================ MANIPULATORS ============================== */
84 
85  virtual UtlBoolean handleMessage(OsMsg& rMsg);
86  //:Handle an incoming message.
87  // If the message is not one that the object is prepared to process,
88  // the handleMessage() method in the derived class should return FALSE
89  // which will cause the OsServerTask::handleMessage() method to be
90  // invoked on the message.
91 
92  void addEventListener(PtEventListener* pListener, const char* callId = NULL);
93 
94  void removeEventListener(PtEventListener& rListener);
95 
96 
97 /* ============================ ACCESSORS ================================ */
98 
99 /* //////////////////////////// PRIVATE ////////////////////////////////// */
100 private:
101 friend class PtTerminal;
102 
103 /* ============================ FUNCTIONS ================================ */
105 
106  UtlBoolean receiveEvent(TaoMessage& rMsg);
107 
108 #ifdef TAO_TIME_DEBUG
109  UtlBoolean receiveCallEvent(TaoMessage& rMsg,
110  PtCallListener* pListener,
111  OsTimeLog& timeLog);
112 #else
113  UtlBoolean receiveCallEvent(TaoMessage& rMsg,
114  PtCallListener* pListener);
115 #endif
116 
117 #ifdef TAO_TIME_DEBUG
118  UtlBoolean receiveConnectionEvent(TaoMessage& rMsg,
119  PtConnectionListener* pListener,
120  OsTimeLog& timeLog);
121 #else
122  UtlBoolean receiveConnectionEvent(TaoMessage& rMsg,
123  PtConnectionListener* pListener);
124 #endif
125 
126 #ifdef TAO_TIME_DEBUG
127  UtlBoolean receiveTerminalEvent(TaoMessage& rMsg,
128  PtTerminalListener* pListener,
129  OsTimeLog& timeLog);
130 #else
131  UtlBoolean receiveTerminalEvent(TaoMessage& rMsg,
132  PtTerminalListener* pListener);
133 #endif
134 
135 #ifdef TAO_TIME_DEBUG
136  UtlBoolean receiveTerminalComponentEvent(TaoMessage& rMsg,
137  PtTerminalComponentListener* pListener,
138  OsTimeLog& timeLog);
139 #else
140  UtlBoolean receiveTerminalComponentEvent(TaoMessage& rMsg,
141  PtTerminalComponentListener* pListener);
142 #endif
143 
144 #ifdef TAO_TIME_DEBUG
146  PtTerminalConnectionListener* pListener,
147  OsTimeLog& timeLog);
148 #else
150  PtTerminalConnectionListener* pListener);
151 #endif
152 
153 
154  UtlBoolean getCallEvent(TaoMessage& rMsg,
155  PtCallListener* pListener,
156  int& evId);
157 
158  UtlBoolean getConnectionEvent(TaoMessage& rMsg,
159  PtConnectionListener* pListener,
160  int& evId,
161  int& addedToCall,
162  int& remoteIsCallee);
163 
164  UtlBoolean getTerminalConnectionEvent(TaoMessage& rMsg,
165  PtConnectionListener* pListener,
166  int& evId,
167  int& addedToCall,
168  int& remoteIsCallee);
169 
170 #ifdef WV_DEBUG
171  void getEventName(int eventId, char *name);
172  void fireUserEvent(int eventId, int userEventId);
173 #endif
174 /* ============================ VARIABLES ================================ */
175 private:
176 
178  OsBSem mListenerSem;
179 
183 
187 
188 
189 };
190 
191 #endif // _TaoListenerClient_h_
TaoListenerDb ** mpListeners
Definition: TaoListenerClient.h:180
UtlBoolean receiveCallEvent(TaoMessage &rMsg, PtCallListener *pListener)
Definition: TaoListenerClient.cpp:327
PtCallEvent * mpCallEvent
Definition: TaoListenerClient.h:184
Definition: TaoMessage.h:51
Definition: PtTerminalConnectionListener.h:33
PtTerminalConnectionEvent * mpTermConnEvent
Definition: TaoListenerClient.h:186
void removeEventListener(PtEventListener &rListener)
Definition: TaoListenerClient.cpp:886
OsBSem mListenerSem
Definition: TaoListenerClient.h:178
Definition: PtTerminalComponentListener.h:34
TaoStatus initInstance()
Definition: TaoListenerClient.cpp:134
Definition: PtConnectionEvent.h:32
int mMaxNumListeners
Definition: TaoListenerClient.h:182
Definition: PtCallListener.h:33
UtlBoolean receiveTerminalEvent(TaoMessage &rMsg, PtTerminalListener *pListener)
Definition: TaoListenerClient.cpp:591
Definition: PtEventListener.h:55
UtlBoolean getTerminalConnectionEvent(TaoMessage &rMsg, PtConnectionListener *pListener, int &evId, int &addedToCall, int &remoteIsCallee)
Definition: TaoListenerClient.cpp:1043
TaoClientTask * mpClient
Definition: TaoListenerClient.h:177
UtlBoolean receiveTerminalComponentEvent(TaoMessage &rMsg, PtTerminalComponentListener *pListener)
Definition: TaoListenerClient.cpp:629
UtlBoolean getConnectionEvent(TaoMessage &rMsg, PtConnectionListener *pListener, int &evId, int &addedToCall, int &remoteIsCallee)
Definition: TaoListenerClient.cpp:972
virtual UtlBoolean handleMessage(OsMsg &rMsg)
Definition: TaoListenerClient.cpp:158
UtlBoolean receiveConnectionEvent(TaoMessage &rMsg, PtConnectionListener *pListener)
Definition: TaoListenerClient.cpp:465
int mListenerCnt
Definition: TaoListenerClient.h:181
UtlBoolean getCallEvent(TaoMessage &rMsg, PtCallListener *pListener, int &evId)
Definition: TaoListenerClient.cpp:916
Definition: TaoListenerClient.h:58
TaoStatus
Definition: TaoDefs.h:41
Definition: TaoObjectMap.h:41
Definition: PtTerminalConnectionEvent.h:36
Definition: PtCallEvent.h:30
Definition: PtTerminal.h:178
UtlBoolean receiveEvent(TaoMessage &rMsg)
Definition: TaoListenerClient.cpp:177
virtual ~TaoListenerClientTask()
Definition: TaoListenerClient.cpp:95
void addEventListener(PtEventListener *pListener, const char *callId=NULL)
Definition: TaoListenerClient.cpp:844
Definition: PtConnectionListener.h:33
TaoListenerClientTask(TaoClientTask *pClient=NULL, const UtlString &name="TaoListenerClientTask-%d", const int maxRequestQMsgs=DEF_MAX_MSGS)
Definition: TaoListenerClient.cpp:49
Definition: TaoClientTask.h:50
Definition: PtTerminalListener.h:31
UtlBoolean receiveTerminalConnectionEvent(TaoMessage &rMsg, PtTerminalConnectionListener *pListener)
Definition: TaoListenerClient.cpp:753
PtConnectionEvent * mpConnEvent
Definition: TaoListenerClient.h:185