1 # agent-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/agent-aries.tcl,v 1.5 2002/02/03 04:21:08 lim Exp $
32
33
34 # Aries is a recording service for AS1.
35 Class AriesAgent
36
37 import ArchiveSystem/Record/Monitored SDPParser Program
38
39 # Start recording
40 AriesAgent public init {agent ssd} {
41 $self instvar sdp_ archive_ archive_sys_
42
43 set sdp_ $ssd
44
45 set o [$self options]
46 $o load_preferences "aries"
47
48 set msg [lindex [ [new SDPParser 0] parse $sdp_] 0]
49 set program [new Program $msg]
50 #puts "Program: $program"
51
52 set archive_ [$self get_option archive_root]
53 append archive_ [$self get_option archive_dir]
54
55 # FIX THIS : need filename to be unique and recreatable, for gather
56 set module [string trim [clock clicks] -]
57
58 set archive_sys_ [new ArchiveSystem/Record/Monitored]
59
60 # Use the ArchiveSystem/Record class for recording and write
61 # the SDP Program information to the catalog file.
62 $archive_sys_ open $archive_ $module
63 $archive_sys_ write_announcement $program
64
65 # Write relevant recording information to the catalog file
66 set current [$self readable_time [clock seconds]]
67 set info "record_start=$current"
68 $archive_sys_ write_info $info
69
70 # Begin recording
71 $archive_sys_ record_program $program $module
72
73
74 }
75
76 # Copied from Rec_Agent. Should be in common?
77 AriesAgent private readable_time { time } {
78 return [clock format $time -format {%a %B %d, %Y at %H:%M}]
79 }
80
81 # Stop recording
82 AriesAgent public close {} {
83 $self instvar archive_sys_
84
85 # Update the catalog file's info block to include the end time.
86 set current [$self readable_time [clock seconds]]
87 set info "record_end=$current"
88 $archive_sys_ write_info $info
89
90 # Close the recording in a clean fashion so that the end
91 # timestamps in the header will be correct
92 $archive_sys_ close
93 delete $archive_sys_
94 }
95
96 # Fetch the list of ssrc's and error rates for the announcement
97 AriesAgent public get_ssd {} {
98 $self instvar archive_sys_
99
100 return [$archive_sys_ get_ssd]
101 }
102
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.