001/**
002 *
003 * Copyright 2003-2006 Jive Software.
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.jivesoftware.smackx.jingle.listeners;
018
019import org.jivesoftware.smack.SmackException.NotConnectedException;
020import org.jivesoftware.smack.XMPPException;
021import org.jivesoftware.smackx.jingle.nat.TransportCandidate;
022
023/**
024 * Interface for listening to transport events.
025 * 
026 * @author Thiago Camargo
027 */
028public interface JingleTransportListener extends JingleListener {
029
030    /**
031     * Notification that the transport has been established.
032     *
033     * @param local  The transport candidate that has been used for listening
034     *               in the local machine
035     * @param remote The transport candidate that has been used for
036     *               transmitting to the remote machine
037     * @throws NotConnectedException 
038     */
039    public void transportEstablished(TransportCandidate local,
040                                     TransportCandidate remote) throws NotConnectedException;
041
042    /**
043     * Notification that a transport must be cancelled.
044     *
045     * @param cand The transport candidate that must be cancelled. A value
046     *             of "null" means all the transports for this session.
047     */
048    public void transportClosed(TransportCandidate cand);
049
050    /**
051     * Notification that the transport was closed due to an exception.
052     *
053     * @param e the exception.
054     */
055    public void transportClosedOnError(XMPPException e);
056}
057