AcceptPolicy.java 1.33 KB
Newer Older
Matt Tucker's avatar
Matt Tucker committed
1 2 3 4 5
/**
 * $RCSfile$
 * $Revision$
 * $Date$
 *
6
 * Copyright (C) 2004 Jive Software. All rights reserved.
Matt Tucker's avatar
Matt Tucker committed
7
 *
8 9
 * This software is published under the terms of the GNU Public License (GPL),
 * a copy of which is included in this distribution.
Matt Tucker's avatar
Matt Tucker committed
10 11
 */

12
package org.jivesoftware.net;
Matt Tucker's avatar
Matt Tucker committed
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

/**
 * <p>Defines the rules that determine whether a connection should be
 * accepted or rejected based exclusively on the initial connection
 * parameters.</p>
 *
 * <p>Accept policies allow rejection of incoming connections based on IP
 * address (creating white and black lists), time of day, rate, etc. without
 * any knowledge of the underlying protocol. In most cases, a simple white/black
 * list of IP addresses in the global policy is sufficient.</p>
 *
 * @author Iain Shigeoka
 */
public interface AcceptPolicy {

    /**
     * <p>Evaluate if the given connection should be accepted or rejected.</p>
     *
     * <p>For AcceptPorts the accept policy should examine it's rules
     * for accepting and declining. If there is no corresponding rule
     * the global accept policy should be applied. If no rules for the
     * global accept policy apply, the connection should be rejected.</p>
     *
     * @param connection The connection to evaluate
     * @return True if the connection should be accepted, false otherwise
     */
    boolean evaluate(Connection connection);
}