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