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

Class NDRUnionField

scapy/layers/dcerpc.py:2501–2513  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2499
2500
2501class NDRUnionField(NDRConstructedType, _NDRUnionField):
2502 def __init__(self, flds, dflt, align, switch_fmt):
2503 _NDRUnionField.__init__(self, flds, dflt, align=align, switch_fmt=switch_fmt)
2504 NDRConstructedType.__init__(self, [x[0] for x in flds] + [dflt])
2505
2506 def any2i(self, pkt, x):
2507 # User-friendly helper
2508 if x:
2509 if not isinstance(x, NDRUnion):
2510 raise ValueError("Invalid value for %s; should be NDRUnion" % self.name)
2511 else:
2512 x.value = _NDRUnionField.any2i(self, pkt, x)
2513 return x
2514
2515
2516# Misc

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…