/[resiprocate]/main/reTurn/RemotePeer.cxx
ViewVC logotype

Contents of /main/reTurn/RemotePeer.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8397 - (show annotations) (download)
Wed Jan 14 18:46:21 2009 UTC (10 years, 10 months ago) by sgodin
File MIME type: text/plain
File size: 2213 byte(s)
-added lifetime to channel bindings
-added ability for client API's to automatically handle channel binding refreshes
 Note:  This is done at an interval that will be frequent enough to also refresh permissions
-added checks to channel data messages over UDP to ensure packet size is large enough to hold indicated data size
-fixed bug in server logic that caused it always send DataInd instead of Channel data messages
-reTurn is now turn-12 compliant
1 #include "RemotePeer.hxx"
2
3 using namespace std;
4
5 namespace reTurn {
6
7 RemotePeer::RemotePeer(const StunTuple& peerTuple, unsigned short channel, unsigned int timeoutSeconds) :
8 mPeerTuple(peerTuple),
9 mChannel(channel),
10 mChannelConfirmed(false),
11 mExpires(time(0)+timeoutSeconds),
12 mTimeoutSeconds(timeoutSeconds)
13 {
14 }
15
16 void
17 RemotePeer::refresh()
18 {
19 mExpires = time(0)+mTimeoutSeconds;
20 }
21
22 bool
23 RemotePeer::isExpired()
24 {
25 if(time(0) > mExpires)
26 {
27 return true;
28 }
29 return false;
30 }
31
32 } // namespace
33
34
35 /* ====================================================================
36
37 Copyright (c) 2007-2008, Plantronics, Inc.
38 All rights reserved.
39
40 Redistribution and use in source and binary forms, with or without
41 modification, are permitted provided that the following conditions are
42 met:
43
44 1. Redistributions of source code must retain the above copyright
45 notice, this list of conditions and the following disclaimer.
46
47 2. Redistributions in binary form must reproduce the above copyright
48 notice, this list of conditions and the following disclaimer in the
49 documentation and/or other materials provided with the distribution.
50
51 3. Neither the name of Plantronics nor the names of its contributors
52 may be used to endorse or promote products derived from this
53 software without specific prior written permission.
54
55 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
56 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
57 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
58 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
59 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
60 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
61 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
62 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
63 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
64 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
65 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
66
67 ==================================================================== */

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