1 # application-asmon.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/mgamon/application-asmon.tcl,v 1.6 2002/02/03 04:27:48 lim Exp $
32
33
34 import Application ASMonitorUI AnnounceListenManager/AS/ASMon MeGa
35
36 Class ASMonApplication -superclass Application
37
38 ASMonApplication instproc init argv {
39 $self next asmon
40
41 $self instvar ui_
42
43 set o [$self options]
44 $self init_args $o
45 $self init_resources $o
46 $o parse_args $argv
47
48 # Source the user's hook file if it exists. The function
49 # user_hook, which may be defined in this file, will be
50 # called at the end of init.
51 if {[$o get_option userhookFile] != ""} {
52 if {[file isfile [$o get_option userhookFile]] && \
53 [file readable [$o get_option userhookFile]]} {
54 source [$o get_option userhookFile]
55 } else {
56 puts stderr "Unable to source \"[$o get_option userhookFile]\". Not a file or not readable."
57 }
58 }
59
60 set ui_ [ASMonitorUI .top]
61 pack .top -fill both -expand 1
62 .top application $self
63
64 $self init_network .top
65
66 $self user_hook
67 }
68
69
70 ASMonApplication instproc init_args o {
71 $o register_option -u userhookFile
72 $o register_option -log doLog
73 $o register_option -megactrl asCtrl
74 }
75
76 ASMonApplication instproc init_resources o {
77 $o add_default defaultTTL 1
78 $o add_default asCtrl 224.4.5.24/50000/31
79 $o add_default asCtrlBW 20000
80 }
81
82
83 ASMonApplication instproc init_network { ui } {
84 set megaspec [$self get_option asCtrl]
85 set bw [$self get_option asCtrlBW]
86 $self instvar al_
87 foreach m { audio video sdp mb hm srv } {
88 set spec [MeGa ctrlchan $m $megaspec]
89 set al_($m) [new AnnounceListenManager/AS/ASMon \
90 $ui $spec $bw]
91 }
92 }
93
94 ASMonApplication instproc build_death { atype } {
95 $self instvar al_
96 set al $al_($atype)
97
98 set o "ASCP v[AnnounceListenManager/AS version]"
99 set n mgamon
100 set o $o\n$n
101 set n [$al agent_instance]
102 set o $o\n$n
103 set n "DEATH"
104 set o $o\n$n
105 set n $atype
106 set o $o\n$n
107 set n "-"
108 set o $o\n$n
109 set n "-"
110 set o $o\n$n
111
112 $al announce $o
113 }
114
115
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.