001/** 002 * 003 * Copyright the original author or authors 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.bytestreams; 018 019import org.jivesoftware.smack.SmackException; 020import org.jivesoftware.smack.SmackException.NoResponseException; 021import org.jivesoftware.smack.SmackException.NotConnectedException; 022import org.jivesoftware.smack.XMPPException.XMPPErrorException; 023import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamRequest; 024import org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamRequest; 025import org.jxmpp.jid.Jid; 026 027/** 028 * BytestreamRequest provides an interface to handle incoming bytestream requests. 029 * <p> 030 * There are two implementations of the interface. See {@link Socks5BytestreamRequest} and 031 * {@link InBandBytestreamRequest}. 032 * 033 * @author Henning Staib 034 */ 035public interface BytestreamRequest { 036 037 /** 038 * Returns the sender of the bytestream open request. 039 * 040 * @return the sender of the bytestream open request 041 */ 042 public Jid getFrom(); 043 044 /** 045 * Returns the session ID of the bytestream open request. 046 * 047 * @return the session ID of the bytestream open request 048 */ 049 public String getSessionID(); 050 051 /** 052 * Accepts the bytestream open request and returns the session to send/receive data. 053 * 054 * @return the session to send/receive data 055 * @throws XMPPErrorException if an error occurred while accepting the bytestream request 056 * @throws InterruptedException if the thread was interrupted while waiting in a blocking 057 * operation 058 * @throws NoResponseException 059 * @throws SmackException 060 */ 061 public BytestreamSession accept() throws InterruptedException, NoResponseException, XMPPErrorException, SmackException; 062 063 /** 064 * Rejects the bytestream request by sending a reject error to the initiator. 065 * @throws NotConnectedException 066 * @throws InterruptedException 067 */ 068 public void reject() throws NotConnectedException, InterruptedException; 069 070}