reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
TcpTransport.cxx
Go to the documentation of this file.
1#if defined(HAVE_CONFIG_H)
2#include "config.h"
3#endif
4
5#include <memory>
6#include "rutil/compat.hxx"
7#include "rutil/Data.hxx"
8#include "rutil/Socket.hxx"
9#include "rutil/Logger.hxx"
13
14#define RESIPROCATE_SUBSYSTEM Subsystem::TRANSPORT
15
16using namespace std;
17using namespace resip;
18
20 IpVersion version, const Data& pinterface,
22 Compression &compression,
23 unsigned transportFlags,
24 const Data& netNs)
25 : TcpBaseTransport(fifo, portNum, version, pinterface, socketFunc, compression, transportFlags, netNs)
26{
28
29 init();
30
31#ifdef USE_NETNS
32 InfoLog (<< "Creating TCP transport host=" << pinterface
33 << " port=" << mTuple.getPort()
34 << " ipv4=" << bool(version==V4)
35 << " netns=" << netNs);
36#else
37 InfoLog (<< "Creating TCP transport host=" << pinterface
38 << " port=" << mTuple.getPort()
39 << " ipv4=" << bool(version==V4));
40#endif
41
42 mTxFifo.setDescription("TcpTransport::mTxFifo");
43}
44
48
50TcpTransport::createConnection(const Tuple& who, Socket fd, bool server)
51{
53 Connection* conn = new TcpConnection(this, who, fd, mCompression, server);
54 return conn;
55}
56
57
58/* ====================================================================
59 * The Vovida Software License, Version 1.0
60 *
61 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
62 *
63 * Redistribution and use in source and binary forms, with or without
64 * modification, are permitted provided that the following conditions
65 * are met:
66 *
67 * 1. Redistributions of source code must retain the above copyright
68 * notice, this list of conditions and the following disclaimer.
69 *
70 * 2. Redistributions in binary form must reproduce the above copyright
71 * notice, this list of conditions and the following disclaimer in
72 * the documentation and/or other materials provided with the
73 * distribution.
74 *
75 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
76 * and "Vovida Open Communication Application Library (VOCAL)" must
77 * not be used to endorse or promote products derived from this
78 * software without prior written permission. For written
79 * permission, please contact vocal@vovida.org.
80 *
81 * 4. Products derived from this software may not be called "VOCAL", nor
82 * may "VOCAL" appear in their name, without prior written
83 * permission of Vovida Networks, Inc.
84 *
85 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
86 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
87 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
88 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
89 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
90 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
91 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
92 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
93 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
94 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
95 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
96 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
97 * DAMAGE.
98 *
99 * ====================================================================
100 *
101 * This software consists of voluntary contributions made by Vovida
102 * Networks, Inc. and many individuals on behalf of Vovida Networks,
103 * Inc. For more information on Vovida Networks, Inc., please see
104 * <http://www.vovida.org/>.
105 *
106 * vi: set shiftwidth=3 expandtab:
107 */
#define InfoLog(args_)
Definition Logger.hxx:131
#define resip_assert_not_null(x)
Handles cross-platform sockets compatibility.
Connection implements, via sockets, ConnectionBase for managed connections.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
A templated, threadsafe message-queue class.
Definition Fifo.hxx:16
virtual void init()
Performs constructor activities that depend on virtual functions specified by derived classes.
Connection * createConnection(const Tuple &who, Socket fd, bool server=false)
Makes new Connection using provided socket.
TcpTransport(Fifo< TransactionMessage > &fifo, int portNum, IpVersion version, const Data &interfaceObj, AfterSocketCreationFuncPtr socketFunc=0, Compression &compression=Compression::Disabled, unsigned transportFlags=0, const Data &netNs=Data::Empty)
const Data & netNs() const
Compression & mCompression
Represents a network address.
Definition Tuple.hxx:59
void setType(TransportType type)
Definition Tuple.hxx:123
int getPort() const
Definition Tuple.cxx:466
This file is used to handle compatibility fixes/tweaks so reSIProcate can function on multiple platfo...
dcm! – add UnusedChecking(_enum) below;
void(* AfterSocketCreationFuncPtr)(Socket s, int transportType, const char *file, int line)
Definition Socket.hxx:107
int Socket
Definition Socket.hxx:94
IpVersion
An enumeration of IP versions.