View Javadoc

1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License.
18   *
19   */
20  package org.apache.mina.proxy;
21  
22  import org.apache.mina.core.buffer.IoBuffer;
23  import org.apache.mina.core.filterchain.IoFilter.NextFilter;
24  import org.apache.mina.core.write.WriteRequest;
25  import org.apache.mina.proxy.session.ProxyIoSession;
26  
27  /**
28   * ProxyLogicHandler.java - Interface implemented by classes containing proxy type specific logic.
29   * 
30   * @author The Apache MINA Project (dev@mina.apache.org)
31   * @version $Rev: 685703 $, $Date: 2008-08-14 00:14:47 +0200 (Thu, 14 Aug 2008) $
32   * @since MINA 2.0.0-M3
33   */
34  public interface ProxyLogicHandler {
35      /**
36       * Returns <code>true</code> if handshaking is complete and
37       * data can be sent through the proxy.
38       */
39      public abstract boolean isHandshakeComplete();
40  
41      /**
42       * Handle incoming data during the handshake process. Should consume only the
43       * handshake data from the buffer, leaving any extra data in place.
44       */
45      public abstract void messageReceived(NextFilter nextFilter, IoBuffer buf)
46              throws ProxyAuthException;
47  
48      /**
49       * Called at each step of the handshake procedure.
50       */
51      public abstract void doHandshake(NextFilter nextFilter)
52              throws ProxyAuthException;
53  
54      /**
55       * Returns the {@link ProxyIoSession}.
56       */
57      public abstract ProxyIoSession getProxyIoSession();
58  
59      /**
60       * Enqueue a message to be written once handshaking is complete.
61       */
62      public abstract void enqueueWriteRequest(final NextFilter nextFilter,
63              final WriteRequest writeRequest);
64  }