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

Method _compute_value

scapy/contrib/http2.py:617–633  ·  view source on GitHub ↗

Computes the value of this field based on the provided packet and the length_of field and the adjust callback :param packet.Packet pkt: the packet from which is computed this field value. # noqa: E501 :return: int: the computed value for this field. :raises: KeyErr

(self, pkt)

Source from the content-addressed store, hash-verified

615 return super(FieldUVarLenField, self).i2m(pkt, x)
616
617 def _compute_value(self, pkt):
618 # type: (packet.Packet) -> int
619 """ Computes the value of this field based on the provided packet and
620 the length_of field and the adjust callback
621
622 :param packet.Packet pkt: the packet from which is computed this field value. # noqa: E501
623 :return: int: the computed value for this field.
624 :raises: KeyError: the packet nor its payload do not contain an attribute
625 with the length_of name.
626 :raises: AssertionError
627 :raises: KeyError if _length_of is not one of pkt fields
628 """
629 fld, fval = pkt.getfield_and_val(self._length_of)
630 val = fld.i2len(pkt, fval)
631 ret = self._adjust(val)
632 assert ret >= 0
633 return ret
634
635###############################################################################
636# HPACK String Fields #

Callers 2

addfieldMethod · 0.95
i2mMethod · 0.95

Calls 2

getfield_and_valMethod · 0.45
i2lenMethod · 0.45

Tested by

no test coverage detected