Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 May 1995 15:58:58 PDT
From:      Bill Fenner <fenner@parc.xerox.com>
To:        Charles Henrich <henrich@crh.cl.msu.edu>
Cc:        freebsd-hackers@FreeBSD.org
Subject:   Re: passing parameters to vat from sd ? 
Message-ID:  <95May10.155900pdt.49859@crevenia.parc.xerox.com>
In-Reply-To: Your message of "Tue, 09 May 95 17:04:29 PDT." <199505100004.RAA00563@freefall.cdrom.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multipart MIME message.

--===_0_Wed_May_10_15:57:17_PDT_1995
Content-Type: text/plain; charset=us-ascii

In message <199505100004.RAA00563@freefall.cdrom.com> you write:
>Has anyone out there figured out how to make SD spawn VAT with th -U
>/tmp/vatsock so we can use this thing?

I don't use vat under FreeBSD yet, but here is my .sd.tcl for example purposes 
(it has some useful features, if you can figure them out =)

  Bill



--===_0_Wed_May_10_15:57:17_PDT_1995
Content-Type: application/x-tcl
Content-Description: .sd.tcl

# $Header: sd_start.tcl,v 1.2 93/02/28 23:02:25 van Locked $ (LBL)
#
# tcl 'hooks' invoked when sd takes some action on a session.
#
# sd will invoke:
#     start_session   when the user asks to 'open' (start) a session
#     create_session  just after the user creates a new session
#     heard_session   when announcement for a session is first heard
#     delete_session  when the user or a timeout deletes a session
#
# When any of the above are invoked, the global array sd_sess
# contains all the information about the session to be started:
#   sd_sess(name)
#   sd_sess(description)
#   sd_sess(address)
#   sd_sess(ttl)
#   sd_sess(creator)
#   sd_sess(creator_id)
#   sd_sess(source_id)
#   sd_sess(arrival_time)
#   sd_sess(start_time)
#   sd_sess(end_time)
#   sd_sess(attributes)               (list of session attributes)
#   sd_sess(media)            (list of media names)
#
# For each media name there is an array containing the information
# about that media:
#   sd_$media(port)
#   sd_$media(conf_id)
#   sd_$media(attributes)     (list of media attributes)
#
# Media and session attributes are strings of the form "name" or
# "name:value".
#
# Some global state information is available in array sd_priv:
#   sd_priv(audio)            (= 0 if audio disabled with -a)
#   sd_priv(video)            (= 0 if video disabled with -v)
#   sd_priv(whiteboard)               (= 0 if wb disabled with -w)

set sd_priv(mcm) 1
set sd_priv(mumble) 1

# Point keyfile to a file mapping session names to encryption keys
# keyfile should look like this:
#
# set {key(session name)} {session key}
#
set keyfile ~/private/keys.tcl

if {[file exists $keyfile]} {
	source $keyfile
}

set ipc_chan 0
proc get_channel { confid } {
        global ipc_tab ipc_chan
        if { [info exists ipc_tab($confid)] } {
                return $ipc_tab($confid)
        }
        incr ipc_chan
        if { $ipc_chan > 300 } {
                set ipc_chan 1
        }
        set ipc_tab($confid) $ipc_chan
        return $ipc_chan
}
 
proc start_video {} {
	global sd_sess sd_video key

	set videofmt "nv"
	foreach a $sd_video(attributes) {
		case $a {
			fmt:* { set videofmt [string range $a 4 end] }
		}
	}
	case $videofmt {
		jpg {
			global imm
			exec $imm -p $sd_video(port) -I $sd_sess(address) \
				-ttl $sd_sess(ttl) -n $sd_sess(name) &
			return
		}
		mnm {
			global mnm
			exec $mnm -p $sd_video(port) -I $sd_sess(address) \
				-ttl $sd_sess(ttl) -n $sd_sess(name) &
			return
		}
		vic { }
		telesia { set videofmt ivs }
		nv {
			global nv
			if {[info exists nv]} {
				exec $nv -title "nv:$sd_sess(name)" \
					-ttl $sd_sess(ttl) \
					$sd_sess(address) \
					$sd_video(port) &
				return
			}
		}
		ivs {
			global ivs
			if {[info exists ivs]} {
				exec $ivs -a -r -T $sd_sess(ttl) \
					$sd_sess(address)/$sd_video(port) &
				return
			}
		}
		default {
			puts "sd: unknown video format: $videofmt"
			return
		}
	}
        global vic
	set cmd {exec nice $vic -A $videofmt -t $sd_sess(ttl) -C $sd_sess(name)}
        if {[lsearch $sd_sess(media) audio] >= 0} {
                set chan [get_channel $sd_sess(address)/$sd_video(port)]
		append cmd { -I $chan}
	}
# vic doesn't encrypt yet.  Adding the -K option on the command line
# causes some somewhat amusing behavior on the part of the widgets.
#	if {[info exists key($sd_sess(name))]} {
#		append cmd { -K $key($sd_sess(name))}
#	}
	append cmd { $sd_sess(address)/$sd_video(port) &}

#	puts "vic command is: $cmd"
	eval $cmd
}
 
# set up media option menus for new session window.
set sd_menu(video) "fmt: nv vic ivs jpg mnm"
 
# set up the command names
set imm imm
set mnm imm
set vic vic
#
# If you don't set nv or ivs, vic will be run in that-compatibility mode.
set nv nv
#set ivs ivs

proc start_whiteboard {} {
	global sd_sess sd_whiteboard wb key
	set orient -l
	set recvonly +r
	foreach a $sd_whiteboard(attributes) {
		case $a {
			orient:portrait { set orient -p }
			orient:landscape { set orient -l }
			orient:seascape { set orient +l }
			recvonly { set recvonly -r }
			sendrecv { set recvonly +r }
		}
	}

	set cmd {exec $wb -t $sd_sess(ttl) -C "wb:$sd_sess(name)" $orient \
			$recvonly}
	if {[info exists key($sd_sess(name))]} {
		append cmd { -K $key($sd_sess(name))}
	}
	append cmd { $sd_sess(address)/$sd_whiteboard(port) &}

#	puts "wb command is: $cmd"
	eval $cmd
}

set sd_menu(whiteboard) "orient: portrait landscape seascape\nrecvonly"

proc start_audio {} {
	global sd_sess sd_audio sd_video key
	set audiofmt ""
	set packetfmt "-n"
	set priority "-P 100"
	set mode "-c"
	set chan 0
	if {[info exists sd_sess(video)]} {
		global sd_video
		set chan [get_channel $sd_sess(address)/$sd_video(port)]
	}
	foreach a $sd_audio(attributes) {
		case $a {
			fmt:* { set audiofmt [string range $a 4 end] }
			vt  { set packetfmt "-v" }
			lecture  { set mode "-l" }
		}
	}
	set confaddr [format "%s/%s/%s/%s/%s" $sd_sess(address) \
		$sd_audio(port) $sd_audio(conf_id) $audiofmt $sd_sess(ttl)]

	case $sd_sess(name) {
		DARTnet*Audio { set priority "-P 125" }
		MBONE*Robot { set priority "-P 25" }
		Radio*Free*Vat { set priority "-P 10"; set mode -l }
		NASA*Shuttle* { set mode -l }
		*isco*eta* { set priority {-NBill Fenner - 10.X} }
	}

	global vat

	set cmd {exec $vat -C "vat:$sd_sess(name)" $packetfmt $priority $mode}
	if {[info exists key($sd_sess(name))]} {
		append cmd { -K "$key($sd_sess(name))"}
	}
	if {[lsearch $sd_sess(media) video] >= 0} {
		set chan [get_channel $sd_sess(address)/$sd_video(port)]
		append cmd { -I $chan}
	}
	append cmd { $confaddr &}

#	puts "vat command is: $cmd"
	eval $cmd
}

proc start_mcm {} {
	global sd_sess sd_mcm
	exec xterm -T "mcm:$sd_sess(name)" -e mcm-start -sd \
		$sd_sess(name) $sd_sess(description) \
		$sd_sess(address) $sd_mcm(port) $sd_sess(ttl) &
}

proc start_mumble {} {
	global sd_sess sd_mumble
	exec xterm -T "mumble:$sd_sess(name)" -e mumble \
		sd-session:$sd_sess(address):$sd_mumble(port):$sd_sess(ttl) &
}

#set mosaic Mosaic

set mosaicpid 0

proc start_session {} {
        global sd_sess sd_priv mosaic mosaicpid

	# start up Mosaic if there is a URL in the description.
	if {[info exists mosaic] && \
		    [regexp {[a-zA-Z]+://[^ ]+} $sd_sess(description) url]} {
		set url [string trim $url <>.]
		puts "Found a URL: $url, trying to find a running Mosaic"
		if {$mosaicpid == 0} {
			foreach process [split [exec ps -g] "\n" ] {
#				puts "ps output: $process"
				if {[regexp "(\[0-9]+).*$mosaic" $process \
					    junk mosaicpid]} {
#					puts "found a Mosaic: $mosaicpid"
					break
				}
			}
		}
		if {$mosaicpid != 0} {
			puts "Yes, Mosaic is running, pid $mosaicpid"
			set mctrl [open "/tmp/Mosaic.$mosaicpid" w]
			puts $mctrl goto
			puts $mctrl $url
			close $mctrl
			set killresult catch {exec kill -30 $mosaicpid}
			exec rm /tmp/Mosaic.$mosaicpid
			if {$killresult} {
				set mosaicpid 0
			}
		}
		if {$mosaicpid == 0} {
			puts "Starting a new Mosaic."
#			set mosaicpid [exec $mosaic $url &]
			exec $mosaic $url &
#			puts "New mosaic PID is $mosaicpid"
		}
	}

        # invoke the appropriate start proc for each of the media
        # if such a proc exists and that media is enabled.
        foreach m $sd_sess(media) {
                if { [llength [info proc start_$m]] && $sd_priv($m) } {
                        start_$m
                }
        }
}

--===_0_Wed_May_10_15:57:17_PDT_1995--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?95May10.155900pdt.49859>