/** * Deliver a packet to the corresponding protocol * * @param hdr * @param skbuf */ private void deliver(IPv4Header hdr, SocketBuffer skbuf) throws SocketException { final IPv4Protocol protocol; try { protocol = getProtocol(hdr.getProtocol()); protocol.receive(skbuf); } catch (NoSuchProtocolException ex) { log.debug( "Found unknown IP src=" + hdr.getSource() + ", dst=" + hdr.getDestination() + ", prot=0x" + NumberUtils.hex(hdr.getProtocol(), 2)); } }
/** * Unregister a protocol * * @param protocol */ protected void unregisterProtocol(IPv4Protocol protocol) { protocols.remove(protocol.getProtocolID()); }
/** * Register a protocol * * @param protocol */ protected void registerProtocol(IPv4Protocol protocol) { protocols.put(protocol.getProtocolID(), protocol); }