1 # al-client-ssac.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/ssac/al-client-ssac.tcl,v 1.15 2002/02/03 04:30:10 lim Exp $
32
33
34 import AnnounceListenManager/AS/Client Application
35
36 # This class is used in implementing the archive client application, rover
37 # <p> Current status: alpha
38 # <p> Author: Angela Schuett
39
40
41 Class AnnounceListenManager/AS/Client/SSAC -superclass \
42 AnnounceListenManager/AS/Client
43
44
45
46 AnnounceListenManager/AS/Client/SSAC instproc init {client megactrl ssg_port \
47 {srv_loc {}} {bw 500} } {
48 $self instvar client_ service_instance_ ssg_port_ ssd_
49 if { $srv_loc == {} } { set srv_loc "static:mars" }
50 $self next $megactrl $bw $srv_loc
51
52 set service_instance_ "[pid]:[localaddr]:mars"
53 set ssg_port_ $ssg_port
54 set client_ $client
55 $self set_seqno 1
56
57 set ssd_(localaddr) [localaddr]
58 }
59
60
61 AnnounceListenManager/AS/Client/SSAC instproc service_name {} {
62 #puts "service_name"
63 return Mars
64 }
65
66 AnnounceListenManager/AS/Client/SSAC instproc service_instance {} {
67 $self instvar service_instance_
68 return $service_instance_
69 }
70
71 AnnounceListenManager/AS/Client/SSAC instproc agent_data {} {
72 #puts "agent_data"
73 $self instvar ssd_ broadcast_
74
75 set msg ""
76 append msg "Seqno $ssd_(seqno)\n"
77 append msg "Filename $ssd_(filename)\n"
78 append msg "Offset $ssd_(offset)\n"
79 append msg "ClientAddr $ssd_(localaddr)\n"
80 append msg "UnicastPort $ssd_(unicast_port)\n"
81
82 # now put in the broadcast
83 foreach {key value} [array get broadcast_] {
84 append msg "inetBroadcastAddr $key:$value\n"
85 }
86
87 # puts "msg = $msg;"
88
89 return $msg
90 }
91
92
93 AnnounceListenManager/AS/Client/SSAC instproc set_filename {filename} {
94 $self instvar ssd_
95 set ssd_(filename) $filename
96 }
97
98 AnnounceListenManager/AS/Client/SSAC instproc data_multicast {flag} {
99 $self instvar ssd_ ssg_port_
100 if { $flag == 0 && $ssg_port_ != "-" } {
101 set ssd_(unicast_port) [expr $ssg_port_ + 2]
102 } else {
103 set ssd_(unicast_port) 0
104 }
105 }
106
107
108 AnnounceListenManager/AS/Client/SSAC instproc set_offset {offset} {
109 $self instvar ssd_
110 set ssd_(offset) $offset
111 }
112
113
114 AnnounceListenManager/AS/Client/SSAC instproc set_seqno {seqno} {
115 $self instvar ssd_
116 set ssd_(seqno) $seqno
117 }
118
119 AnnounceListenManager/AS/Client/SSAC instproc seqno {} {
120 $self instvar ssd_
121 return $ssd_(seqno)
122 }
123
124
125 AnnounceListenManager/AS/Client/SSAC instproc register { atype aspec addr \
126 srv_name srv_inst msg } {
127 }
128
129
130 AnnounceListenManager/AS/Client/SSAC instproc unregister { atype aspec addr \
131 srv_name srv_inst msg } {
132 }
133
134
135 AnnounceListenManager/AS/Client/SSAC instproc recv_msg { atype aspec addr \
136 srv_name srv_loc srv_inst ssg_port msg } {
137 $self instvar client_ service_instance_
138 if {$srv_inst != $service_instance_} {
139 return
140 }
141
142 if {[string length $msg] > 0} {
143 $client_ notify $msg
144 }
145
146 }
147
148 AnnounceListenManager/AS/Client/SSAC instproc ssg_port {} {
149 $self instvar ssg_port_
150 return $ssg_port_
151 }
152
153 AnnounceListenManager/AS/Client/SSAC instproc set_broadcast {lbroadcast} {
154 $self instvar broadcast_
155 array set broadcast_ $lbroadcast
156 }
157
158
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.