org.gregoire.portknock.server
Class Server

java.lang.Object
  extended byorg.gregoire.portknock.server.Server
Direct Known Subclasses:
AsyncServerImpl, NIOServerImpl

public abstract class Server
extends java.lang.Object

Abstract server from which all other servers should extend.

Version:
0.0.1
Author:
Paul Gregoire

Field Summary
protected  java.lang.String host
           
protected  java.util.LinkedList list
           
protected static Logger logger
           
protected  int port
           
protected  int portDelay
           
protected  int[] ports
           
static java.lang.String REGEX_IPADDRESS
           
protected  int timeout
           
protected  java.lang.String type
           
 
Constructor Summary
Server(java.lang.String type)
           
 
Method Summary
static long getClientTimeout()
          Returns the ammount of time in milliseconds that a client will be kept active in the knock list.
 java.net.InetAddress getInetAddress(java.lang.String hostName)
          Utility method that will return an InetAddress for a given host name or IP address string.
 java.lang.String getType()
          Returns the servers type, currently this consists of either "sequence" for sequenced handling or "dummy" used for intrusion or port scan detection.
abstract  void init()
          Initializes the server.
abstract  void listen()
          Accept connections for current server.
static void setClientTimeout(long cTimeout)
          Sets the ammount of time in milliseconds that a client will be kept active in the knock list.
 void setHost(java.lang.String host)
          Sets the host name or IP address to listen on.
 void setPort(int port)
          Sets the final port to open.
 void setPortDelay(int portDelay)
          Sets time that the server will listen to follow on ports.
 void setPorts(int[] ports)
          Sets the ports to open.
 void setSocketTimeout(int timeout)
          Sets timeout for all sockets created
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

protected java.lang.String type

host

protected java.lang.String host

port

protected int port

ports

protected int[] ports

timeout

protected int timeout

portDelay

protected int portDelay

REGEX_IPADDRESS

public static final java.lang.String REGEX_IPADDRESS
See Also:
Constant Field Values

logger

protected static Logger logger

list

protected java.util.LinkedList list
Constructor Detail

Server

public Server(java.lang.String type)
Method Detail

init

public abstract void init()
                   throws java.io.IOException
Initializes the server.

Throws:
java.io.IOException

listen

public abstract void listen()
Accept connections for current server.


setHost

public void setHost(java.lang.String host)
Sets the host name or IP address to listen on.

Parameters:
host -

setPort

public void setPort(int port)
Sets the final port to open. If this is a sequence server it will only open the port if the sequence is completed correctly and in the specified ammount of time.

Parameters:
port -

setPorts

public void setPorts(int[] ports)
Sets the ports to open. If this is a sequence server it will only open the first port initially and if it is a dummy server it will open all given ports.

Parameters:
ports -

setSocketTimeout

public void setSocketTimeout(int timeout)
Sets timeout for all sockets created

Parameters:
timeout - socket timeout

setClientTimeout

public static void setClientTimeout(long cTimeout)
Sets the ammount of time in milliseconds that a client will be kept active in the knock list.


setPortDelay

public void setPortDelay(int portDelay)
Sets time that the server will listen to follow on ports.

Parameters:
portDelay - time that threads wait listening on follow on ports

getType

public java.lang.String getType()
Returns the servers type, currently this consists of either "sequence" for sequenced handling or "dummy" used for intrusion or port scan detection.

Returns:

getClientTimeout

public static long getClientTimeout()
Returns the ammount of time in milliseconds that a client will be kept active in the knock list.

Returns:
long

getInetAddress

public java.net.InetAddress getInetAddress(java.lang.String hostName)
Utility method that will return an InetAddress for a given host name or IP address string.

Parameters:
hostName - host name or IP address string
Returns:
InetAddress


Copyright © Paul Gregoire, All Rights Reserved.