| # Copyright 2010 The Go Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style |
| # license that can be found in the LICENSE file. |
| # This code is used to parse the debug log from gnutls-cli and generate a |
| # script of the handshake. This script is included in handshake_server_test.go. |
| # See the comments there for details. |
| for line in sys.stdin.readlines(): |
| if line.startswith("|<7>| WRITE: "): |
| if currentBlockType != WRITE: |
| if len(currentBlock) > 0: |
| blocks.append(currentBlock) |
| elif line.startswith("|<7>| READ: "): |
| if currentBlockType != READ: |
| if len(currentBlock) > 0: |
| blocks.append(currentBlock) |
| elif line.startswith("|<7>| 0"): |
| currentBlock.append(int(b, 16)) |
| if len(currentBlock) > 0: |
| blocks.append(currentBlock) |
| sys.stdout.write("\t{\n") |
| sys.stdout.write("0x%02x," % b) |
| sys.stdout.write("\n\t},\n\n") |