// Path: jxnet-core/src/main/java/com/ardikars/jxnet/exception/OperationNotSupportedException.java
// public class OperationNotSupportedException extends RuntimeException {
// 
//     private static final long serialVersionUID = 4918064360828376142L;
// 
//     public OperationNotSupportedException() {
//         this("");
//     }
// 
//     public OperationNotSupportedException(final String s) {
//         this(s, new RuntimeException(s));
//     }
// 
//     public OperationNotSupportedException(final Throwable throwable) {
//         this(throwable.getMessage(), throwable);
//     }
// 
//     public OperationNotSupportedException(final String s, final Throwable throwable) {
//         super(s, throwable);
//     }
// 
// }


import com.ardikars.common.annotation.Mutable;
import com.ardikars.common.net.Inet4Address;
import com.ardikars.common.net.Inet6Address;
import com.ardikars.common.util.NamedNumber;
import com.ardikars.jxnet.exception.OperationNotSupportedException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Copyright (C) 2015-2018 Jxnet
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.ardikars.jxnet;



/**
 * Socket address.
 *
 * @author <a href="mailto:contact@ardikars.com">Ardika Rommy Sanjaya</a>
 * @since 1.0.0
 */
@Mutable(volatiles = { "sa_family", "data" })
public final class SockAddr implements Cloneable {

    private volatile short sa_family;

    private volatile byte[] data = new byte[0];

    protected SockAddr() {
        this((short) 0, new byte[] {});
    }

    protected SockAddr(short saFamily, byte[] data) {
        this.sa_family = saFamily;
        if (data == null) {
            this.data = new byte[0];
        } else {
            this.data = Arrays.copyOf(data, data.length);
        }
    }

    /**
     * This method will throws {@code OperationNotSupportedException}.
     * See {@link Jxnet#PcapFindAllDevs(List, StringBuilder)}.
     * @return nothing.
     * @throws OperationNotSupportedException throws {@code OperationNotSupportedException}.
     */
// Path: jxnet-core/src/main/java/com/ardikars/jxnet/exception/OperationNotSupportedException.java
// public class OperationNotSupportedException extends RuntimeException {
// 
//     private static final long serialVersionUID = 4918064360828376142L;
// 
//     public OperationNotSupportedException() {
//         this("");
//     }
// 
//     public OperationNotSupportedException(final String s) {
//         this(s, new RuntimeException(s));
//     }
// 
//     public OperationNotSupportedException(final Throwable throwable) {
//         this(throwable.getMessage(), throwable);
//     }
// 
//     public OperationNotSupportedException(final String s, final Throwable throwable) {
//         super(s, throwable);
//     }
// 
// }


// Path: jxnet-core/src/main/java/com/ardikars/jxnet/SockAddr.java
import com.ardikars.common.annotation.Mutable;
import com.ardikars.common.net.Inet4Address;
import com.ardikars.common.net.Inet6Address;
import com.ardikars.common.util.NamedNumber;
import com.ardikars.jxnet.exception.OperationNotSupportedException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Copyright (C) 2015-2018 Jxnet
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.ardikars.jxnet;



/**
 * Socket address.
 *
 * @author <a href="mailto:contact@ardikars.com">Ardika Rommy Sanjaya</a>
 * @since 1.0.0
 */
@Mutable(volatiles = { "sa_family", "data" })
public final class SockAddr implements Cloneable {

    private volatile short sa_family;

    private volatile byte[] data = new byte[0];

    protected SockAddr() {
        this((short) 0, new byte[] {});
    }

    protected SockAddr(short saFamily, byte[] data) {
        this.sa_family = saFamily;
        if (data == null) {
            this.data = new byte[0];
        } else {
            this.data = Arrays.copyOf(data, data.length);
        }
    }

    /**
     * This method will throws {@code OperationNotSupportedException}.
     * See {@link Jxnet#PcapFindAllDevs(List, StringBuilder)}.
     * @return nothing.
     * @throws OperationNotSupportedException throws {@code OperationNotSupportedException}.
     */
    public static SockAddr newInstance() throws OperationNotSupportedException {