You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
const: generalise register_alias from AppType to every pcapkit.const enum #842
Split out of #838 at the maintainer's direction. His framing, verbatim:
register_alias is an API on each Enum, and it only touches the concrete Enum
class it serves; AppType is the exception where it must goes to the underlying
transport protocol registry Enum class.
In this case, ETH will become an alias to IANA's default ETHERNET name and is
only register_alias'ed when PyShark being used. We might also check other PDML
attributes to extend other Wireshark's display-filter names as well.
Today it is bespoke to one registry.register_alias exists only on AppType (pcapkit/const/reg/apptype/apptype.py, from #807). Its docstring scopes
itself deliberately to the per-transport port registry: TCP.register_alias(...) must
never touch UDP, so an alias registered on one transport cannot leak onto a transport
IANA never assigned it. It mints through extend_enum, which is the caller-named path #775 deliberately preserves.
The design questions this has to answer:
What does "this registry alone" mean for an enum that is not per-transport? On AppType the boundary is the transport class; elsewhere there is no analogue, so
the generalised contract needs stating rather than inheriting.
AppType's override routes to the underlying transport registry. What is the hook
that lets one registry opt into different routing without the template knowing
about it?
Which other Wireshark display-filter names are worth aliasing, and from which PDML
attribute are they read? pyshark/packet/layers/xml_layer.py takes the layer name
from <proto name=…>; the maintainer suggests other attributes may carry more.
Not blocking #838, which carries a trivial local fix for the eth case per the
same ruling.
Split out of #838 at the maintainer's direction. His framing, verbatim:
Today it is bespoke to one registry.
register_aliasexists only onAppType(pcapkit/const/reg/apptype/apptype.py, from #807). Its docstring scopesitself deliberately to the per-transport port registry:
TCP.register_alias(...)mustnever touch
UDP, so an alias registered on one transport cannot leak onto a transportIANA never assigned it. It mints through
extend_enum, which is the caller-named path#775 deliberately preserves.
The design questions this has to answer:
AppTypethe boundary is the transport class; elsewhere there is no analogue, sothe generalised contract needs stating rather than inheriting.
register_aliasbelong in the shared template(
pcapkit/vendor/default.py), giving all 105 generated registries the method, oronly where a caller needs it? The shared template reaches 26 registries directly;
the other 79 carry their own
process()or template — see Registries mint a permanent member for every unrecognised value: 1,169 extend_enum sites across 113 registries #775's census.AppType's override routes to the underlying transport registry. What is the hookthat lets one registry opt into different routing without the template knowing
about it?
ETHshould only exist while pyshark is in use. What registersit, when, and does anything unregister it — a process-wide alias that outlives the
engine that wanted it is the same class of surprise Registries mint a permanent member for every unrecognised value: 1,169 extend_enum sites across 113 registries #775 removed.
attribute are they read?
pyshark/packet/layers/xml_layer.pytakes the layer namefrom
<proto name=…>; the maintainer suggests other attributes may carry more.Not blocking #838, which carries a trivial local fix for the
ethcase per thesame ruling.