decode: fix failure in layered tunnel

If we have multiple layer of tunnel, the decoding of initial
Packet will recurse in DecodeTunnel function called in
PacketTunnelPktSetup. If we are not setting the pseudo
packet root before calling DecodeTunnel (as done in previous
code), then the tunnel root will no be correct for the lower
layer packets. This result in an counter problem and a suricata
failure after some time.
luajit: pass calling rule's sid,gid,rev to script as SCRuleSid, SCRuleGid, SCRuleRev.
lua: clear stack after each script run
lua: push correct length back through ScFlowvarGet, work around valgrind warning
htp: randomization of htp inspection sizes

This is an implementation of #940. It randomize libhtp request
and response size if the same way this has been done for stream
inspection.
htp: display info about randomization

When randomizatin is used display a message about actual values.
When setting final configuration nodes, set the whole tree as final.

Prevents benign log message of parent nodes of final values being
redefined (which ends up having no affect as the final nodes
are protected from being removed).
Use the stack for temporary memory buffers.
prscript: add support for pcap build

Now also start a pcap test build.
dns: rules files was not installed

Installed dns-events.rules files in rules directory with install-rules.
yaml: remove no more present files

emerging-virus.rules is not present anymore in ET ruleset downloaded
by 'make install-rules'. This patch removes it from the list to avoid
an error message.
erf-dag: fix typo in header guard

Spotted out by clang:
 source-erf-dag.h|25 col 9| warning: '__SOURCE_ERR_DAG_H__'
 is used as a header guard here, followed by #define of a different macro
 [-Wheader-guard]
stream: add option to disable raw reassembly

Raw reassembly is used only by the detection engine. For users only
caring about logging it's a significant overhead, both in cpu and
memory usage.

The option is called 'raw' and lives under the stream.reassembly
options.

stream:
  memcap: 32mb
  checksum-validation: yes      # reject wrong csums
  inline: auto                  # auto will use inline mode in IPS mode, yes or no set it statically
  reassembly:
    memcap: 64mb
    depth: 1mb                  # reassemble 1mb into a stream
    toserver-chunk-size: 2560
    toclient-chunk-size: 2560
    randomize-chunk-size: yes
    #randomize-chunk-range: 10
    raw: false # <- new option
flow/stream: use named values in flow timeout code
flow timeout cleanup and fix

Flow timeout code worked by luck when checking if a flow still needed
reassembly for app layer inspection or logging. It would check for a
part of raw reassembly (smsg list) to determine if detection was
needed. In this case it would also process app layer cleanup,
including logging.

Introduced AppLayerTransactionGetActive which returns the lowest tx_id
in a direction that still needs some work.

FlowForceReassemblyNeedReassmbly now uses it to determine if the
applayer still needs work.

Converted FlowForceReassemblyForHash to use the checking function
FlowForceReassemblyNeedReassmbly as well, so that checking if a flow
needs work is now unified.
flow: fix typo in function name

FlowForceReassemblyNeedReassmbly -> FlowForceReassemblyNeedReassembly
flow timeout: remove now unused code
pcap: fix stats dump logic

pcap has a callback function that is called for each packet. Once a
second, it's meant to 'dump stats'. However, the timing logic was
broken, so it would actually dump stats for each packet.

By moving the stats second timer into the thread vars, next calls of
the callback will be able to use the stored time.
flowvar: initialize new memory to prevent issues on error handling
Convert Flow macros to inline functions

Convert FlowReference and FlowDeReference to inline functions for
better readability and to aid static code analyzers.