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

Method i2m

scapy/contrib/bgp.py:116–121  ·  view source on GitHub ↗

Internal" (IP as bytes, mask as int) to "machine" representation.

(self, pkt, i)

Source from the content-addressed store, hash-verified

114 return self.mask2iplen(mask) + 1
115
116 def i2m(self, pkt, i):
117 """"Internal" (IP as bytes, mask as int) to "machine"
118 representation."""
119 mask, ip = i
120 ip = socket.inet_aton(ip)
121 return struct.pack(">B", mask) + ip[:self.mask2iplen(mask)]
122
123 def addfield(self, pkt, s, val):
124 return s + self.i2m(pkt, val)

Callers 1

addfieldMethod · 0.95

Calls 1

mask2iplenMethod · 0.95

Tested by

no test coverage detected