// Path: jxnet-core/src/main/java/com/ardikars/jxnet/exception/NativeException.java
// public class NativeException extends RuntimeException {
// 
// 	private static final long serialVersionUID = -3993889826336916332L;
// 
// 	public NativeException() {
// 		this("");
// 	}
// 
// 	public NativeException(final String message) {
// 		this(message, new RuntimeException(message));
// 	}
// 
// 	public NativeException(final Throwable cause) {
// 		this(cause.getMessage(), cause);
// 	}
// 
// 	public NativeException(final String message, final Throwable cause) {
// 		super(message, cause);
// 	}
// 
// }
// 
// Path: jxnet-core/src/main/java/com/ardikars/jxnet/exception/PlatformNotSupportedException.java
// public class PlatformNotSupportedException extends RuntimeException {
// 
//     private static final long serialVersionUID = -5714154798477963289L;
// 
//     public PlatformNotSupportedException() {
//         this("");
//     }
// 
//     public PlatformNotSupportedException(final String message) {
//         this(message, new RuntimeException(message));
//     }
// 
//     public PlatformNotSupportedException(final Throwable cause) {
//         this(cause.getMessage(), cause);
//     }
// 
//     public PlatformNotSupportedException(final String message, final Throwable cause) {
//         super(message, cause);
//     }
// 
// }


import com.ardikars.common.annotation.Mutable;
import com.ardikars.common.net.Inet4Address;
import com.ardikars.common.util.Platforms;
import com.ardikars.common.util.Validate;
import com.ardikars.jxnet.exception.NativeException;
import com.ardikars.jxnet.exception.PlatformNotSupportedException;
import java.io.IOException;
import java.util.concurrent.locks.ReentrantReadWriteLock;
		/**
		 * Build a live pcap handle.
		 * @return pcap handle.
		 */
		private Pcap buildLive() {
			Validate.notIllegalArgument(source != null,
					new IllegalArgumentException("Device name should be not null."));
			Validate.notIllegalArgument(snaplen > 0 && snaplen < 65536,
					new IllegalArgumentException("Snaplen should be greater then 0 and less then 65536."));
			Validate.notIllegalArgument(timeout > 0,
					new IllegalArgumentException("Timeout should be greater then 0."));
			Validate.notIllegalArgument(errbuf != null,
					new IllegalArgumentException("Error buffer should be not null."));

			Pcap pcap = Jxnet.PcapCreate(source, errbuf);
			if (Jxnet.PcapSetSnaplen(pcap, snaplen) < Jxnet.OK) {
				throw new NativeException(Jxnet.PcapGetErr(pcap));
			}
			if (Jxnet.PcapSetPromisc(pcap, promiscuousMode.getValue()) < Jxnet.OK) {
				throw new NativeException(Jxnet.PcapGetErr(pcap));
			}
			if (Jxnet.PcapSetTimeout(pcap, timeout) < Jxnet.OK) {
				throw new NativeException(Jxnet.PcapGetErr(pcap));
			}
			setImmediateModeAndTimeStamp(pcap);
			setEnableRfMon(pcap);
			if (Jxnet.PcapActivate(pcap) < Jxnet.OK) {
				throw new NativeException(Jxnet.PcapGetErr(pcap));
			}
			if (!Platforms.isWindows() && Jxnet.PcapSetDirection(pcap, direction) < Jxnet.OK) {
// Path: jxnet-core/src/main/java/com/ardikars/jxnet/exception/NativeException.java
// public class NativeException extends RuntimeException {
// 
// 	private static final long serialVersionUID = -3993889826336916332L;
// 
// 	public NativeException() {
// 		this("");
// 	}
// 
// 	public NativeException(final String message) {
// 		this(message, new RuntimeException(message));
// 	}
// 
// 	public NativeException(final Throwable cause) {
// 		this(cause.getMessage(), cause);
// 	}
// 
// 	public NativeException(final String message, final Throwable cause) {
// 		super(message, cause);
// 	}
// 
// }
// 
// Path: jxnet-core/src/main/java/com/ardikars/jxnet/exception/PlatformNotSupportedException.java
// public class PlatformNotSupportedException extends RuntimeException {
// 
//     private static final long serialVersionUID = -5714154798477963289L;
// 
//     public PlatformNotSupportedException() {
//         this("");
//     }
// 
//     public PlatformNotSupportedException(final String message) {
//         this(message, new RuntimeException(message));
//     }
// 
//     public PlatformNotSupportedException(final Throwable cause) {
//         this(cause.getMessage(), cause);
//     }
// 
//     public PlatformNotSupportedException(final String message, final Throwable cause) {
//         super(message, cause);
//     }
// 
// }


// Path: jxnet-core/src/main/java/com/ardikars/jxnet/Pcap.java
import com.ardikars.common.annotation.Mutable;
import com.ardikars.common.net.Inet4Address;
import com.ardikars.common.util.Platforms;
import com.ardikars.common.util.Validate;
import com.ardikars.jxnet.exception.NativeException;
import com.ardikars.jxnet.exception.PlatformNotSupportedException;
import java.io.IOException;
import java.util.concurrent.locks.ReentrantReadWriteLock;

		/**
		 * Build a live pcap handle.
		 * @return pcap handle.
		 */
		private Pcap buildLive() {
			Validate.notIllegalArgument(source != null,
					new IllegalArgumentException("Device name should be not null."));
			Validate.notIllegalArgument(snaplen > 0 && snaplen < 65536,
					new IllegalArgumentException("Snaplen should be greater then 0 and less then 65536."));
			Validate.notIllegalArgument(timeout > 0,
					new IllegalArgumentException("Timeout should be greater then 0."));
			Validate.notIllegalArgument(errbuf != null,
					new IllegalArgumentException("Error buffer should be not null."));

			Pcap pcap = Jxnet.PcapCreate(source, errbuf);
			if (Jxnet.PcapSetSnaplen(pcap, snaplen) < Jxnet.OK) {
				throw new NativeException(Jxnet.PcapGetErr(pcap));
			}
			if (Jxnet.PcapSetPromisc(pcap, promiscuousMode.getValue()) < Jxnet.OK) {
				throw new NativeException(Jxnet.PcapGetErr(pcap));
			}
			if (Jxnet.PcapSetTimeout(pcap, timeout) < Jxnet.OK) {
				throw new NativeException(Jxnet.PcapGetErr(pcap));
			}
			setImmediateModeAndTimeStamp(pcap);
			setEnableRfMon(pcap);
			if (Jxnet.PcapActivate(pcap) < Jxnet.OK) {
				throw new NativeException(Jxnet.PcapGetErr(pcap));
			}
			if (!Platforms.isWindows() && Jxnet.PcapSetDirection(pcap, direction) < Jxnet.OK) {
				throw new PlatformNotSupportedException();