// $Log: DatagramSocketImpl.java,v $
// Revision 1.1  2000/04/27 13:24:12  sdalu
// ajout jdk1.1
//
// Revision 1.3  2000/04/03 08:05:32  chelius
// Javadoc
//
// Revision 1.2  2000/02/14 10:35:22  chelius
// Modifications mineures. Reste QoS et Doc a faire.
//
/*
 * @(#)DatagramSocketImpl.java	1.14 98/06/29
 *
 * Copyright 1996-1998 by Sun Microsystems, Inc.,
 * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information
 * of Sun Microsystems, Inc. ("Confidential Information").  You
 * shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement
 * you entered into with Sun.
 */

package java.net;

import java.io.FileDescriptor;
import java.io.IOException;
import java.io.InterruptedIOException;

/**
 * Abstract datagram and multicast socket implementation base class.
 * @author Pavani Diwanji
 * @author  Guillaume Chelius (IPv6 modifications)
 * @since  JDK1.1
 */

public abstract class DatagramSocketImpl implements SocketOptions {
    protected int localPort;

    /**
     * The file descriptor object
     */
    protected FileDescriptor fd;


    /**
     * Creates a datagram socket
     */
    protected abstract void create() throws SocketException;

    /**
     * Binds a datagram socket to a local port and address.
     */
    protected abstract void bind(int lport, InetAddress laddr) throws SocketException;

    /**
     * Sends a datagram packet. The packet contains the data and the
     * destination address to send the packet to.
     * @param packet to be sent.
     */
    protected abstract void send(DatagramPacket p) throws IOException;

    /**
     * Peek at the packet to see who it is from.
     * @param return the address which the packet came from.
     */
    protected abstract int peek(InetAddress i) throws IOException;

    /**
     * Receive the datagram packet.
     * @param Packet Received.
     */
    protected abstract void receive(DatagramPacket p) throws IOException;

    /**
     * Set the Hops option.
     * @param hops to be set.
     */
    protected abstract void setHOPS(int hops) throws IOException;

    /**
     * Retrieve the Hops option.
     */
    protected abstract int getHOPS() throws IOException;

    /**
     * Join the multicast group.
     * @param multicast address to join.
     */
    protected abstract void join(InetAddress inetaddr) throws IOException;

    /**
     * Leave the multicast group.
     * @param multicast address to leave.
     */
    protected abstract void leave(InetAddress inetaddr) throws IOException;

    /**
     * Close the socket.
     */
    protected abstract void close();

    /**
     * Get the local port.
     */
    protected int getLocalPort() {
	return localPort;
    }

    /**
     * Get the datagram socket file descriptor
     */
    protected FileDescriptor getFileDescriptor() {
	return fd;
    }
}
