sipXcallLib home page


CSeqManager.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 #ifndef _CSeqManager_h_
12 #define _CSeqManager_h_
13 
14 // SYSTEM INCLUDES
15 
16 // APPLICATION INCLUDES
17 #include "utl/UtlHashMap.h"
18 #include "utl/UtlRandom.h"
19 #include "utl/UtlString.h"
20 #include "os/OsMutex.h"
21 
22 // DEFINES
23 #define CSEQ_MANAGER_STATE_CHECKS
24 #undef CSEQ_MANAGER_STATE_CHECKS
25 
26 #define CSEQ_ID_INVITE "INVITE"
27 #define CSEQ_ID_INFO "INFO"
28 #define CSEQ_ID_NOTIFY "NOTIFY"
29 #define CSEQ_ID_REFER "REFER"
30 #define CSEQ_ID_OPTIONS "OPTIONS"
31 
32 // MACROS
33 // EXTERNAL FUNCTIONS
34 // EXTERNAL VARIABLES
35 // CONSTANTS
36 // STRUCTS
37 // TYPEDEFS
38 typedef struct CSEQ_CONTEXT
39 {
40  UtlString identifier ;
42  int iCSeq ;
43 } CSEQ_CONTEXT ;
44 
45 // FORWARD DECLARATIONS
46 
47 
54 {
55 /* //////////////////////////// PUBLIC //////////////////////////////////// */
56  public:
57 
58 /* ============================ CREATORS ================================== */
59 
63  CSeqManager();
64 
68  virtual ~CSeqManager();
69 
70 /* ============================ MANIPULATORS ============================== */
71 
79  bool startTransaction(const char* szIdentifier, int& iCSeq) ;
80 
84  bool endTransaction(const char* szIdentifier) ;
85 
89  void dumpState(UtlString& state) ;
90 
91 /* ============================ ACCESSORS ================================= */
92 
96  int getCSeqNumber(const char* szIdentifier) ;
97 
98 /* ============================ INQUIRY =================================== */
99 
103  bool isInTransaction(const char* szIdentifier) ;
104 
105 /* //////////////////////////// PROTECTED ///////////////////////////////// */
106  protected:
107  UtlHashMap mHashMap ;
108  UtlRandom mRandomGenerator ;
109  OsMutex mGuard ;
110  int miCSeq ;
111 
116  CSEQ_CONTEXT* getContext(const char* szIdentifier) ;
117 
118 /* //////////////////////////// PRIVATE /////////////////////////////////// */
119  private:
120 
122  CSeqManager(const CSeqManager& rCSeqManager);
123 
125  CSeqManager& operator=(const CSeqManager& rhs);
126 
127 };
128 
129 /* ============================ INLINE METHODS ============================ */
130 
131 #endif // _CSeqManager_h_
CSeqManager manages the CSeq number space for a dialog.
Definition: CSeqManager.h:53
int miCSeq
Definition: CSeqManager.h:110
bool bInTransaction
Definition: CSeqManager.h:41
Definition: CSeqManager.h:38
UtlHashMap mHashMap
Definition: CSeqManager.h:107
struct CSEQ_CONTEXT CSEQ_CONTEXT
int iCSeq
Definition: CSeqManager.h:42
OsMutex mGuard
Definition: CSeqManager.h:109
UtlString identifier
Definition: CSeqManager.h:40
UtlRandom mRandomGenerator
Definition: CSeqManager.h:108