reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
TcpBaseTransport.hxx
Go to the documentation of this file.
1#if !defined(RESIP_TCPBASETRANSPORT_HXX)
2#define RESIP_TCPBASETRANSPORT_HXX
3
7
8namespace resip
9{
10
11class TransactionMessage;
12
14{
15 public:
17 int portNum,
18 IpVersion version,
19 const Data& interfaceName,
21 Compression &compression,
22 unsigned transportFlags = 0,
23 const Data& netNs = Data::Empty);
24 virtual ~TcpBaseTransport();
25
26 virtual void processPollEvent(FdPollEventMask mask);
27 virtual void process(FdSet& fdset);
28 virtual void buildFdSet( FdSet& fdset);
29 virtual bool isReliable() const { return true; }
30 virtual bool isDatagram() const { return false; }
31 virtual void process();
32 virtual void setPollGrp(FdPollGrp *grp);
33 virtual void setRcvBufLen(int buflen);
34
35 ConnectionManager& getConnectionManager() {return mConnectionManager;}
36 const ConnectionManager& getConnectionManager() const {return mConnectionManager;}
37
38 virtual void invokeAfterSocketCreationFunc() const;
39
40 protected:
44 virtual void init();
45
47 virtual Connection* createConnection(const Tuple& who, Socket fd, bool server=false)=0;
48
53
58 // return 1 if accepted connection
59 int processListen();
60
61 /* Helper to make a new outgoing TCP connection.
62 * Makes the socket, connects it, etc.
63 */
65 TransportFailure::FailureReason &failCode, int &subCode);
66
67 static const size_t MaxWriteSize;
68 static const size_t MaxReadSize;
69
70 private:
71 static const int MaxBufferSize;
72 ConnectionManager mConnectionManager;
73
84 bool bindClientSocket(Socket sock,
86 int &failSubCode);
87};
88
89}
90
91#endif
92
93/* ====================================================================
94 * The Vovida Software License, Version 1.0
95 *
96 * Copyright (c) 2000-2005 Vovida Networks, Inc. All rights reserved.
97 *
98 * Redistribution and use in source and binary forms, with or without
99 * modification, are permitted provided that the following conditions
100 * are met:
101 *
102 * 1. Redistributions of source code must retain the above copyright
103 * notice, this list of conditions and the following disclaimer.
104 *
105 * 2. Redistributions in binary form must reproduce the above copyright
106 * notice, this list of conditions and the following disclaimer in
107 * the documentation and/or other materials provided with the
108 * distribution.
109 *
110 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
111 * and "Vovida Open Communication Application Library (VOCAL)" must
112 * not be used to endorse or promote products derived from this
113 * software without prior written permission. For written
114 * permission, please contact vocal@vovida.org.
115 *
116 * 4. Products derived from this software may not be called "VOCAL", nor
117 * may "VOCAL" appear in their name, without prior written
118 * permission of Vovida Networks, Inc.
119 *
120 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
121 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
122 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
123 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
124 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
125 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
126 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
127 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
128 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
129 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
130 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
131 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
132 * DAMAGE.
133 *
134 * ====================================================================
135 *
136 * This software consists of voluntary contributions made by Vovida
137 * Networks, Inc. and many individuals on behalf of Vovida Networks,
138 * Inc. For more information on Vovida Networks, Inc., please see
139 * <http://www.vovida.org/>.
140 *
141 * vi: set shiftwidth=3 expandtab:
142 */
Collection of Connection per Transport.
Connection implements, via sockets, ConnectionBase for managed connections.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
static const Data Empty
Constant that represents a zero-length data.
Definition Data.hxx:882
Object-oriented wrapper for your platform's file-descriptor set.
Definition Socket.hxx:162
A templated, threadsafe message-queue class.
Definition Fifo.hxx:16
virtual void processPollEvent(FdPollEventMask mask)
Called by PollGrp when activity is possible.
Connection * makeOutgoingConnection(const Tuple &dest, TransportFailure::FailureReason &failCode, int &subCode)
const ConnectionManager & getConnectionManager() const
static const size_t MaxReadSize
virtual void setRcvBufLen(int buflen)
virtual void buildFdSet(FdSet &fdset)
Adds the Transport's socket FD to the appropriate read or write sets as applicable.
virtual void process()
Version of process to be invoked periodically when using callback-based IO (via FdPollGrp).
ConnectionManager & getConnectionManager()
virtual bool isReliable() const
int processListen()
This doesn't exist anywhere that I can find? !kw! void sendFromRoundRobin(FdSet& fdset);.
virtual void setPollGrp(FdPollGrp *grp)
virtual bool isDatagram() const
static const size_t MaxWriteSize
void processAllWriteRequests()
Forms a connection if one doesn't exist, moves requests to the appropriate connection's fifo.
virtual void init()
Performs constructor activities that depend on virtual functions specified by derived classes.
virtual Connection * createConnection(const Tuple &who, Socket fd, bool server=false)=0
Makes new Connection using provided socket.
virtual void invokeAfterSocketCreationFunc() const
const Data & interfaceName() const
const Data & netNs() const
Represents a network address.
Definition Tuple.hxx:59
dcm! – add UnusedChecking(_enum) below;
void(* AfterSocketCreationFuncPtr)(Socket s, int transportType, const char *file, int line)
Definition Socket.hxx:107
unsigned short FdPollEventMask
Definition FdPoll.hxx:28
int Socket
Definition Socket.hxx:94
IpVersion
An enumeration of IP versions.