MCPcopy Index your code
hub / github.com/secdev/scapy / write_header

Method write_header

scapy/utils.py:2124–2138  ·  view source on GitHub ↗
(self, pkt)

Source from the content-addressed store, hash-verified

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]

Callers 2

closeMethod · 0.80
writeMethod · 0.80

Calls 2

_write_headerMethod · 0.95
warningFunction · 0.90

Tested by

no test coverage detected