anchor.diff:  % IOList form.
   %    [ Src, Dest, << encode_type(Type):16/big>>, Data ].
   
  -payload_type(#eth{type=T}) -> T.
  -payload(#eth{data=D}) -> D.
  +payload_type(#eth{type=T}, _) -> T.
  +payload(#eth{data=D}, _) -> D.
  +
  +default_options() -> [].
   
   %%====================================================================
   %% Internal functions
  
positive.code: decode(_Frame, _) ->
      {error, bad_packet}.
  
  encode(P = #eth{src=Src}) when not is_binary(Src) ->
      encode(P#eth{src=encode_addr(Src)});
  encode(P = #eth{dst=Dest}) when not is_binary(Dest) ->
      encode(P#eth{dst=encode_addr(Dest)});
  encode(P = #eth{type=Type, data=Data}) when is_atom(Type), is_tuple(Data) ->
      encode(P#eth{type=encode_type(Type), data=enet_codec:encode(Type,Data)});
  encode(P = #eth{type=Type}) when is_atom(Type) ->
      encode(P#eth{type=encode_type(Type)});
  
  encode(#eth{src=Src,dst=Dest,type=Type,data=Data})
    when is_binary(Src), is_binary(Dest), is_integer(Type), is_binary(Data) ->
      <<Dest:6/binary,
       Src:6/binary,
  
negative.code: -module(enet_eth).
  
  %% API
  -behavior(enet_codec).
  -export([decode/2
           ,payload/2
           ,payload_type/2
           ,encode/2
           ,default_options/0
          ]).
  
  %% API
  -export([decode_type/1, encode_type/1,
           decode_addr/1, encode_addr/1,
           addr_len/0]).
  
  -include("enet_types.hrl").
  
  