~ubuntu-branches/ubuntu/lucid/anytun/lucid

« back to all changes in this revision

Viewing changes to src/anyrtpproxy/rtpSession.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Prokop
  • Date: 2009-12-14 02:08:25 UTC
  • Revision ID: james.westby@ubuntu.com-20091214020825-ntyi58y4wvsaglhi
Tags: upstream-0.3.2
ImportĀ upstreamĀ versionĀ 0.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  anytun
 
3
 *
 
4
 *  The secure anycast tunneling protocol (satp) defines a protocol used
 
5
 *  for communication between any combination of unicast and anycast
 
6
 *  tunnel endpoints.  It has less protocol overhead than IPSec in Tunnel
 
7
 *  mode and allows tunneling of every ETHER TYPE protocol (e.g.
 
8
 *  ethernet, ip, arp ...). satp directly includes cryptography and
 
9
 *  message authentication based on the methodes used by SRTP.  It is
 
10
 *  intended to deliver a generic, scaleable and secure solution for
 
11
 *  tunneling and relaying of packets of any protocol.
 
12
 *
 
13
 *
 
14
 *  Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, 
 
15
 *                          Christian Pointner <satp@wirdorange.org>
 
16
 *
 
17
 *  This file is part of Anytun.
 
18
 *
 
19
 *  Anytun is free software: you can redistribute it and/or modify
 
20
 *  it under the terms of the GNU General Public License as published by
 
21
 *  the Free Software Foundation, either version 3 of the License, or
 
22
 *  any later version.
 
23
 *
 
24
 *  Anytun is distributed in the hope that it will be useful,
 
25
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
26
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
27
 *  GNU General Public License for more details.
 
28
 *
 
29
 *  You should have received a copy of the GNU General Public License
 
30
 *  along with anytun.  If not, see <http://www.gnu.org/licenses/>.
 
31
 */
 
32
 
 
33
#include "rtpSession.h"
 
34
 
 
35
#include "callIdQueue.h"
 
36
 
 
37
RtpSession::RtpSession(const std::string& call_id) : in_sync_(false), call_id_(call_id) , dead_(false), complete_(false), 
 
38
                                                     seen1_(false), seen2_(false)
 
39
{  
 
40
}
 
41
 
 
42
void RtpSession::reinit()
 
43
{
 
44
  gCallIdQueue.push(call_id_);
 
45
}
 
46
 
 
47
bool RtpSession::isDead()
 
48
{
 
49
  Lock lock(mutex_);
 
50
  return (dead_ && in_sync_);
 
51
}
 
52
 
 
53
bool RtpSession::isDead(bool d)
 
54
{
 
55
  Lock Lock(mutex_);
 
56
  return dead_ = d;
 
57
}
 
58
 
 
59
bool RtpSession::isComplete()
 
60
{
 
61
  Lock lock(mutex_);
 
62
  return complete_;
 
63
}
 
64
 
 
65
bool RtpSession::isComplete(bool c)
 
66
{
 
67
  Lock lock(mutex_);
 
68
  return complete_ = c;
 
69
}
 
70
 
 
71
bool RtpSession::getSeen1()
 
72
{
 
73
  Lock lock(mutex_);
 
74
  return seen1_;
 
75
}
 
76
 
 
77
RtpSession& RtpSession::setSeen1()
 
78
{
 
79
  Lock lock(mutex_);
 
80
  //in_sync_ = false;
 
81
  seen1_ = true;
 
82
  return *this;
 
83
}
 
84
 
 
85
bool RtpSession::getSeen2()
 
86
{
 
87
  Lock lock(mutex_);
 
88
  return seen2_;
 
89
}
 
90
 
 
91
RtpSession& RtpSession::setSeen2()
 
92
{
 
93
  Lock lock(mutex_);
 
94
  //in_sync_ = false;
 
95
  seen2_ = true;
 
96
  return *this;
 
97
}
 
98
 
 
99
RtpSession::proto::endpoint RtpSession::getLocalEnd1()
 
100
{
 
101
  Lock lock(mutex_);
 
102
  return local_end1_;
 
103
}
 
104
 
 
105
RtpSession& RtpSession::setLocalEnd1(RtpSession::proto::endpoint e)
 
106
{
 
107
  Lock lock(mutex_);
 
108
  in_sync_ = false;
 
109
  local_end1_ = e;
 
110
  return *this;
 
111
}
 
112
 
 
113
RtpSession::proto::endpoint RtpSession::getLocalEnd2()
 
114
{
 
115
  Lock lock(mutex_);
 
116
  return local_end2_;
 
117
}
 
118
 
 
119
RtpSession& RtpSession::setLocalEnd2(RtpSession::proto::endpoint e)
 
120
{
 
121
  Lock lock(mutex_);
 
122
  in_sync_ = false;
 
123
  local_end2_ = e;
 
124
  return *this;
 
125
}
 
126
 
 
127
RtpSession::proto::endpoint RtpSession::getRemoteEnd1()
 
128
{
 
129
  Lock lock(mutex_);
 
130
  return remote_end1_;
 
131
}
 
132
 
 
133
RtpSession& RtpSession::setRemoteEnd1(RtpSession::proto::endpoint e)
 
134
{
 
135
  Lock lock(mutex_);
 
136
  in_sync_ = false;
 
137
  remote_end1_ = e;
 
138
  return *this;
 
139
}
 
140
 
 
141
RtpSession::proto::endpoint RtpSession::getRemoteEnd2()
 
142
{
 
143
  Lock lock(mutex_);
 
144
  return remote_end2_;
 
145
}
 
146
 
 
147
RtpSession& RtpSession::setRemoteEnd2(RtpSession::proto::endpoint e)
 
148
{
 
149
  Lock lock(mutex_);
 
150
  in_sync_ = false;
 
151
  remote_end2_ = e;
 
152
  return *this;
 
153
}
 
154
 
 
155