DHCP - Dynamic Host Configuration Protocol¶
pcapkit.protocols.application.dhcp.protocol holds
DHCP, the abstract base of
the Bootstrap Protocol (BOOTP) [RFC 951, RFC 1542] and the Dynamic Host
Configuration Protocol (DHCP) [RFC 2131], whose messages share one layout:
Octets |
Bits |
Name |
Description |
|---|---|---|---|
0 |
0 |
|
Message Op Code |
1 |
8 |
|
Hardware Address Type |
2 |
16 |
|
Hardware Address Length |
3 |
24 |
|
Hops |
4 |
32 |
|
Transaction ID |
8 |
64 |
|
Seconds Elapsed |
10 |
80 |
|
Flags |
12 |
96 |
|
Client IP Address |
16 |
128 |
|
Your (Client) IP Address |
20 |
160 |
|
Next Server IP Address |
24 |
192 |
|
Relay Agent IP Address |
28 |
224 |
|
Client Hardware Address |
44 |
352 |
|
Server Host Name |
108 |
864 |
|
Boot File Name |
236 |
1888 |
BOOTP’s |
Each is a member of its own:
Message |
Class |
Specification |
|---|---|---|
BOOTP |
RFC 951, RFC 1542, and the vendor extensions of RFC 2132 sections 3 to 8 |
|
DHCP |
A DHCP message is the one whose options carry the DHCP Message Type option
(RFC 2131 Section 3, RFC 1534 Section 2); no field gives a version. UDP
ports 67 and 68 carry either, so UDP.__proto__ binds this base and it
picks the member, by _classify().
Added in version 1.10.0.
- class pcapkit.protocols.application.dhcp.protocol.DHCP[_PT: Data, _ST: Schema](file, length=None, /, *, layer=None, protocol=None, context=None)[source]¶
Bases:
Application[_PT,_ST],Generic[_PT,_ST]This class implements the BOOTP and DHCP family.
It is abstract, as
STPis, and never gives an instance of this class. Octets give the member_classify()picks; no field names a member, since the family has no version, so fields are refused here and a member builds itself;from_data()reads the data model’s class. See__new__().The options either member decodes are those
__option__registers, each exactly as its specification defines it; a BOOTP message decodes the vendor extensions alone (VENDOR_EXTENSIONS). An option whose data its decoder refuses keeps its octets, as does each instance of an option the message carries more than once. A DHCP message decodes those instances once, concatenated as RFC 3396 Section 7 gives, inDHCPv4.split_options; RFC 3396 Section 1 and RFC 3396 Section 7 concatenate the options of a received DHCP packet, so a BOOTP message concatenates none.The data each option carries:
Option
Data Model
Subnet Mask, Swap Server, Broadcast Address, Router Solicitation Address, Requested IP Address, Server Identifier, Subnet Selection
Router and the other server lists of RFC 2132, Mobile IP Home Agent
Time Offset, Boot File Size, the timers, TTLs and sizes, IPv6-Only Preferred
The on/off options of RFC 2132, Auto-Configure
Host Name and the other text options of RFC 2132, PCode, TCode, Captive-Portal
Policy Filter
Path MTU Plateau Table
Static Route
NetBIOS over TCP/IP Node Type
Option Overload
DHCP Message Type
Parameter Request List
Client-identifier
User Class (RFC 3004)
Client FQDN (RFC 4702)
Relay Agent Information (RFC 3046)
Client System Architecture (RFC 4578)
Client Network Interface Identifier (RFC 4578)
Client Machine Identifier (RFC 4578)
Domain Search (RFC 3397)
Classless Static Route (RFC 3442)
Vendor-Identifying Vendor Class (RFC 3925)
Vendor-Identifying Vendor-Specific Information (RFC 3925)
Any other option, the opaque Vendor Specific Information and Vendor Class Identifier of RFC 2132 among them, keeps its octets.
Note
The subpackage does not track the dispatch tier. The family is dispatched from
UDP.__proto__at ports 67 and 68; it configures a host rather than relaying its packets, so it is a user of the stack, as RFC 1122 Section 1.1.3 places booting.Defaults
- __option__: DefaultDict[Option | int, str | tuple[Callable[[Option, bytes], OptionData | bytes], Callable[[Option, Mapping[str, Any]], bytes]]]¶
Option code to method mapping, which both members read through. A
strvalue names the methods_read_opt_${name}and_make_opt_${name}, falling back to_read_opt_unknown()and_make_opt_unknown(); any other value is a(parser, constructor)pair of callables.
Properties
Methods
- classmethod id()[source]¶
Index ID of the protocol.
RFC 2131 names its protocol plain
DHCP, so the family’s own name doubles as the canonical name ofDHCPv4, the shapeICMP.idtakes.
- classmethod from_data(data, /, **kwargs)[source]¶
Create protocol instance from data.
- Parameters:
**kwargs (
Any) – AsProtocol.from_data.
- Return type:
- Returns:
Protocol instance; on this class, an instance of the member whose data model
datais.- Raises:
ProtocolError – If
datais no member’s data model, on this class. Adictis refused, since no key picks the member.
- classmethod register_option(code, meth)[source]¶
Register an option parser.
- Parameters:
- Warns:
RegistryWarning– If a different entry is already registered forcode; it is overwritten. Handing back the entry already stored, or one equal to it, is a silent no-op.
Data Models
- classmethod __index__()[source]¶
Numeral registry index of the protocol.
- Return type:
- Returns:
Numeral registry index of the protocol in IANA service names and port numbers: port 67, the port of
UDP.bootpsas anint, which every member inherits (The Registry Index).
- __length_hint__()[source]¶
Return an estimated length for the object, the header and the magic cookie.
- Return type:
- static __new__(cls, file=NO_VALUE, length=None, /, **kwargs)[source]¶
Create the member a parse of this class describes.
Octets give the member
_classify()picks, whose__init__then runs with the same arguments; fields are refused, as no field names a member. A subclass of this class is created as itself.- Parameters:
- Return type:
- Returns:
An uninitialised instance of the member.
- Raises:
ProtocolError – If fields are given, on this class.
Utilities
- _read_opt_address(code, data)[source]¶
Read an option carrying one IPv4 address, four octets (RFC 2132).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais not four octets.
- _read_opt_time_offset(code, data)[source]¶
Read the Time Offset option, a signed 32-bit integer (RFC 2132 Section 3.4).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais not four octets.
- _read_opt_addresses(code, data)[source]¶
Read an option carrying one IPv4 address or more (RFC 2132).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais empty or not a multiple of four octets.
- _read_opt_text(code, data)[source]¶
Read an option carrying ASCII text, one octet or more (RFC 2132 Section 2).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais empty or not ASCII.
- _read_opt_uint16(code, data)[source]¶
Read an option carrying a 16-bit unsigned integer (RFC 2132).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais not two octets, or the value is below the leastMINIMUMSgives the option.
- _read_opt_boolean(code, data)[source]¶
Read an option carrying an octet of
0or1(RFC 2132, RFC 2563).- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais not one octet of0or1.
- _read_opt_policy_filter(code, data)[source]¶
Read the Policy Filter option (RFC 2132 Section 4.3).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais empty or not a multiple of eight octets.
- _read_opt_uint8(code, data)[source]¶
Read an option carrying an 8-bit unsigned integer (RFC 2132).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais not one octet, or the value is below the leastMINIMUMSgives the option.
- _read_opt_uint32(code, data)[source]¶
Read an option carrying a 32-bit unsigned integer (RFC 2132, RFC 8925).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais not four octets.
- _read_opt_mtu_plateau(code, data)[source]¶
Read the Path MTU Plateau Table option (RFC 2132 Section 4.7).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais empty or not a multiple of two octets, or a size is below 68.
- _read_opt_static_route(code, data)[source]¶
Read the Static Route option (RFC 2132 Section 5.8).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais empty or not a multiple of eight octets.
- _read_opt_node_type(code, data)[source]¶
Read the NetBIOS over TCP/IP Node Type option (RFC 2132 Section 8.7).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais not one octet of0x1,0x2,0x4or0x8.
- _read_opt_overload(code, data)[source]¶
Read the Option Overload option (RFC 2132 Section 9.3).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais not one octet of1,2or3.
- _read_opt_message_type(code, data)[source]¶
Read the DHCP Message Type option (RFC 2132 Section 9.6).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais not one octet.
- _read_opt_parameter_list(code, data)[source]¶
Read the Parameter Request List option (RFC 2132 Section 9.8).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais empty.
- _read_opt_client_id(code, data)[source]¶
Read the Client-identifier option (RFC 2132 Section 9.14).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais shorter than two octets.
- _read_opt_home_agent(code, data)[source]¶
Read the Mobile IP Home Agent option, of zero addresses or more (RFC 2132 Section 8.10).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais not a multiple of four octets.
- _read_opt_user_class(code, data)[source]¶
Read the User Class option (RFC 3004 Section 4).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais empty, an instance is empty, or one runs pastdata.
- _read_opt_client_fqdn(code, data)[source]¶
Read the Client FQDN option (RFC 4702 Section 2).
The domain name is in canonical wire format, uncompressed, where the
Eflag is set, and may be partial, without the root label; else it is ASCII text, as RFC 4702 Section 2.3.1 keeps for older clients.- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais shorter than three octets, or the domain name is malformed.
- _read_opt_relay_agent(code, data)[source]¶
Read the Relay Agent Information option (RFC 3046 Section 2.0).
Each sub-option’s data is kept as octets, its format being its own specification’s.
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais empty, or a sub-option runs past it.
- _read_opt_client_system(code, data)[source]¶
Read the Client System Architecture Type option (RFC 4578 Section 2.1).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais empty or not a multiple of two octets.
- _read_opt_client_ndi(code, data)[source]¶
Read the Client Network Interface Identifier option (RFC 4578 Section 2.2).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais not three octets.
- _read_opt_machine_id(code, data)[source]¶
Read the Client Machine Identifier option (RFC 4578 Section 2.3).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais not 17 octets.
- _read_opt_domain_search(code, data)[source]¶
Read the Domain Search option (RFC 3397 Section 2).
Its names are written as RFC 1035 Section 3.1 writes them, and a compression pointer is an offset into the option’s data.
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais empty or a name is malformed.
- _read_opt_classless_route(code, data)[source]¶
Read the Classless Static Route option (RFC 3442 Section 2).
Each route is its prefix length, the significant octets of its destination and its router.
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais shorter than five octets, a prefix length exceeds 32, a route runs pastdata, or a destination sets a bit past its prefix.
- _read_opt_vendor_class(code, data)[source]¶
Read the Vendor-Identifying Vendor Class option (RFC 3925 Section 3).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais empty, or a vendor’s data or an item of it runs past its end.
- _read_opt_vendor_specific(code, data)[source]¶
Read the Vendor-Identifying Vendor-Specific Information option (RFC 3925 Section 4).
- Parameters:
- Return type:
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
datais empty, or a vendor’s data or a sub-option of it runs past its end.
- _make_opt_relay_agent(code, data)[source]¶
Make the Relay Agent Information option.
- Parameters:
- Return type:
- Returns:
Option data.
- Raises:
ProtocolError – If
suboptionsis empty, or a sub-option is no mapping or its data is no octets.
- _make_opt_domain_search(code, data)[source]¶
Make the Domain Search option.
- Parameters:
code (
Option) – Option code.data (
Mapping[str,Any]) – Option fields, i.e.names: each aDomainName, which writes the compression it records, or its presentation form, written in full.
- Return type:
- Returns:
Option data.
- Raises:
ProtocolError – If
namesis empty, or a name is malformed.
- _make_opt_vendor_specific(code, data)[source]¶
Make the Vendor-Identifying Vendor-Specific Information option.
- classmethod _construction_member(fields)[source]¶
The class
from_fields()and a call given no file construct.
- classmethod _classify(data)[source]¶
Pick the member a message is.
A message whose options carry the DHCP Message Type option is a DHCP message (RFC 1534 Section 2): the options field, opening with the magic cookie, then the
fileandsnamefields an Option Overload option there says hold options (RFC 2131 Section 4.1), read in that order. The option counts where it is whole before any option runs past its field, as a capture cut leaves one; any other message is a BOOTP message.
- static _split_options(area)[source]¶
Split an option area into its options (RFC 2132 Section 2).
The Pad and End options are one octet; every other option is its code, its length octet and that many octets of data. The area ends at the End option, where its octets do, or at an option that runs past them.
- Parameters:
area (
bytes) – The option area, after any magic cookie.- Return type:
- Returns:
The whole options, each its code and data, the latter
Nonefor the Pad and End options; the offset past the End option, of the option that runs past the area, or the area’s length; and whether an option runs past the area.
- static _overloaded_fields(entries)[source]¶
The fields an Option Overload option says hold options, in the order they are read (RFC 2131 Section 4.1).
- Parameters:
entries (
Iterable[Tuple[int,bytes|None]]) – The options of the options field, where the Option Overload option is.- Return type:
- Returns:
The offsets of the
filefield, then of thesnamefield, in the message, each where the Option Overload option, its instances concatenated (RFC 3396 Section 7), has a valid value saying it holds options.
- _read_dhcp_area(area)[source]¶
Split the options field, after its magic cookie, into its options.
An option the field ends inside is what a capture cut leaves, so it is recorded as the header schema records a field the data ends inside, and rebuilds as captured.
- _read_dhcp_options(entries, counts, codes=None)[source]¶
Decode the options of an area.
Each option’s data is decoded by
_read_dhcp_data(), and kept as raw octets wherecodesleaves the code out, or wherecountshas the code more than once, as RFC 3396 Section 7 concatenates such instances before any is read (_read_dhcp_split()).- Parameters:
- Return type:
- Returns:
The options, in order.
- _read_dhcp_split(areas, counts, cut=())[source]¶
Decode the options a DHCP message carries more than once (RFC 3396 Section 7).
The instances of each are concatenated in the order of
areas, the aggregate option buffer (RFC 3396 Section 5), and the concatenation is decoded once, by_read_dhcp_data().- Parameters:
areas (
Iterable[Iterable[Tuple[int,bytes|None]]]) – The options of the options field, then of thefileandsnamefields where they hold options, as_split_options()gives them.counts (
Counter[int]) – How many times each code occurs in the message, countingcut.cut (
Iterable[int]) – Codes of the options that run past their fields, as a capture cut leaves one. Such an option is cut short, so it is left out, as one carried once keeps its octets.
- Return type:
- Returns:
The options, in the order their first instances appear.
- _read_dhcp_data(code, data)[source]¶
Decode an option’s data, by the parser
__option__registers for its code.- Parameters:
- Return type:
- Returns:
The decoded data, or
dataitself where the parser refuses it.
- _make_dhcp_header(*, op, htype, hlen, hops, xid, secs, flags, ciaddr, yiaddr, siaddr, giaddr, chaddr, chaddr_padding)[source]¶
Make the fields a BOOTP and a DHCP message share,
opthroughchaddr.- Parameters:
hlen (
int|None) – Hardware address length; that ofchaddrifNone.hops (
int) – Hops.xid (
int) – Transaction ID.secs (
int) – Seconds elapsed.flags (
Mapping[str,Any] |int) – Flags, as their data model or a mapping of its keys, or the two octets as an integer.ciaddr (
IPv4Address|str|bytes|int) – Client IP address.yiaddr (
IPv4Address|str|bytes|int) – Your (client) IP address.siaddr (
IPv4Address|str|bytes|int) – Next server IP address.giaddr (
IPv4Address|str|bytes|int) – Relay agent IP address.chaddr (
str|bytes) – Client hardware address: a MAC address, or its octets.chaddr_padding (
bytes|None) – Octets of the field after the address; zeros filling the field ifNone.
- Return type:
- Returns:
The schema’s keyword arguments.
- Raises:
ProtocolError – If a field does not fit its width, or the address and its padding are not 16 octets.
- _make_dhcp_field(value, *, size, name)[source]¶
Make the
snameorfilefield from its text.- Parameters:
- Return type:
- Returns:
The field’s octets.
- Raises:
ProtocolError – If
valueis no octets, or longer thansize.
- _make_dhcp_options(options, padding, *, codes=None, size=None, aggregate=None)[source]¶
Make an option area.
- Parameters:
options (
Iterable[Mapping[str,Any]]) – Each option’scode,lengthanddata, asOptionholds them;datais raw octets, a mapping of the fields of the code’s data model, orNonefor the Pad and End options, andlengthis computed when not given.padding (
bytes) – Octets after the End option, or with none, an option the area ends inside, as_split_options()reads one.codes (
frozenset[int] |None) – The codes a mapping may build, orNonefor all.size (
int|None) – Octets the area fills, for an overloadedsnameorfile, orNonefor the options field.aggregate (
Iterable[Mapping[str,Any]] |None) – Every option of the message’s aggregate option buffer (RFC 3396 Section 5),optionsamong them, orNoneforoptionsalone.
- Return type:
- Returns:
The area’s octets.
- Raises:
ProtocolError – If an option is malformed; if its data is a mapping for a code
codesleaves out, or that the aggregate option buffer holds more than once, since RFC 3396 Section 7 reads such instances concatenated; ifpaddingfollows no End option yet is no option the area ends inside, which forsizehas to run to its end; or if the area does not fitsize.
- _read_dhcp_addresses(code, data)[source]¶
Read a run of IPv4 addresses.
- Parameters:
- Return type:
- Returns:
The addresses, in order.
- Raises:
ProtocolError – If
datais not a multiple of four octets.
- _read_dhcp_text(code, data)[source]¶
Read ASCII text.
- Parameters:
- Return type:
- Returns:
The text.
- Raises:
ProtocolError – If
datais not ASCII.
- _read_dhcp_uint(code, data, *, size)[source]¶
Read an unsigned integer, no less than the least its option takes.
- _read_dhcp_pairs(code, data)[source]¶
Read a run of IPv4 address pairs.
- Parameters:
- Return type:
- Returns:
The addresses, in order, two per pair.
- Raises:
ProtocolError – If
datais empty or not a multiple of eight octets.
- _read_dhcp_vectors(code, data)[source]¶
Read a run of vectors, each one octet of length and that many octets.
- _read_fqdn_name(code, data)[source]¶
Read the domain name of the Client FQDN option, in canonical wire format.
- Parameters:
- Return type:
- Returns:
The name in presentation form, ending in
.where the root label ends it, i.e. where it is fully qualified.- Raises:
ProtocolError – If a label is longer than 63 octets or runs past
data, or octets follow the root label.
- _read_dhcp_vendors(code, data)[source]¶
Read the per-vendor data of a Vendor-Identifying option (RFC 3925).
- _make_dhcp_text(code, value)[source]¶
Make ASCII text.
- Parameters:
- Return type:
- Returns:
Its octets.
- Raises:
ProtocolError – If
valueis no ASCIIstr.
- _make_dhcp_uint(code, value, *, size)[source]¶
Make an unsigned integer, no less than the least its option takes.
- _make_dhcp_vectors(code, vectors)[source]¶
Make a run of vectors, each one octet of length and that many octets.
- Parameters:
- Return type:
- Returns:
Their octets.
- Raises:
ProtocolError – If a vector is no octets or longer than 255.
- _make_fqdn_name(code, value)[source]¶
Make the domain name of the Client FQDN option, in canonical wire format.
- Parameters:
- Return type:
- Returns:
The name’s octets, the root label ending it where it is fully qualified.
- Raises:
ProtocolError – If
valueis nostr, or is malformed.
- _make_dhcp_vendors(code, vendors, body)[source]¶
Make the per-vendor data of a Vendor-Identifying option (RFC 3925).
- Parameters:
- Return type:
- Returns:
Option data.
- Raises:
ProtocolError – If
vendorsis empty, a vendor is no mapping, or its data is longer than 255 octets.
Header Schemas¶
- class pcapkit.protocols.application.dhcp.schema.DHCP(op=NO_VALUE, htype=NO_VALUE, hlen=NO_VALUE, hops=NO_VALUE, xid=NO_VALUE, secs=NO_VALUE, flags=NO_VALUE, ciaddr=NO_VALUE, yiaddr=NO_VALUE, siaddr=NO_VALUE, giaddr=NO_VALUE, chaddr=NO_VALUE, sname=NO_VALUE, file=NO_VALUE, options=NO_VALUE, payload=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for a BOOTP or DHCP message.
- flags: Flags = <BitField flags>¶
Flags (RFC 1542 Section 3.1.1).
- ciaddr: IPv4Address = <IPv4AddressField ciaddr>¶
Client IP address.
- yiaddr: IPv4Address = <IPv4AddressField yiaddr>¶
Your (client) IP address.
- siaddr: IPv4Address = <IPv4AddressField siaddr>¶
Next server IP address.
- giaddr: IPv4Address = <IPv4AddressField giaddr>¶
Relay agent IP address.
Type Stubs¶
Auxiliary Functions¶
Data Models¶
- class pcapkit.protocols.application.dhcp.data.Flags(broadcast, reserved)[source]¶
Bases:
DataData model for the header flags (RFC 1542 Section 3.1.1, RFC 2131 Section 2).
- class pcapkit.protocols.application.dhcp.data.Option(code, length, data)[source]¶
Bases:
DataData model for an option (RFC 2132 Section 2).
dataholds the decoded data where the option’s parser registers a decoder forcodeand reads it exactly, and the raw octets otherwise.- data: OptionData | bytes | None¶
Data, decoded or as raw octets;
Nonefor the Pad and End options.
- class pcapkit.protocols.application.dhcp.data.OverloadedField(options, padding)[source]¶
Bases:
DataData model for an
snameorfilefield holding options (RFC 2131 Section 4.1, RFC 2132 Section 9.3).
- class pcapkit.protocols.application.dhcp.data.SplitOption(code, length, data)[source]¶
Bases:
DataData model for an option a DHCP message carries more than once (RFC 3396 Section 7).
Its instances are one option, so
datais their data concatenated in the order of the aggregate option buffer (RFC 3396 Section 5), decoded once asOption.datais from one instance; each instance keeps its own octets.- data: OptionData | bytes¶
Data, decoded or as raw octets.
- class pcapkit.protocols.application.dhcp.data.DomainName(name, labels, literal, pointer)[source]¶
Bases:
DataData model for a domain name (RFC 1035 Section 3.1).
literalandpointerrecord how the name was written, so that it is rebuilt with the compression it was read with (RFC 1035 Section 4.1.4).
Option Data¶
- class pcapkit.protocols.application.dhcp.data.OptionData(*args, **kwargs)[source]¶
Bases:
DataData model for the decoded data of an option.
- class pcapkit.protocols.application.dhcp.data.Address(address)[source]¶
Bases:
OptionDataData model for an option carrying one IPv4 address.
- address: IPv4Address¶
The address.
- class pcapkit.protocols.application.dhcp.data.Addresses(addresses)[source]¶
Bases:
OptionDataData model for an option carrying a list of IPv4 addresses.
- addresses: tuple[IPv4Address, ...]¶
The addresses, in order of preference.
- class pcapkit.protocols.application.dhcp.data.Number(value)[source]¶
Bases:
OptionDataData model for an option carrying one integer.
- value: int¶
The integer, signed for the Time Offset option (RFC 2132 Section 3.4).
- class pcapkit.protocols.application.dhcp.data.Boolean(value)[source]¶
Bases:
OptionDataData model for an option carrying an octet of
0or1.
- class pcapkit.protocols.application.dhcp.data.Text(text)[source]¶
Bases:
OptionDataData model for an option carrying ASCII text (RFC 2132 Section 2).
- class pcapkit.protocols.application.dhcp.data.Sizes(sizes)[source]¶
Bases:
OptionDataData model for the Path MTU Plateau Table option (RFC 2132 Section 4.7).
- class pcapkit.protocols.application.dhcp.data.AddressMask(address, mask)[source]¶
Bases:
DataData model for an address and mask pair of the Policy Filter option.
- address: IPv4Address¶
Destination address.
- mask: IPv4Address¶
Its mask.
- class pcapkit.protocols.application.dhcp.data.PolicyFilter(filters)[source]¶
Bases:
OptionDataData model for the Policy Filter option (RFC 2132 Section 4.3).
- filters: tuple[AddressMask, ...]¶
Address and mask pairs.
- class pcapkit.protocols.application.dhcp.data.Route(destination, router)[source]¶
Bases:
DataData model for a destination and router pair of the Static Route option.
- destination: IPv4Address¶
Destination address.
- router: IPv4Address¶
Router.
- class pcapkit.protocols.application.dhcp.data.StaticRoutes(routes)[source]¶
Bases:
OptionDataData model for the Static Route option (RFC 2132 Section 5.8).
- class pcapkit.protocols.application.dhcp.data.NodeType(node_type)[source]¶
Bases:
OptionDataData model for the NetBIOS over TCP/IP Node Type option (RFC 2132 Section 8.7).
- class pcapkit.protocols.application.dhcp.data.Overload(file, sname)[source]¶
Bases:
OptionDataData model for the Option Overload option (RFC 2132 Section 9.3).
- class pcapkit.protocols.application.dhcp.data.MessageType(type)[source]¶
Bases:
OptionDataData model for the DHCP Message Type option (RFC 2132 Section 9.6).
- type: MessageType¶
Message type.
- class pcapkit.protocols.application.dhcp.data.ParameterList(codes)[source]¶
Bases:
OptionDataData model for the Parameter Request List option (RFC 2132 Section 9.8).
- class pcapkit.protocols.application.dhcp.data.ClientIdentifier(type, identifier)[source]¶
Bases:
OptionDataData model for the Client-identifier option (RFC 2132 Section 9.14).
- class pcapkit.protocols.application.dhcp.data.UserClass(classes)[source]¶
Bases:
OptionDataData model for the User Class option (RFC 3004 Section 4).
- class pcapkit.protocols.application.dhcp.data.FQDNFlags(n, e, o, s, mbz)[source]¶
Bases:
DataData model for the flags of the Client FQDN option (RFC 4702 Section 2.1).
- class pcapkit.protocols.application.dhcp.data.ClientFQDN(flags, rcode1, rcode2, name)[source]¶
Bases:
OptionDataData model for the Client FQDN option (RFC 4702 Section 2).
- name: str¶
Domain name, in presentation form where the
Eflag sets canonical wire format, ending in.where it is fully qualified, and else its ASCII text (RFC 4702 Section 2.3).
- class pcapkit.protocols.application.dhcp.data.RelayAgentSubOption(code, length, data)[source]¶
Bases:
DataData model for a sub-option of the Relay Agent Information option.
- code: RelayAgentSubOption¶
Sub-option code.
- class pcapkit.protocols.application.dhcp.data.RelayAgentInformation(suboptions)[source]¶
Bases:
OptionDataData model for the Relay Agent Information option (RFC 3046 Section 2.0).
- suboptions: tuple[RelayAgentSubOption, ...]¶
Sub-options, in order.
- class pcapkit.protocols.application.dhcp.data.ArchitectureTypes(types)[source]¶
Bases:
OptionDataData model for the Client System Architecture Type option (RFC 4578 Section 2.1).
- class pcapkit.protocols.application.dhcp.data.ClientNDI(type, major, minor)[source]¶
Bases:
OptionDataData model for the Client Network Interface Identifier option (RFC 4578 Section 2.2).
- class pcapkit.protocols.application.dhcp.data.MachineIdentifier(type, identifier)[source]¶
Bases:
OptionDataData model for the Client Machine Identifier option (RFC 4578 Section 2.3).
- class pcapkit.protocols.application.dhcp.data.DomainSearch(names)[source]¶
Bases:
OptionDataData model for the Domain Search option (RFC 3397 Section 2).
- names: tuple[DomainName, ...]¶
Domain names, in order.
- class pcapkit.protocols.application.dhcp.data.ClasslessRoute(destination, router)[source]¶
Bases:
DataData model for a route of the Classless Static Route option.
- destination: IPv4Network¶
Destination network.
- router: IPv4Address¶
Router.
- class pcapkit.protocols.application.dhcp.data.ClasslessStaticRoutes(routes)[source]¶
Bases:
OptionDataData model for the Classless Static Route option (RFC 3442 Section 2).
- routes: tuple[ClasslessRoute, ...]¶
Routes, in order.
- class pcapkit.protocols.application.dhcp.data.VendorClassEntry(enterprise, classes)[source]¶
Bases:
DataData model for one vendor’s data in the Vendor-Identifying Vendor Class option.
- class pcapkit.protocols.application.dhcp.data.VendorClass(vendors)[source]¶
Bases:
OptionDataData model for the Vendor-Identifying Vendor Class option (RFC 3925 Section 3).
- vendors: tuple[VendorClassEntry, ...]¶
Each vendor’s data.
- class pcapkit.protocols.application.dhcp.data.VendorOption(code, data)[source]¶
Bases:
DataData model for a sub-option of the Vendor-Identifying Vendor-Specific Information option.
- class pcapkit.protocols.application.dhcp.data.VendorOptions(enterprise, options)[source]¶
Bases:
DataData model for one vendor’s data in the Vendor-Identifying Vendor-Specific Information option.
- options: tuple[VendorOption, ...]¶
The vendor’s sub-options.
- class pcapkit.protocols.application.dhcp.data.VendorSpecific(vendors)[source]¶
Bases:
OptionDataData model for the Vendor-Identifying Vendor-Specific Information option (RFC 3925 Section 4).
- vendors: tuple[VendorOptions, ...]¶
Each vendor’s data.
Constants¶
- pcapkit.protocols.application.dhcp.const.HEADER_LENGTH = 236¶
Length of the fixed header,
opthroughfile(RFC 2131 Section 2).
- pcapkit.protocols.application.dhcp.const.CHADDR_LENGTH = 16¶
Length of the
chaddrfield.
- pcapkit.protocols.application.dhcp.const.SNAME_LENGTH = 64¶
Length of the
snamefield.
- pcapkit.protocols.application.dhcp.const.FILE_LENGTH = 128¶
Length of the
filefield.
- pcapkit.protocols.application.dhcp.const.MAGIC_COOKIE = b'c\x82Sc'¶
The magic cookie, 99.130.83.99, opening an option area (RFC 2132 Section 2).