sipxtacklib  Version 3.3
HttpConnectionMap.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2006 Pingtel Corp.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 #ifndef _HttpConnectionMap_h_
12 #define _HttpConnectionMap_h_
13 
14 // SYSTEM INCLUDES
15 
16 // APPLICATION INCLUDES
17 #include <os/OsDefs.h>
18 #include <net/HttpServer.h>
19 #include <net/HttpBody.h>
20 #include <net/NameValuePair.h>
21 #include <os/OsSocket.h>
22 #include <os/OsConnectionSocket.h>
23 #include <os/OsTimeLog.h>
24 #include <os/OsMsgQ.h>
25 #include <utl/UtlHashMap.h>
26 #include <os/OsBSem.h>
27 
28 // DEFINES
29 
30 class HttpConnectionMapEntry : public UtlString
31 {
32 public:
34  HttpConnectionMapEntry(const UtlString& name);
35 
37  virtual ~HttpConnectionMapEntry();
38 
39  OsConnectionSocket* mpSocket; //< pointer to a connection socket
40  OsBSem mLock; //< protects access to the connection
41  bool mbInUse; //< true if entry is in use, false if not
42  static int count; //< used to udentify the entry
43 };
44 
45 class HttpConnectionMap : public UtlHashMap
46 {
47 /* //////////////////////////// PUBLIC //////////////////////////////////// */
48 public:
50  static HttpConnectionMap* getHttpConnectionMap();
51 
57  void releaseHttpConnectionMap();
59 
61  void clearHttpConnectionMap();
62 
64  HttpConnectionMapEntry* getPersistentConnection(const Url& url, OsConnectionSocket*& socket);
65 
73 /* ============================ MANIPULATORS ============================== */
74 /* ============================ ACCESSORS ================================= */
75 /* ============================ INQUIRY =================================== */
76 /* //////////////////////////// PROTECTED ///////////////////////////////// */
77 protected:
78 
79 /* //////////////////////////// PRIVATE /////////////////////////////////// */
80 private:
83 
85  virtual ~HttpConnectionMap();
86 
88  void getPersistentUriKey(const Url& url, UtlString& key);
89 
90  static HttpConnectionMap* pInstance;
91  static OsBSem mLock;
92 
94  HttpConnectionMap(const HttpConnectionMap& nocopy);
95 
97  HttpConnectionMap& operator=(const HttpConnectionMap& noassignment);
98 };
99 
100 /* ============================ INLINE METHODS ============================ */
101 
102 #endif // _HttpConnectionMap_h_
Definition: HttpConnectionMap.h:30
Definition: HttpConnectionMap.h:45
HttpConnectionMapEntry(const UtlString &name)
Constructor.
Definition: HttpConnectionMap.cpp:185
OsConnectionSocket * mpSocket
Definition: HttpConnectionMap.h:39
virtual ~HttpConnectionMapEntry()
Destructor.
Definition: HttpConnectionMap.cpp:195
static int count
Definition: HttpConnectionMap.h:42
bool mbInUse
Definition: HttpConnectionMap.h:41
OsBSem mLock
Definition: HttpConnectionMap.h:40
URL parser and constructor.
Definition: Url.h:90

sipXtackLib home page