| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | private int maxReceiveDelay; |
| | | private int maxSendDelay; |
| | | private int windowSize; |
| | | private boolean handshakeOnly; |
| | | private ServerState serverState = null; |
| | | |
| | | /** |
| | |
| | | * @param generationId The generationId for this server. |
| | | * @param sslEncryption Whether to continue using SSL to encrypt messages |
| | | * after the start messages have been exchanged. |
| | | * @param handshakeOnly Whether this message is only to get an handshake |
| | | * with the server or not. |
| | | */ |
| | | public ServerStartMessage(short serverId, DN baseDn, int maxReceiveDelay, |
| | | int maxReceiveQueue, int maxSendDelay, |
| | |
| | | ServerState serverState, |
| | | short protocolVersion, |
| | | long generationId, |
| | | boolean sslEncryption) |
| | | boolean sslEncryption, |
| | | boolean handshakeOnly) |
| | | { |
| | | super(protocolVersion, generationId); |
| | | |
| | |
| | | this.heartbeatInterval = heartbeatInterval; |
| | | this.sslEncryption = sslEncryption; |
| | | this.serverState = serverState; |
| | | this.handshakeOnly = handshakeOnly; |
| | | |
| | | try |
| | | { |
| | |
| | | sslEncryption = Boolean.valueOf(new String(in, pos, length, "UTF-8")); |
| | | pos += length +1; |
| | | |
| | | |
| | | /* |
| | | * read the handshakeOnly flag |
| | | */ |
| | | length = getNextLength(in, pos); |
| | | handshakeOnly = Boolean.valueOf(new String(in, pos, length, "UTF-8")); |
| | | pos += length +1; |
| | | |
| | | /* |
| | | * read the ServerState |
| | | */ |
| | | serverState = new ServerState(in, pos, in.length-1); |
| | | |
| | | } catch (UnsupportedEncodingException e) |
| | | { |
| | | throw new DataFormatException("UTF-8 is not supported by this jvm."); |
| | |
| | | byte[] byteSSLEncryption = |
| | | String.valueOf(sslEncryption).getBytes("UTF-8"); |
| | | byte[] byteServerState = serverState.getBytes(); |
| | | byte[] byteHandshakeOnly = |
| | | String.valueOf(handshakeOnly).getBytes("UTF-8"); |
| | | |
| | | int length = byteDn.length + 1 + byteServerId.length + 1 + |
| | | byteServerUrl.length + 1 + |
| | |
| | | byteWindowSize.length + 1 + |
| | | byteHeartbeatInterval.length + 1 + |
| | | byteSSLEncryption.length + 1 + |
| | | byteHandshakeOnly.length + 1 + |
| | | byteServerState.length + 1; |
| | | |
| | | /* encode the header in a byte[] large enough to also contain the mods */ |
| | |
| | | |
| | | pos = addByteArray(byteSSLEncryption, resultByteArray, pos); |
| | | |
| | | pos = addByteArray(byteHandshakeOnly, resultByteArray, pos); |
| | | |
| | | pos = addByteArray(byteServerState, resultByteArray, pos); |
| | | |
| | | return resultByteArray; |
| | |
| | | { |
| | | return sslEncryption; |
| | | } |
| | | |
| | | /** |
| | | * Get the SSL encryption value for the ldap server that created the |
| | | * message. |
| | | * |
| | | * @return The SSL encryption value for the ldap server that created the |
| | | * message. |
| | | */ |
| | | public boolean isHandshakeOnly() |
| | | { |
| | | return handshakeOnly; |
| | | } |
| | | } |