Lines Matching +full:sub +full:- +full:device

1 #!/local/bin/perl --*-perl-*-
8 ;# Rainer Pruy Friedrich-Alexander Universitaet Erlangen-Nuernberg
28 #eval 'sub INADDR_ANY { 0; } sub AF_INET {2;} sub SOCK_DGRAM {2;} 1;' || die "$0: $@";
46 sub usage
48 die("usage: $0 [-p <port>] [-l <logfile>] [host] ...\n");
52 &Getopts if 0; # make -w happy
56 $opt_p = 0 # port to use locally - (0 does mean: will be chosen by kernel)
63 $DEBUGFILE="&STDERR" if $DEBUGFILE eq '-';
69 sub log
75 sub debug
98 sub cleanup
121 sub timeouts # sort timeout id array
150 warn "$0: unknown host \"$_\" - ignored\n";
161 sub hostname
177 grep(&debug(" - ".$_),keys(%Host));
202 &set_timeout("retry-".unpack("H*",$req),time+$BASE_TIMEOUT,
216 $timeout = $TIMEOUTS{$TIMEOUTS[$[]} - time;
223 ;# no work yet - wait for some messages dropping in
256 ;# could check for ntp_port - but who cares
257 &debug("-Packet from ",&hostname($from));
269 &clear_timeout("retry-".unpack("H*",pack("a4SC",$from,$associd,$op))) unless $op == 7;
280 &clear_timeout("retry-".unpack("H*",pack("a4SC",$from,$associd,$op)));
294 sub set_timeout
305 sub clear_timeout
315 sub refresh
324 sub retry
343 sub process_response
350 $msg .= sprintf("%40s trap#%-5d",
376 ($peer) = ($data =~ /peer=([0-9]+)/);
381 if (($device) = ($data =~ /device=\"([^\"]+)\"/))
383 ($cstatus) = ($data =~ /refclockstatus=0?x?([\da-fA-F]+)/);
385 $msg .= sprintf("- %-32s",&ntp'clock_status($Cstatus)); #');
387 $msg .= " \"$device\" \"$timecode\"";
399 $msg .= sprintf("%-18s %40s ", "[$srcadr]",
406 if (($device) = ($data =~ /device=\"([^\"]+)\"/))
408 ;#&debug("----\n$data\n====\n");
409 ($cstatus) = ($data =~ /refclockstatus=0?x?([\da-fA-F]+)/);
411 $msg .= sprintf("- %-32s",&ntp'clock_status($Cstatus)); #');
413 $msg .= " \"$device\" \"$timecode\"";
417 ;# no clockvars included - post a cv request
431 &set_timeout("refresh-".unpack("H*",$from),time+$REFRESH_TIME,
447 $msg .= sprintf("%-32s",&ntp'clock_status($status)); #');
448 ($device) = ($data =~ /device=\"([^\"]+)\"/);
450 $msg .= " \"$device\" \"$timecode\"";
456 &clear_timeout("refresh-".unpack("H*",$from));