Class w3c.mux.MPStream
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class w3c.mux.MPStream

java.lang.Object
   |
   +----w3c.mux.MPStream

public class MPStream
extends Object
implements MUX

Variable Index

 o DEFINCR
 o DEFSIZE

Constructor Index

 o MPStream(boolean, InputStream, OutputStream)
Build a multiplexed stream out of the given streams.
 o MPStream(boolean, Socket)
Build a multiplexed stream out of the given socket.

Method Index

 o accept()
 o accept(int)
Accept any incoming connection on this stream.
 o allocateSession(int, int)
Allocate a new session.
 o checkAccept(int)
Check for session waiting for accept:
 o connect()
Connect to target, using any session identifier, and without protocol.
 o connect(int)
Connect to target, to speak the given protocol.
 o connect(int, byte[], int, int)
Connect to target, to speak the given protocol, send data.
 o connect(int, int, byte[], int, int)
Connect to the other end, using the given protocol id.
 o fin(byte, int, int)
Close the corresponding input stream of the session.
 o getFakeSession()
Get this MPStream fake session (used for accepting new connections)
 o getReader()
Get this MPStream reader object.
 o getSession(byte, int)
 o getSession(byte, int, int)
Get the session associated with the given session id.
 o getSession(int)
 o getWriter()
Get this MPStream writer object.
 o lookupSession(int)
 o push(byte, int, int)
 o rst(byte, int, int)
 o syn(byte, int, int)
 o unregisterSession(Session)
Unregister the given session.

Variables

 o DEFSIZE
  public final static int DEFSIZE
 o DEFINCR
  public final static int DEFINCR

Constructors

 o MPStream
  public MPStream(boolean server,
                  InputStream input,
                  OutputStream output) throws IOException
Build a multiplexed stream out of the given streams.
Parameters:
server - Am I server on this connection ?
input - The input stream to multiplex.
output - The output stream to multiplex.
 o MPStream
  public MPStream(boolean server,
                  Socket socket) throws IOException
Build a multiplexed stream out of the given socket.
Parameters:
server - Should this end of the multiplexer act as the server or as the client.
socket - The socket to multiplex.

Methods

 o getFakeSession
  protected Session getFakeSession()
Get this MPStream fake session (used for accepting new connections)
 o getReader
  protected MPReader getReader()
Get this MPStream reader object.
 o getWriter
  protected MPWriter getWriter()
Get this MPStream writer object.
 o allocateSession
  protected synchronized Session allocateSession(int id,
                                                 int protid) throws IOException
Allocate a new session. If the provided id is positive, we try to allocate this one, otherwise we allocate the first available one.
Parameters:
id - The identifier of the session to allocate.
Returns:
A Session instance.
Throws: IOException
If the provided session identifier is invalid.
 o getSession
  protected synchronized Session getSession(byte flags,
                                            int id,
                                            int protid) throws IOException
Get the session associated with the given session id. If such a session doesn't exist, try creating it.
Parameters:
id - The session identifier.
 o getSession
  protected Session getSession(byte flags,
                               int id) throws IOException
 o getSession
  protected Session getSession(int id) throws IOException
 o lookupSession
  protected synchronized Session lookupSession(int id)
 o unregisterSession
  protected synchronized void unregisterSession(Session session)
Unregister the given session. The session should have been closed properly (both its input and its output). This method will than unregister any knowledge we have of it, in particular, its session identifier will be available for reuse.
Parameters:
session - The session to unregister.
 o syn
  protected synchronized void syn(byte flags,
                                  int id,
                                  int protid)
 o fin
  protected synchronized void fin(byte flags,
                                  int id,
                                  int protid) throws IOException
Close the corresponding input stream of the session. This method is invoked by the reader, when it receives a message with the FIN bit set. The corresponding input session stream is to be closed and any reader need to be notified of the close operation.
Parameters:
flags - Flags of the received message.
id - The session identitifer of the message.
protid - The protocol running on this session (or -1).
Throws: RuntimeException
If the FIN message is for an unexsiting session.
 o rst
  protected synchronized void rst(byte flags,
                                  int id,
                                  int protid)
 o push
  protected synchronized void push(byte flags,
                                   int id,
                                   int protid)
 o connect
  public Session connect(int id,
                         int protocol,
                         byte buf[],
                         int off,
                         int len) throws IOException
Connect to the other end, using the given protocol id.
Parameters:
session - The session to use.
protocol - The protocol number to use on this session.
buf - Associated data (can be null).
off - Offset in the provided buffer.
len - Length in the provided buffer.
 o connect
  public Session connect(int protocol) throws IOException
Connect to target, to speak the given protocol.
Parameters:
protocol - The protocol identfier to speak on the new session.
 o connect
  public Session connect(int protocol,
                         byte buf[],
                         int off,
                         int len) throws IOException
Connect to target, to speak the given protocol, send data.
Parameters:
protocol - The protocol to speak on the new session.
buf - The data to send with the connection packet.
buf - The buffer containing the data.
off - Offset in the buffer.
len - Length of data to send.
 o connect
  public Session connect() throws IOException
Connect to target, using any session identifier, and without protocol.
 o checkAccept
  protected synchronized Session checkAccept(int protid) throws IOException
Check for session waiting for accept:
 o accept
  public Session accept(int protid) throws IOException
Accept any incoming connection on this stream.
 o accept
  public Session accept() throws IOException

All Packages  Class Hierarchy  This Package  Previous  Next  Index