Traceroute.Sockets.ICMPConn (traceroute v0.2.3)

View Source

Opens a singleton ICMP socket connection upon request and sends back received ICMP packets to the process that registered for its protocol + port_or_identifier combination.

We should only ever have one open ICMP socket, because received ICMP packets are not routed to the ICMP sockets that sent them, unlike TCP or UDP sockets. That's why we open only a single socket and send&receive all ICMP packets through this socket. The routing of received packets happens in our application based on a combintation of protocol (e.g. :tcp, :udp, :icmp) and identifier (port or ICMP packet identifier)

Summary

Functions

Returns a specification to start this module under a supervisor.

Returns the pid of the ICMPConn for a given ip_protocol: (:ipv4 | :ipv6).

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_or_start_conn(ip_protocol)

Returns the pid of the ICMPConn for a given ip_protocol: (:ipv4 | :ipv6).

Starts the GenServer for the given ip_protocol if no process for the given protocol exists already.

register(ip_protocol, protocol, identifier, pid)

send_packet(ip_protocol, ttl, packet, destination)

start_link(args)

unregister(ip_protocol, protocol, identifier)