stream: cast memcap checks to uint64_t
stream: improve memcap checking

Only the TcpSegment structure would be checked for fitting in the
memcap, not the actual data.
pool: update internal counters at the proper time

Only update Pool::outstanding and Pool::allocated in PoolGet when
we are sure both Alloc and Init were successful.
pool: document some of the Pool:: fields.
pool: remove tail tracking in alloc list

The list fully acts like a stack now.
pool: rename data structure fields to stack

Rename the following fields:
 -    uint32_t alloc_list_size;
 +    uint32_t alloc_stack_size;

 -    PoolBucket *alloc_list;
 +    PoolBucket *alloc_stack;

 -    PoolBucket *empty_list;
 -    uint32_t empty_list_size;
 +    PoolBucket *empty_stack;
 +    uint32_t empty_stack_size;

To reflect that these are in fact, stacks.
stream: in SACK, always decrease memcap on free

We should always decrease the stream memcap on freeing SACK records.
stream: use reassembly.memcap for stream chunks

Use the stream.reassembly.memcap for stream chunks (StreaMsg) as well.
app-layer: shrink AppLayerParserState

Change layout to be more efficient, shrinks structure with 8 bytes.
app-layer-event: refactor

Move app layer event handling into app-layer-event.[ch].
Convert 'Set' macro's to functions.
Get rid of duplication in Set and SetRaw. Set now calls SetRaw.
Fix potentential int overflow condition in the event storage.
Update callers.
app-layer-proto: speed up

AppLayer Proto detection code uses a mix of pattern search and
"probing parsers". The pattern search validates potential matches
using a single pattern search algo. The code was using SpmSearch
for this, but this made it inefficient as it builds a BoyerMoore
context for each search. This lead to significant memory pressure,
especially on high speed/bandwidth boxes.

This patch switches the search calls to BoyerMoore and BoyerMoore-
Nocase directly. This can be done as the ctx' were available already.
flow-timeout: change error logic

If FlowForceReassemblyForFlowV2 can't get packets to inject into the
engine, until now it would bail and retry later. In case of resource
starvation issues, this would cause a lot of lock contention, as the
flow manager would try over and over again.

This patch limits FlowForceReassemblyForFlowV2 to one try per flow,
if it fails... bad luck. It will only fail in serious conditions,
which means we must prefer the health of the engine over the proper
inspection of the flow in question.