MCPcopy Create free account
hub / github.com/secdev/scapy / i2m

Method i2m

scapy/contrib/http2.py:602–615  ·  view source on GitHub ↗

:param packet.Packet|None pkt: the packet instance containing this field instance. This parameter must not be # noqa: E501 None if the x parameter is. :param int|None x: the positive or null value to be added. If None, the value is computed from pkt. # noqa: E501

(self, pkt, x)

Source from the content-addressed store, hash-verified

600 return super(FieldUVarLenField, self).addfield(pkt, s, val)
601
602 def i2m(self, pkt, x):
603 # type: (Optional[packet.Packet], Optional[int]) -> str
604 """
605 :param packet.Packet|None pkt: the packet instance containing this field instance. This parameter must not be # noqa: E501
606 None if the x parameter is.
607 :param int|None x: the positive or null value to be added. If None, the value is computed from pkt. # noqa: E501
608 :return: str
609 :raises: AssertionError
610 """
611 if x is None:
612 assert isinstance(pkt, packet.Packet), \
613 'EINVAL: pkt: Packet expected when x is None; received {}'.format(type(pkt)) # noqa: E501
614 x = self._compute_value(pkt)
615 return super(FieldUVarLenField, self).i2m(pkt, x)
616
617 def _compute_value(self, pkt):
618 # type: (packet.Packet) -> int

Callers

nothing calls this directly

Calls 3

_compute_valueMethod · 0.95
formatMethod · 0.45
i2mMethod · 0.45

Tested by

no test coverage detected