UDP operations

1. Has UDP datagram 

Description

Checks if a packet has or not an UDP datagram.

Format

hasupd(arg_1) → result

  • arg_1 : Packet
  • result : Boolean

Examples

  Example 1

pkt → packet field name

hasupd(pkt), where pkt is a packet with an UDP datagram

  • arg_1 : pkt
  • result : true
  Example 2

pkt → packet field name

 hasupd(pkt), where pkt is a packet without an UDP datagram

  • arg_1 : pkt
  • result : false

2. UDP checksum

Description

Returns the checksum value of an UDP datagram. This value is used for error checking of the header and data. It carries all-zeroes if unused.

Format

udpcs(arg_1) → result

  • arg_1 : Packet
  • result : Integer

Examples

  Example 1

pkt → packet field name

udpcs(pkt)

  • arg_1 : pkt
  • result : 511
  Example 2

pkt → packet field name

 udpcs(pkt)

  • arg_1 : pkt
  • result : 37492

3. UDP destination port

Description

Returns the destination port of an UDP datagram. This value identifies the receiving port.

Format

udpdst(arg_1) → result

  • arg_1 : Packet
  • result : Integer

Examples

  Example 1

pkt → packet field name

udpdst(pkt)

  • arg_1 : pkt
  • result : 53
  Example 2

pkt → packet field name

 udpdst(pkt)

  • arg_1 : pkt
  • result : 8760

4. UDP length

Description

Returns the length of an UDP datagram. This field specifies the length in bytes of the UDP header and UDP data.

Format

udplen(arg_1) → result

  • arg_1 : Packet
  • result : Integer

Examples

  Example 1

pkt → packet field name

udplen(pkt)

  • arg_1 : pkt
  • result : 56
  Example 2

pkt → packet field name

 udplen(pkt)

  • arg_1 : pkt
  • result : 350

The minimum length is 8 bytes (header length) and the maximum is 65535 bytes (8 bytes of header + 65527 bytes of data).


5. UDP payload

Description

Returns the payload of an UDP datagram.Please note that non-encrypted data can be shown with fromtuf8(pkt).

Format

udppayload(arg_1) → result

  • arg_1 : Packet
  • result : Bytes array

Examples

  Example 1

pkt → packet field name

udppayload(pkt)

  • arg_1 : pkt
  • result : 14660100000100000000000 00470696E67096368617274626561 74036E6574000001000
  Example 2

pkt → packet field name

 udppayload(pkt)

  • arg_1 : pkt
  • result : 6C370100000100000000000 003777777036E666C03636F6D0000 1C0001

6. UDP source port

Description

Returns the source port of an UDP datagram. This value identifies the receiving port.

Format

udpsrc(arg_1) → result

  • arg_1 : Packet
  • result : Integer

Examples

  Example 1

pkt → packet field name

udpsrc(pkt)

  • arg_1 : pkt
  • result : 53
  Example 2

 pkt → packet field name

 udpsrc(pkt)

  • arg_1 : pkt
  • result : 8760

7. UDP Status

Description

Returns the status of a UDP packet.

  Check here the packet status codes
  • OK → The packet has been parsed without problems
  • UNPARSED → Unparded packet
  • UNDERFLOW → The packet is smaller than its outer payload
  • OVERFLOW → The packet is bigger than the payload
  • CRC_UNAVAILABLE → CRC cannot be declared due to the lack of data
  • BAD_CRC → CRC does not match
  • HEADER_BAD → Header has inconsistent values
  • TOO_SHORT → There is not enough data to fill the header

Format

udpstatus(arg_1) → result

  • arg_1 : Packet
  • result : String

Examples

  Example 1

pkt → packet field name

udpstatus(pkt)

  • arg_1 : pkt
  • result : OK
  Example 2

pkt → packet field name

 udpstatus(pkt)

  • arg_1 : pkt
  • result : CRC_BAD

Have we answered your question?

If not, please contact our technical support team via email by clicking the button below.

CONTACT US