1# The client writes 300 messages to Sys::Syslog native method.
2# The syslogd writes it into a file and through a pipe.
3# The syslogd passes it via TLS to the loghost.
4# The server blocks the message on its TLS socket.
5# The server waits until the client has written all messages.
6# The server receives the message on its TLS socket.
7# The client waits until the server as read the first message.
8# Find the message in client, file, pipe, syslogd, server log.
9# Check that the 300 messages are in syslogd and file log.
10# Check that the dropped message is in server and file log.
11
12use strict;
13use warnings;
14use Socket;
15
16our %args = (
17    client => {
18	func => sub { write_between2logs(shift, sub {
19	    my $self = shift;
20	    write_message($self, get_secondlog());
21	    write_lines($self, 300, 1024);
22	    write_message($self, get_thirdlog());
23	    ${$self->{server}}->loggrep(get_secondlog(), 5)
24		or die ref($self), " server did not receive second log";
25	})},
26    },
27    syslogd => {
28	loghost => '@tls://localhost:$connectport',
29	loggrep => {
30	    get_between2loggrep(),
31	    get_charlog() => 300,
32	    qr/ \(dropped\)/ => 16,
33	},
34    },
35    server => {
36	listen => { domain => AF_UNSPEC, proto => "tls", addr => "localhost" },
37	func => sub {
38	    my $self = shift;
39	    ${$self->{client}}->loggrep(get_thirdlog(), 5)
40		or die ref($self), " client did not send third log";
41	    read_log($self);
42	},
43	loggrep => {
44	    get_between2loggrep(),
45	    get_secondlog() => 1,
46	    get_thirdlog() => 0,
47	    get_charlog() => 285,
48	    qr/syslogd: dropped 16 messages to loghost "\@tls:.*"/ => 1,
49	},
50    },
51    file => {
52	loggrep => {
53	    get_between2loggrep(),
54	    get_secondlog() => 1,
55	    get_thirdlog() => 1,
56	    get_charlog() => 300,
57	    qr/syslogd: dropped 16 messages to loghost "\@tls:.*"/ => 1,
58	},
59    },
60);
61
621;
63