001/*
002 * Copyright 2012-2019 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 2015-2019 Ping Identity Corporation
007 *
008 * This program is free software; you can redistribute it and/or modify
009 * it under the terms of the GNU General Public License (GPLv2 only)
010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
011 * as published by the Free Software Foundation.
012 *
013 * This program is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016 * GNU General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with this program; if not, see <http://www.gnu.org/licenses>.
020 */
021package com.unboundid.ldap.sdk.unboundidds.logs;
022
023
024
025import com.unboundid.util.NotMutable;
026import com.unboundid.util.ThreadSafety;
027import com.unboundid.util.ThreadSafetyLevel;
028
029
030
031/**
032 * This class provides a data structure that holds information about a log
033 * message that may appear in the Directory Server access log about a form of
034 * security negotiation performed on a client connection.
035 * <BR>
036 * <BLOCKQUOTE>
037 *   <B>NOTE:</B>  This class, and other classes within the
038 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
039 *   supported for use against Ping Identity, UnboundID, and
040 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
041 *   for proprietary functionality or for external specifications that are not
042 *   considered stable or mature enough to be guaranteed to work in an
043 *   interoperable way with other types of LDAP servers.
044 * </BLOCKQUOTE>
045 */
046@NotMutable()
047@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
048public final class SecurityNegotiationAccessLogMessage
049       extends AccessLogMessage
050{
051  /**
052   * The serial version UID for this serializable class.
053   */
054  private static final long serialVersionUID = -8588250275523891216L;
055
056
057
058  // The negotiated cipher suite.
059  private final String cipher;
060
061  // The negotiated protocol.
062  private final String protocol;
063
064
065
066  /**
067   * Creates a new security negotiation access log message from the provided
068   * message string.
069   *
070   * @param  s  The string to be parsed as a security negotiation access log
071   *            message.
072   *
073   * @throws  LogException  If the provided string cannot be parsed as a valid
074   *                        log message.
075   */
076  public SecurityNegotiationAccessLogMessage(final String s)
077         throws LogException
078  {
079    this(new LogMessage(s));
080  }
081
082
083
084  /**
085   * Creates a new security negotiation log message from the provided log
086   * message.
087   *
088   * @param  m  The log message to be parsed as a connect access log message.
089   */
090  public SecurityNegotiationAccessLogMessage(final LogMessage m)
091  {
092    super(m);
093
094    protocol = getNamedValue("protocol");
095    cipher   = getNamedValue("cipher");
096  }
097
098
099
100  /**
101   * Retrieves the name of the security protocol that was negotiated.
102   *
103   * @return  The name of the security protocol that was negotiated.
104   */
105  public String getProtocol()
106  {
107    return protocol;
108  }
109
110
111
112  /**
113   * Retrieves the name of the cipher suite that was negotiated.
114   *
115   * @return  The name of the cipher suite that was negotiated.
116   */
117  public String getCipher()
118  {
119    return cipher;
120  }
121
122
123
124  /**
125   * {@inheritDoc}
126   */
127  @Override()
128  public AccessLogMessageType getMessageType()
129  {
130    return AccessLogMessageType.SECURITY_NEGOTIATION;
131  }
132}