Fix decode failure when AVP Length < 8

Such a length caused decode of a message with valid (24-bit) length to
fail. Note that the error detected is wrong: it should be 5014
(INVALID_AVP_LENGTH), not 3009 (INVALID_AVP_BITS). This will be dealt
with by OTP-11007.
Fix checking for odbc in standard locations when "with-odbc" flag present.
Correct AVP Length error testcases

To return what RFC 6733 says. 3588 says less so follow 6733, even
though the extra specification of 6733 means that it isn't strictly
backwards compatible. In particular, 6733 says to send a zero'd payload
or none at all while 3588 says to send the offending AVP, despite the
fact that the peer will likely have equal difficulty in decoding it.

The testcases now fail, which will be remedied in subsequent commits.
Ensure setting Failed-AVP is appropriate

When setting Failed-AVP in a message record, it was never tested that
the field was actually present. RFC 6733 says it should be, 3588 says
MAY.
Introduce a better id allocation algorithm for PTabs
Fix recognition of 5014 (INVALID_AVP_LENGTH) errors

Invalid lengths come in two flavours: ones that correctly point at the
end of an AVP's payload but don't agree with its type, and ones that
point elsewhere. The former are relatively harmless but the latter leave
no way to recover AVP boundaries, which typically results in failure to
decode subsequent AVP's in the message in question.

In the case that AVP Length points past the end of the message, diameter
incorrectly regarded the error as 5009, INVALID_AVP_BITS: not right
since the error has nothing to do with AVP Flags. Ditto if the length
was less than 8, a minimal header length. Only in the remaining case was
the detected error 5014, INVALID_AVP_LENGTH. However, in this case it
slavishly followed RFC 3588 in suggesting the undecodable AVP as
Failed-AVP, thereby passing the woeful payload back to the sender to
have equal difficulty decoding. Now follow RFC 6733 and suggest an AVP
with a zero-filled payload.
Add spec to diameter_gen
Add spec to diameter_codec
Adapt Failed-AVP setting to RFC 6733

When setting these from an #diameter_packet.errors list, select one
Result-Code or {Result-Code, Failed-AVP}, instead of accumulating all
AVP's from the 2-tuples in the list. This is more in keeping with RFC
6733:

  7.5.  Failed-AVP AVP

     The Failed-AVP AVP (AVP Code 279) is of type Grouped and provides
     debugging information in cases where a request is rejected or not
     fully processed due to erroneous information in a specific AVP.  The
     value of the Result-Code AVP will provide information on the reason
     for the Failed-AVP AVP.  A Diameter answer message SHOULD contain an
     instance of the Failed-AVP AVP that corresponds to the error
     indicated by the Result-Code AVP.  For practical purposes, this
     Failed-AVP would typically refer to the first AVP processing error
     that a Diameter node encounters.

The text of RFC 3588 was less specific, not including the last two
sentences.

Note that an improper AVP Length will result in both 5014 and 5005 being
detected for the same AVP. Without this commit, Failed-AVP would be
populated with two AVP's for the same error.
Detect all 5005 (MISSING_AVP) errors and don't reverse errors

The previous commit ensures that only one will be reported in an answer
message when diameter itself sets Result-Code/Failed-AVP.

The order of errors in #diameter_packet.errors is that in which they're
detected, not the reverse as previously.
Fix {stream, {self, once}} in httpc

Previously the only difference between {stream, self} and {stream,
{self, once}} was an extra Pid in the stream_start message due to a
bug in httpc_handler. It was immediately sending a bunch of messages
till the end instead of waiting for httpc:stream_next/1 being called.
Remove http_chunk:decode/4 as it is no longer used

http_chunk:decode/4, the side-effecting chunk decoder, was only used
by httpc_handler:handle_http_body/2 but now it's completely unused.
Fix watchdog function_clause

Commit 0b7c87dc caused diameter_watchdog:restart/2 to start returning
'stop', so that a watchdog process for a listening transport that
allowed multiple connections to the same peer would die one watchdog
timeout after losing a connection. The new return value was supposed to
be passed up to transition/2, but was instead passed to set_watchdog/1,
resulting in a function_clause error. The resulting crash was harmless
but unseemly.

Not detected by dialyzer.

Thanks to Aleksander Nycz.
add support for hipe on Raspberry Pi (armv6l)

To enable hipe on a Raspberry Pi, configure has to detect the ARM processor
correctly. On a Pi, uname detects the CPU as armv6l. Other CPU variants are
already detected with ARCH=arm, so does now the armv6l of the Raspberry Pi.
Fix renaming of bs_put_string instructions

The clause was formerly commented-out because at this point in the code,
no bs_put_string instruction has been generated yet when compiling from
Erlang.

If an Erlang module is compiled to BEAM assembly and the result contains
a bs_put_string instruction, the output can't be compiled to binary
anymore and the compiler crashes with the following error:

$ erlc prs.S
Function: compress/1
prs.S:none: internal error in beam_block;
crash reason: {{case_clause,
                   {'EXIT',
                       {function_clause,
                           [{beam_utils,live_opt,
                                [[{bs_put_string,1,{string,[0]}},
                                  {bs_init,
                                      {f,0},
                                      {bs_append,0,8,{field_flags,[]}},
                                      0,
                                      [{integer,8},{x,0}],
                                      {x,1}},
                                  {label,2}],
                                 2,
                                 {1,{1,1,nil,nil}},
                                 [{block,
                                      [{'%live',2},
                                       {set,[{x,0}],[{x,1}],move},
                                       {'%live',1}]},
                                  return]],
                                [{file,"beam_utils.erl"},{line,639}]},
                            {beam_utils,live_opt,1,
                                [{file,"beam_utils.erl"},{line,205}]},
                            {beam_block,function,2,
                                [{file,"beam_block.erl"},{line,38}]},
                            {lists,mapfoldl,3,
                                [{file,"lists.erl"},{line,1329}]},
                            {beam_block,module,2,
                                [{file,"beam_block.erl"},{line,29}]},
                            {compile,'-select_passes/2-anonymous-2-',2,
                                [{file,"compile.erl"},{line,476}]},
                            {compile,'-internal_comp/4-anonymous-1-',2,
                                [{file,"compile.erl"},{line,276}]},
                            {compile,fold_comp,3,
                                [{file,"compile.erl"},{line,294}]}]}}},
               [{compile,'-select_passes/2-anonymous-2-',2,
                    [{file,"compile.erl"},{line,476}]},
                {compile,'-internal_comp/4-anonymous-1-',2,
                    [{file,"compile.erl"},{line,276}]},
                {compile,fold_comp,3,[{file,"compile.erl"},{line,294}]},
                {compile,internal_comp,4,[{file,"compile.erl"},{line,278}]},
                {compile,'-do_compile/2-anonymous-0-',2,
                    [{file,"compile.erl"},{line,152}]}]}
Fix recognition of 5001 on mandatory AVP's

An AVP setting the M-bit was not regarded as erroneous if it was defined
in the dictionary in question and its container (message or Grouped AVP)
had an 'AVP' field. It's now regarded as a 5001 error (AVP_UNSUPPORTED),
as in the case that the AVP is not defined.
Remove redundant integer type specifiers from binaries
Merge branch 'md/httpc-stream-once-fix/OTP-11122' into maint

* md/httpc-stream-once-fix/OTP-11122:
  Remove http_chunk:decode/4 as it is no longer used
  Fix {stream, {self, once}} in httpc
Merge branch 'anders/diameter/avp_length_failure/OTP-11026' into maint

* anders/diameter/avp_length_failure/OTP-11026:
  Fix decode failure when AVP Length < 8
Merge branch 'anders/diameter/avp_decode/OTP-11007' into maint

* anders/diameter/avp_decode/OTP-11007:
  Detect all 5005 (MISSING_AVP) errors and don't reverse errors
  Adapt Failed-AVP setting to RFC 6733
  Add spec to diameter_codec
  Add spec to diameter_gen
  Fix recognition of 5014 (INVALID_AVP_LENGTH) errors
  Ensure setting Failed-AVP is appropriate
  Correct AVP Length error testcases