#include <xorp_config.h>

#ifdef HAVE_IPV6

/**
 * Interface that users of socket6/0.1 should implement.
 *
 * This interface only contains asynchronous notifications that a socket
 * user should be interested in, ie data arrived, error occured.
 */
interface socket6_user/0.1 {
    /**
     * Method invoked by target implementing socket6/0.1 when a packet
     * arrives from an IPv6 source.
     *
     * @param sockid the identifier associated with socket where the event
     *               occurred.
     * @param if_name the interface name the packet arrived on, if known.
     * If unknown, then it is an empty string.
     * @param vif_name the vif name the packet arrived on, if known.
     * If unknown, then it is an empty string.
     * @param src_host the originating host.
     * @param src_port the originating IP port.
     * @param data the data received.
     */
    recv_event		? sockid:txt					\
			& if_name: txt					\
			& vif_name: txt					\
			& src_host:ipv6					\
			& src_port:u32					\
			& data:binary;

    /**
     * Method invoked by target implementing socket6/0.1 when a connection
     * request is received from an IPv6 source.
     *
     * It applies only to TCP sockets.
     *
     * @param sockid the identifier associated with socket where the event
     *               occurred.
     * @param src_host the connecting host.
     * @param src_port the connecting IP port.
     * @param new_sockid the identifier associated with the new socket
     *                   that has been created to handle the new connection.
     * @param accept if true, the connection request has been accepted,
     *               otherwise it has been rejected.
     */
     inbound_connect_event	? sockid:txt				\
				& src_host:ipv6				\
				& src_port:u32				\
				& new_sockid:txt			\
				-> accept:bool;

    /**
     * Method invoked by target implementing socket6/0.1 when an outgoing
     * connection request originated by the local host is completed.
     *
     * It applies only to TCP sockets.
     * Note that if the connection failed, the error_event will be dispatched
     * instead.
     *
     * @param sockid the identifier associated with socket where the event
     *               occurred.
     */
     outgoing_connect_event	? sockid:txt;

    /**
     * Method invoked by target implementing socket6/0.1 when an error occurs.
     *
     * @param sockid the identifier associated with socket where the event
     *               occurred.
     * @param error a textual description of the error.
     * @param fatal indication of whether socket is shutdown because of error.
     */
    error_event		? sockid:txt					\
			& error:txt					\
			& fatal:bool;

    /**
     * Method invoked by target implementing socket6/0.1 when the peer
     * has closed the connection.
     *
     * It applies only to TCP sockets.
     * Note that the socket itself is left open and must be explicitly closed.
     *
     * @param sockid the identifier associated with socket where the event
     *               occurred.
     */
     disconnect_event	? sockid:txt;
}

#endif
