anchor.diff:  -module(enet_ipv4).
   
   %% API
  --export([decode_addr/1, encode_addr/1,
  -         decode/1, decode/2, encode/1,
  -         decode_protocol/1, encode_protocol/1,
  -         header_checksum/1,
  -         addr_len/0]).
  +-export([decode_addr/1, encode_addr/1
  +         ,decode/1, decode/2
  +         ,encode/1, expand/1
  +         ,decode_protocol/1, encode_protocol/1
  +         ,header_checksum/1
  +         ,addr_len/0
  +        ]).
   
   -include("types.hrl").
   -define(IP_VERSION, 4).
  
positive.code:     Header = <<?IP_VERSION:4, HLen:4, DiffServ:8, TotLen:16,
                ID:16, Flags:3/bits, FragOff:13, TTL:8, Proto:8, 0:16,
                SrcIP:4/binary, DestIP:4/binary, RestDgram/binary>>,
      checksum(Header).
  
  checksum(Bin) when is_binary(Bin) ->
      lists:foldl(fun checksum/2,
                  0,
                  [N || <<N:16/big>> <= Bin]).
  
  %% 16 bits Ones complement addition.
  checksum(A, Sum) ->
      case A + Sum of
          N when N > 16#FFFF ->
              N - 16#10000 + 1;
          N when N =< 16#FFFF ->
              N
      end.
  
  decode_option_type(0,  0) -> eool;
  decode_option_type(0,  1) -> nop;
  
negative.code:                                                  is_integer(HdrChkSum) ->
      HeaderLen = 4 * HLen,
      <<Header:HeaderLen/binary, _/binary>> = Dgram,
      enet_checksum:oc16_check(Header, HdrChkSum).
  
  header_checksum(#ipv4{vsn=?IP_VERSION,
                        hlen=HLen,
  