udp-stream
UDP header serialization object stream.
Example
Reading
var UdpStream = ;var IpStream = ;var EtherStream = ;var PcapStream = ; var pstream = PCAP_FILE;var estream = ;var ipstream = ;var ustream = ; pstream; upstream; // Packets that cannot be parsed as UDP are emitted with 'ignored' eventupstream; upstream;
Writing
var UdpStream = ;var IpStream = ;var EtherStream = ;var UdpHeader = ;var IpHeader = ;var EtherFrame = ; var estream = ;var ipstream = ;var ustream = ; estream; // define the header fields to write out to the buffervar input = ether: dst: '01:02:03:04:05:06' ip: dst: '1.2.3.4' udp: dstPort: 52 dataLength: 500 data: 8*1024 // space to write header to; // NOTE: packet payload is not in.data, that must be appended later estream;var out = ustream; // header values have been written to the bufferoutoffset === inputetherlength * inputiplength + inputudplength;test;test;test; // UDP checksums will only be calculated if the message contains both// the 'ip' header property and the UDP payload. By default the// payload is assumed to be in the 'suffix' property.inputsuffix = 500; // The location of the UDP payload can be configured.ustream2 = payload: 'udpPayload';inputudpPayload = 500;