INNER CODE UNIT · Python
_parse_hs_types
wolfSSL/wolfssl · scripts/multi-msg-record.py:184
def _parse_hs_types(data):
"""Parse handshake message types from raw handshake content."""
msgs = []
off = 0
while off + 4 <= len(data):
ht = data[off]
hl = struct.unpack("!I", b"\x00" + bytes(data[off + 1 : off + 4]))[0]
msgs.append(HS_NAMES.get(ht, f"T{ht}"))
off += 4 + hl
return msgs
def _listen_socket():
"""Bind a listening TCP socket on localhost with the standard test timeout.
The port is read back from the socket that keeps it, rather than from a
throwaway one that is closed first: closing it leaves a window in which
anything else on the machine can take the port before the real bind.