aboutsummaryrefslogtreecommitdiff
path: root/tests/serverhelp.pm
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2009-12-31 02:29:55 +0000
committerYang Tse <yangsita@gmail.com>2009-12-31 02:29:55 +0000
commiteb0479575abceb38850f34a64e6601c9140ae4d0 (patch)
treea69313076aa4f8ffb4d10ece0cdbf99d9f63058b /tests/serverhelp.pm
parent97141d08f71c82062fb619e5272090b08841c92a (diff)
Subs for refactoring purposes
Diffstat (limited to 'tests/serverhelp.pm')
-rw-r--r--tests/serverhelp.pm107
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;