1 # agent-rtcp.tcl --
2 #
3 # FIXME: This file needs a description here.
4 #
5 # Copyright (c) 1998-2002 The Regents of the University of California.
6 # All rights reserved.
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are met:
10 #
11 # A. Redistributions of source code must retain the above copyright notice,
12 # this list of conditions and the following disclaimer.
13 # B. Redistributions in binary form must reproduce the above copyright notice,
14 # this list of conditions and the following disclaimer in the documentation
15 # and/or other materials provided with the distribution.
16 # C. Neither the names of the copyright holders nor the names of its
17 # contributors may be used to endorse or promote products derived from this
18 # software without specific prior written permission.
19 #
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
21 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
24 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31 import MediaAgent
32
33 Class RTCPAgent -superclass MediaAgent
34
35 RTCPAgent public init ab {
36
37 $self next
38 $self instvar session_;
39
40 set session_ [$self create_session];
41
42 $session_ sm $self;
43
44 if {$ab != ""} {
45 $self reset $ab
46 }
47 }
48
49 RTCPAgent public destroy {} {
50 $self instvar session_ network_;
51
52 delete $session_;
53 delete $network_;
54 $self next;
55 }
56
57 RTCPAgent public reset_spec spec {
58 set ab [new AddressBlock $spec]
59 $self reset $ab
60 delete $ab
61 }
62
63 #
64 # Reset the address specifier of the underlying session in question.
65 # This allows the network objects to be dynamically reconfigured to
66 # facilitate higher-level control protocols that might instruct an
67 # application to switch multicast sessions or speak to a different
68 # unicast destination. FIXME should only reset the piece that matters.
69 #
70 RTCPAgent public reset ab {
71 $self instvar network_ session_ sources_
72
73 if [info exists network_] {
74 delete $network_
75 }
76 set network_ [new NetworkManager $ab $session_ $self]
77
78 #FIXME
79 $self app_loopback 1
80 $self net_loopback [$self get_option loopback]
81
82 set key [$self get_option sessionKey]
83 if { $key != "" } {
84 $network_ install-key $key
85 }
86
87 # FIXME Eventually use 'attach' mechanism.
88 catch {[Application instance] reset $ab}
89 }
90
91 #
92 # Return true iff an underlying network object has been
93 # created and attached to this RTCP agent.
94 #
95 RTCPAgent public have_network {} {
96 $self instvar network_
97 return [info exists network_]
98 }
99
100 #
101 # Return the network object that underlies the RTCP session,
102 # or return "none" if it does not yet exist.
103 #
104 RTCPAgent public network {} {
105 $self instvar network_
106 if ![info exists network_] {
107 return none
108 }
109 return [$network_ data-net 0]
110 }
111
112 #
113 # Return the network address of the underlying
114 # communication session, or the string "none"
115 # if the underlying network object hasn't yet
116 # been created.
117 #
118 RTCPAgent public session-addr {} {
119 $self instvar network_
120 if ![info exists network_] {
121 return none
122 }
123 return [[$self network] addr]
124 }
125
126 #
127 # Return the network port number of the underlying
128 # communication session, or the string "none"
129 # if the underlying network object hasn't yet
130 # been created. FIXME why do we have three port methods?
131 #
132 RTCPAgent public session-port {} {
133 $self instvar network_
134 if ![info exists network_] {
135 return none
136 }
137 return [[$self network] port]
138 }
139
140 #
141 # Return the inbound port number of the underlying
142 # communication session, or the string "none"
143 # if the underlying network object hasn't yet
144 # been created.
145 #
146 RTCPAgent public session-rport {} {
147 $self instvar network_
148 if ![info exists network_] {
149 return none
150 }
151 return [[$self network] rport]
152 }
153
154 #
155 # Return the outbound port number of the underlying
156 # communication session, or the string "none"
157 # if the underlying network object hasn't yet
158 # been created.
159 #
160 RTCPAgent public session-sport {} {
161 $self instvar network_
162 if ![info exists network_] {
163 return none
164 }
165 return [[$self network] sport]
166 }
167
168 #
169 # Return the time-to-live values used by the underlying
170 # communication session, or the string "none"
171 # if the underlying network object hasn't yet
172 # been created. This value is undefined if the
173 # underlying session is not a multicast address.
174 #
175 RTCPAgent public session-ttl {} {
176 $self instvar network_
177 if ![info exists network_] {
178 return none
179 }
180 return [[$self network] ttl]
181 }
182
183 #
184 # Turn off encryption.
185 #
186 RTCPAgent public crypt_clear {} {
187 if [info exists network_] {
188 $network_ crypt_clear
189 }
190 }
191
192 RTCPAgent public create_session {} {
193 return [new Session/RTCP];
194 }
195
196 RTCPAgent public set_maxchannel n {}
197
198 RTCPAgent public net_loopback enable {
199 $self instvar network_
200 $network_ loopback $enable
201 }
202
203 RTCPAgent public app_loopback enable {
204 $self instvar session_
205 $session_ set loopback_ $enable
206 }
207
208
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.