reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
RemotePeer.cxx
Go to the documentation of this file.
1#include "RemotePeer.hxx"
2#include <time.h>
3
4using namespace std;
5
6namespace reTurn {
7
8RemotePeer::RemotePeer(const StunTuple& peerTuple, unsigned short channel, unsigned int timeoutSeconds) :
9 mPeerTuple(peerTuple),
10 mChannel(channel),
11 mChannelConfirmed(false),
12 mExpires(time(0)+timeoutSeconds),
13 mTimeoutSeconds(timeoutSeconds)
14{
15}
16
17void
19{
20 mExpires = time(0)+mTimeoutSeconds;
21}
22
23bool
25{
26 if(time(0) > mExpires)
27 {
28 return true;
29 }
30 return false;
31}
32
33} // namespace
34
35
36/* ====================================================================
37
38 Copyright (c) 2007-2008, Plantronics, Inc.
39 All rights reserved.
40
41 Redistribution and use in source and binary forms, with or without
42 modification, are permitted provided that the following conditions are
43 met:
44
45 1. Redistributions of source code must retain the above copyright
46 notice, this list of conditions and the following disclaimer.
47
48 2. Redistributions in binary form must reproduce the above copyright
49 notice, this list of conditions and the following disclaimer in the
50 documentation and/or other materials provided with the distribution.
51
52 3. Neither the name of Plantronics nor the names of its contributors
53 may be used to endorse or promote products derived from this
54 software without specific prior written permission.
55
56 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
57 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
58 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
59 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
60 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
61 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
62 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
63 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
64 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
65 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
66 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
67
68 ==================================================================== */
RemotePeer(const StunTuple &peerTuple, unsigned short channel, unsigned int timeoutSeconds)
Definition RemotePeer.cxx:8