reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
ConnectionManager.hxx
Go to the documentation of this file.
1#ifndef RESIP_ConnectionMgr_hxx
2#define RESIP_ConnectionMgr_hxx
3
4#include <map>
5#include "rutil/HashMap.hxx"
7
8namespace resip
9{
10class FdPollGrp;
11
20{
21 friend class Connection;
22
23 public:
36 static bool EnableAgressiveGc;
37
40
42 Connection* findConnection(const Tuple& tuple);
43 const Connection* findConnection(const Tuple& tuple) const;
44
47 void buildFdSet(FdSet& fdset);
48 void process(FdSet& fdset);
49
50 virtual void invokeAfterSocketCreationFunc() const;
51
52 private:
53 void addToWritable(Connection* conn); // add the specified conn to end
54 void removeFromWritable(Connection* conn); // remove the current mWriteMark
55
56 typedef std::map<Tuple, Connection*> AddrMap;
57 typedef std::map<Socket, Connection*> IdMap;
58
59 void addConnection(Connection* connection);
60 void removeConnection(Connection* connection);
61 void closeConnections();
62
65 unsigned int gc(uint64_t threshold, unsigned int maxToRemove);
66 unsigned int gcWithTarget(unsigned int target);
67
69 void touch(Connection* connection);
70 void moveToFlowTimerLru(Connection *connection);
71
72 AddrMap mAddrMap;
73 IdMap mIdMap;
74
76 Connection mHead;
77
79 ConnectionWriteList* mWriteHead;
81 ConnectionReadList* mReadHead;
83 ConnectionLruList* mLRUHead;
85 FlowTimerLruList* mFlowTimerLRUHead;
86
88 FdPollGrp* mPollGrp;
89 //<<---------------------------------
90
91 friend class TcpBaseTransport;
92};
93
94}
95
96#endif
97
98/* ====================================================================
99 * The Vovida Software License, Version 1.0
100 *
101 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
102 *
103 * Redistribution and use in source and binary forms, with or without
104 * modification, are permitted provided that the following conditions
105 * are met:
106 *
107 * 1. Redistributions of source code must retain the above copyright
108 * notice, this list of conditions and the following disclaimer.
109 *
110 * 2. Redistributions in binary form must reproduce the above copyright
111 * notice, this list of conditions and the following disclaimer in
112 * the documentation and/or other materials provided with the
113 * distribution.
114 *
115 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
116 * and "Vovida Open Communication Application Library (VOCAL)" must
117 * not be used to endorse or promote products derived from this
118 * software without prior written permission. For written
119 * permission, please contact vocal@vovida.org.
120 *
121 * 4. Products derived from this software may not be called "VOCAL", nor
122 * may "VOCAL" appear in their name, without prior written
123 * permission of Vovida Networks, Inc.
124 *
125 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
126 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
127 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
128 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
129 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
130 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
131 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
132 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
133 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
134 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
135 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
136 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
137 * DAMAGE.
138 *
139 * ====================================================================
140 *
141 * This software consists of voluntary contributions made by Vovida
142 * Networks, Inc. and many individuals on behalf of Vovida Networks,
143 * Inc. For more information on Vovida Networks, Inc., please see
144 * <http://www.vovida.org/>.
145 *
146 */
Wraps your platform's implementation of hash_map, hash_multimap, and hash_set.
Collection of Connection per Transport.
static bool EnableAgressiveGc
Enable Agressive Connection Garbage Collection to have resip perform garbage collection on every new ...
Connection * findConnection(const Tuple &tuple)
may return 0
void setPollGrp(FdPollGrp *grp)
populate the fdset againt the read and write lists
static uint64_t MinimumGcAge
connection must have no inbound traffic for greater than this time (in ms) before it is garbage colle...
virtual void invokeAfterSocketCreationFunc() const
static uint64_t MinimumGcHeadroom
If the difference between the number of permitted FDs (reported by periodic calls to getrlimit()) and...
Connection implements, via sockets, ConnectionBase for managed connections.
Object-oriented wrapper for your platform's file-descriptor set.
Definition Socket.hxx:162
Represents a network address.
Definition Tuple.hxx:59
dcm! – add UnusedChecking(_enum) below;
unsigned long long uint64_t
Definition Stun.hxx:39
void list()
Definition userAdmin.cxx:66