~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Open Mash Cross Reference
mash/tcl/tgmb/agent-rmx.tcl

Component: ~ [ mash ] ~ [ apps ] ~ [ gsm ] ~ [ lib ] ~ [ otcl ] ~ [ srm ] ~ [ tcl8.3 ] ~ [ tclcl ] ~ [ tk8.3 ] ~ [ tutorials ] ~

  1 # agent-rmx.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/tgmb/agent-rmx.tcl,v 1.4 2002/02/03 04:30:13 lim Exp $
 32 
 33 
 34 import ALM/RMX TCP TGMB_Manager SRMAgent
 35 
 36 Class RMXAgent
 37 
 38 
 39 RMXAgent public initialize {servinst megactrl} {
 40         $self instvar sessSpec_ alm_ server_ port_
 41 
 42         # create the AS1 AnnounceListenManager
 43         set alm_ [new ALM/RMX $self $servinst $megactrl]
 44 
 45         set idx [string first : $servinst]
 46         set sessSpec_ [string range $servinst [expr $idx+1] end]
 47         # create the SRM agent
 48         puts "trying to create session for $sessSpec_ ($idx, '$servinst')"
 49         $self create_session $sessSpec_
 50 
 51         # create the TCP server socket
 52         set server_ [new TCP/Server]
 53         $server_ open 0 TCP/MediaPad
 54         set port_ [lindex [fconfigure [$server_ channel] -sockname] 2]
 55         puts stderr "Created RMX servent on port $port_"
 56 }
 57 
 58 
 59 RMXAgent public destroy {} {
 60         $self instvar alm_ server_
 61         delete $alm_
 62         delete $server_
 63         $self next
 64 }
 65 
 66 
 67 RMXAgent public port {} {
 68         return [$self set port_]
 69 }
 70 
 71 
 72 RMXAgent instproc create_session { spec } {
 73         global mb
 74         $self instvar ui_
 75 
 76         $self instvar mgr_ srmagent_ session_ dummy_sender_
 77 
 78         set mgr_ [new TGMB_Manager]
 79         set srmagent_ [new SRMAgent 0xEEEEEE {} \
 80                         "Mediaboard RMX @ [localaddr]"]
 81         #set dummy_sender_ [new MB_Sender]
 82 
 83         set session_ [$srmagent_ create-session $mgr_ $mgr_]
 84         $mgr_ attach_session $session_
 85 
 86         if { $spec != "" } {
 87                 $srmagent_ reset_spec $spec
 88         }
 89 
 90         # make the manager it's own UI
 91         $mgr_ attach_ui $mgr_
 92 }
 93 
 94 
 95 RMXAgent instproc reset { ab } {
 96         $self instvar srmagent_ session_ have_network_
 97         set nm [$srmagent_ set network_]
 98         [$nm data-net] loopback 1
 99         [$nm ctrl-net] loopback 1
100 
101         # do this for the first time only
102         if { ![info exists have_network_] || $have_network_==0 } {
103                 $self instvar mgr_
104                 $session_ start_timers
105                 $mgr_ create_dummy_rcvr
106                 set have_network_ 1
107                 #[$self set dummy_sender_] attach $mgr_
108         }
109 }
110 
111 
112 
113 TCP/MediaPad superclass {TCP SplitObject}
114 
115 TCP/MediaPad public init {} {
116         $self next
117         puts "creating a server side socket"
118 }
119 
120 
121 TCP/MediaPad public open {chan} {
122         $self next $chan
123         $self set_binary 1
124         $self set_socket $chan
125 
126         $self handshake
127 }
128 
129 
130 TCP/MediaPad instproc chunk_error { } {
131         delete $self
132 }
133 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.