LogProto: fixed a bug in fixed-size-encoding detection

Due to a typo, fixed-size encodings were not properly recognized, causing
syslog-ng to use the slow-path in case encoding() was used on a source.

This change fixes that issue, and at the same time publishes the function
log_proto_get_char_size_for_fixed_encoding() so that its unit test can call
it directly.

Cc: <syslog-ng-stable@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
LogProtoTextServer: fixed a possible memory leak in case encoding() was used

In case encoding was used on a source, its related data structures were
not properly freed as the destructor function wasn't properly registered.

Cc: <syslog-ng-stable@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
LogProtoBufferedServer: fixed a SockAddr caching problem that shouldn't be user-visible

The log_proto_buffered_server_fetch() function improperly NULLed the
cached GSockAddr instance every time it attempted to read. However that
forthcoming read may return EAGAIN, which causes the sockaddr to remain
NULL.

In case an EOF is read the next time, log_proto_fetch() will return NULL as
the originating sockaddr for the partial message still in the buffer.

This bug shouldn't bite anyone as the cached sockaddr is only used for
udp() sources, but which in turn don't have partial messages nor EOFs.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
LogProtoFramedServer: change dynamic buffer allocation

Until now the buffer of LogProtoFramedServer class implementing
RFC5424 style framing was sized in accordance to the maximum frame length
processed by the class. More exactly it was sized as "max_frame_len + 10".

This could mean that if most of the messages are about the same size, that
the buffer is limited to hold one single message. This is certainly not
the best for performance, so be a bit more liberal when allocating this
buffer size, it is scaled to hold 16 messages, but at the same time limited
to 6*log_msg_size().

This is 48k buffer space for the default log_msg_size() value of 8k and
matches exactly with the buffer size used by LogProtoTextServer.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
LogProtoFramedServer: fixed an incorrect error message

This patch changes the generic I/O error message to reflect that it
actually can apply to the framed data as well as the header.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
LogProtoDGramServer: encoding is to be applied to individual frames

Instead of trying to make up missing characters in one frame from the next,
treat them individually, especially as they might come from a different
source.

The same change is applied to LogProtoRecordServer used to read binary
files.

Cc: <syslog-ng-stable@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
apphook: explicitly deinit a number of subsystems at shutdown

To get away with a number of leaks in unit tests.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
tests: use proper version for configuration in msg_parse_lib

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
tests: added support for comparing fixed length strings to testutils

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
tests: cleaned up includes in testutils

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
tests: added support for assertions on internal messages

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
test_logproto: add new unit test to cover LogProto server implementations

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>