This is hooks.tcl in view mode; [Download] [Up]
#
# TCL script that's usually sourced by the dialing script for a network
# interface. Has default hooks which are invoked by tcldiald
#
# $Id: hooks.tcl,v 4.6 1992/09/05 02:00:07 louie Rel $
#
set mtu [duioctl SIOCGIFMTU]
set atimeo [duioctl SIOCGATIMEO]
set wtimeo [duioctl SIOCGWTIMEO]
set ipkts [duioctl SIOCGIPKTS]
set opkts [duioctl SIOCGOPKTS]
log "mtu $mtu atimeo $atimeo wtimeo $wtimeo ipkts $ipkts opkts $opkts"
# Define some TCL hooks that will be invoked from time to time. You are free
# to do other stuff here, including nothing if you don't want the log messages.
#
proc event_linkdown {} {
global interface site
log "Link DOWN event for $interface for $site"
return "0"
}
proc event_linkup {why} {
global interface site
log "Link UP event ($why) for $interface for $site"
}
# note here how we only print a message at most every 20 minutes, no matter
# how often we are invoked
proc event_uptime {uptime} {
global interface
if {[expr "$uptime % 20 == 0"]} {
log "SLIP interface $interface up $uptime minutes."
}
}
proc phex {val} {
return [format "0x%x" $val]
}
proc event_ifflags {oldflags newflags} {
global interface site
log "$interface/$site IF flags changed from [phex $oldflags] => [phex $newflags]"
}
proc event_softflags {oldflags newflags} {
global interface site
log "$interface/$site SOFT flags changed from [phex $oldflags] => [phex $newflags]"
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.