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

Function _make_le

scapy/contrib/opc_da.py:254–274  ·  view source on GitHub ↗

Make all fields in a packet LE.

(pkt_cls)

Source from the content-addressed store, hash-verified

252
253
254def _make_le(pkt_cls):
255 """
256 Make all fields in a packet LE.
257 """
258 flds = [f.copy() for f in pkt_cls.fields_desc]
259 for f in flds:
260 if isinstance(f, _FieldContainer):
261 f = f.fld
262 if isinstance(f, UUIDField):
263 f.uuid_fmt = UUIDField.FORMAT_LE
264 elif isinstance(f, _PacketField):
265 f.cls = globals().get(f.cls.__name__ + "LE", f.cls)
266 elif not isinstance(f, StrField):
267 f.fmt = "<" + f.fmt.replace(">", "").replace("!", "")
268 f.struct = struct.Struct(f.fmt)
269
270 class LEPacket(pkt_cls):
271 fields_desc = flds
272 name = pkt_cls().name + " (LE)"
273 LEPacket.__name__ = pkt_cls.__name__ + "LE"
274 return LEPacket
275
276
277# Sub class for dissection

Callers 1

opc_da.pyFile · 0.85

Calls 3

replaceMethod · 0.80
copyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…