(self, pkt)
| 2122 | return sec, usec # type: ignore |
| 2123 | |
| 2124 | def write_header(self, pkt): |
| 2125 | # type: (Optional[Union[Packet, bytes]]) -> None |
| 2126 | if not hasattr(self, 'linktype'): |
| 2127 | try: |
| 2128 | if pkt is None or isinstance(pkt, bytes): |
| 2129 | # Can't guess LL |
| 2130 | raise KeyError |
| 2131 | self.linktype = conf.l2types.layer2num[ |
| 2132 | pkt.__class__ |
| 2133 | ] |
| 2134 | except KeyError: |
| 2135 | msg = "%s: unknown LL type for %s. Using type 1 (Ethernet)" |
| 2136 | warning(msg, self.__class__.__name__, pkt.__class__.__name__) |
| 2137 | self.linktype = DLT_EN10MB |
| 2138 | self._write_header(pkt) |
| 2139 | |
| 2140 | def write_packet(self, |
| 2141 | packet, # type: Union[bytes, Packet] |
no test coverage detected