1
# Copyright 2010 The Go Authors. All rights reserved.
2
# Use of this source code is governed by a BSD-style
3
# license that can be found in the LICENSE file.
5
# This code is used to parse the debug log from gnutls-cli and generate a
6
# script of the handshake. This script is included in handshake_server_test.go.
7
# See the comments there for details.
18
for line in sys.stdin.readlines():
20
if line.startswith("|<7>| WRITE: "):
21
if currentBlockType != WRITE:
22
if len(currentBlock) > 0:
23
blocks.append(currentBlock)
25
currentBlockType = WRITE
26
elif line.startswith("|<7>| READ: "):
27
if currentBlockType != READ:
28
if len(currentBlock) > 0:
29
blocks.append(currentBlock)
31
currentBlockType = READ
32
elif line.startswith("|<7>| 0"):
37
currentBlock.append(int(b, 16))
38
elif line.startswith("|<7>| RB-PEEK: Read 1 bytes"):
39
currentBlock = currentBlock[:-1]
41
if len(currentBlock) > 0:
42
blocks.append(currentBlock)
45
sys.stdout.write("\t{\n")
50
sys.stdout.write("\t\t")
51
sys.stdout.write("0x%02x," % b)
53
sys.stdout.write("\n")
57
sys.stdout.write("\n\t},\n\n")