1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 * 19 */ 20 package org.apache.directory.shared.kerberos.messages; 21 22 23 import org.apache.directory.api.asn1.AbstractAsn1Object; 24 import org.apache.directory.shared.kerberos.KerberosConstants; 25 import org.apache.directory.shared.kerberos.KerberosMessageType; 26 27 28 /** 29 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 30 */ 31 public abstract class KerberosMessage extends AbstractAsn1Object 32 { 33 /** The protocol version (should be 5) */ 34 private int protocolVersionNumber = KerberosConstants.KERBEROS_V5; 35 36 /** The message type */ 37 private KerberosMessageType messageType; 38 39 40 /** 41 * Creates a new instance of KerberosMessage. 42 * 43 * @param type The message type 44 */ 45 public KerberosMessage( KerberosMessageType type ) 46 { 47 this( KerberosConstants.KERBEROS_V5, type ); 48 } 49 50 51 /** 52 * Creates a new instance of KerberosMessage. 53 * 54 * @param versionNumber 55 * @param type 56 */ 57 public KerberosMessage( int versionNumber, KerberosMessageType type ) 58 { 59 protocolVersionNumber = versionNumber; 60 messageType = type; 61 } 62 63 64 /** 65 * Returns the {@link org.apache.directory.server.kerberos.shared.KerberosMessageType}. 66 * 67 * @return The {@link org.apache.directory.server.kerberos.shared.KerberosMessageType}. 68 */ 69 public KerberosMessageType getMessageType() 70 { 71 return messageType; 72 } 73 74 75 /** 76 * Sets the {@link org.apache.directory.server.kerberos.shared.KerberosMessageType}. 77 * 78 * @param type 79 */ 80 public void setMessageType( KerberosMessageType type ) 81 { 82 messageType = type; 83 } 84 85 86 /** 87 * Returns the protocol version number. 88 * 89 * @return The protocol version number. 90 */ 91 public int getProtocolVersionNumber() 92 { 93 return protocolVersionNumber; 94 } 95 96 97 /** 98 * Sets the protocol version number. 99 * 100 * @param versionNumber 101 */ 102 public void setProtocolVersionNumber( int versionNumber ) 103 { 104 protocolVersionNumber = versionNumber; 105 } 106 }