|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.iids.aos.kernel.mux.Mux
public final class Mux
The main part of the AOS kernel multiplexer implementation.
| Field Summary | |
|---|---|
protected LocalDescriptorTable |
_localDescriptorTable
Table for allocating connection ports and listen ports from a single address space |
protected static int |
MAX_PAYLOAD
Maximum number of bytes of user-provided payload that we can fit into a payload message. |
protected static int |
PROTO_HEADER_LENGTH
Length in bytes of PROTO header V1 |
static int |
VIRTUAL_BACKLOG
|
| Constructor Summary | |
|---|---|
Mux(java.net.InetSocketAddress contactPoint,
int backlog,
int nthreads,
boolean secureComm,
java.security.KeyStore keyStore,
java.lang.String keyStorePassphrase)
Creates a multiplexer listening on a specific TCP/IP contact point. |
|
| Method Summary | |
|---|---|
int |
acceptVirtual(int listenPortNumber,
boolean blocking)
Returns the next connection waiting in a listen port. |
void |
checkOwnerOfConnectionPort(int connectionPort,
Role r)
Check ownership of connection port |
void |
checkOwnerOfListenPort(int listenPort,
Role r)
Check ownership of listen port |
void |
checkOwnerOfPortSets(SelectSets sets,
Role r)
|
void |
closeMultiplexer()
Closes the base listener and base connections, and stops handler threads. |
void |
closeVirtual(int connectionPortNumber,
int code)
Closes a virtual connection. |
void |
closeVirtualContactPoint(int listenPortNumber,
int code)
Destroys a listen port and its virtual contact point, and closes any pending connections. |
int |
connectVirtual(Endpoint remote,
java.lang.String[] userSecSuites)
Establishes a virtual connection with a remote contact point. |
int |
createVirtualContactPoint(int listenPortNumber,
java.lang.String[] secSuites)
Creates a listen port and makes it available as a virtual contact point. |
void |
deletePortsOwnedBy(Role r)
Deletes all connection and listen ports owned by role. |
java.net.InetSocketAddress |
getContactPoint()
Returns the address of the base listener TCP/IP contact point. |
static Mux |
getInstance()
|
int |
getRemoteConnectionPort(int connectionPortNumber)
Asks for the remote connection port number of a virtual connection. |
java.lang.String |
getRemoteSCID(int connectionPortNumber)
Asks for the remote SCID of a virtual connection. |
java.net.InetSocketAddress |
getRemoteSocketAddress(int connectionPortNumber)
Asks for the remote TCP/IP connection socket address of the base connection of a virtual connection. |
byte[] |
peekVirtual(int connectionPort,
int max,
boolean blocking)
As receiveVirtual() but leaves the data that was read in the connection port. |
byte[] |
receiveVirtual(int connectionPort,
int max,
boolean blocking)
Reads available data from a connection port up to a specified maximum number of bytes. |
SelectSets |
select(SelectSets sets,
boolean block,
SelectRendezvous sr)
|
static void |
sendMessage(BaseConnection bconn,
org.acplt.oncrpc.XdrAble msg,
int payloadSize)
Sends a message over a base connection. |
static void |
sendOpenNack(BaseConnection bconn,
int senderLport,
int receiverCport,
int errorCode,
java.lang.String[] receiverSecSuites)
Sends an 'open nack' message. |
void |
sendVirtual(int connectionPortNumber,
byte[] buffer,
int offset,
int length)
Writes data to a virtual connection. |
void |
setOwnerOfConnectionPort(int connectionPort,
Role r)
Set owner of connection port |
void |
setOwnerOfListenPort(int listenPort,
Role r)
Set owner of listen port |
java.lang.String |
toString()
Returns a string representation of the mux |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int VIRTUAL_BACKLOG
protected static final int MAX_PAYLOAD
protected static final int PROTO_HEADER_LENGTH
protected LocalDescriptorTable _localDescriptorTable
| Constructor Detail |
|---|
public Mux(java.net.InetSocketAddress contactPoint,
int backlog,
int nthreads,
boolean secureComm,
java.security.KeyStore keyStore,
java.lang.String keyStorePassphrase)
throws java.io.IOException,
java.security.KeyStoreException,
java.security.cert.CertificateException,
java.security.NoSuchAlgorithmException,
java.security.KeyManagementException,
java.security.UnrecoverableKeyException,
NoKnownSecuritySuiteException
contactPoint - the address of the TCP/IP contact point to listen on.
If null, an address will be picked.backlog - the listen backlog length. If <= 0, a default will be
used
java.io.IOException
java.security.KeyStoreException
java.security.cert.CertificateException
java.security.NoSuchAlgorithmException
java.security.KeyManagementException
java.security.UnrecoverableKeyException
NoKnownSecuritySuiteException| Method Detail |
|---|
public static Mux getInstance()
public java.net.InetSocketAddress getContactPoint()
public int connectVirtual(Endpoint remote,
java.lang.String[] userSecSuites)
throws KernelException
remote - the remote base endpointuserSecSuites - a series of cipher suites acceptable to the caller, or
null or empty to leave unspecified
KernelException
public int createVirtualContactPoint(int listenPortNumber,
java.lang.String[] secSuites)
throws KernelException
listenPortNumber - the listen port number to use, or
0 to leave unspecifiedsecSuites - a series of cipher suites acceptable to the caller, or
null or empty to leave unspecified
KernelException - if an attempt is made to explicitly allocate a listen port number that is
already in use
public int acceptVirtual(int listenPortNumber,
boolean blocking)
throws KernelException
listenPortNumber - the listen port numberblocking - whether to allow this method to block
UnknownEndpointDescrException - if the listen port number is non-existent or closed
KernelExceptionpublic void closeMultiplexer()
public void closeVirtualContactPoint(int listenPortNumber,
int code)
throws KernelException
listenPortNumber - the listen port number
UnknownEndpointDescrException - if the listen port number is non-existent
KernelException
public void closeVirtual(int connectionPortNumber,
int code)
throws KernelException
connectionPortNumber - the local connection port number
KernelException - if the connection port number is non-existent
public void sendVirtual(int connectionPortNumber,
byte[] buffer,
int offset,
int length)
throws KernelException
connectionPortNumber - the local connection port numberbuffer - the buffer that holds the dataoffset - where in the buffer the data beginslength - the length of the data
PeerClosedConnectionException - the remote peer closed the connection
InputOutputException - an I/O error occurred (e.g. the base connection
is broken or the call was illegal (e.g. port
as already locally closed)
BadArgumentException - if buffer, offset or length does not make sense
UnknownConnectionIDException - if the connectionPortNumber is unknown
KernelException
public byte[] receiveVirtual(int connectionPort,
int max,
boolean blocking)
throws KernelException
connectionPort - the connection port to readmax - maximum number of bytes to readblocking - whether to allow this method to block
PeerClosedConnectionException - if no more data was available because the remote
port was closed by the remote peer
InputOutputException - an I/O exception occurred (e.g. the base
connection is closed) or the call was illegal
(e.g. the port was already locally closed)
BadArgumentException - if 'max' is zero
UnknownConnectionIDException - if the connectionPortNumber is unknown
KernelException
public byte[] peekVirtual(int connectionPort,
int max,
boolean blocking)
throws KernelException
KernelException
public int getRemoteConnectionPort(int connectionPortNumber)
throws UnknownConnectionIDException
connectionPortNumber - the local connection port number
UnknownConnectionIDException - if the local connection port number is non-existent
public java.net.InetSocketAddress getRemoteSocketAddress(int connectionPortNumber)
throws KernelException
connectionPortNumber - the local connection port number
UnknownConnectionIDException - if the local connection port number is non-existent
KernelException
public java.lang.String getRemoteSCID(int connectionPortNumber)
throws UnknownConnectionIDException,
AuthenticationException
connectionPortNumber - the local connection port number
UnknownConnectionIDException - if the local connection port number is non-existent
AuthenticationException - if the remoteSCID could not be established
public static void sendOpenNack(BaseConnection bconn,
int senderLport,
int receiverCport,
int errorCode,
java.lang.String[] receiverSecSuites)
throws KernelException
bconn - the connection to send the message oversenderLport - message field: listen port of the senderreceiverCport - message field: connection port of the receivererrorCode - message field: reason for closurereceiverSecSuites - message field (if applicable) acceptable set suites
KernelException - a communication error occurred
public static void sendMessage(BaseConnection bconn,
org.acplt.oncrpc.XdrAble msg,
int payloadSize)
throws KernelException
payloadSize - the size of any user-provided payload data included in
the message
KernelException - a communication error occurred
public void setOwnerOfListenPort(int listenPort,
Role r)
throws KernelException
listenPort - the port in questionr - the prospective owner
KernelException
public void checkOwnerOfListenPort(int listenPort,
Role r)
throws AccessDeniedException,
UnknownEndpointDescrException
listenPort - the port in questionr - the expected owner
AccessDeniedException
UnknownEndpointDescrException
public void setOwnerOfConnectionPort(int connectionPort,
Role r)
throws KernelException
connectionPort - the port in questionr - the prospective owner
KernelException
public void checkOwnerOfConnectionPort(int connectionPort,
Role r)
throws AccessDeniedException,
UnknownConnectionIDException
connectionPort - the port in questionr - the expected owner
AccessDeniedException - if the port belongs to another role
UnknownConnectionIDException - if the port is unknownpublic void deletePortsOwnedBy(Role r)
public void checkOwnerOfPortSets(SelectSets sets,
Role r)
throws AccessDeniedException,
UnknownConnectionIDException,
UnknownEndpointDescrException,
BadArgumentException
AccessDeniedException
UnknownConnectionIDException
UnknownEndpointDescrException
BadArgumentException
public SelectSets select(SelectSets sets,
boolean block,
SelectRendezvous sr)
throws KernelException
KernelExceptionAOSapi.select(org.iids.aos.kernel.Cookie, org.iids.aos.kernel.SelectSets, boolean)public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||