anchor.diff:  -endif.
   
   %% api
  --export([handle/1,
  -         handle_datagram/1,
  -         unpack/2,
  +-export([handle/2,
  +         handle_datagram/2,
  +         unpack/3,
            pack/1]).
   
   -opaque endpoint() :: {endpoint, list( endpoint_option())}.
  
positive.code: %% </p>
  %% @end
  
  -spec handle_datagram(datagram()) -> ok.
  handle_datagram(_Datagram = {datagram, _Dgram_as_Dict}) ->
      %% handle/1 needs to become handle/2 as the swarm state and inbound channel
      %% are needed to process the messages correctly.
      %% This also needs to be moved into ppspp_message module wrt opaque typing.
  
negative.code: %% @spec handle_datagram() -> ok
  %% @end
  -spec handle({udp, inet:socket(), inet:ip_address(), inet:port_number(),
                binary()}, ppspp_options:options()) -> ok.
  
  handle(_Packet = {udp, Socket, Peer_IP_Address, Peer_Port, Maybe_Datagram},
         Swarm_Options) ->
      Channel = ppspp_channel:unpack_channel(Maybe_Datagram),
      Endpoint = build_endpoint(udp, Socket, Peer_IP_Address, Peer_Port, Channel),
      Datagram = unpack(Maybe_Datagram, Endpoint, Swarm_Options),
      ?DEBUG("dgram: got valid datagram ~p~n", [Datagram]),
      % NB usually called from spawned process, so return values are ignored
      handle_datagram(Datagram, Swarm_Options).
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %% @doc Extract PPSPP channel ID from header of datagram
  