src/java.base/share/classes/sun/security/ssl/Plaintext.java
branchJDK-8145252-TLS13-branch
changeset 56542 56aaa6cb3693
parent 47216 71c04702a3d5
equal deleted inserted replaced
56541:92cbbfc996f3 56542:56aaa6cb3693
     1 /*
     1 /*
     2  * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    32  * Plaintext
    32  * Plaintext
    33  */
    33  */
    34 final class Plaintext {
    34 final class Plaintext {
    35     static final Plaintext PLAINTEXT_NULL = new Plaintext();
    35     static final Plaintext PLAINTEXT_NULL = new Plaintext();
    36 
    36 
    37     byte            contentType;
    37     final byte       contentType;
    38     byte            majorVersion;
    38     final byte       majorVersion;
    39     byte            minorVersion;
    39     final byte       minorVersion;
    40     int             recordEpoch;    // incremented on every cipher state change
    40     final int        recordEpoch;     // increments on every cipher state change
    41     long            recordSN;       // contains epcoh number (epoch | sequence)
    41     final long       recordSN;        // epoch | sequence number
    42     ByteBuffer      fragment;       // null if need to be reassembled
    42     final ByteBuffer fragment;        // null if need to be reassembled
    43 
    43 
    44     HandshakeStatus handshakeStatus;    // null if not used or not handshaking
    44     HandshakeStatus  handshakeStatus; // null if not used or not handshaking
    45 
    45 
    46     Plaintext() {
    46     private Plaintext() {
    47         this.contentType = 0;
    47         this.contentType = 0;
    48         this.majorVersion = 0;
    48         this.majorVersion = 0;
    49         this.minorVersion = 0;
    49         this.minorVersion = 0;
    50         this.recordEpoch = -1;
    50         this.recordEpoch = -1;
    51         this.recordSN = -1;
    51         this.recordSN = -1;
    52         this.fragment = null;
    52         this.fragment = null;
    53         this.handshakeStatus = null;
    53         this.handshakeStatus = null;
    54     }
    54     }
    55 
    55 
    56     Plaintext(byte contentType, byte majorVersion, byte minorVersion,
    56     Plaintext(byte contentType,
       
    57             byte majorVersion, byte minorVersion,
    57             int recordEpoch, long recordSN, ByteBuffer fragment) {
    58             int recordEpoch, long recordSN, ByteBuffer fragment) {
    58 
    59 
    59         this.contentType = contentType;
    60         this.contentType = contentType;
    60         this.majorVersion = majorVersion;
    61         this.majorVersion = majorVersion;
    61         this.minorVersion = minorVersion;
    62         this.minorVersion = minorVersion;
    64         this.fragment = fragment;
    65         this.fragment = fragment;
    65 
    66 
    66         this.handshakeStatus = null;
    67         this.handshakeStatus = null;
    67     }
    68     }
    68 
    69 
       
    70     @Override
    69     public String toString() {
    71     public String toString() {
    70         return "contentType: " + contentType + "/" +
    72         return "contentType: " + contentType + "/" +
    71                "majorVersion: " + majorVersion + "/" +
    73                "majorVersion: " + majorVersion + "/" +
    72                "minorVersion: " + minorVersion + "/" +
    74                "minorVersion: " + minorVersion + "/" +
    73                "recordEpoch: " + recordEpoch + "/" +
    75                "recordEpoch: " + recordEpoch + "/" +