[erlang-questions] Diameter header cmd_code field bit size

Ulf Wiger ulf@REDACTED
Sun Apr 6 18:42:08 CEST 2014


The *actual implementation* in diameter_codec.erl [1] gets it right, though.

BR,
Ulf W

[1] https://github.com/erlang/otp/blob/maint/lib/diameter/src/base/diameter_codec.erl#L104
https://github.com/erlang/otp/blob/maint/lib/diameter/src/base/diameter_codec.erl#L296

On 06 Apr 2014, at 16:51, austin aigbe <eshikafe@REDACTED> wrote:

> Hello,
> 
> According to RFC6733, the diameter header Command Code field is three octets (i.e 24 bits) but the Erlang diameter header implementation has it defined as a 1 octet field (i.e 8 bits). Why?
> 
> 
> 
> RFC 6733:
> 
> 3.  Diameter Header
> 
>    A summary of the Diameter header format is shown below.  The fields
>    are transmitted in network byte order.
> 
>        0                   1                   2                   3
>        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
>       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>       |    Version    |                 Message Length                |
>       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>       | Command Flags |                  Command Code                 |
>       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>       |                         Application-ID                        |
>       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>       |                      Hop-by-Hop Identifier                    |
>       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>       |                      End-to-End Identifier                    |
>       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>       |  AVPs ...
>       +-+-+-+-+-+-+-+-+-+-+-+-+-
> 
> C:\Program Files\erl6.0\lib\diameter-1.6\include\diameter.hrl:
> -record(diameter_header,
>         {version,            %%  8-bit unsigned
>          length,             %% 24-bit unsigned
>          cmd_code,           %%  8-bit unsigned
>          application_id,     %% 24-bit unsigned
>          hop_by_hop_id,      %% 32-bit unsigned
>          end_to_end_id,      %% 32-bit unsigned
>          is_request,         %% boolean() R flag
>          is_proxiable,       %% boolean() P flag
>          is_error,           %% boolean() E flag
>          is_retransmitted}). %% boolean() T flag
> 
> BR,
> Austin
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
http://feuerlabs.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140406/f5baabf6/attachment.htm>


More information about the erlang-questions mailing list