FTP Constant Enumerations¶
This module contains all constant enumerations of
FTP implementations. Available
enumerations include:
FTP Command¶
This module contains the constant enumeration for FTP Command, which is
automatically generated from pcapkit.vendor.ftp.command.Command, plus the
companion FEATCode enumeration it also declares –
the FEAT response keywords the FEAT code column of the same IANA registry
names, c.f., RFC 5797 Section 3.
- class pcapkit.const.ftp.command.Command(*values)[source]¶
Bases:
EnumRegistry,StrEnum[Command] FTP Command
Changed in version 1.5.0: Neither
_missing_norget()mints a member. The owner ruled on GitHub issue #860 thatgetshould not mint: only IANA-registered values are legitimate members, a new one is properly created throughregister(), andgetis not given enough information to create one. Concretely true here – a bare wire command word carries nofeat/desc/type/conf, so a minted member had all four hollowed out to their defaults;register()is the path that can actually supply them.- feat: FEATCode | None¶
Feature code. Keyword returned in FEAT response line for this command/extension, c.f., RFC 5797 Section 2.2.
- type: CommandType¶
Type of “kind” of command, based on RFC 959 Section 4.
- conf: ConformanceRequirement¶
Expectation for support in modern FTP implementations.
- ALGS: Command = 'ALGS'¶
FTP64 ALG status [RFC 6384 Section 11]
- classmethod _unregistered_member(value, name)[source]¶
Build a member absent from this registry’s own lookup tables.
Leaves
feat,desc,typeandconfat the same defaults__new__()itself would, rather than missing entirely –_unregistered_member()bypasses__new__()(it callsstr’s directly), so those four attributes would otherwise be absent and__repr__()(which readsdesc) would raise on the result. There is no more specific value to reconstruct them from – a bare wire command word carries none of the four, which is exactly the owner’s reasoning for whyget()/_missing_must not mint one:register()is the path that can actually supply them.- Parameters:
value (
str) – Value to get enum item – the convention here, shared withFEATCodeandMethod, is the caller’s own casing, unchanged: an unregistered member’s value is exactly what was observed on the wire, matching how a registered member’s own value is exactly what was declared, never reformatted. Onlyname– the identifier, not the value – is canonicalised.name (
str) – Bare label for the unregistered member – here, the canonical upper-case form ofvalue, matching the name every registered member of this class is looked up by, since #860’s open-vocabulary registries have no manufactured placeholder label to fall back to.
- Return type:
- classmethod register(value, name)[source]¶
Register a new command
valueundername, upper-cased.get()and_missing_()look a command up by its upper-case name, sonameis canonicalised to upper case here beforeregister()mints it.valueis kept as given, as a declared member’s value is.- Parameters:
- Return type:
- Returns:
The newly registered member.
- Raises:
ValueError – As
register().
- classmethod register_alias(value, name)[source]¶
Add
name, upper-cased, as a further name for the member atvalue.Canonicalised for the same reason as
register(), so thatget()finds the alias.- Parameters:
- Return type:
- Returns:
The existing member, now reachable under the upper-cased
nameas well.- Raises:
ValueError – As
register_alias().
- classmethod _validate_value(value)[source]¶
Reject
valueunless it is astr, as_missing_()does.Overrides
_validate_value()with the check_missing_()makes, and the message it raises, soregister()refuses a value the constructor refuses, in the same words (#1816).get()reaches it as well, through the base, for every non-strkey (#1824), so it refuses the same values. Anystrpasses, since_missing_()resolves every one.- Parameters:
value (
Any) – Value about to be looked up or minted.- Raises:
EnumValueError – If
valueis not astr. AValueError, so anexcept ValueErrorcaller is unaffected.
- static _generate_next_value_(name, start, count, last_values)¶
Return the lower-cased version of the member name.
- class pcapkit.const.ftp.command.FEATCode(*values)[source]¶
Bases:
EnumRegistry,StrEnumKeyword returned in FEAT response line for this command/extension, c.f., RFC 5797 Section 3.
Note
Declares every FEAT keyword the IANA registry’s own
FEAT codecolumn names – the 5 group markers below plus the per-command keywords generated after them (data-driven, not hand-picked; seeprocess()) – rather than minting the per-command ones at import time as an incidental side effect of buildingCommand’s own rows. GitHub issue #860: that import-time mutation was the same defect shape #775 removed fromFilterType._missing_still unmints for a keyword that turns up on the wire but names none of these – the extendability the owner conditionally asked to keep on GitHub issue #860: unsure what a FEAT value absent from the RFC’s list means in the CSV table, the owner said that if the expected handling is our current approach, as industry convention has it, the registry stays extendable as is, and then approved declaring the registry’s keywords as real members with_missing_still covering the rest. No custom__new__here, so the base’s generic_unregistered_member()needs no override.- classmethod get(key, default=<NO_DEFAULT>)[source]¶
Resolve
keycase-insensitively, per RFC 5797 Section 2.One of the few case-insensitive overrides the ruling on GitHub issue #877 allows, and the registry’s own defining document states the comparison rule outright rather than leaving it to be inferred – RFC 5797 Section 2, on the
FEAT Codecolumn this class is generated from: “IANA maintains uniqueness of feature names (FEAT codes) based on case-insensitive comparison.” Two FEAT codes therefore cannot differ only by case, so folding the caller’s key cannot resolve ambiguously.RFC 2389 Section 3.2, which defines the
FEATresponse the codes appear in, points the same way from the wire side: “The feature-label and feature-parms are nominally case sensitive, however … it is to be expected that those definitions will usually specify the label and parameters in a case independent manner. Where this is done, implementations are recommended to use upper case letters when transmitting the feature response.” A caller feeding aFEATresponse line is therefore holding upper case by recommendation, while 5 of this registry’s 15 codes are registered in lower case – measured on the IANA CSV: 10 distinct all-upper-case keywords againstbase,feat,hist,nat6andsecu, with none mixed. Without this overrideget('BASE')raisedKeyError, which is the defect GitHub issue #903’s audit found.The obvious objection, answered: RFC 5797 uses case presentationally to tell a real keyword from a placeholder – “defined FEAT keywords codes are listed in all uppercase, whereas placeholder keywords … are listed in lowercase” – so folding might look like it discards that distinction. It does not. Only the inbound
keyis folded; every member keeps the registrar’s own casing, and the fold itself is backed by the RFC: the final ruling on GitHub issue #877 is that an enum treats its values as case-insensitive where the RFC states they are, and as case-sensitive otherwise. Soget('BASE').nameis still'base'and still says placeholder. And the uniqueness rule quoted above is what makes that safe: a real keywordBASEcould not be registered alongside the placeholderbase, so there is no second member for the fold to hide.Folds only as a fallback. An exact name or value hit is delegated to
get()untouched, so the base’s own precedence – name before value – and its non-mintingstrpath both survive: nothing here callscls(key), so a key matching no member, folded or not, still raises rather than growing the registry.get('ZZ-NOT-REAL')therefore still raisesKeyErrorwhileFEATCode('ZZ-NOT-REAL')still yields an unregistered member, exactly as before.- Parameters:
- Return type:
- Returns:
The canonical member for
key, or fordefault.- Raises:
KeyError – If no member matches
keyexactly or case-insensitively and there is no usabledefault.ValueError – As
get(), for a non-strkey.
- classmethod _validate_value(value)[source]¶
Reject
valueunless it is astr, as_missing_()does.Overrides
_validate_value()with the check_missing_()makes, and the message it raises, soregister()refuses exactly the valuesget()refuses, in the same words (#1816). Anystrpasses, since_missing_()resolves every one.- Parameters:
value (
Any) – Value about to be looked up or minted.- Raises:
EnumValueError – If
valueis not astr. AValueError, so anexcept ValueErrorcaller is unaffected.
- static _generate_next_value_(name, start, count, last_values)¶
Return the lower-cased version of the member name.
FTP Server Return Code¶
This module contains the constant enumeration for FTP Server Return Code,
which is automatically generated from pcapkit.vendor.ftp.return_code.ReturnCode.
- class pcapkit.const.ftp.return_code.ReturnCode(*values)[source]¶
Bases:
EnumRegistry,IntEnum[ReturnCode] FTP Server Return Code
- kind: ResponseKind¶
Response kind.
- group: GroupingInformation¶
Grouping information.
- CODE_110: ReturnCode = 110¶
Restart marker replay. In this case, the text is exact and not left to the particular implementation; it must read: MARK yyyy = mmmm where yyyy is User-process data stream marker, and mmmm server’s equivalent marker (note the spaces between markers and “=”).
- CODE_120: ReturnCode = 120¶
Service ready in nnn minutes.
- CODE_125: ReturnCode = 125¶
Data connection already open; transfer starting.
- CODE_150: ReturnCode = 150¶
File status okay; about to open data connection.
- CODE_202: ReturnCode = 202¶
Command not implemented, superfluous at this site.
- CODE_211: ReturnCode = 211¶
System status, or system help reply.
- CODE_212: ReturnCode = 212¶
Directory status.
- CODE_213: ReturnCode = 213¶
File status.
- CODE_214: ReturnCode = 214¶
Help message. Explains how to use the server or the meaning of a particular non-standard command. This reply is useful only to the human user.
- CODE_215: ReturnCode = 215¶
NAME system type. Where NAME is an official system name from the registry kept by IANA.
- CODE_220: ReturnCode = 220¶
Service ready for new user.
- CODE_221: ReturnCode = 221¶
Service closing control connection. Logged out if appropriate.
- CODE_225: ReturnCode = 225¶
Data connection open; no transfer in progress.
- CODE_226: ReturnCode = 226¶
Closing data connection. Requested file action successful (for example, file transfer or file abort).
- CODE_227: ReturnCode = 227¶
Entering Passive Mode (h1,h2,h3,h4,p1,p2).
- CODE_228: ReturnCode = 228¶
Entering Long Passive Mode (long address, port).
- CODE_229: ReturnCode = 229¶
Entering Extended Passive Mode ( |||port| ).
- CODE_230: ReturnCode = 230¶
User logged in, proceed.
- CODE_232: ReturnCode = 232¶
User logged in, authorized by security data exchange.
- CODE_234: ReturnCode = 234¶
Server accepts the security mechanism specified by the client; no security data needs to be exchanged.
- CODE_235: ReturnCode = 235¶
Server accepts the security data given by the client; no further security data needs to be exchanged.
- CODE_250: ReturnCode = 250¶
Requested file action was okay, completed.
- CODE_331: ReturnCode = 331¶
User name okay, password needed.
- CODE_332: ReturnCode = 332¶
No need account for login.
- CODE_334: ReturnCode = 334¶
Server accepts the security mechanism specified by the client; some security data needs to be exchanged.
- CODE_335: ReturnCode = 335¶
Server accepts the security data given by the client; more security data needs to be exchanged.
- CODE_336: ReturnCode = 336¶
Username okay, password okay. Challenge is “… . “.
- CODE_421: ReturnCode = 421¶
Service NOT available, closing control connection. This may be a reply to any command if the service knows it must shut down.
- CODE_425: ReturnCode = 425¶
Can’t open data connection.
- CODE_426: ReturnCode = 426¶
Connection closed; transfer aborted.
- CODE_430: ReturnCode = 430¶
Invalid username or password
- CODE_431: ReturnCode = 431¶
Need some unavailable resource to process security.
- CODE_434: ReturnCode = 434¶
Requested host unavailable.
- CODE_450: ReturnCode = 450¶
Requested file action not taken. File unavailable (e.g., file busy).
- CODE_451: ReturnCode = 451¶
Requested action aborted. Local error in processing.
- CODE_452: ReturnCode = 452¶
Requested action not taken. Insufficient storage space in system.
- CODE_501: ReturnCode = 501¶
Syntax error in parameters or arguments.
- CODE_502: ReturnCode = 502¶
Command not implemented.
- CODE_503: ReturnCode = 503¶
Bad sequence of commands.
- CODE_504: ReturnCode = 504¶
Command not implemented for that parameter.
- CODE_530: ReturnCode = 530¶
Not logged in.
- CODE_532: ReturnCode = 532¶
Need account for storing files.
- CODE_533: ReturnCode = 533¶
Command protection level denied for policy reasons.
- CODE_534: ReturnCode = 534¶
Request denied for policy reasons.
- CODE_535: ReturnCode = 535¶
Failed security check.
- CODE_536: ReturnCode = 536¶
Data protection level not supported by security mechanism.
- CODE_537: ReturnCode = 537¶
Command protection level not supported by security mechanism.
- CODE_550: ReturnCode = 550¶
Requested action not taken. File unavailable (e.g., file not found, no access).
- CODE_551: ReturnCode = 551¶
Requested action aborted. Page type unknown.
- CODE_552: ReturnCode = 552¶
Requested file action aborted. Exceeded storage allocation (for current directory or dataset).
- CODE_553: ReturnCode = 553¶
Requested action not taken. File name not allowed.
- CODE_631: ReturnCode = 631¶
Integrity protected reply.
- CODE_632: ReturnCode = 632¶
Confidentiality and integrity protected reply.
- CODE_633: ReturnCode = 633¶
Confidentiality protected reply.
- classmethod _unregistered_member(value, name)[source]¶
Build a member absent from this registry’s own lookup tables.
Reconstructs
description,kindandgroupthe same way__new__()would, rather than leaving them unset –_unregistered_member()bypasses__new__()entirely (it callsint’s directly), so those three attributes would otherwise be missing from the result and__str__()/__repr__()would raise on it.- Parameters:
- Return type:
- classmethod _validate_value(value)[source]¶
Reject
valueunless it is a three-digit reply code.Overrides
_validate_value()with the range check_missing_()makes, and the message it raises, soregister()refuses exactly the valuesget()refuses, in the same words (#1816). That range is0-999rather than the registry’s own, since_missing_()resolves a code outside the registry toUnknownrather than refusing it.- Parameters:
value (
Any) – Value about to be looked up or minted.- Raises:
EnumValueError – If
valueis not anintin0-999. AValueError, so anexcept ValueErrorcaller is unaffected.
- classmethod _missing_(value)[source]¶
Lookup function used when value is not found.
A reply code is three digits (RFC 959 Section 4.2), so every value from 0 to 999 can arrive on the wire: one within the registry’s range resolves to
Unassigned, any other toUnknown.- Parameters:
value (
int) – Value to get enum item.- Return type:
Footnotes