2362N/A * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * A class to help abstract away SSLEngine writing synchronization. 0N/A * Outgoing handshake Data waiting for a ride is stored here. 0N/A * Normal application data is written directly into the outbound 0N/A * buffer, but handshake data can be written out at any time, 0N/A * so we have buffer it somewhere. 0N/A * When wrap is called, we first check to see if there is 0N/A * any data waiting, then if we're in a data transfer state, 0N/A * we try to write app data. 0N/A * This will contain either ByteBuffers, or the marker 0N/A * HandshakeStatus.FINISHED to signify that a handshake just completed. 0N/A /* Class and subclass dynamic debugging support */ 0N/A * Upper levels assured us we had room for at least one packet of data. 0N/A * As per the SSLEngine spec, we only return one SSL packets worth of 0N/A * If we have more data in the queue, it's either 0N/A * a finished message, or an indication that we need 0N/A * to call wrap again. 0N/A * Properly orders the output of the data written to the wrap call. 0N/A * This is only handshake data, application data goes through the 0N/A * other writeRecord. 0N/A * Only output if we're still open. 0N/A * Did our handshakers notify that we just sent the 0N/A * Add an "I'm finished" message to the queue. 0N/A * Output the packet info. 0N/A * Properly orders the output of the data written to the wrap call. 0N/A * Only app data goes through here, handshake data goes through 0N/A * the other writeRecord. 0N/A * Shouldn't expect to have an IOException here. 0N/A * Return any determined status. 0N/A * If we have data ready to go, output this first before 0N/A * trying to consume app data. 0N/A * We could have put the dump in 0N/A * OutputRecord.write(OutputStream), but let's actually 0N/A * output when it's actually output by the SSLEngine. 0N/A * If we are closed, no more app data can be output. 0N/A * Only existing handshake data (above) can be obtained. 0N/A * No way new outbound handshake data got here if we're 0N/A * We don't have any status we can return. 0N/A * We already hold "this" lock, this is the callback from the 0N/A * outputRecord.write() above. We already know this 0N/A * writer can accept more data (outboundClosed == false), 0N/A * and the closure is sync'd. 0N/A * This is for the really rare case that someone is writing from 0N/A * the *InputRecord* before we know what to do with it. 0N/A * Non-synch'd version of this method, called by internals