sipxtacklib  Version 3.3
SipTransactionList.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 _SipTransactionList_h_
13 #define _SipTransactionList_h_
14 
15 // SYSTEM INCLUDES
16 
17 // APPLICATION INCLUDES
18 #include <utl/UtlHashBag.h>
19 
20 #include <os/OsDefs.h>
21 #include <os/OsMutex.h>
22 
23 // DEFINES
24 // MACROS
25 // EXTERNAL FUNCTIONS
26 // EXTERNAL VARIABLES
27 // CONSTANTS
28 // STRUCTS
29 // TYPEDEFS
30 // FORWARD DECLARATIONS
31 
32 class SipMessage;
33 
34 //:Class short description which may consist of multiple lines (note the ':')
35 // Class detailed description which may extend to multiple lines
37 /* //////////////////////////// PUBLIC //////////////////////////////////// */
38 public:
39 
40 /* ============================ CREATORS ================================== */
41 
43  //:Default constructor
44 
45  virtual
47  //:Destructor
48 
49 /* ============================ MANIPULATORS ============================== */
50 
51  void addTransaction(SipTransaction* transaction,
52  UtlBoolean lockList = TRUE);
53  //: Adds a transaction to the list
54  // Note: does not make a copy
55 
57  UtlBoolean isOutgoing,
58  enum SipTransaction::messageRelationship& relationship);
59  //: Find a transaction for the given message
60  // Note: the caller should first lock the list and keep
61  // it locked until all access of the transaction is complete
62 
63  UtlBoolean transactionExists(const SipTransaction* transaction,
64  const UtlString& hash);
65  //: Used to confirm a transaction is still good and has not been deleted
66  // Note: this should only be used inside of a lock to prevent any sort
67  // of delete race.
68 
69  UtlBoolean waitUntilAvailable(SipTransaction* transaction,
70  const UtlString& hash);
71  //: waits until the transaction is available and them marks it as busy
72  // Note: be sure to check the return. If returns false the transaction
73  // is not locked or available. Most likely as it got removed from
74  // the list (e.g. deleted)
75 
76  void markAvailable(SipTransaction& transaction);
77  //: Marks the transaction as available
78 
79  void removeOldTransactions(long oldTransaction,
80  long oldTcpTransaction);
81  //: Remove transactions not accessed after given time
82 
83  void stopTransactionTimers();
85 
87 
88 /* ============================ ACCESSORS ================================= */
89 
90  void toString(UtlString& string);
91 
92  void toStringWithRelations(UtlString& string,
93  SipMessage& message,
94  UtlBoolean isOutGoing);
95 
96 /* ============================ INQUIRY =================================== */
97 
98 /* //////////////////////////// PROTECTED ///////////////////////////////// */
99 protected:
100  void lock();
101  //: Locks the list for iteration, reading or writing
102 
103  void unlock();
104  //: Unlock
105 
106 /* //////////////////////////// PRIVATE /////////////////////////////////// */
107  private:
108  SipTransactionList(const SipTransactionList& rSipTransactionList);
109  //:Copy constructor (disabled)
110 
111  SipTransactionList& operator=(const SipTransactionList& rhs);
112  //:Assignment operator
113 
114  UtlHashBag mTransactions;
115  OsMutex mListMutex;
116 
117 };
118 
119 /* ============================ INLINE METHODS ============================ */
120 
121 #endif
void stopTransactionTimers()
Definition: SipTransactionList.cpp:312
SipTransactionList()
Definition: SipTransactionList.cpp:41
Specialization of HttpMessage to contain and manipulate SIP messages.
Definition: SipMessage.h:343
void deleteTransactionTimers()
Definition: SipTransactionList.cpp:350
void addTransaction(SipTransaction *transaction, UtlBoolean lockList=TRUE)
Definition: SipTransactionList.cpp:71
SipTransaction correlates requests and responses.
Definition: SipTransaction.h:51
UtlBoolean waitUntilAvailable(SipTransaction *transaction, const UtlString &hash)
Definition: SipTransactionList.cpp:431
messageRelationship
The relationship of a message to a transaction.
Definition: SipTransaction.h:76
SipTransaction * findTransactionFor(const SipMessage &message, UtlBoolean isOutgoing, enum SipTransaction::messageRelationship &relationship)
Definition: SipTransactionList.cpp:89
void markAvailable(SipTransaction &transaction)
Definition: SipTransactionList.cpp:536
UtlBoolean transactionExists(const SipTransaction *transaction, const UtlString &hash)
Definition: SipTransactionList.cpp:559
void unlock()
Definition: SipTransactionList.cpp:426
void toString(UtlString &string)
Definition: SipTransactionList.cpp:369
virtual ~SipTransactionList()
Definition: SipTransactionList.cpp:54
void lock()
Definition: SipTransactionList.cpp:421
void startTransactionTimers()
Definition: SipTransactionList.cpp:331
void toStringWithRelations(UtlString &string, SipMessage &message, UtlBoolean isOutGoing)
Definition: SipTransactionList.cpp:389
void removeOldTransactions(long oldTransaction, long oldTcpTransaction)
Definition: SipTransactionList.cpp:205
Definition: SipTransactionList.h:36

sipXtackLib home page