(self,
_pkt=b"", # type: Union[bytes, bytearray]
post_transform=None, # type: Any
_internal=0, # type: int
_underlayer=None, # type: Optional[Packet]
_parent=None, # type: Optional[Packet]
stop_dissection_after=None, # type: Optional[Type[Packet]]
**fields # type: Any
)
| 146 | ) |
| 147 | |
| 148 | def __init__(self, |
| 149 | _pkt=b"", # type: Union[bytes, bytearray] |
| 150 | post_transform=None, # type: Any |
| 151 | _internal=0, # type: int |
| 152 | _underlayer=None, # type: Optional[Packet] |
| 153 | _parent=None, # type: Optional[Packet] |
| 154 | stop_dissection_after=None, # type: Optional[Type[Packet]] |
| 155 | **fields # type: Any |
| 156 | ): |
| 157 | # type: (...) -> None |
| 158 | self.time = time.time() # type: Union[EDecimal, float] |
| 159 | self.sent_time = None # type: Union[EDecimal, float, None] |
| 160 | self.name = (self.__class__.__name__ |
| 161 | if self._name is None else |
| 162 | self._name) |
| 163 | self.default_fields = {} # type: Dict[str, Any] |
| 164 | self.overload_fields = self._overload_fields |
| 165 | self.overloaded_fields = {} # type: Dict[str, Any] |
| 166 | self.fields = {} # type: Dict[str, Any] |
| 167 | self.fieldtype = {} # type: Dict[str, AnyField] |
| 168 | self.packetfields = [] # type: List[AnyField] |
| 169 | self.payload = NoPayload() # type: Packet |
| 170 | self.init_fields(bool(_pkt)) |
| 171 | self.underlayer = _underlayer |
| 172 | self.parent = _parent |
| 173 | if isinstance(_pkt, bytearray): |
| 174 | _pkt = bytes(_pkt) |
| 175 | self.original = _pkt |
| 176 | self.explicit = 0 |
| 177 | self.raw_packet_cache = None # type: Optional[bytes] |
| 178 | self.raw_packet_cache_fields = None # type: Optional[Dict[str, Any]] # noqa: E501 |
| 179 | self.wirelen = None # type: Optional[int] |
| 180 | self.direction = None # type: Optional[int] |
| 181 | self.sniffed_on = None # type: Optional[_GlobInterfaceType] |
| 182 | self.comments = None # type: Optional[List[bytes]] |
| 183 | self.process_information = None # type: Optional[Dict[str, Any]] |
| 184 | self.stop_dissection_after = stop_dissection_after |
| 185 | if _pkt: |
| 186 | self.dissect(_pkt) |
| 187 | if not _internal: |
| 188 | self.dissection_done(self) |
| 189 | # We use this strange initialization so that the fields |
| 190 | # are initialized in their declaration order. |
| 191 | # It is required to always support MultipleTypeField |
| 192 | for field in self.fields_desc: |
| 193 | fname = field.name |
| 194 | try: |
| 195 | value = fields.pop(fname) |
| 196 | except KeyError: |
| 197 | continue |
| 198 | self.fields[fname] = value if isinstance(value, RawVal) else \ |
| 199 | self.get_field(fname).any2i(self, value) |
| 200 | # The remaining fields are unknown |
| 201 | for fname in fields: |
| 202 | if fname in self.deprecated_fields: |
| 203 | # Resolve deprecated fields |
| 204 | value = fields[fname] |
| 205 | fname = self._resolve_alias(fname) |
nothing calls this directly
no test coverage detected