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

Class CharEnumField

scapy/fields.py:2649–2670  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2647
2648
2649class CharEnumField(EnumField[str]):
2650 def __init__(self,
2651 name, # type: str
2652 default, # type: str
2653 enum, # type: _EnumType[str]
2654 fmt="1s", # type: str
2655 ):
2656 # type: (...) -> None
2657 super(CharEnumField, self).__init__(name, default, enum, fmt)
2658 if self.i2s is not None:
2659 k = list(self.i2s)
2660 if k and len(k[0]) != 1:
2661 self.i2s, self.s2i = self.s2i, self.i2s
2662
2663 def any2i_one(self, pkt, x):
2664 # type: (Optional[Packet], str) -> str
2665 if len(x) != 1:
2666 if self.s2i:
2667 x = self.s2i[x]
2668 elif self.s2i_cb:
2669 x = self.s2i_cb(x)
2670 return x
2671
2672
2673class BitEnumField(_BitField[Union[List[int], int]], _EnumField[int]):

Callers 3

ReadyForQueryClass · 0.90
CloseClass · 0.90
DescribeClass · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…