diff options
author | Yang Tse <yangsita@gmail.com> | 2009-12-31 02:29:55 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2009-12-31 02:29:55 +0000 |
commit | eb0479575abceb38850f34a64e6601c9140ae4d0 (patch) | |
tree | a69313076aa4f8ffb4d10ece0cdbf99d9f63058b | |
parent | 97141d08f71c82062fb619e5272090b08841c92a (diff) |
Subs for refactoring purposes
-rw-r--r-- | tests/serverhelp.pm | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/tests/serverhelp.pm b/tests/serverhelp.pm index 54cc42ee3..424697e5e 100644 --- a/tests/serverhelp.pm +++ b/tests/serverhelp.pm @@ -50,6 +50,15 @@ use vars qw( servername_id servername_str servername_canon + server_pidfilename + server_logfilename + server_cmdfilename + server_inputfilename + server_outputfilename + mainsockf_pidfilename + mainsockf_logfilename + datasockf_pidfilename + datasockf_logfilename ); @@ -98,6 +107,104 @@ sub servername_canon { #*************************************************************************** +# Return file name for server pid file. +# +sub server_pidfilename { + my ($proto, $ipver, $idnum) = @_; + my $trailer = '_server.pid'; + return '.'. servername_canon($proto, $ipver, $idnum) ."$trailer"; +} + + +#*************************************************************************** +# Return file name for server log file. +# +sub server_logfilename { + my ($logdir, $proto, $ipver, $idnum) = @_; + my $trailer = '_server.log'; + return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer"; +} + + +#*************************************************************************** +# Return file name for server commands file. +# +sub server_cmdfilename { + my ($logdir, $proto, $ipver, $idnum) = @_; + my $trailer = '_server.cmd'; + return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer"; +} + + +#*************************************************************************** +# Return file name for server input file. +# +sub server_inputfilename { + my ($logdir, $proto, $ipver, $idnum) = @_; + my $trailer = '_server.input'; + return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer"; +} + + +#*************************************************************************** +# Return file name for server output file. +# +sub server_outputfilename { + my ($logdir, $proto, $ipver, $idnum) = @_; + my $trailer = '_server.output'; + return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer"; +} + + +#*************************************************************************** +# Return file name for main or primary sockfilter pid file. +# +sub mainsockf_pidfilename { + my ($proto, $ipver, $idnum) = @_; + die "unsupported protocol: $proto" unless($proto && + (lc($proto) =~ /^(ftp|imap|pop3|smtp)s?$/)); + my $trailer = (lc($proto) =~ /^ftps?$/) ? '_sockctrl.pid':'_sockfilt.pid'; + return '.'. servername_canon($proto, $ipver, $idnum) ."$trailer"; +} + + +#*************************************************************************** +# Return file name for main or primary sockfilter log file. +# +sub mainsockf_logfilename { + my ($logdir, $proto, $ipver, $idnum) = @_; + die "unsupported protocol: $proto" unless($proto && + (lc($proto) =~ /^(ftp|imap|pop3|smtp)s?$/)); + my $trailer = (lc($proto) =~ /^ftps?$/) ? '_sockctrl.log':'_sockfilt.log'; + return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer"; +} + + +#*************************************************************************** +# Return file name for data or secondary sockfilter pid file. +# +sub datasockf_pidfilename { + my ($proto, $ipver, $idnum) = @_; + die "unsupported protocol: $proto" unless($proto && + (lc($proto) =~ /^ftps?$/)); + my $trailer = '_sockdata.pid'; + return '.'. servername_canon($proto, $ipver, $idnum) ."$trailer"; +} + + +#*************************************************************************** +# Return file name for data or secondary sockfilter log file. +# +sub datasockf_logfilename { + my ($logdir, $proto, $ipver, $idnum) = @_; + die "unsupported protocol: $proto" unless($proto && + (lc($proto) =~ /^ftps?$/)); + my $trailer = '_sockdata.log'; + return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer"; +} + + +#*************************************************************************** # End of library 1; |