1 # al-megagw.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 # @(#) $Header: /usr/mash/src/repository/mash/mash-1/tcl/mega/al-megagw.tcl,v 1.7 2002/02/03 04:27:39 lim Exp $
32
33 import AnnounceListenManager/AS/Service RTP/Audio RTP/Video MeGa
34
35 #
36 Class AnnounceListenManager/AS/Service/MeGa -superclass \
37 { AnnounceListenManager/AS/Service MeGa }
38 #
39 Class AnnounceListenManager/AS/Service/MeGa/Audio -superclass \
40 { AnnounceListenManager/AS/Service/MeGa RTP/Audio }
41 #
42 Class AnnounceListenManager/AS/Service/MeGa/Video -superclass \
43 { AnnounceListenManager/AS/Service/MeGa RTP/Video }
44
45 AnnounceListenManager/AS/Service/MeGa instproc init { agent spec bw sspec toolname media } {
46 set spec [MeGa ctrlchan $media $spec]
47 $self next $agent $spec $bw $sspec
48 $self instvar toolname_ media_
49 set toolname_ $toolname
50 set media_ $media
51 }
52
53 AnnounceListenManager/AS/Service/MeGa instproc recv_msg { atype aspec addr srv_name srv_loc srv_inst ssg_port msg } {
54 $self instvar media_
55 # Check for media specific death packet
56 if { $srv_name == "DEATH" && $srv_loc == $media_ } {
57 puts stderr "Received death packet from $aspec at $addr - exiting."
58 $self announce_death
59 exit 0
60 }
61 $self next $atype $aspec $addr $srv_name $srv_loc $srv_inst $ssg_port \
62 "$msg"
63 }
64
65
66 AnnounceListenManager/AS/Service/MeGa private format_num { fmt } {
67 return -1
68 }
69
70 AnnounceListenManager/AS/Service/MeGa/Video private format_num { fmt } {
71 return [$self rtp_fmt_number $fmt]
72 }
73
74 AnnounceListenManager/AS/Service/MeGa/Audio private format_num { fmt } {
75 return [$self rtp_fmt_number $fmt]
76 }
77
78 AnnounceListenManager/AS/Service/MeGa instproc agent_data {} {
79 $self instvar id1_ id2_ agent_ toolname_ media_ srv_inst_
80
81 set o "v=0"
82 set n "o=gw [pid] 0 IN IP4 [localaddr]"
83 set o $o\n$n
84 set n "s=$srv_inst_"
85 set o $o\n$n
86 set n "t=0 0"
87 set o $o\n$n
88
89 set o $o\n$n
90 set n "a=tool:$toolname_"
91 set o $o\n$n
92 # for now all we do is no share
93 # set n "a=noshare"
94 # set o $o\n$n
95
96 # media record for each output session
97 foreach outs [$agent_ set sessions_] {
98 set nm [$outs set netmgr_]
99 if { $nm == "" } {
100 continue
101 }
102 set net [$nm set net_(0)]
103 set dn [$net data-net]
104 set sport [$dn sport]
105 set rport [$dn rport]
106 set fmt [$self format_num [$outs set ofmt_]]
107 set n "m=$media_ $sport:$rport RTP/AVP $fmt"
108 set o $o\n$n
109
110 set n "c=IN IP4 [$dn addr]/[$dn ttl]"
111 set o $o\n$n
112
113 if { [$outs set sname_] == "global" } {
114 set n "a=global"
115 set o $o\n$n
116 }
117 }
118
119 return $o
120 }
121
122 AnnounceListenManager/AS/Service/MeGa instproc service_name {} {
123 return MeGa
124 }
125
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.