<commit_before>package net.floodlightcontroller.offloading;


import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ScheduledExecutorService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.floodlightcontroller.core.IFloodlightProviderService;
import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.module.FloodlightModuleException;
import net.floodlightcontroller.core.module.IFloodlightModule;
import net.floodlightcontroller.core.module.IFloodlightService;
import net.floodlightcontroller.offloading.OffloadingProtocolServer;
// import net.floodlightcontroller.restserver.IRestApiService;
import net.floodlightcontroller.threadpool.IThreadPoolService;

public class OffloadingMaster implements IFloodlightModule, IFloodlightService {
	protected static Logger log = LoggerFactory.getLogger(OffloadingMaster.class);
	// protected IRestApiService restApi;

	// private IFloodlightProviderService floodlightProvider;
	private ScheduledExecutorService executor;
	
	//	private final AgentManager agentManager;

	// some defaults
	static private final int DEFAULT_PORT = 2819;
	
	public OffloadingMaster(){
		// clientManager = new ClientManager();
	}
	
	/**
     * Handle a ping from an agent. 
     * 
     * @param AgentAddr
     */
	void receivePing(final InetAddress agentAddr) {
		log.info("Ping message from: " + agentAddr);
	}
	
	
	//********* from IFloodlightModule **********//

	@Override
	public Collection<Class<? extends IFloodlightService>> getModuleServices() {<commit_msg>try to add a communication channel from floodlight to click<commit_after>package net.floodlightcontroller.offloading;


import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ScheduledExecutorService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.floodlightcontroller.core.IFloodlightProviderService;
import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.module.FloodlightModuleException;
import net.floodlightcontroller.core.module.IFloodlightModule;
import net.floodlightcontroller.core.module.IFloodlightService;
import net.floodlightcontroller.offloading.OffloadingProtocolServer;
// import net.floodlightcontroller.restserver.IRestApiService;
import net.floodlightcontroller.threadpool.IThreadPoolService;

public class OffloadingMaster implements IFloodlightModule, IFloodlightService {
	protected static Logger log = LoggerFactory.getLogger(OffloadingMaster.class);
	// protected IRestApiService restApi;

	// private IFloodlightProviderService floodlightProvider;
	private ScheduledExecutorService executor;
	private Socket agentSocket = null;
	private PrintWriter outBuf;
	
	//	private final AgentManager agentManager;

	// some defaults
	private final int AGENT_PORT = 6777;
	static private final int DEFAULT_PORT = 2819;
	
	public OffloadingMaster(){
		// clientManager = new ClientManager();
	}
	
	/**
     * Handle a ping from an agent. 
     * 
     * @param AgentAddr
     */
	void receivePing(final InetAddress agentAddr) {
		log.info("Ping message from: " + agentAddr);
		
		try {
			agentSocket = new Socket(agentAddr.getHostAddress(), AGENT_PORT);
			outBuf = new PrintWriter(agentSocket.getOutputStream(), true);
		} catch (UnknownHostException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		outBuf.println("ack");
	}
	
	//********* from IFloodlightModule **********//

	@Override
	public Collection<Class<? extends IFloodlightService>> getModuleServices() {
{'fraction_non_alphanumeric': 0.09439300411522633, 'fraction_numerical': 0.00411522633744856, 'mean_word_length': 5.591525423728814, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1920033', 'n_tokens_mistral': 1185, 'n_tokens_neox': 1099, 'n_words': 237}