001 /*
002 * Copyright 2012-2015 UnboundID Corp.
003 * All Rights Reserved.
004 */
005 /*
006 * Copyright (C) 2015 UnboundID Corp.
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 */
021 package com.unboundid.ldap.sdk.unboundidds.logs;
022
023
024
025 import com.unboundid.util.NotMutable;
026 import com.unboundid.util.ThreadSafety;
027 import com.unboundid.util.ThreadSafetyLevel;
028
029
030
031 /**
032 * <BLOCKQUOTE>
033 * <B>NOTE:</B> This class is part of the Commercial Edition of the UnboundID
034 * LDAP SDK for Java. It is not available for use in applications that
035 * include only the Standard Edition of the LDAP SDK, and is not supported for
036 * use in conjunction with non-UnboundID products.
037 * </BLOCKQUOTE>
038 * This class provides a data structure that holds information about a log
039 * message that may appear in the Directory Server access log about a form of
040 * security negotiation performed on a client connection.
041 */
042 @NotMutable()
043 @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
044 public final class SecurityNegotiationAccessLogMessage
045 extends AccessLogMessage
046 {
047 /**
048 * The serial version UID for this serializable class.
049 */
050 private static final long serialVersionUID = -8588250275523891216L;
051
052
053
054 // The negotiated cipher suite.
055 private final String cipher;
056
057 // The negotiated protocol.
058 private final String protocol;
059
060
061
062 /**
063 * Creates a new security negotiation access log message from the provided
064 * message string.
065 *
066 * @param s The string to be parsed as a security negotiation access log
067 * message.
068 *
069 * @throws LogException If the provided string cannot be parsed as a valid
070 * log message.
071 */
072 public SecurityNegotiationAccessLogMessage(final String s)
073 throws LogException
074 {
075 this(new LogMessage(s));
076 }
077
078
079
080 /**
081 * Creates a new security negotiation log message from the provided log
082 * message.
083 *
084 * @param m The log message to be parsed as a connect access log message.
085 */
086 public SecurityNegotiationAccessLogMessage(final LogMessage m)
087 {
088 super(m);
089
090 protocol = getNamedValue("protocol");
091 cipher = getNamedValue("cipher");
092 }
093
094
095
096 /**
097 * Retrieves the name of the security protocol that was negotiated.
098 *
099 * @return The name of the security protocol that was negotiated.
100 */
101 public String getProtocol()
102 {
103 return protocol;
104 }
105
106
107
108 /**
109 * Retrieves the name of the cipher suite that was negotiated.
110 *
111 * @return The name of the cipher suite that was negotiated.
112 */
113 public String getCipher()
114 {
115 return cipher;
116 }
117
118
119
120 /**
121 * {@inheritDoc}
122 */
123 @Override()
124 public AccessLogMessageType getMessageType()
125 {
126 return AccessLogMessageType.SECURITY_NEGOTIATION;
127 }
128 }