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

Open Mash Cross Reference
mash/tcl/indiva/imgr/imgr-flow.tcl

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

  1 # imgr-flow.tcl --
  2 #
  3 #   This file implements the flow abstraction in an Indiva manager.
  4 #   A Flow is an abstraction that represents the sequence of cables 
  5 #   and network path a media stream/signal pass through.
  6 #
  7 # Copyright (c) 1996-2002 The Regents of the University of California.
  8 # All rights reserved.
  9 #
 10 # Redistribution and use in source and binary forms, with or without
 11 # modification, are permitted provided that the following conditions are met:
 12 #
 13 # A. Redistributions of source code must retain the above copyright notice,
 14 #    this list of conditions and the following disclaimer.
 15 # B. Redistributions in binary form must reproduce the above copyright notice,
 16 #    this list of conditions and the following disclaimer in the documentation
 17 #    and/or other materials provided with the distribution.
 18 # C. Neither the names of the copyright holders nor the names of its
 19 #    contributors may be used to endorse or promote products derived from this
 20 #    software without specific prior written permission.
 21 #
 22 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
 23 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 24 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 25 # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
 26 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 27 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 28 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 29 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 30 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 31 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 32 #
 33 # @(#) $Header: /usr/mash/src/repository/mash/mash-1/tcl/indiva/imgr/imgr-flow.tcl,v 1.5 2002/07/18 22:49:32 weitsang Exp $
 34 
 35 #------------------------------------------------------------------------
 36 # Class:
 37 #   ImgrFlow
 38 # Description:
 39 #   A signal/stream flow in a audio/video environment.  An object is 
 40 #   created by Indiva Manager whenever a request is received.
 41 # Members:
 42 #   src_, dest_ -- the origin and final destination of the flow.
 43 #   csock_ -- socket to the client.
 44 #   path_ -- a sequence of names of mob that the flows flow through.
 45 #   service_instance_ -- a tables of ASCP objects, indexed by two mobs.
 46 #     the ASCP object for a service that goes from $mob1 to $mob2 are
 47 #     stored as $service_instance_($mob1,$mob2)
 48 #   why_abort_ -- if defined, indicates that this flow has been aborted.
 49 #-----------------------------------------------------------------------
 50 Class IMgrFlow 
 51 
 52 IMgrFlow instproc init {src dest client} {
 53     $self instvar src_ dest_ csock_ path_ chost_ commit_ creation_time_
 54     set commit_ 0
 55     set src_ $src
 56     set dest_ $dest
 57     set csock_ $client
 58     if [catch {fconfigure $client -peername} chost_] {
 59         set chost_ ""
 60     }
 61     set creation_time_ ""
 62     set path_ ""
 63 }
 64 
 65 IMgrFlow instproc client {args} {
 66     $self instvar csock_
 67     if {$args == ""} {
 68         return $csock_
 69     } else {
 70         set csock_ $args
 71     }
 72 }
 73 
 74 IMgrFlow instproc host {} {
 75     $self instvar chost_
 76     return $chost_
 77 }
 78 
 79 IMgrFlow instproc src {args} {
 80     $self instvar src_
 81     if {$args == ""} {
 82         return $src_
 83     } else {
 84         set src_ $args
 85     }
 86 }
 87 
 88 IMgrFlow instproc dest {args} {
 89     $self instvar dest_
 90     if {$args == ""} {
 91         return $dest_
 92     } else {
 93         set dest_ $args
 94     }
 95 }
 96 
 97 IMgrFlow instproc service_instance {from to args} {
 98     $self instvar service_instance_
 99     if {$args == ""} {
100         if [info exists service_instance_($from,$to)] {
101             return $service_instance_($from,$to)
102         } else {
103             return ""
104         }
105     } else {
106         set service_instance_($from,$to) $args
107     }
108 }
109 
110 
111 IMgrFlow instproc service {from to args} {
112     $self instvar service_
113     if {$args == ""} {
114         if [info exists service_($from,$to)] {
115             return $service_($from,$to)
116         } else {
117             return ""
118         }
119     } else {
120         set service_($from,$to) [join $args]
121     }
122 }
123 
124 
125 IMgrFlow instproc path {args} {
126     $self instvar path_
127     if {$args == ""} {
128         return $path_
129     } else {
130         eval set path_ $args
131     }
132 }
133 
134 
135 IMgrFlow instproc abort {why} {
136     $self instvar why_abort_
137     set why_abort_ $why
138 }
139 
140 
141 IMgrFlow instproc why_abort? {} {
142     $self set why_abort_
143 }
144 
145 
146 IMgrFlow instproc is_aborted {} {
147     $self instvar why_abort_
148     return [expr {[info exists why_abort_]} ? 1 : 0]
149 }
150 
151 
152 IMgrFlow instproc commit {} {
153     $self set commit_ 1
154     $self set creation_time_  [clock format [clock seconds] -format {%a, %d %b %Y %T %Z}]
155 }
156 
157 IMgrFlow instproc is_committed {} {
158     return [$self set commit_]
159 }
160 
161 IMgrFlow instproc time {} {
162     return [$self set creation_time_]
163 }
164 

~ [ 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.