sipxtacklib  Version 3.3
SipUserAgentBase.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 _SipUserAgentBase_h_
13 #define _SipUserAgentBase_h_
14 
15 // SYSTEM INCLUDES
16 //#include <...>
17 
18 // APPLICATION INCLUDES
19 #include <utl/UtlHashBag.h>
20 
21 #include <os/OsServerTask.h>
22 #include <os/OsRWMutex.h>
23 #include <net/SipMessage.h>
24 #include <net/SipMessageEvent.h>
25 #include <net/SipContactDb.h>
26 
28 
29 
30 
31 
32 // DEFINES
33 // MACROS
34 // EXTERNAL FUNCTIONS
35 // EXTERNAL VARIABLES
36 // CONSTANTS
37 // STRUCTS
38 // TYPEDEFS
39 // FORWARD DECLARATIONS
40 class OsConfigDb;
41 
42 //:Base class for SipUserAgent
43 // Class detailed description which may extend to multiple lines
44 class SipUserAgentBase : public OsServerTask
45 {
46 /* //////////////////////////// PUBLIC //////////////////////////////////// */
47 public:
48 
49 
50 /* ============================ CREATORS ================================== */
51 
52  SipUserAgentBase(int sipTcpPort = SIP_PORT,
53  int sipUdpPort = SIP_PORT,
54  int sipTlsPort = SIP_TLS_PORT,
55  int queueSize = OsServerTask::DEF_MAX_MSGS);
56  //:Default constructor
57 
58 
59  virtual
61  //:Destructor
62 
63 /* ============================ MANIPULATORS ============================== */
64 
65  virtual UtlBoolean handleMessage(OsMsg& eventMessage) = 0;
66 
67  virtual void addMessageConsumer(OsServerTask* messageConsumer) = 0;
68  //: Add a SIP message recipient
69 
70 
71  //: Send a SIP message over the net
72  // This method sends the SIP message via
73  // a SIP UDP or TCP client as dictated by policy and the address
74  // specified in the message
75  virtual UtlBoolean send(SipMessage& message,
76  OsMsgQ* responseListener = NULL,
77  void* responseListenerData = NULL,
78  SIPX_TRANSPORT_DATA* pTransport = NULL) = 0;
82 
83  //: Dispatch the SIP message to the message consumer(s)
84  // All incoming SIP message need to be dispatched via the user agent
85  // server so that it can provide the reliablity for UDP
86  // (i.e. resend requests when no response is received)
87  // messageType - is as define by SipMessageEvent::MessageStatusTypes
88  // APPLICATION type are normal incoming messages
89  // TRANSPORT_ERROR type are notification of failures to send messages
90  virtual void dispatch(SipMessage* message,
91  int messageType = SipMessageEvent::APPLICATION,
92  SIPX_TRANSPORT_DATA* pTransport = NULL) = 0;
93 
94  void addConfigChangeConsumer(OsMsgQ& messageQueue);
95  //: Register to find out when UA config changes (i.e. contact address)
96 
97 /* ============================ ACCESSORS ================================= */
98 
99  virtual void logMessage(const char* message, int messageLength) = 0;
100 
101  virtual void getContactUri(UtlString* contactUri) ;
102 
103 /* ============================ INQUIRY =================================== */
104 
105  virtual UtlBoolean isMessageLoggingEnabled() = 0;
106  //: Is message logging enabled?
107 
108  virtual UtlBoolean isReady();
109  //: Return boolean if the UA is started and initialized
110 
111  virtual UtlBoolean waitUntilReady();
112  //: Block and wait until the UA is started and initialized
113 
114 /* //////////////////////////// PROTECTED ///////////////////////////////// */
115 protected:
116  int mTcpPort;
117  int mUdpPort;
118  int mTlsPort;
119  UtlBoolean mMessageLogEnabled;
120  UtlString mContactAddress;
121  OsRWMutex mObserverMutex;
124 
125 /* //////////////////////////// PRIVATE /////////////////////////////////// */
126 private:
127  SipUserAgentBase(const SipUserAgentBase& rSipUserAgent);
128  //:Copy constructor
129 
130  SipUserAgentBase& operator=(const SipUserAgentBase& rhs);
131  //:Assignment operator
132 
133 
134 
135 };
136 
137 /* ============================ INLINE METHODS ============================ */
138 
139 #endif // _SipUserAgentBase_h_
virtual ~SipUserAgentBase()
Definition: SipUserAgentBase.cpp:46
int mTlsPort
Definition: SipUserAgentBase.h:118
Definition: SipMessageEvent.h:39
virtual UtlBoolean isReady()
Definition: SipUserAgentBase.cpp:69
SipContactDb mContactDb
Definition: SipUserAgentBase.h:123
virtual UtlBoolean send(SipMessage &message, OsMsgQ *responseListener=NULL, void *responseListenerData=NULL, SIPX_TRANSPORT_DATA *pTransport=NULL)=0
int mTcpPort
Definition: SipUserAgentBase.h:116
UtlHashBag mConfigChangeObservers
Definition: SipUserAgentBase.h:122
Specialization of HttpMessage to contain and manipulate SIP messages.
Definition: SipMessage.h:343
Definition: SipContactDb.h:36
void addConfigChangeConsumer(OsMsgQ &messageQueue)
Definition: SipUserAgentBase.cpp:52
#define SIP_PORT
Definition: SipMessage.h:256
#define SIP_TLS_PORT
Definition: SipMessage.h:257
SipUserAgentBase(int sipTcpPort=SIP_PORT, int sipUdpPort=SIP_PORT, int sipTlsPort=SIP_TLS_PORT, int queueSize=OsServerTask::DEF_MAX_MSGS)
Definition: SipUserAgentBase.cpp:30
virtual UtlBoolean waitUntilReady()
Definition: SipUserAgentBase.cpp:74
virtual void dispatch(SipMessage *message, int messageType=SipMessageEvent::APPLICATION, SIPX_TRANSPORT_DATA *pTransport=NULL)=0
param: message - the sip message to be sent param: responseListener - the queue on which to place Sip...
UtlString mContactAddress
Definition: SipUserAgentBase.h:120
OsRWMutex mObserverMutex
Definition: SipUserAgentBase.h:121
virtual void getContactUri(UtlString *contactUri)
Definition: SipUserAgentBase.cpp:61
virtual void addMessageConsumer(OsServerTask *messageConsumer)=0
Definition: sipXtapiInternal.h:288
int mUdpPort
Definition: SipUserAgentBase.h:117
Definition: SipUserAgentBase.h:44
virtual void logMessage(const char *message, int messageLength)=0
virtual UtlBoolean handleMessage(OsMsg &eventMessage)=0
UtlBoolean mMessageLogEnabled
Definition: SipUserAgentBase.h:119
virtual UtlBoolean isMessageLoggingEnabled()=0

sipXtackLib home page