version 1.214, 2004/07/27 11:10:47
|
version 1.215, 2004/07/27 11:21:48
|
Line 1035 sub tie_user_hash {
|
Line 1035 sub tie_user_hash {
|
|
|
#--------------------- Request Handlers -------------------------------------------- |
#--------------------- Request Handlers -------------------------------------------- |
# |
# |
# By convention each request handler registers itself prior to the sub declaration: |
# By convention each request handler registers itself prior to the sub |
|
# declaration: |
# |
# |
|
|
# Handles ping requests. |
# Handles ping requests. |
Line 1062 sub ping_handler {
|
Line 1063 sub ping_handler {
|
} |
} |
®ister_handler("ping", \&ping_handler, 0, 1, 1); # Ping unencoded, client or manager. |
®ister_handler("ping", \&ping_handler, 0, 1, 1); # Ping unencoded, client or manager. |
|
|
|
# |
|
# Handles pong requests. Pong replies with our current host id, and |
|
# the results of a ping sent to us via our lonc. |
|
# |
|
# Parameters: |
|
# $cmd - the actual keyword that invoked us. |
|
# $tail - the tail of the request that invoked us. |
|
# $replyfd- File descriptor connected to the client |
|
# Implicit Inputs: |
|
# $currenthostid - Global variable that carries the name of the host we are |
|
# connected to. |
|
# Returns: |
|
# 1 - Ok to continue processing. |
|
# 0 - Program should exit. |
|
# Side effects: |
|
# Reply information is sent to the client. |
|
|
|
sub pong_handler { |
|
my ($cmd, $tail, $replyfd) = @_; |
|
|
|
my $reply=&reply("ping",$clientname); |
|
&Reply( $replyfd, "$currenthostid:$reply\n", "$cmd:$tail"); |
|
return 1; |
|
} |
|
®ister_handler("pong", \&pong_handler, 0, 1, 1); # Pong unencoded, client or manager |
|
|
|
|
|
|
#--------------------------------------------------------------- |
#--------------------------------------------------------------- |
# |
# |
Line 1174 sub process_request {
|
Line 1202 sub process_request {
|
|
|
} |
} |
|
|
# ------------------------------------------------------------- Normal commands |
#------------------- Commands not yet in spearate handlers. -------------- |
if ($userinput =~ /^pong/) { # client only |
|
if(isClient) { |
|
my $reply=&reply("ping",$clientname); |
|
print $client "$currenthostid:$reply\n"; |
|
} else { |
|
Reply($client, "refused\n", $userinput); |
|
} |
|
# ------------------------------------------------------------------------ ekey |
# ------------------------------------------------------------------------ ekey |
} elsif ($userinput =~ /^ekey/) { # ok for both clients & mgrs |
if ($userinput =~ /^ekey/) { # ok for both clients & mgrs |
my $buildkey=time.$$.int(rand 100000); |
my $buildkey=time.$$.int(rand 100000); |
$buildkey=~tr/1-6/A-F/; |
$buildkey=~tr/1-6/A-F/; |
$buildkey=int(rand 100000).$buildkey.int(rand 100000); |
$buildkey=int(rand 100000).$buildkey.int(rand 100000); |