sipXcallLib home page


TaoServerTask.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 _TaoServer_h_
13 #define _TaoServer_h_
14 
15 #if _MSC_VER >= 1000
16 #pragma once
17 #endif // _MSC_VER >= 1000
18 
19 // SYSTEM INCLUDES
20 
21 // APPLICATION INCLUDES
22 #include "os/OsMsgQ.h"
23 #include "os/OsServerTask.h"
24 #include "os/OsTime.h"
25 #include "tao/TaoObject.h"
26 #include "tao/TaoMessage.h"
27 #include "tao/TaoObjectMap.h"
28 #include "tao/TaoReference.h"
29 #include "tao/TaoListenerManager.h"
30 
31 // DEFINES
32 // MACROS
33 // EXTERNAL FUNCTIONS
34 // EXTERNAL VARIABLES
35 // CONSTANTS
36 // STRUCTS
37 // TYPEDEFS
38 // FORWARD DECLARATIONS
39 class TaoTransportTask;
40 class PtProvider;
41 class PtCall;
42 class CpCallManager;
43 class PsPhoneTask;
44 
45 //:The server is the place where all requests from clients are received and
46 // processed accordingly. It contains a db of addresses, a registry of listeners,
47 // a registry of clients, a list of invoked PTAPI objects, and an incoming message
48 // queue.
49 class TaoServerTask : public OsServerTask
50 {
51 /* //////////////////////////// PUBLIC //////////////////////////////////// */
52 public:
53 /* ============================ CREATORS ================================== */
54 
55  static TaoServerTask* getTaoServerTask(CpCallManager *pCallMgr);
56 
57  TaoServerTask(const TaoServerTask& rTaoServerTask);
58  //:Copy constructor (not implemented for this class)
59 
60  virtual ~TaoServerTask();
61 
62 
63 /* ============================ MANIPULATORS ============================== */
64 
65  virtual UtlBoolean handleMessage(OsMsg& rMsg);
66  //:Handle an incoming message.
67  // If the message is not one that the object is prepared to process,
68  // the handleMessage() method in the derived class should return FALSE
69  // which will cause the OsServerTask::handleMessage() method to be
70  // invoked on the message.
71 
72  virtual OsStatus setErrno(int errno);
73  //:Set the errno status for the task
74  // This call has no effect under Windows NT and, if the task has been
75  // started, will always returns OS_SUCCESS
76 
77  void setClientHandle(TaoObjHandle hClient);
78  //:Set the handle for the client that is at the same location of the TaoServer
79 
80  void setEventClient(TaoObjHandle hEventClient);
81  //:Set the handle for the client event handler that will receive the event messages from TaoListenerManager
82 
83 /* ============================ ACCESSORS ================================= */
85 
86 /* //////////////////////////// PRIVATE /////////////////////////////////// */
87 private:
88  // Singleton globals
89  // Note: this class does not need to be a singleton. The only method that
90  // assumes singleton is getTaoServerTask
91  static TaoServerTask* mpInstance;
92  static OsBSem sLock;
93 
94  TaoServerTask(CpCallManager *pCallMgr,
95  PsPhoneTask *pPhoneTask,
96  const UtlString& name="TaoServerTask-%d",
97  void* pArg=NULL,
98  const int maxRequestQMsgs=DEF_MAX_MSGS,
99  const int priority=DEF_PRIO,
100  const int options=DEF_OPTIONS,
101  const int stackSize=DEF_STACKSIZE);
102  //:Constructor
103 
104  TaoServerTask(const UtlString& name="TaoServerTask-%d",
105  void* pArg=NULL,
106  const int maxRequestQMsgs=DEF_MAX_MSGS,
107  const int priority=DEF_PRIO,
108  const int options=DEF_OPTIONS,
109  const int stackSize=DEF_STACKSIZE);
110  //:Constructor
111 
112  TaoServerTask(const int maxIncomingQMsgs);
113  //:Constructor
114 
115 /* ============================ MANIPULATORS ============================== */
117 
118 /* ============================ MEMBERS ============================== */
120  PsPhoneTask* mpPhoneTask; // phone set task
121 
126 
132 
138  OsMsgQ mOutgoingQ; // queue for outgoing messages
139 
142 
143 
144 };
145 
146 #endif // _TaoServer_h_
Definition: TaoReference.h:35
Abstract call manager.
Definition: CpCallManager.h:97
virtual ~TaoServerTask()
Definition: TaoServerTask.cpp:131
PsPhoneTask * mpPhoneTask
Definition: TaoServerTask.h:120
Definition: TaoObjectMap.h:56
TaoReference * mpClientCnt
Definition: TaoServerTask.h:134
TaoObjectMap * mpListeners
Definition: TaoServerTask.h:129
TaoObjHandle mEventClient
Definition: TaoServerTask.h:123
TaoObjectMap * mpAdaptors
Definition: TaoServerTask.h:131
void setClientHandle(TaoObjHandle hClient)
Definition: TaoServerTask.cpp:206
CpCallManager * mpCallMgr
Definition: TaoServerTask.h:119
TaoReference * mpConnectionCnt
Definition: TaoServerTask.h:133
TaoObjHandle mClientHandle
Definition: TaoServerTask.h:122
static TaoServerTask * mpInstance
Definition: TaoServerTask.h:84
OsMsgQ mOutgoingQ
Definition: TaoServerTask.h:138
Definition: TaoTransportTask.h:45
virtual OsStatus setErrno(int errno)
Definition: TaoServerTask.cpp:355
TaoObjectMap * mpClients
Definition: TaoServerTask.h:130
TaoListenerManager * mpListenerMgr
Definition: TaoServerTask.h:125
void setEventClient(TaoObjHandle hEventClient)
Definition: TaoServerTask.cpp:200
TaoListenerManager * getTaoListenerManager()
Definition: TaoServerTask.h:84
TaoStatus
Definition: TaoDefs.h:41
static TaoServerTask * getTaoServerTask(CpCallManager *pCallMgr)
Definition: TaoServerTask.cpp:166
static OsBSem sLock
Definition: TaoServerTask.h:92
TaoReference * mpListenerCnt
Definition: TaoServerTask.h:135
TaoReference * mpTransactionCnt
Definition: TaoServerTask.h:136
Definition: TaoServerTask.h:49
TaoTransportTask * mpSvrTransport
Definition: TaoServerTask.h:124
virtual UtlBoolean handleMessage(OsMsg &rMsg)
Definition: TaoServerTask.cpp:215
TaoReference * mpAdaptorCnt
Definition: TaoServerTask.h:137
TaoObjectMap * mpTransactionDb
Definition: TaoServerTask.h:128
PtCall * mpCall
Definition: TaoServerTask.h:141
TaoStatus initInstance()
Definition: TaoServerTask.cpp:98
uintptr_t TaoObjHandle
Definition: TaoDefs.h:32
Definition: PtCall.h:253
Definition: PsPhoneTask.h:50
Definition: PtProvider.h:118
TaoServerTask(const TaoServerTask &rTaoServerTask)
PtProvider * mpProvider
Definition: TaoServerTask.h:140
Definition: TaoListenerManager.h:44
TaoObjectMap * mpConnectionDb
Definition: TaoServerTask.h:127