org.openflow.example
Class SimpleController

java.lang.Object
  extended by org.openflow.example.SimpleController
All Implemented Interfaces:
SelectListener

public class SimpleController
extends java.lang.Object
implements SelectListener

Author:
Rob Sherwood (rob.sherwood@stanford.edu), David Erickson (daviderickson@cs.stanford.edu), Srini Seetharaman (srini.seetharaman@gmail.com)

Nested Class Summary
protected  class SimpleController.OFSwitch
           
 
Field Summary
protected  java.util.concurrent.ExecutorService es
           
protected  BasicFactory factory
           
protected  SelectLoop listenSelectLoop
           
protected  java.nio.channels.ServerSocketChannel listenSock
           
protected  int port
           
protected  java.util.List<SelectLoop> switchSelectLoops
           
protected  java.util.Map<java.nio.channels.SocketChannel,SimpleController.OFSwitch> switchSockets
           
protected  java.lang.Integer threadCount
           
 
Constructor Summary
SimpleController(int port)
           
 
Method Summary
 void handleEvent(java.nio.channels.SelectionKey key, java.lang.Object arg)
          Tell the select listener that an event took place on the passed object
protected  void handleListenEvent(java.nio.channels.SelectionKey key, java.nio.channels.ServerSocketChannel ssc)
           
protected  void handleSwitchEvent(java.nio.channels.SelectionKey key, java.nio.channels.SocketChannel sock)
           
static void main(java.lang.String[] args)
           
static SimpleCLI parseArgs(java.lang.String[] args)
           
static void printUsage(Options options)
           
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

es

protected java.util.concurrent.ExecutorService es

factory

protected BasicFactory factory

listenSelectLoop

protected SelectLoop listenSelectLoop

listenSock

protected java.nio.channels.ServerSocketChannel listenSock

switchSelectLoops

protected java.util.List<SelectLoop> switchSelectLoops

switchSockets

protected java.util.Map<java.nio.channels.SocketChannel,SimpleController.OFSwitch> switchSockets

threadCount

protected java.lang.Integer threadCount

port

protected int port
Constructor Detail

SimpleController

public SimpleController(int port)
                 throws java.io.IOException
Throws:
java.io.IOException
Method Detail

handleEvent

public void handleEvent(java.nio.channels.SelectionKey key,
                        java.lang.Object arg)
                 throws java.io.IOException
Description copied from interface: SelectListener
Tell the select listener that an event took place on the passed object

Specified by:
handleEvent in interface SelectListener
Parameters:
key - the key used on the select
arg - some parameter passed by the caller when registering
Throws:
java.io.IOException

handleListenEvent

protected void handleListenEvent(java.nio.channels.SelectionKey key,
                                 java.nio.channels.ServerSocketChannel ssc)
                          throws java.io.IOException
Throws:
java.io.IOException

handleSwitchEvent

protected void handleSwitchEvent(java.nio.channels.SelectionKey key,
                                 java.nio.channels.SocketChannel sock)

run

public void run()
         throws java.io.IOException
Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Throws:
java.io.IOException

parseArgs

public static SimpleCLI parseArgs(java.lang.String[] args)

printUsage

public static void printUsage(Options options)