/[resiprocate]/branches/b-identity-0505/InternalTransport.hxx
ViewVC logotype

Contents of /branches/b-identity-0505/InternalTransport.hxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4598 - (show annotations) (download)
Wed May 11 22:53:07 2005 UTC (14 years, 6 months ago) by derek
File size: 4111 byte(s)
set svn:eol-style to LF
1 #if !defined(RESIP_INTERNAL_TRANSPORT_HXX)
2 #define RESIP_INTERNAL_TRANSPORT_HXX
3
4 #include <exception>
5
6 #include "resiprocate/Message.hxx"
7 #include "resiprocate/Transport.hxx"
8 #include "resiprocate/os/BaseException.hxx"
9 #include "resiprocate/os/Data.hxx"
10 #include "resiprocate/os/Fifo.hxx"
11 #include "resiprocate/os/Socket.hxx"
12 #include "resiprocate/os/Tuple.hxx"
13 #include "resiprocate/os/ThreadIf.hxx"
14 #include "resiprocate/SendData.hxx"
15
16 namespace resip
17 {
18
19 class TransactionMessage;
20 class SipMessage;
21 class Connection;
22
23 class InternalTransport : public Transport, public ThreadIf
24 {
25 public:
26 // sendHost what to put in the Via:sent-by
27 // portNum is the port to receive and/or send on
28 InternalTransport(Fifo<TransactionMessage>& rxFifo,
29 int portNum,
30 IpVersion version,
31 const Data& interfaceObj);
32
33 virtual ~InternalTransport();
34
35 virtual bool isFinished() const;
36 virtual bool hasDataToSend() const;
37
38 virtual bool shareStackProcessAndSelect() const { return !mHasOwnThread; }
39
40 virtual void startOwnProcessing() { run(); }
41
42
43 // shared by UDP, TCP, and TLS
44 static Socket socket(TransportType type, IpVersion ipVer);
45 void bind();
46 void thread();
47
48 //used for epoll
49 virtual int maxFileDescriptors() const { return 1; }
50 virtual unsigned int getFifoSize() const;
51 protected:
52 friend class SipStack;
53 virtual void transmit(const Tuple& dest, const Data& pdata, const Data& tid);
54
55 Socket mFd; // this is a unix file descriptor or a windows SOCKET
56 Fifo<SendData> mTxFifo; // owned by the transport
57 bool mHasOwnThread;
58 };
59
60
61 }
62
63 #endif
64
65 /* ====================================================================
66 * The Vovida Software License, Version 1.0
67 *
68 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
69 *
70 * Redistribution and use in source and binary forms, with or without
71 * modification, are permitted provided that the following conditions
72 * are met:
73 *
74 * 1. Redistributions of source code must retain the above copyright
75 * notice, this list of conditions and the following disclaimer.
76 *
77 * 2. Redistributions in binary form must reproduce the above copyright
78 * notice, this list of conditions and the following disclaimer in
79 * the documentation and/or other materials provided with the
80 * distribution.
81 *
82 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
83 * and "Vovida Open Communication Application Library (VOCAL)" must
84 * not be used to endorse or promote products derived from this
85 * software without prior written permission. For written
86 * permission, please contact vocal@vovida.org.
87 *
88 * 4. Products derived from this software may not be called "VOCAL", nor
89 * may "VOCAL" appear in their name, without prior written
90 * permission of Vovida Networks, Inc.
91 *
92 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
93 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
94 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
95 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
96 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
97 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
98 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
99 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
100 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
101 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
102 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
103 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
104 * DAMAGE.
105 *
106 * ====================================================================
107 *
108 * This software consists of voluntary contributions made by Vovida
109 * Networks, Inc. and many individuals on behalf of Vovida Networks,
110 * Inc. For more information on Vovida Networks, Inc., please see
111 * <http://www.vovida.org/>.
112 *
113 */

Properties

Name Value
svn:eol-style LF
svn:executable *

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27