<commit_before>/**
 * Copyright (c) 2011, 2014 Eurotech and/or its affiliates
 *
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  which accompanies this distribution, and is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Eurotech
 */
package org.eclipse.kura.net;

import java.util.List;
import java.util.Map;

import org.eclipse.kura.KuraException;
import org.eclipse.kura.net.firewall.FirewallNatConfig;
import org.eclipse.kura.net.firewall.FirewallOpenPortConfigIP;
import org.eclipse.kura.net.firewall.FirewallPortForwardConfigIP;
import org.eclipse.kura.net.wifi.WifiAccessPoint;
import org.eclipse.kura.net.wifi.WifiConfig;
import org.eclipse.kura.net.wifi.WifiHotspotInfo;

/**
 * Service API for getting and setting network interface configurations.
 * 
 * @author eurotech
 *
 */
public interface NetworkAdminService {
	
    /**
     * Returns a list of all of the configurations associated with all of the interfaces on
     * the system.
     *
     * @return list of NetInterfaceConfigs on the system
     * @throws KuraException
     */
    public List<? extends NetInterfaceConfig<? extends NetInterfaceAddressConfig>> getNetworkInterfaceConfigs() throws KuraException;

	
	/**
	 * Returns the configuration information for the specified NetworkInterface name.
	 * The returned NetConfig captured how the interface was configured; the returned
	 * list will have a NetConfig4 instance for IPv4 and an NetConfig6 instance for IPv6. 
	 * This should not be confused with the currently active NetInterfaceAddress associated 
	 * with the NetInterface.
	 *   
	 * @param interfaceName
	 * @return list of NetConfig for this interface.
	 */
	public List<NetConfig> getNetworkInterfaceConfigs(String interfaceName) throws KuraException;
	
	
	/**
	 * Updates the configuration of the specified EthernetInterface.
	 * 
	 * @param interfaceName - name of the Ethernet interface
	 * @param autoConnect - specifies the auto-connect value for the interface
	 * @param mtu - required MTU for the interface, -1 to keep the automatic default
	 * @param netConfig4 - the IPv4 configuration
	 * @param netConfig6 - the IPv6 configuration
	 * @throws KuraException
	 */
	public void updateEthernetInterfaceConfig(String interfaceName,
											  boolean autoConnect,
											  int mtu,
											  List<NetConfig> netConfigs) 
	    throws KuraException;

	
	/**
	 * Updates the configuration of the specified WifiInterface.
	 * 
	 * @param interfaceName - name of the wifi interface
	 * @param autoConnect - specifies the auto-connect value for the interface
	 * @param mtu - required MTU for the interface, -1 to keep the automatic default
	 * @param netConfig4 - the IPv4 configuration
	 * @param netConfig6 - the IPv6 configuration
	 * @throws KuraException
	 */
	public void updateWifiInterfaceConfig(String interfaceName,
										  boolean autoConnect,
										  WifiAccessPoint accessPoint,
										  List<NetConfig> netConfigs) 
	    throws KuraException;
	
	
	/**
	 * Updates the configuration of the specified ModemInterface.
	 * 
	 * @param interfaceName - name of the Modem interface
	 * @param serialNum - the modem's serial number
	 * @param modemId - user string to identify the modem
	 * @param pppNumber - ppp number to use for this interface
	 * @param autoConnect - specifies the auto-connect value for the interface
	 * @param mtu - required MTU for the interface, -1 to keep the automatic default
	 * @param netConfigs - list of NetConfigs for this interface
	 * @throws KuraException
	 */
	public void updateModemInterfaceConfig(String interfaceName,
											  String serialNum,
											  String modemId,
											  int pppNumber,
											  boolean autoConnect,
											  int mtu,
											  List<NetConfig> netConfigs) 
	    throws KuraException;
	
	
	/**
	 * Enables the specified interface.
	 * 
	 * @param interfaceName - name of the interface to be enabled.
	 */
	public void enableInterface(String interfaceName, boolean dhcp) throws KuraException; 	

	
	/**
	 * Disables the specified interface.
	 * 
	 * @param interfaceName - name of the interface to be disabled.
	 */
	public void disableInterface(String interfaceName) throws KuraException;
	
	
	/**
	 * Used to control DHCP servers on specified interfaces.
	 * 
	 * @param interfaceName		The interface of the DHCP server to modify the state
	 * @param enable			Whether to enable or disable the DHCP server
	 * @param allowedNetwork	The allowed network for the DHCP server if enabled
	 * @throws KuraException
	 */
	public void manageDhcpServer(String interfaceName, boolean enable, NetworkPair<IP4Address> allowedNetwork) throws KuraException;
	
	/**
	 * Releases current IP address and acquires a new lease for the provided interface.
	 * 
	 * @param interfaceName		The interface on which to renew the lease
	 * @throws KuraException
	 */
	public void renewDhcpLease(String interfaceName) throws KuraException;
	
	/**
	 * Gets the firewall configuration of the system as currently specified
	 * 
	 * @return					A list of NetConfigs representing the firewall configuration
	 * @throws KuraException
	 */
	public List<NetConfig> getFirewallConfiguration() throws KuraException;<commit_msg>fixing a problem of IP adress being assigned from dhcpd pool<commit_after>/**
 * Copyright (c) 2011, 2014 Eurotech and/or its affiliates
 *
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  which accompanies this distribution, and is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Eurotech
 */
package org.eclipse.kura.net;

import java.util.List;
import java.util.Map;

import org.eclipse.kura.KuraException;
import org.eclipse.kura.net.firewall.FirewallNatConfig;
import org.eclipse.kura.net.firewall.FirewallOpenPortConfigIP;
import org.eclipse.kura.net.firewall.FirewallPortForwardConfigIP;
import org.eclipse.kura.net.wifi.WifiAccessPoint;
import org.eclipse.kura.net.wifi.WifiConfig;
import org.eclipse.kura.net.wifi.WifiHotspotInfo;

/**
 * Service API for getting and setting network interface configurations.
 * 
 * @author eurotech
 *
 */
public interface NetworkAdminService {
	
    /**
     * Returns a list of all of the configurations associated with all of the interfaces on
     * the system.
     *
     * @return list of NetInterfaceConfigs on the system
     * @throws KuraException
     */
    public List<? extends NetInterfaceConfig<? extends NetInterfaceAddressConfig>> getNetworkInterfaceConfigs() throws KuraException;

	
	/**
	 * Returns the configuration information for the specified NetworkInterface name.
	 * The returned NetConfig captured how the interface was configured; the returned
	 * list will have a NetConfig4 instance for IPv4 and an NetConfig6 instance for IPv6. 
	 * This should not be confused with the currently active NetInterfaceAddress associated 
	 * with the NetInterface.
	 *   
	 * @param interfaceName
	 * @return list of NetConfig for this interface.
	 */
	public List<NetConfig> getNetworkInterfaceConfigs(String interfaceName) throws KuraException;
	
	
	/**
	 * Updates the configuration of the specified EthernetInterface.
	 * 
	 * @param interfaceName - name of the Ethernet interface
	 * @param autoConnect - specifies the auto-connect value for the interface
	 * @param mtu - required MTU for the interface, -1 to keep the automatic default
	 * @param netConfig4 - the IPv4 configuration
	 * @param netConfig6 - the IPv6 configuration
	 * @throws KuraException
	 */
	public void updateEthernetInterfaceConfig(String interfaceName,
											  boolean autoConnect,
											  int mtu,
											  List<NetConfig> netConfigs) 
	    throws KuraException;

	
	/**
	 * Updates the configuration of the specified WifiInterface.
	 * 
	 * @param interfaceName - name of the wifi interface
	 * @param autoConnect - specifies the auto-connect value for the interface
	 * @param mtu - required MTU for the interface, -1 to keep the automatic default
	 * @param netConfig4 - the IPv4 configuration
	 * @param netConfig6 - the IPv6 configuration
	 * @throws KuraException
	 */
	public void updateWifiInterfaceConfig(String interfaceName,
										  boolean autoConnect,
										  WifiAccessPoint accessPoint,
										  List<NetConfig> netConfigs) 
	    throws KuraException;
	
	
	/**
	 * Updates the configuration of the specified ModemInterface.
	 * 
	 * @param interfaceName - name of the Modem interface
	 * @param serialNum - the modem's serial number
	 * @param modemId - user string to identify the modem
	 * @param pppNumber - ppp number to use for this interface
	 * @param autoConnect - specifies the auto-connect value for the interface
	 * @param mtu - required MTU for the interface, -1 to keep the automatic default
	 * @param netConfigs - list of NetConfigs for this interface
	 * @throws KuraException
	 */
	public void updateModemInterfaceConfig(String interfaceName,
											  String serialNum,
											  String modemId,
											  int pppNumber,
											  boolean autoConnect,
											  int mtu,
											  List<NetConfig> netConfigs) 
	    throws KuraException;
	
	
	/**
	 * Enables the specified interface.
	 * 
	 * @param interfaceName - name of the interface to be enabled.
	 */
	public void enableInterface(String interfaceName, boolean dhcp) throws KuraException; 	

	
	/**
	 * Disables the specified interface.
	 * 
	 * @param interfaceName - name of the interface to be disabled.
	 */
	public void disableInterface(String interfaceName) throws KuraException;
	
	/**
	 * Used to control DHCP clients on specified interfaces.
	 * 
	 * @param interfaceName		The interface of the DHCP server to modify the state
	 * @param enable			Whether to enable or disable the DHCP client
	 * @throws KuraException
	 */
	public void manageDhcpClient(String interfaceName, boolean enable) throws KuraException; 
	
	/**
	 * Used to control DHCP servers on specified interfaces.
	 * 
	 * @param interfaceName		The interface of the DHCP server to modify the state
	 * @param enable			Whether to enable or disable the DHCP server
	 * @throws KuraException
	 */
	public void manageDhcpServer(String interfaceName, boolean enable) throws KuraException;
	
	/**
	 * Releases current IP address and acquires a new lease for the provided interface.
	 * 
	 * @param interfaceName		The interface on which to renew the lease
	 * @throws KuraException
	 */
	public void renewDhcpLease(String interfaceName) throws KuraException;
	
	/**
	 * Gets the firewall configuration of the system as currently specified
	 * 
	 * @return					A list of NetConfigs representing the firewall configuration
	 * @throws KuraException
	 */
	public List<NetConfig> getFirewallConfiguration() throws KuraException;
{'fraction_non_alphanumeric': 0.06452498627127952, 'fraction_numerical': 0.005033864177192019, 'mean_word_length': 3.4672935404742438, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5221237', 'n_tokens_mistral': 3310, 'n_tokens_neox': 2757, 'n_words': 1096}