nl_tokens: const portUtils = require ( . / port - utils ) ; const IP4Address = require ( . / ip4 - address ) ; const interfaces = require ( . / interfaces ) ; const netError = require ( . / net - error ) ;
pl_tokens: function receive ( intf , srcIP , destIP , u8 , headerOffset ) { const srcPort = udpHeader . getSrcPort ( u8 , headerOffset ) ; const destPort = udpHeader . getDestPort ( u8 , headerOffset ) ; const dataLength = udpHeader . getDataLength ( u8 , headerOffset ) - udpHeader . headerLength ; const dataOffset = headerOffset + udpHeader . headerLength ; debug ( 'recv UDP over IP4' , srcPort , destPort , dataLength ) ; const socket = UDPSocket . lookupReceive ( destPort ) ; if ( ! socket ) { return ; } const u8data = u8 . subarray ( dataOffset ) ; if ( socket . onmessage ) setImmediate ( ( ) => <mask> . onmessage ( srcIP , srcPort , u8data ) ) ; }