Constructor
new UDP()
PropertiesName | Type | Description |
---|---|---|
src | number | Source UDP port. |
dst | number | Destination UDP port. |
totalLength | number | This field specifies the length in bytes of the UDP datagram (the header fields and Data field) in octets. |
checksum | number | The 16-bit checksum field is used for error-checking of the header and data. |
- Implements
- Source
Members
length :number
Number of bytes occupied by the layer.
Type:
- number
- Implements
- Source
options :Iterable.<TLVOption>
TLV options;
Type:
- Iterable.<TLVOption>
- Source
osi :OsiModelLayers
Respective protocol OSI layer.
Type:
- Implements
- Source
Methods
calculateChecksum()
Calculates and updates the checksum for the UDP layer. This method mutates the object by setting the `checksum` property based on the current state of the `buffer` and `prev` field.
- Source
toObject() → {Object}
Retrieves all fields of the UDP layer.
- Implements
- Source
Returns:
The UDP layer fields as an object.
- Type:
- Object
Example
udp.toObject();
// {
// src: 52622,
// dst: 24043,
// seq: 3994458414,
// totalLength: 2048,
// checksum: 3346,
// }