sipXcallLib home page


TaoListeningTask.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 _TaoListeningTask_h_
13 #define _TaoListeningTask_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/OsTask.h"
23 #include <os/OsServerSocket.h>
24 #include <os/OsServerTask.h>
25 #include <os/OsLockingList.h>
26 #include <os/OsRWMutex.h>
27 
28 // DEFINES
29 // MACROS
30 // EXTERNAL FUNCTIONS
31 // CONSTANTS
32 // STRUCTS
33 // TYPEDEFS
34 
35 // FORWARD DECLARATIONS
36 class OsServerTask;
37 class OsServerSocket;
38 class TaoTransportAgent;
39 
40 class TaoListeningTask : public OsTask
41 {
42 /* //////////////////////////// PUBLIC //////////////////////////////////// */
43 public:
44  TaoListeningTask(OsServerTask* pServer, OsServerSocket* pListenSocket);
45 
46  TaoListeningTask(const TaoListeningTask& rTaoListeningTask);
47  //:Copy constructor (not implemented for this class)
48 
49  virtual ~TaoListeningTask();
50  //:Destructor
51  // As part of destroying the task, flush all messages from the incoming
52  // OsMsgQ.
53 
54 /* ============================ MANIPULATORS ============================== */
55 
56  UtlBoolean startListener();
57 
58  //void addEventConsumer(OsServerTask* messageEventListener);
59  //void removeEventConsumer(OsServerTask* messageEventListener);
60 
61  void shutdownListeners();
62 
63  void shutdownAgent(TaoTransportAgent* pAgent);
64 
65  virtual int run(void* pArg);
66  //:The entry point for the task.
67  // This method executes a message processing loop until either
68  // requestShutdown(), deleteForce(), or the destructor for this object
69  // is called.
70 
71 // virtual void requestShutdown(void);
72  //:Call OsTask::requestShutdown() and then post an OS_SHUTDOWN message
73  //: to the incoming message queue to unblock the task.
74 
75 
76  virtual OsStatus setErrno(int errno);
77  //:Set the errno status for the task
78  // This call has no effect under Windows NT and, if the task has been
79  // started, will always returns OS_SUCCESS
80 
81 
82  int getAgentCount();
83 
84 
85 /* //////////////////////////// PROTECTED ///////////////////////////////// */
86 protected:
87 
88 // TaoTransportAgent* getAgent(const char* hostAddress,
89 // int hostPort,
90 // const char* callId,
91 // const char* toField,
92 // const char* fromField);
93 
94  void deleteAgent(TaoTransportAgent* pAgent);
95 
96 private:
97  OsLockingList agentList;
98  OsRWMutex agentLock;
99  OsServerTask* mpServer;
100  UtlString mRemoteHost; // remote TaoServer
101  int mRemotePort; // TaoServer's listener port
102  int mListenerPort; // this transport's listener port
103 
104  OsServerSocket* mpListenSocket;
105 
107  //:disable Assignment operator
108 
109 
110 };
111 
112 #endif // _TaoListeningTask_h_
OsServerTask * mpServer
Definition: TaoListeningTask.h:99
TaoListeningTask(OsServerTask *pServer, OsServerSocket *pListenSocket)
Definition: TaoListeningTask.cpp:27
UtlString mRemoteHost
Definition: TaoListeningTask.h:100
void shutdownAgent(TaoTransportAgent *pAgent)
Definition: TaoListeningTask.cpp:112
int mRemotePort
Definition: TaoListeningTask.h:101
OsRWMutex agentLock
Definition: TaoListeningTask.h:98
void shutdownListeners()
Definition: TaoListeningTask.cpp:98
virtual ~TaoListeningTask()
Definition: TaoListeningTask.cpp:36
virtual OsStatus setErrno(int errno)
Definition: TaoListeningTask.cpp:181
UtlBoolean startListener()
Definition: TaoListeningTask.cpp:83
int mListenerPort
Definition: TaoListeningTask.h:102
TaoListeningTask & operator=(const TaoListeningTask &rhs)
Definition: TaoListeningTask.cpp:161
int getAgentCount()
Definition: TaoListeningTask.cpp:173
virtual int run(void *pArg)
Definition: TaoListeningTask.cpp:52
OsLockingList agentList
Definition: TaoListeningTask.h:97
OsServerSocket * mpListenSocket
Definition: TaoListeningTask.h:104
Definition: TaoTransportAgent.h:37
void deleteAgent(TaoTransportAgent *pAgent)
Definition: TaoListeningTask.cpp:132
Definition: TaoListeningTask.h:40