anchor.diff:            frag_offset=FragOff,
             ttl=TTL,
             proto=Protocol,
  -          hdr_csum=HdrChkSum,
  +          hdr_csum=check_header_checksum(Dgram, HLen, HdrChkSum),
             src=decode_addr(SrcIP),
             dst=decode_addr(DestIP),
             options=decode_options(Opts),
  -          data=enet_codec:decode(Protocol, Data)};
  -decode(_Dgram) ->
  +          data=enet_codec:decode(Protocol, Data, DecodeOptions)};
  +decode(_Dgram, _) ->
       {error, bad_packet}.
  +
  +expand(Pkt = #ipv4{options=Opts}) when is_list(Opts) ->
  +    expand(Pkt#ipv4{options=encode_options(Opts)});
  +expand(Pkt = #ipv4{hlen=H, options=Opts}) when not is_integer(H), is_binary(Opts) ->
  +    expand(Pkt#ipv4{hlen=5 + (byte_size(Opts) div 4)});
  +expand(Pkt = #ipv4{totlen=T, hlen=H, data=D})
  +  when not is_integer(T), is_integer(H), is_binary(D) ->
  +    expand(Pkt#ipv4{totlen=H + byte_size(D)});
  +expand(Pkt = #ipv4{flags=Flags}) when is_list(Flags) ->
  +    expand(Pkt#ipv4{flags=encode_flags(Flags)});
  +expand(Pkt = #ipv4{src=Src}) when not (is_binary(Src) andalso byte_size(Src) =:= 4) ->
  +    expand(Pkt#ipv4{src=encode_addr(Src)});
  +expand(Pkt = #ipv4{dst=Dst}) when not (is_binary(Dst) andalso byte_size(Dst) =:= 4) ->
  +    expand(Pkt#ipv4{dst=encode_addr(Dst)});
  +expand(Pkt = #ipv4{proto=P}) when not is_integer(P) ->
  +    expand(Pkt#ipv4{proto=encode_protocol(P)});
  +expand(Pkt = #ipv4{hdr_csum=S}) when not is_integer(S) ->
  +    expand(Pkt#ipv4{hdr_csum=header_checksum(Pkt)});
  +expand(Pkt) ->
  +    Pkt.
   
   encode(#ipv4{vsn=?IP_VERSION,
                hlen=HLen,
  
positive.code:                     (_, Acc) -> Acc
                  end,
                  [],
                  [{dont_fragmet, DF}, {more_fragments, MF},
                   {evil, Evil}]).
  
  decode_options(Blob) ->
      decode_options(Blob, []).
  
negative.code: 
  %% 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]).
  
  -include("types.hrl").
  