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.components;
021    
022    
023    import org.apache.directory.server.kerberos.shared.KerberosMessageType;
024    import org.apache.directory.server.kerberos.shared.messages.Encodable;
025    import org.apache.directory.server.kerberos.shared.messages.KerberosMessage;
026    import org.apache.directory.server.kerberos.shared.messages.value.HostAddress;
027    import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
028    
029    
030    /**
031     * Encrypted part of private messages.
032     * 
033     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
034     * @version $Rev: 589780 $, $Date: 2007-10-29 19:14:59 +0100 (Mon, 29 Oct 2007) $
035     */
036    public class EncKrbPrivPart extends KerberosMessage implements Encodable
037    {
038        private byte[] userData;
039        private KerberosTime timestamp; //optional
040        private Integer usec; //optional
041        private Integer sequenceNumber; //optional
042        private HostAddress senderAddress; //optional
043        private HostAddress recipientAddress; //optional
044    
045    
046        /**
047         * Creates a new instance of EncKrbPrivPart.
048         *
049         * @param userData
050         * @param timestamp
051         * @param usec
052         * @param sequenceNumber
053         * @param senderAddress
054         * @param recipientAddress
055         */
056        public EncKrbPrivPart( byte[] userData, KerberosTime timestamp, Integer usec, Integer sequenceNumber,
057            HostAddress senderAddress, HostAddress recipientAddress )
058        {
059            super( KerberosMessageType.ENC_PRIV_PART );
060    
061            this.userData = userData;
062            this.timestamp = timestamp;
063            this.usec = usec;
064            this.sequenceNumber = sequenceNumber;
065            this.senderAddress = senderAddress;
066            this.recipientAddress = recipientAddress;
067        }
068    
069    
070        /**
071         * Returns the recipient {@link HostAddress}.
072         *
073         * @return The recipient {@link HostAddress}.
074         */
075        public HostAddress getRecipientAddress()
076        {
077            return recipientAddress;
078        }
079    
080    
081        /**
082         * Returns the sender {@link HostAddress}.
083         *
084         * @return The sender {@link HostAddress}.
085         */
086        public HostAddress getSenderAddress()
087        {
088            return senderAddress;
089        }
090    
091    
092        /**
093         * Returns the sequence number.
094         *
095         * @return The sequence number.
096         */
097        public Integer getSequenceNumber()
098        {
099            return sequenceNumber;
100        }
101    
102    
103        /**
104         * Returns the {@link KerberosTime} timestamp.
105         *
106         * @return The {@link KerberosTime} timestamp.
107         */
108        public KerberosTime getTimestamp()
109        {
110            return timestamp;
111        }
112    
113    
114        /**
115         * Returns the microsecond.
116         *
117         * @return The microsecond.
118         */
119        public Integer getMicroSecond()
120        {
121            return usec;
122        }
123    
124    
125        /**
126         * Returns the user data.
127         *
128         * @return The user data.
129         */
130        public byte[] getUserData()
131        {
132            return userData;
133        }
134    }