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

Method addfield

scapy/contrib/http2.py:77–88  ·  view source on GitHub ↗

:param packet.Packet|None pkt: the packet instance containing this field instance; probably unused. # noqa: E501 :param str|(str, int, long) s: either a str if 0 == size%8 or a tuple with the string to add this field to, the # noqa: E501 number of bits already generated

(self, pkt, s, val)

Source from the content-addressed store, hash-verified

75 super(HPackMagicBitField, self).__init__(name, default, size)
76
77 def addfield(self, pkt, s, val):
78 # type: (Optional[packet.Packet], Union[str, Tuple[str, int, int]], int) -> Union[str, Tuple[str, int, int]] # noqa: E501
79 """
80 :param packet.Packet|None pkt: the packet instance containing this field instance; probably unused. # noqa: E501
81 :param str|(str, int, long) s: either a str if 0 == size%8 or a tuple with the string to add this field to, the # noqa: E501
82 number of bits already generated and the generated value so far.
83 :param int val: unused; must be equal to default value
84 :return: str|(str, int, long): the s string extended with this field machine representation # noqa: E501
85 :raises: AssertionError
86 """
87 assert val == self._magic, 'val parameter must value {}; received: {}'.format(self._magic, val) # noqa: E501
88 return super(HPackMagicBitField, self).addfield(pkt, s, self._magic)
89
90 def getfield(self, pkt, s):
91 # type: (Optional[packet.Packet], Union[str, Tuple[str, int]]) -> Tuple[Union[Tuple[str, int], str], int] # noqa: E501

Callers

nothing calls this directly

Calls 2

formatMethod · 0.45
addfieldMethod · 0.45

Tested by

no test coverage detected