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

Method encode

scapy/contrib/sdnv.py:41–57  ·  view source on GitHub ↗
(self, number)

Source from the content-addressed store, hash-verified

39 return self.maxValue
40
41 def encode(self, number):
42 if number > self.maxValue:
43 raise SDNVValueError(self.maxValue)
44
45 foo = bytearray()
46 foo.append(number & 0x7F)
47 number = number >> 7
48
49 while (number > 0):
50 thisByte = number & 0x7F
51 thisByte |= 0x80
52 number = number >> 7
53 temp = bytearray()
54 temp.append(thisByte)
55 foo = temp + foo
56
57 return foo
58
59 def decode(self, ba, offset):
60 number = 0

Callers 15

write_packetMethod · 0.80
_guess_linktype_valueFunction · 0.80
whoisFunction · 0.80
h2iMethod · 0.80
pushMethod · 0.80
high_pushMethod · 0.80
_printMethod · 0.80
_startMethod · 0.80
_resolve_oneMethod · 0.80
resolveMethod · 0.80
bytes_encodeFunction · 0.80
loadFunction · 0.80

Calls 2

SDNVValueErrorClass · 0.85
appendMethod · 0.45

Tested by

no test coverage detected