001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied. See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 *
019 */
020 package org.apache.directory.server.kerberos.shared.messages;
021
022 import org.apache.directory.server.kerberos.shared.KerberosConstants;
023 import org.apache.directory.server.kerberos.shared.KerberosMessageType;
024
025
026 /**
027 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
028 * @version $Rev: 642496 $, $Date: 2008-03-29 05:09:22 +0200 (Sat, 29 Mar 2008) $
029 */
030 public class KerberosMessage
031 {
032 /**
033 * The Kerberos protocol version number (5).
034 */
035 public static final int PVNO = KerberosConstants.KERBEROS_V5;
036
037 private int protocolVersionNumber;
038 private KerberosMessageType messageType;
039
040
041 /**
042 * Creates a new instance of KerberosMessage.
043 *
044 * @param type
045 */
046 public KerberosMessage( KerberosMessageType type )
047 {
048 this( PVNO, type );
049 }
050
051
052 /**
053 * Creates a new instance of KerberosMessage.
054 *
055 * @param versionNumber
056 * @param type
057 */
058 public KerberosMessage( int versionNumber, KerberosMessageType type )
059 {
060 protocolVersionNumber = versionNumber;
061 messageType = type;
062 }
063
064
065 /**
066 * Returns the {@link org.apache.directory.server.kerberos.shared.KerberosMessageType}.
067 *
068 * @return The {@link org.apache.directory.server.kerberos.shared.KerberosMessageType}.
069 */
070 public KerberosMessageType getMessageType()
071 {
072 return messageType;
073 }
074
075
076 /**
077 * Sets the {@link org.apache.directory.server.kerberos.shared.KerberosMessageType}.
078 *
079 * @param type
080 */
081 public void setMessageType( KerberosMessageType type )
082 {
083 messageType = type;
084 }
085
086
087 /**
088 * Returns the protocol version number.
089 *
090 * @return The protocol version number.
091 */
092 public int getProtocolVersionNumber()
093 {
094 return protocolVersionNumber;
095 }
096
097
098 /**
099 * Sets the protocol version number.
100 *
101 * @param versionNumber
102 */
103 public void setProtocolVersionNumber( int versionNumber )
104 {
105 protocolVersionNumber = versionNumber;
106 }
107 }