Shuyi Chen | d7955ce | 2013-05-22 14:51:55 -0700 | [diff] [blame] | 1 | /**
|
| 2 | * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
|
| 3 | * you may not use this file except in compliance with the License.
|
| 4 | * You may obtain a copy of the License at
|
| 5 | *
|
| 6 | * http://www.apache.org/licenses/LICENSE-2.0
|
| 7 | *
|
| 8 | * Unless required by applicable law or agreed to in writing, software
|
| 9 | * distributed under the License is distributed on an "AS IS" BASIS,
|
| 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 11 | * See the License for the specific language governing permissions and
|
| 12 | * limitations under the License.
|
| 13 | */
|
| 14 | package org.jivesoftware.smackx.bytestreams;
|
| 15 |
|
| 16 | import org.jivesoftware.smack.XMPPException;
|
| 17 | import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamRequest;
|
| 18 | import org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamRequest;
|
| 19 |
|
| 20 | /**
|
| 21 | * BytestreamRequest provides an interface to handle incoming bytestream requests.
|
| 22 | * <p>
|
| 23 | * There are two implementations of the interface. See {@link Socks5BytestreamRequest} and
|
| 24 | * {@link InBandBytestreamRequest}.
|
| 25 | *
|
| 26 | * @author Henning Staib
|
| 27 | */
|
| 28 | public interface BytestreamRequest {
|
| 29 |
|
| 30 | /**
|
| 31 | * Returns the sender of the bytestream open request.
|
| 32 | *
|
| 33 | * @return the sender of the bytestream open request
|
| 34 | */
|
| 35 | public String getFrom();
|
| 36 |
|
| 37 | /**
|
| 38 | * Returns the session ID of the bytestream open request.
|
| 39 | *
|
| 40 | * @return the session ID of the bytestream open request
|
| 41 | */
|
| 42 | public String getSessionID();
|
| 43 |
|
| 44 | /**
|
| 45 | * Accepts the bytestream open request and returns the session to send/receive data.
|
| 46 | *
|
| 47 | * @return the session to send/receive data
|
| 48 | * @throws XMPPException if an error occurred while accepting the bytestream request
|
| 49 | * @throws InterruptedException if the thread was interrupted while waiting in a blocking
|
| 50 | * operation
|
| 51 | */
|
| 52 | public BytestreamSession accept() throws XMPPException, InterruptedException;
|
| 53 |
|
| 54 | /**
|
| 55 | * Rejects the bytestream request by sending a reject error to the initiator.
|
| 56 | */
|
| 57 | public void reject();
|
| 58 |
|
| 59 | }
|