/****************************************************************
 * Licensed to the Apache Software Foundation (ASF) under one   *
 * or more contributor license agreements.  See the NOTICE file *
 * distributed with this work for additional information        *
 * regarding copyright ownership.  The ASF licenses this file   *
 * to you under the Apache License, Version 2.0 (the            *
 * "License"); you may not use this file except in compliance   *
 * with the License.  You may obtain a copy of the License at   *
 *                                                              *
 *   http://www.apache.org/licenses/LICENSE-2.0                 *
 *                                                              *
 * Unless required by applicable law or agreed to in writing,   *
 * software distributed under the License is distributed on an  *
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
 * KIND, either express or implied.  See the License for the    *
 * specific language governing permissions and limitations      *
 * under the License.                                           *
 ****************************************************************/

package org.apache.james.smtpserver;

import java.util.Map;

import org.apache.commons.logging.Log;

/**
 * All the handlers access this interface to communicate with
 * SMTPHandler object
 */

public interface SMTPSession {

    // Keys used to store/lookup data in the internal state hash map
    public final static String SENDER = "SENDER_ADDRESS";     // Sender's email address
    public final static String RCPT_LIST = "RCPT_LIST";   // The message recipients
    public final static String CURRENT_HELO_MODE = "CURRENT_HELO_MODE"; // HELO or EHLO
    public final static String CURRENT_HELO_NAME = "CURRENT_HELO_NAME"; 
    public final static String SESSION_STATE_MAP = "SESSION_STATE_MAP"; // the Session state 

    /**
     * Returns host name of the client
     *
     * @return hostname of the client
     */
    String getRemoteHost();

    /**
     * Returns host ip address of the client
     *
     * @return host ip address of the client
     */
    String getRemoteIPAddress();

    /**
     * Returns Map that consists of the state of the SMTPSession per mail
     *
     * @return map of the current SMTPSession state per mail
     */
    Map<String, Object> getState();

    /**
     * Resets message-specific, but not authenticated user, state.
     *
     */
    void resetState();

    /**
     * Returns the service wide hello name
     *
     * @return the hello name
     */
    String getHelloName();
    
    /**
     * Returns whether the remote server needs to send a HELO/EHLO
     * of its senders.
     *
     * @return whether SMTP authentication is on
     */
    boolean useHeloEhloEnforcement();
    
    /**
     * Return the SMTPGreeting which should used.
     * 
     * @return the SMTPGreeting
     */
    String getSMTPGreeting();
    
    /**
     * Returns the service wide maximum message size in bytes.
     *
     * @return the maximum message size
     */
    long getMaxMessageSize();
    
    /**
     * Return wheter the mailserver will accept addresses without brackets enclosed.
     * 
     * @return true or false
     */
    boolean useAddressBracketsEnforcement();
    
    /**
     * Returns whether Relaying is allowed or not
     *
     * @return the relaying status
     */
    boolean isRelayingAllowed();
    
    /**
     * Set if reallying is allowed
     * 
     * @param relayingAllowed
     */
    void setRelayingAllowed(boolean relayingAllowed);

    /**
     * Returns whether Authentication is required or not
     *
     * @return authentication required or not
     */
    boolean isAuthSupported();

    /**
     * Returns the user name associated with this SMTP interaction.
     *
     * @return the user name
     */
    String getUser();

    /**
     * Sets the user name associated with this SMTP interaction.
     *
     * @param user the user name
     */
    void setUser(String user);

    /**
     * Returns the SMTP session id
     *
     * @return SMTP session id
     */
    String getSessionID();
    
    /**
     * Returns the recipient count
     * 
     * @return recipient count
     */
    int getRcptCount();
    
    /**
     * Returns Map that consists of the state of the SMTPSession per connection
     *
     * @return map of the current SMTPSession state per connection
     */
    Map<String,Object> getConnectionState();

    /**
     * Put a new line handler in the chain
     * @param overrideCommandHandler
     */
    void pushLineHandler(LineHandler overrideCommandHandler);
    
    /**
     * Pop the last command handler 
     */
    void popLineHandler();

    /**
     * Write an SMTPResponse to the client
     */
    void writeSMTPResponse(SMTPResponse response);
    
    /**
     * Sleep for the given ms 
     * 
     * @param ms the time to sleep in milliseconds
     */
    void sleep(long ms);
    
    /**
     * Gets the context sensitive log for this session.
     * @return log, not null
     */
    Log getLogger();
}


@@ -1478,16 +1478,50 @@
 ash map%0A
+    /** Sender's email address */%0A
     publ
@@ -1573,38 +1573,42 @@
 SS%22;
- 
+%0A
     /
-/ Sender's email address
+** The message recipients */
 %0A   
@@ -1665,34 +1665,32 @@
 %22;  
- // The message recipients
+%0A    /** HELO or EHLO */
 %0A   
@@ -1761,24 +1761,8 @@
 DE%22;
- // HELO or EHLO
 %0A   
@@ -1829,17 +1829,45 @@
 O_NAME%22;
- 
+%0A    /** the Session state */
 %0A    pub
@@ -1934,30 +1934,8 @@
 AP%22;
- // the Session state 
 %0A%0A  

Convert comments to java docs