class Controller {

    public void updateConfig(List<OspfProcess> ospfProcesses) throws Exception {
        log.debug("Controller::UpdateConfig called");
        configPacket = new byte[OspfUtil.CONFIG_LENGTH];
        byte numberOfInterface = 0; // number of interfaces to configure
        configPacket[0] = (byte) 0xFF; // its a conf packet - identifier
        for (OspfProcess ospfProcess : ospfProcesses) {
            log.debug("OspfProcessDetails : " + ospfProcess);
            for (OspfArea ospfArea : ospfProcess.areas()) {
                for (OspfInterface ospfInterface : ospfArea.ospfInterfaceList()) {
                    log.debug("OspfInterfaceDetails : " + ospfInterface);
                    numberOfInterface++;
                    configPacket[2 * numberOfInterface] = (byte) ospfInterface.interfaceIndex();
                    configPacket[(2 * numberOfInterface) + 1] = (byte) 4;
                }
            }
        }
        configPacket[1] = numberOfInterface;
        //First time configuration
        if (processes == null) {
            if (ospfProcesses.size() > 0) {
                processes = ospfProcesses;
                connectPeer();
            }
        } else {
            ospfChannelHandler.updateInterfaceMap(ospfProcesses);
            //Send the config packet
            ospfChannelHandler.sentConfigPacket(configPacket);
        }
    }

}