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

Method addfield

scapy/layers/sixlowpan.py:111–117  ·  view source on GitHub ↗

Add an internal value to a string

(self, pkt, s, val)

Source from the content-addressed store, hash-verified

109 self.length_of = length_of
110
111 def addfield(self, pkt, s, val):
112 """Add an internal value to a string"""
113 tmp_len = self.length_of(pkt)
114 if tmp_len == 0:
115 return s
116 internal = self.i2m(pkt, val)[-tmp_len:]
117 return s + struct.pack("!%ds" % tmp_len, internal)
118
119 def getfield(self, pkt, s):
120 tmp_len = self.length_of(pkt)

Callers

nothing calls this directly

Calls 1

i2mMethod · 0.45

Tested by

no test coverage detected