|
reSIProcate/stack
9694
|
00001 #ifndef RESIP_ConnectionMgr_hxx 00002 #define RESIP_ConnectionMgr_hxx 00003 00004 #include <map> 00005 #include "rutil/HashMap.hxx" 00006 #include "resip/stack/Connection.hxx" 00007 00008 namespace resip 00009 { 00010 class FdPollGrp; 00011 00019 class ConnectionManager 00020 { 00021 friend class Connection; 00022 public: 00025 static UInt64 MinimumGcAge; 00029 static bool EnableAgressiveGc; 00030 00031 ConnectionManager(); 00032 ~ConnectionManager(); 00033 00035 Connection* findConnection(const Tuple& tuple); 00036 const Connection* findConnection(const Tuple& tuple) const; 00037 00039 void setPollGrp(FdPollGrp *grp); 00040 void buildFdSet(FdSet& fdset); 00041 void process(FdSet& fdset); 00042 00043 private: 00044 void addToWritable(Connection* conn); // add the specified conn to end 00045 void removeFromWritable(Connection* conn); // remove the current mWriteMark 00046 00047 typedef std::map<Tuple, Connection*> AddrMap; 00048 typedef std::map<Socket, Connection*> IdMap; 00049 00050 void addConnection(Connection* connection); 00051 void removeConnection(Connection* connection); 00052 void closeConnections(); 00053 00056 void gc(UInt64 threshold, unsigned int maxToRemove); 00057 00059 void touch(Connection* connection); 00060 void moveToFlowTimerLru(Connection *connection); 00061 00062 AddrMap mAddrMap; 00063 IdMap mIdMap; 00064 00066 Connection mHead; 00067 00069 ConnectionWriteList* mWriteHead; 00071 ConnectionReadList* mReadHead; 00073 ConnectionLruList* mLRUHead; 00075 FlowTimerLruList* mFlowTimerLRUHead; 00076 00078 FdPollGrp* mPollGrp; 00079 //<<--------------------------------- 00080 00081 friend class TcpBaseTransport; 00082 }; 00083 00084 } 00085 00086 #endif 00087 00088 /* ==================================================================== 00089 * The Vovida Software License, Version 1.0 00090 * 00091 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00092 * 00093 * Redistribution and use in source and binary forms, with or without 00094 * modification, are permitted provided that the following conditions 00095 * are met: 00096 * 00097 * 1. Redistributions of source code must retain the above copyright 00098 * notice, this list of conditions and the following disclaimer. 00099 * 00100 * 2. Redistributions in binary form must reproduce the above copyright 00101 * notice, this list of conditions and the following disclaimer in 00102 * the documentation and/or other materials provided with the 00103 * distribution. 00104 * 00105 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00106 * and "Vovida Open Communication Application Library (VOCAL)" must 00107 * not be used to endorse or promote products derived from this 00108 * software without prior written permission. For written 00109 * permission, please contact vocal@vovida.org. 00110 * 00111 * 4. Products derived from this software may not be called "VOCAL", nor 00112 * may "VOCAL" appear in their name, without prior written 00113 * permission of Vovida Networks, Inc. 00114 * 00115 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00116 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00117 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00118 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00119 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00120 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00121 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00122 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00123 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00124 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00125 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00126 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00127 * DAMAGE. 00128 * 00129 * ==================================================================== 00130 * 00131 * This software consists of voluntary contributions made by Vovida 00132 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00133 * Inc. For more information on Vovida Networks, Inc., please see 00134 * <http://www.vovida.org/>. 00135 * 00136 */
1.7.5.1