UDP - User Datagram Protocol¶
pcapkit.protocols.transport.udp
contains
UDP
only,
which implements extractor for User Datagram Protocol
(UDP) [*], whose structure is described as below:
Octets |
Bits |
Name |
Description |
---|---|---|---|
0 |
0 |
|
Source Port |
2 |
16 |
|
Destination Port |
4 |
32 |
|
Length (header includes) |
6 |
48 |
|
Checksum |
- class pcapkit.protocols.transport.udp.UDP(file=None, length=None, **kwargs)[source]¶
-
This class implements User Datagram Protocol.
This class currently supports parsing of the following protocols, which are registered in the
self.__proto__
attribute:Port Number
Protocol
80
- property name: Literal['User Datagram Protocol']¶
Name of current protocol.
- read(length=None, **kwargs)[source]¶
Read User Datagram Protocol (UDP).
Structure of UDP header [RFC 768]:
0 7 8 15 16 23 24 31 +--------+--------+--------+--------+ | Source | Destination | | Port | Port | +--------+--------+--------+--------+ | | | | Length | Checksum | +--------+--------+--------+--------+ | | data octets ... +---------------- ...
- make(srcport=0, dstport=0, checksum=b'\\x00\\x00', payload=b'', **kwargs)[source]¶
Make (construct) packet data.
- __proto__: DefaultDict[int, ModuleDescriptor[Protocol] | Type[Protocol]]¶
Protocol index mapping for decoding next layer, c.f.
self._decode_next_layer
&self._import_next_layer
.- Type:
DefaultDict[int, ModuleDescriptor[Protocol] | Type[Protocol]]
Header Schemas¶
- class pcapkit.protocols.schema.transport.udp.UDP(dict_=None, **kwargs)[source]¶
Bases:
Schema
Header schema for UDP packet.
- srcport: Enum_AppType = <PortEnumField srcport>¶
Source port.
- dstport: Enum_AppType = <PortEnumField dstport>¶
Destination port.
- len: int = <UInt16Field len>¶
Length of UDP packet.
- checksum: bytes = <BytesField checksum>¶
Checksum of UDP packet.
- payload: bytes = <PayloadField payload>¶
Payload.
Data Models¶
- class pcapkit.protocols.data.transport.udp.UDP(*args: VT, **kwargs: VT)[source]¶
Bases:
Protocol
Data model for UDP protocol.
- srcport: AppType¶
Source port.
- dstport: AppType¶
Destination port.
- len: int¶
Length (header includes).
- checksum: bytes¶
Checksum.
Footnotes