sipxtacklib  Version 3.3
SipTcpServer.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 _SipTcpServer_h_
13 #define _SipTcpServer_h_
14 
15 // SYSTEM INCLUDES
16 //#include <...>
17 
18 // APPLICATION INCLUDES
19 #include <os/OsServerSocket.h>
21 
22 
23 // DEFINES
24 // MACROS
25 // EXTERNAL FUNCTIONS
26 // EXTERNAL VARIABLES
27 // CONSTANTS
28 // STRUCTS
29 // TYPEDEFS
30 // FORWARD DECLARATIONS
31 class SipUserAgent;
32 
34 {
36 };
37 
38 class SipServerBrokerListener : public OsServerTask
39 {
40 public:
42  OsServerTask("SipTcpServerBrokerListener-%d", (void*)pOwner),
43  mpOwner(pOwner)
44  {
45  start();
46  }
48  {
49  waitUntilShutDown();
50  }
51  virtual UtlBoolean handleMessage(OsMsg& rMsg);
52  private:
53  SipProtocolServerBase* mpOwner;
54 };
55 
56 //:Class short description which may consist of multiple lines (note the ':')
57 // Class detailed description which may extend to multiple lines
59 {
60 /* //////////////////////////// PUBLIC //////////////////////////////////// */
61 public:
62 
63 /* ============================ CREATORS ================================== */
64 
65  SipTcpServer(int sipPort = SIP_PORT,
66  SipUserAgent* userAgent = NULL,
67  const char* protocolString = SIP_TRANSPORT_TCP,
68  const char* taskName = "SipTcpServer-%d",
69  UtlBoolean bUseNextAvailablePort = FALSE,
70  const char* szBindAddr = NULL);
71  //:Default constructor
72 
73 
74  virtual
75  ~SipTcpServer();
76  //:Destructor
77 
78 /* ============================ MANIPULATORS ============================== */
79  virtual UtlBoolean startListener();
80 
81  //void addEventConsumer(OsServerTask* messageEventListener);
82  //void removeEventConsumer(OsServerTask* messageEventListener);
83 
84  void shutdownListener();
85 
86  int run(void* pArg);
87 
88 /* ============================ ACCESSORS ================================= */
89 
90  int getServerPort() const ;
91  //: The the local server port for this server
92 
93 /* ============================ INQUIRY =================================== */
94 
95 
96 /* ============================ Enumerations ============================== */
97 
98 /* //////////////////////////// PROTECTED ///////////////////////////////// */
99 protected:
100  OsStatus createServerSocket(const char* szBindAddr,
101  int& port,
102  const UtlBoolean& bUseNextAvailablePort);
103 
104 
105  virtual OsSocket* buildClientSocket(int hostPort, const char* hostAddress, const char* localIp);
106 
108 
109  UtlHashMap mServerBrokers;
110 
111 /* //////////////////////////// PRIVATE /////////////////////////////////// */
112 private:
113 
114  SipTcpServer(const SipTcpServer& rSipTcpServer);
115  //: disable Copy constructor
116 
117  SipTcpServer& operator=(const SipTcpServer& rhs);
118  //:disable Assignment operator
119 
120 };
121 
122 
123 /* ============================ INLINE METHODS ============================ */
124 
125 #endif // _SipTcpServer_h_
Transaction and Transport manager for SIP stack.
Definition: SipUserAgent.h:157
Definition: SipTcpServer.h:58
Definition: SipTcpServer.h:38
virtual UtlBoolean handleMessage(OsMsg &rMsg)
Definition: SipTcpServer.cpp:281
virtual ~SipServerBrokerListener()
Definition: SipTcpServer.h:47
Definition: SipProtocolServerBase.h:40
#define SIP_TRANSPORT_TCP
Definition: SipMessage.h:265
Definition: SipTcpServer.h:35
SipServerBrokerListener(SipProtocolServerBase *pOwner)
Definition: SipTcpServer.h:41
#define SIP_PORT
Definition: SipMessage.h:256
EventSubTypes
Definition: SipTcpServer.h:33
int mServerPort
Definition: SipTcpServer.h:107
UtlHashMap mServerBrokers
Definition: SipTcpServer.h:109

sipXtackLib home page