rule setup: cleanup

Remove rule preparation logic that ran, but it's results were not
used.
decode: update API to return error

In some cases, the decoding is not possible and some really invalid
packet can be created. This is in particular the case of tunnel. In
that case, it is more interesting to forget about the tunneled
packet and only consider the original packet.

DecodeTunnel function is maked as warn_unused_result because it is
meaningful for the decoder to know if the underlying data were not
correct. And in this case, only focus detection on the content.
decode: PacketTunnelPktSetup replaces PacketPseudoPktSetup

This patch replaces PacketPseudoPktSetup by a better named
PacketTunnelPktSetup function which is also in charge of doing
the decoding of the tunneled packet.
This allow to clean the code. But it also fixes an issue.
Previously, if the DecodeTunnel function was failling (cause of
an invalid packet mainly), the result was that the original packet
to be considered as a tunnel packet (and not inspected by payload
detection).
defrag: don't modify packet if defrag fails

If defrag fails dur to an invalid decoding, we are not modifying
the origin packet anymore.
defrag: clean up

Rename PacketDefragPktFinishSetup to PacketDefragPktSetupParent to
better refect it's function.
content: reorder DetectContentData member, shrinking the struct from 64 to 48 bytes.
stream: minor clean up of TcpSession structure
pcre: parsing cleanup

Remove all flags indicating the buffer type. They were only used
at parse time.

Because of this the DetectPcreData_ structure could shrink to 32
bytes.
vars: optimize layout to reduce size requirements of flowbits and other vars
Fix parsing of 'custom' detect grouping values

Also, add error checking

Bug 892
Add invalid pkt counter.

This patch adds and increments a invalid packet counter. It
does this by introducing PacketDecodeFinalize function

This function is incrementing the invalid counter and is also
signalling the packet to CUDA.
Set packet invalid flag during decoding.

This patch set a new value in pkt->flag to signal that a packet is
invalid during decoding. The patch has been obtained via a coccinelle
transformation.
pcap-file: add checksum-checks configuration variable

This patch adds support for checksum-checks in the pcap-file running
mode. This is the same functionnality as the one already existing for
live interface.

It can be setup in the YAML:
  pcap-file:
    checksum-checks: auto

A message is displayed for small pcap to warn that invalid checksum
rate is big on the pcap file and that checksum-check could
be set to no.
cmdline: add -k to specify checksum validation

This patch adds a '-k' option to suricata to be able to specify
the checksum validation to use. If '-k all' is used, checksum
validation is forced. If '-k none' is used, no checksum validation
is made.

Message output in case of detection of a pcap file with a probable
cheksum issue has been updated to indicate that '-k' is a solution.
decode: clean DecodeThreadVars counter

Speed counters are not compute anymore and can be removed from the
structure definition.
stream: wait for protocol detection to complete

Wait for protocol detection to complete before removing segments
from the list.
stream: add size debug code
proto detection: add limit for one sided sessions

If a session only has data in one direction, like ftp data sessions,
protocol detection will only run in one direction. This led to a
situation where reassembly would hold all the segments as proto
detection was never flagged as complete.

This patch introduces a limit for protocol detection in this case.
If the limit is reached, detection will give up.
app layer: set event if proto detect disabled for a stream, but we see data anyway.
Convert reference keyword to pcre_copy_substring