1 # al-service-aries.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/applications/aries/al-service-aries.tcl,v 1.5 2002/02/03 04:21:08 lim Exp $
32
33
34 import AnnounceListenManager/AS/Service AriesAgent
35
36 # AnnounceListenManager for the Aries AS1 recording service.
37 # <p> Status: pre-alpha <p> Author: Angela Schuett
38
39 Class AnnounceListenManager/AS/Service/Aries -superclass AnnounceListenManager/AS/Service
40
41
42 # On receipt of the first announcement, create an AriesAgent object, pass
43 # it the sdp message, which contains all the info necessary to start recording.
44 AnnounceListenManager/AS/Service/Aries public init {argv} {
45
46 $self instvar serv_inst_ agent_
47
48 #puts "***********************"
49 #puts "$argv"
50 #puts "***********************"
51
52 set ssd [lindex $argv 0]
53 set serv_inst_ [lindex $argv 1]
54 set megactrl [lindex $argv 3]
55
56 $self next $self $megactrl 20000 $serv_inst_
57
58
59 set agent_ [new AriesAgent $self $ssd]
60
61 }
62
63 #
64 AnnounceListenManager/AS/Service/Aries public service_name {} {
65 return Aries
66 }
67
68 # Return a list of ssrc's and error rates as our SSD
69 AnnounceListenManager/AS/Service/Aries public agent_data {} {
70 $self instvar agent_
71 #puts "aries agent_data"
72 return [$agent_ get_ssd]
73
74
75 }
76
77
78
79 # Recv a message, check if it's for us, and check if anything in the
80 # message has changed. If not, then it's a keep alive message, and we
81 # can ignore it. If so, then pass the message in to the aries agent
82 AnnounceListenManager/AS/Service/Aries public recv_msg {atype aspec addr srv_name srv_loc srv_inst ssg_port ssd} {
83
84 $self instvar serv_inst_
85
86 if { $srv_name == "DEATH" } {
87 puts stderr "Received death packet from $aspec at $addr - exiting."
88 $self announce_death
89 exit 0
90 }
91 $self next $atype $aspec $addr $srv_name $srv_loc $srv_inst $ssg_port $ssd
92
93 if {$serv_inst_ != $srv_inst} {
94 return
95 }
96
97 # check if the sdp message has changed
98
99 # ??
100
101 }
102
103
104
105
106
107 AnnounceListenManager/AS/Service/Aries instproc unregister { atype aspec addr \
108 srv_name srv_inst msg } {
109
110 $self instvar agentbytype_ srv_inst_ agenttab_ agent_
111 if { $atype != "client" || $srv_inst != $srv_inst_ } {
112 return
113 }
114 foreach aspec $agentbytype_(client) {
115 set sid [lindex $agenttab_($aspec) 4]
116 if { $sid == $srv_inst_ } {
117 return
118 }
119 }
120
121 $agent_ close
122 puts stderr "Aries- no more clients -- exiting"
123 exit 0
124
125 }
126
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.