예제 #1
0
 /**
  * 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));
   }
 }
예제 #2
0
 /**
  * Unregister a protocol
  *
  * @param protocol
  */
 protected void unregisterProtocol(IPv4Protocol protocol) {
   protocols.remove(protocol.getProtocolID());
 }
예제 #3
0
 /**
  * Register a protocol
  *
  * @param protocol
  */
 protected void registerProtocol(IPv4Protocol protocol) {
   protocols.put(protocol.getProtocolID(), protocol);
 }