/[resiprocate]/main/reTurn/UdpRelayServer.hxx
ViewVC logotype

Contents of /main/reTurn/UdpRelayServer.hxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11159 - (show annotations) (download)
Fri Apr 25 14:03:32 2014 UTC (5 years, 6 months ago) by sgodin
File MIME type: text/plain
File size: 3076 byte(s)
-modified asio and boost include file ordering to avoid multiply defined symbol errors on linking
 -in preparation for upgrade of asio drop and support for latest boost 
 -include asio/ssh.hpp everywhere asio.hpp is included
 -include boost headers before others, to ensure we are not redefining stdint definitions in some includes
  and not others

1 #ifndef UDP_RELAY_SERVER_HXX
2 #define UDP_REALY_SERVER_HXX
3
4 #include <asio.hpp>
5 #ifdef USE_SSL
6 #include <asio/ssl.hpp>
7 #endif
8 #include <string>
9 #include <boost/noncopyable.hpp>
10 #include "RequestHandler.hxx"
11 #include "AsyncUdpSocketBase.hxx"
12
13 namespace reTurn {
14
15 class StunTuple;
16
17 class UdpRelayServer
18 : public AsyncUdpSocketBase,
19 private boost::noncopyable
20 {
21 public:
22 /// Create the server to listen on the specified UDP address and port
23 explicit UdpRelayServer(asio::io_service& ioService, TurnAllocation& turnAllocation);
24 ~UdpRelayServer();
25
26 /// Starts processing
27 bool startReceiving();
28
29 /// Causes this object to destroy itself safely (ie. waiting for ayncronous callbacks to finish)
30 void stop();
31
32 private:
33 /// Handle completion of a receive_from operation
34 virtual void onReceiveSuccess(const asio::ip::address& address, unsigned short port, boost::shared_ptr<DataBuffer>& data);
35 virtual void onReceiveFailure(const asio::error_code& e);
36
37 /// Handle completion of a send operation
38 virtual void onSendSuccess();
39 virtual void onSendFailure(const asio::error_code& e);
40
41 TurnAllocation& mTurnAllocation;
42 bool mStopping;
43 bool mBindSuccess;
44 asio::error_code mLastSendErrorCode; // Use to ensure we only log at Warning level once for a particular send error
45 };
46
47 typedef boost::shared_ptr<UdpRelayServer> UdpRelayServerPtr;
48
49 }
50
51 #endif
52
53
54 /* ====================================================================
55
56 Copyright (c) 2007-2008, Plantronics, Inc.
57 All rights reserved.
58
59 Redistribution and use in source and binary forms, with or without
60 modification, are permitted provided that the following conditions are
61 met:
62
63 1. Redistributions of source code must retain the above copyright
64 notice, this list of conditions and the following disclaimer.
65
66 2. Redistributions in binary form must reproduce the above copyright
67 notice, this list of conditions and the following disclaimer in the
68 documentation and/or other materials provided with the distribution.
69
70 3. Neither the name of Plantronics nor the names of its contributors
71 may be used to endorse or promote products derived from this
72 software without specific prior written permission.
73
74 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
75 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
76 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
77 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
78 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
79 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
80 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
81 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
82 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
83 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
84 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
85
86 ==================================================================== */

Properties

Name Value
svn:eol-style native
svn:mime-type text/plain

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27