sipxtacklib  Version 3.3
SipNonceDb.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 _SipNonceDb_h_
13 #define _SipNonceDb_h_
14 
15 // SYSTEM INCLUDES
16 
17 // APPLICATION INCLUDES
18 #include <utl/UtlString.h>
19 #include <utl/UtlHashBag.h>
20 #include "os/OsBSem.h"
21 
22 // DEFINES
23 // MACROS
24 // EXTERNAL FUNCTIONS
25 // EXTERNAL VARIABLES
26 // CONSTANTS
27 // STRUCTS
28 // TYPEDEFS
29 // FORWARD DECLARATIONS
30 
31 //:Class short description which may consist of multiple lines (note the ':')
32 // Class detailed description which may extend to multiple lines
34 {
35 /* //////////////////////////// PUBLIC //////////////////////////////////// */
36 public:
37 
38 /* ============================ CREATORS ================================== */
39 
40  SipNonceDb();
41  //:Default constructor
42 
43  virtual
44  ~SipNonceDb();
45  //:Destructor
46 
47 /* ============================ MANIPULATORS ============================== */
48 
49  void createNewNonce(const UtlString& callId, //input
50  const UtlString& fromTag, // input
51  const UtlString& uri, // input
52  const UtlString& realm, // input
53  UtlString& nonce); // output
54 
55  void removeOldNonces(long oldTime);
56 
57 /* ============================ ACCESSORS ================================= */
58 
59 /* ============================ INQUIRY =================================== */
60 
61  UtlBoolean isNonceValid(const UtlString& nonce,
62  const UtlString& callId,
63  const UtlString& fromTag,
64  const UtlString& uri,
65  const UtlString& realm,
66  const long expiredTime);
67 
68 /* //////////////////////////// PROTECTED ///////////////////////////////// */
69 protected:
70 
71 /* //////////////////////////// PRIVATE /////////////////////////////////// */
72 private:
73  SipNonceDb(const SipNonceDb& rSipNonceDb);
74  //:Copy constructor
75 
76  SipNonceDb& operator=(const SipNonceDb& rhs);
77  //:Assignment operator
78 
79  UtlString nonceSignature(const UtlString& callId,
80  const UtlString& uri,
81  const UtlString& fromTag,
82  const UtlString& realm,
83  const UtlString& timestamp
84  );
85 
86  UtlHashBag mNonceHash;
87  UtlString mNonceSignatureSecret;
88 
89 };
90 
92 class SharedNonceDb : public SipNonceDb
93 {
94  public:
95 
97  static SipNonceDb* get();
98 
99  private:
100 
101  static OsBSem* spLock;
102  static SipNonceDb* spSipNonceDb;
103 
105  SharedNonceDb();
106 
108  ~SharedNonceDb();
109 };
110 
111 
112 /* ============================ INLINE METHODS ============================ */
113 
114 #endif // _SipNonceDb_h_
virtual ~SipNonceDb()
Definition: SipNonceDb.cpp:48
Definition: SipNonceDb.h:33
void removeOldNonces(long oldTime)
Definition: SipNonceDb.cpp:116
void createNewNonce(const UtlString &callId, const UtlString &fromTag, const UtlString &uri, const UtlString &realm, UtlString &nonce)
Definition: SipNonceDb.cpp:100
UtlBoolean isNonceValid(const UtlString &nonce, const UtlString &callId, const UtlString &fromTag, const UtlString &uri, const UtlString &realm, const long expiredTime)
Definition: SipNonceDb.cpp:124
SipNonceDb()
Definition: SipNonceDb.cpp:36
A shared singleton instance of SipNonceDb.
Definition: SipNonceDb.h:92

sipXtackLib home page