package guard.api.sensitive.ui.sapiguard.hookedapis;

import java.util.ArrayList;
import java.util.List;

import guard.api.sensitive.ui.sapiguard.XHook;
import guard.api.sensitive.ui.sapiguard.utils.PrivacyManager;
import guard.api.sensitive.ui.sapiguard.utils.XParam;

public class XInetAddress extends XHook {
	@SuppressWarnings("unused")
	private Methods mMethod;

	private XInetAddress(Methods method, String restrictionName, String specifier) {
		super(restrictionName, method.name(), "InetAddress." + method.name());
		mMethod = method;
	}

	public String getClassName() {
		return "java.net.InetAddress";
	}

	// public static InetAddress[] getAllByName(String host)
	// public static InetAddress[] getAllByNameOnNet(String host, int netId)
	// public static InetAddress getByAddress(byte[] ipAddress)
	// public static InetAddress getByAddress(String hostName, byte[] ipAddress)
	// public static InetAddress getByName(String host)
	// public static InetAddress getByNameOnNet(String host, int netId)
	// libcore/luni/src/main/java/java/net/InetAddress.java
	// http://developer.android.com/reference/java/net/InetAddress.html
	// http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.0.0_r1/android/net/Network.java

	private enum Methods {
		getAllByName, getAllByNameOnNet, getByAddress, getByName, getByNameOnNet
	};

	public static List<XHook> getInstances() {
		List<XHook> listHook = new ArrayList<XHook>();
		for (Methods addr : Methods.values())
			listHook.add(new XInetAddress(addr, PrivacyManager.cInternet, null));
		return listHook;
	}

	@Override
	protected void before(XParam param) throws Throwable {
		// Do nothing
	}

	@Override
	protected void after(XParam param) throws Throwable {

	}
}