#
# Contributed by Bastiaan Bakker for SOCKETMAP
# $Id: socketmapServer.pl,v 1.1 2003-05-21 15:36:33 ca Exp $
use strict;
my $connection = shift @ARGV;
my $sock;
LocalAddr => $1,
LocalPort => $2,
Proto => 'tcp',
Listen => 32,
ReuseAddr => 1
);
} elsif ($connection =~ /((unix)|(local)):(.+)/) {
unlink($4);
Type => SOCK_STREAM,
Local => $4,
Listen => 32
);
} else {
die "unrecognized connection specification $connection";
}
my $childpid = fork();
if ($childpid) {
$client->close();
} else {
die "can't fork $!" unless defined($childpid);
$sock->close();
$client->close();
exit;
}
}
$sock->close();
sub handleConnection {
my $client = shift;
while(!eof($client)) {
eval {
};
if ($@) {
print STDERR "$@\n";
last;
}
}
}
sub mapLookup {
'wolter.eldering@example.com' => 'wolter@other.example.com');
my $mapName = shift;
my $key = shift;
return $value;
}
sub netstringWrite {
my $sock = shift;
my $data = shift;
}
sub netstringRead {
my $sock = shift;
my $saveSeparator = $/;
$/ = ':';
my $dataLength = <$sock>;
die "cannot read netstring length" unless defined($dataLength);
chomp $dataLength;
my $data;
} else {
}
$/ = $saveSeparator;
return $data;
}