MCPcopy Index your code
hub / github.com/secdev/scapy / decode

Method decode

scapy/contrib/sdnv.py:59–74  ·  view source on GitHub ↗
(self, ba, offset)

Source from the content-addressed store, hash-verified

57 return foo
58
59 def decode(self, ba, offset):
60 number = 0
61 numBytes = 1
62
63 b = ba[offset]
64 number = (b & 0x7F)
65 while (b & 0x80 == 0x80):
66 number = number << 7
67 if (number > self.maxValue):
68 raise SDNVValueError(self.maxValue)
69 b = ba[offset + numBytes]
70 number += (b & 0x7F)
71 numBytes += 1
72 if (number > self.maxValue):
73 raise SDNVValueError(self.maxValue)
74 return number, numBytes
75
76
77SDNVUtil = SDNV()

Callers 15

decode_locale_strFunction · 0.80
_read_block_pibMethod · 0.80
read_packetMethod · 0.80
_guess_linktype_nameFunction · 0.80
i2hMethod · 0.80
i2reprMethod · 0.80
_commandMethod · 0.80
_gitFunction · 0.80
plain_strFunction · 0.80
sendpfastFunction · 0.80
_npcap_setMethod · 0.80
_npcap_getMethod · 0.80

Calls 1

SDNVValueErrorClass · 0.85

Tested by

no test coverage detected