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

Method addfield

scapy/layers/dcerpc.py:2470–2480  ·  view source on GitHub ↗
(self, pkt, s, val)

Source from the content-addressed store, hash-verified

2468 )
2469
2470 def addfield(self, pkt, s, val):
2471 fmt = _e(pkt.ndrendian) + self.switch_fmt[pkt.ndr64]
2472 if not isinstance(val, NDRUnion):
2473 raise ValueError(
2474 "Expected NDRUnion in %s. You are using it wrong!" % self.name
2475 )
2476 _set_ctx_on(val.value, pkt)
2477 # First, align the whole tag+union against the align param
2478 s = NDRAlign(Field("", 0, fmt=fmt), align=self.align).addfield(pkt, s, val.tag)
2479 # Then, compute the subfield with its own alignment
2480 return super(_NDRUnionField, self).addfield(pkt, s, val)
2481
2482 def _find_fld_pkt_val(self, pkt, val):
2483 fld, val = super(_NDRUnionField, self)._find_fld_pkt_val(pkt, val)

Callers

nothing calls this directly

Calls 5

FieldClass · 0.90
_eFunction · 0.85
_set_ctx_onFunction · 0.85
NDRAlignClass · 0.85
addfieldMethod · 0.45

Tested by

no test coverage detected