|
reSIProcate/stack
9694
|
00001 #if !defined(RESIP_TCPBASETRANSPORT_HXX) 00002 #define RESIP_TCPBASETRANSPORT_HXX 00003 00004 #include "resip/stack/InternalTransport.hxx" 00005 #include "resip/stack/ConnectionManager.hxx" 00006 #include "resip/stack/Compression.hxx" 00007 00008 namespace resip 00009 { 00010 00011 class TransactionMessage; 00012 00013 class TcpBaseTransport : public InternalTransport, public FdPollItemIf 00014 { 00015 public: 00016 TcpBaseTransport(Fifo<TransactionMessage>& fifo, 00017 int portNum, 00018 IpVersion version, 00019 const Data& interfaceName, 00020 AfterSocketCreationFuncPtr socketFunc, 00021 Compression &compression, 00022 unsigned transportFlags = 0); 00023 virtual ~TcpBaseTransport(); 00024 00025 00026 00027 virtual void processPollEvent(FdPollEventMask mask); 00028 virtual void process(FdSet& fdset); 00029 virtual void buildFdSet( FdSet& fdset); 00030 virtual bool isReliable() const { return true; } 00031 virtual bool isDatagram() const { return false; } 00032 virtual void process(); 00033 virtual void setPollGrp(FdPollGrp *grp); 00034 virtual void setRcvBufLen(int buflen); 00035 00036 ConnectionManager& getConnectionManager() {return mConnectionManager;} 00037 const ConnectionManager& getConnectionManager() const {return mConnectionManager;} 00038 00039 protected: 00043 virtual void init(); 00044 00046 virtual Connection* createConnection(const Tuple& who, Socket fd, bool server=false)=0; 00047 00051 void processAllWriteRequests(); 00052 00057 // return 1 if accepted connection 00058 int processListen(); 00059 00060 /* Helper to make a new outgoing TCP connection. 00061 * Makes the socket, connects it, etc. 00062 */ 00063 Connection* makeOutgoingConnection(const Tuple &dest, 00064 TransportFailure::FailureReason &failCode, int &subCode); 00065 00066 static const size_t MaxWriteSize; 00067 static const size_t MaxReadSize; 00068 00069 private: 00070 static const int MaxBufferSize; 00071 ConnectionManager mConnectionManager; 00072 }; 00073 00074 } 00075 00076 #endif 00077 00078 /* ==================================================================== 00079 * The Vovida Software License, Version 1.0 00080 * 00081 * Copyright (c) 2000-2005 Vovida Networks, Inc. All rights reserved. 00082 * 00083 * Redistribution and use in source and binary forms, with or without 00084 * modification, are permitted provided that the following conditions 00085 * are met: 00086 * 00087 * 1. Redistributions of source code must retain the above copyright 00088 * notice, this list of conditions and the following disclaimer. 00089 * 00090 * 2. Redistributions in binary form must reproduce the above copyright 00091 * notice, this list of conditions and the following disclaimer in 00092 * the documentation and/or other materials provided with the 00093 * distribution. 00094 * 00095 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00096 * and "Vovida Open Communication Application Library (VOCAL)" must 00097 * not be used to endorse or promote products derived from this 00098 * software without prior written permission. For written 00099 * permission, please contact vocal@vovida.org. 00100 * 00101 * 4. Products derived from this software may not be called "VOCAL", nor 00102 * may "VOCAL" appear in their name, without prior written 00103 * permission of Vovida Networks, Inc. 00104 * 00105 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00106 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00107 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00108 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00109 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00110 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00111 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00112 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00113 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00114 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00115 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00116 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00117 * DAMAGE. 00118 * 00119 * ==================================================================== 00120 * 00121 * This software consists of voluntary contributions made by Vovida 00122 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00123 * Inc. For more information on Vovida Networks, Inc., please see 00124 * <http://www.vovida.org/>. 00125 * 00126 * vi: set shiftwidth=3 expandtab: 00127 */
1.7.5.1