@Override
	    void processOFMessage(ControllerChannelHandler h, OFMessage m)
		    throws IOException {
		switch (m.getType()) {
		    case HELLO:
			processOFHello(h, (OFHello) m);
			break;    
		    case ECHO_REPLY:
			break;
		    case ECHO_REQUEST:
			processOFEchoRequest(h, (OFEchoRequest) m);
			break;
		    case FEATURES_REQUEST:
			processOFFeaturesRequest(h, (OFFeaturesRequest) m);
			break;
		    case BARRIER_REQUEST:
			//TODO: actually implement barrier contract
			OFBarrierReply breply = new OFBarrierReply();
			breply.setXid(m.getXid());
			h.channel.write(Collections.singletonList(breply));
			break;
		    case SET_CONFIG:
		    case ERROR:
		    case PACKET_OUT:
		    case PORT_MOD:
		    case QUEUE_GET_CONFIG_REQUEST:
		    case STATS_REQUEST:    
		    case FLOW_MOD:
		    case GET_CONFIG_REQUEST:
			h.sw.handleIO(m);
			break;
		    case VENDOR:
			unhandledMessageReceived(h, m);
			break;
		    case FEATURES_REPLY:
		    case FLOW_REMOVED:
		    case PACKET_IN:
		    case PORT_STATUS:
		    case BARRIER_REPLY:
		    case GET_CONFIG_REPLY:
		    case STATS_REPLY:
		    case QUEUE_GET_CONFIG_REPLY:
			illegalMessageReceived(h, m);
			break;
		}
	    }
@Override
	    void processOFMessage(ControllerChannelHandler h, OFMessage m)
		    throws IOException {
		switch (m.getType()) {
		    case HELLO:
			processOFHello(h, (OFHello) m);
			break;    
		    case ECHO_REPLY:
			break;
		    case ECHO_REQUEST:
			processOFEchoRequest(h, (OFEchoRequest) m);
			break;
		    case FEATURES_REQUEST:
			processOFFeaturesRequest(h, (OFFeaturesRequest) m);
			break;
		    case BARRIER_REQUEST:
		
			OFBarrierReply breply = new OFBarrierReply();
			breply.setXid(m.getXid());
			h.channel.write(Collections.singletonList(breply));
			break;
		    case SET_CONFIG:
		    case ERROR:
		    case PACKET_OUT:
		    case PORT_MOD:
		    case QUEUE_GET_CONFIG_REQUEST:
		    case STATS_REQUEST:    
		    case FLOW_MOD:
		    case GET_CONFIG_REQUEST:
			h.sw.handleIO(m);
			break;
		    case VENDOR:
			unhandledMessageReceived(h, m);
			break;
		    case FEATURES_REPLY:
		    case FLOW_REMOVED:
		    case PACKET_IN:
		    case PORT_STATUS:
		    case BARRIER_REPLY:
		    case GET_CONFIG_REPLY:
		    case STATS_REPLY:
		    case QUEUE_GET_CONFIG_REPLY:
			illegalMessageReceived(h, m);
			break;
		}
	    }
@override void processofmessage(controllerchannelhandler h, ofmessage m) throws ioexception { switch (m.gettype()) { case hello: processofhello(h, (ofhello) m); break; case echo_reply: break; case echo_request: processofechorequest(h, (ofechorequest) m); break; case features_request: processoffeaturesrequest(h, (offeaturesrequest) m); break; case barrier_request: ofbarrierreply breply = new ofbarrierreply(); breply.setxid(m.getxid()); h.channel.write(collections.singletonlist(breply)); break; case set_config: case error: case packet_out: case port_mod: case queue_get_config_request: case stats_request: case flow_mod: case get_config_request: h.sw.handleio(m); break; case vendor: unhandledmessagereceived(h, m); break; case features_reply: case flow_removed: case packet_in: case port_status: case barrier_reply: case get_config_reply: case stats_reply: case queue_get_config_reply: illegalmessagereceived(h, m); break; } }