madkit.netcomm.rules
Class ConnectionRules

java.lang.Object
  extended by madkit.netcomm.rules.ConnectionRules

public final class ConnectionRules
extends java.lang.Object

Contains a set of rules to accept, reject or refuse incomming connections. WarnningThe Default Rule accepts all incomming connections. Warnning If madkit.netcomm.rules is defined, the rules will be loaded from the file and all parameters will be disregarded.

Version:
$Revision: 1.2 $
Author:
Sebastian Rodriguez - sebastian.rodriguez@utbm.fr

Constructor Summary
ConnectionRules()
          Creates a new ConnectionRule with an empty rule set and Rule.ACCEPT as the default action
ConnectionRules(java.util.Collection rules)
          Creates a new ConnectionRule with rules as the rule set and Rule.ACCEPT as the default action
ConnectionRules(int action, java.lang.Object arg)
          Creates a new ConnectionRule with an empty rule set and action as the default action
ConnectionRules(int action, java.lang.Object arg, java.util.Collection rules)
          Creates a new Connectionrule with action as the default's rule action, and rules as the rules set.
 
Method Summary
 Rule getDefaultConnectionRule()
          gets the Default connection rule.
static ConnectionRules getInstance()
           
 Rule getRule(java.lang.String host)
          Finds the firts rule that matches host.
 void printRules()
           
 void setDefaultConnectionRuleAction(int action, java.lang.Object arg)
          Sets the action for the default action rule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionRules

public ConnectionRules()
Creates a new ConnectionRule with an empty rule set and Rule.ACCEPT as the default action


ConnectionRules

public ConnectionRules(int action,
                       java.lang.Object arg)
Creates a new ConnectionRule with an empty rule set and action as the default action

Parameters:
action -
arg -

ConnectionRules

public ConnectionRules(java.util.Collection rules)
Creates a new ConnectionRule with rules as the rule set and Rule.ACCEPT as the default action

Parameters:
rules -

ConnectionRules

public ConnectionRules(int action,
                       java.lang.Object arg,
                       java.util.Collection rules)
Creates a new Connectionrule with action as the default's rule action, and rules as the rules set.

Parameters:
action - default action
arg - default rule argument
rules - rules set.
Method Detail

setDefaultConnectionRuleAction

public void setDefaultConnectionRuleAction(int action,
                                           java.lang.Object arg)
Sets the action for the default action rule.

Parameters:
action - action
arg - argument.

getDefaultConnectionRule

public Rule getDefaultConnectionRule()
gets the Default connection rule.

Returns:
default rule.

getRule

public Rule getRule(java.lang.String host)
Finds the firts rule that matches host. If no rule is found, the defualt rule is returned.

Parameters:
host -
Returns:
the rule to apply.

getInstance

public static ConnectionRules getInstance()

printRules

public void printRules()


Copyright © Madkit Team (O. Gutknecht, J. Ferber, F. Michel et al.) All Rights Reserved.