|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.iids.aos.kernel.sunrpc.SunRpcKernelClient
public class SunRpcKernelClient
Converter class that allows the transparent invocation of the kernel primitives over Sun-RPC. Use this class to call the kernel from your AppMW. We currently catch UndeclaredThrowableException and turn them into an IPCException. This is valid, as the former exception is thrown when something happens that cannot be mapped to one of the declared exceptions in the AOSapi.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.iids.aos.kernel.AOSapi |
|---|
AOSapi.AcceptResult, AOSapi.ConnectResult, AOSapi.CreateRoleResult, AOSapi.PrepareWaitACResult, AOSapi.SecSuites, AOSapi.WaitACResult |
| Field Summary | |
|---|---|
static java.lang.String |
COMM_HOSTNAME
|
static int |
DEFAULT_SUNRPC_TOC_ENTRY_SIZE
Size of TOC_ENTRY. |
static int |
MINUS_SUNRPC_CLIENT_MAX_READ_SEG_N
read_seg_out is 8+n. |
static int |
MINUS_SUNRPC_CLIENT_MAX_READ_TOC_N
RPC reply with AUTH_NONE is 24 bytes, read_toc_out is retval (4) + TOC_ENTRY<> is 4+n*536 (536 is size TOC_ENTRY). |
static int |
MINUS_SUNRPC_CLIENT_MAX_RECV_N
recv_out is 8+n. |
static int |
MINUS_SUNRPC_CLIENT_MAX_SEND_N
RPC request with AUTH_NONE is 40 bytes, send_in is COOKIE COOKIE_BYTELENGTH+4-(COOKIE_BYTELENGTH%4) int conn_id; 4 opaque msgbuf<>; 4+n+4-(n%4) For a max receive buffer size of 8192, this gives a max for n of 8124, padding is taken into account. |
static int |
MINUS_SUNRPC_CLIENT_MAX_WRITE_SEG_N
write_seg_in is COOKIE c; COOKIE_BYTELENGTH+4-(COOKIE_BYTELENGTH%4) ACID acid; 4 SEGMENT_ID segid; 4 int offset; 4 opaque frombuf<>; 4+n+4-(n%4) For a max receive buffer size of 8192, this gives a max for n of 8116, padding is taken into account. |
int |
SUNRPC_CLIENT_MAX_READ_SEG_N
|
int |
SUNRPC_CLIENT_MAX_READ_TOC_N
|
int |
SUNRPC_CLIENT_MAX_RECV_N
|
int |
SUNRPC_CLIENT_MAX_SEND_N
|
int |
SUNRPC_CLIENT_MAX_WRITE_SEG_N
|
protected aosapi_sunrpcClient |
xkernel
|
| Fields inherited from interface org.iids.aos.kernel.AOSapi |
|---|
ACTP_TLS_PROTOCOL_VERSION, MUX_TLS_PROTOCOL_VERSION, SCID_AUTH_ALGO, SCID_AUTH_KEYSIZE, SCID_CERT_SIGN_ALGO, SCID_DIGEST_ALGO, SCID_DIGEST_ALGO_BITLENGTH, SEGMENT_CERT_SUBTYPE, SEGMENT_DIGEST_ALGO, SEGMENT_DIGEST_ALGO_BITLENGTH, SEGMENT_SIGN_SUBTYPE, SEGMENT_TOC_SUBTYPE, SIGN_TOC_ALGO, SIGN_TOC_CERTTYPE, XDR_ENCODING_CHARSET |
| Constructor Summary | |
|---|---|
SunRpcKernelClient(Cookie cookie,
int sunRpcPort)
Creates a new instance of KernelClient |
|
SunRpcKernelClient(Cookie cookie,
int sunRpcPort,
int protocol)
Creates a new instance of KernelClient |
|
| Method Summary | |
|---|---|
AOSapi.AcceptResult |
accept(Cookie cookie,
int listenPort,
boolean blocking)
Returns the next permitted connection waiting at a listen endpoint. |
void |
close()
|
void |
closeConnection(Cookie cookie,
int connectionID)
Closes a connection. |
void |
closeListenEndpoint(Cookie cookie,
int listenPort)
Destroys a listen endpoint and closes any pending connections that have arrived at the listen endpoint. |
AOSapi.ConnectResult |
connect(Cookie cookie,
Endpoint listenEndpoint,
java.lang.String[] secSuites)
Establishes a connection by connecting to a remote listen endpoint. |
int |
createAgentContainer(Cookie cookie)
Creates an empty agent container. |
Endpoint |
createListenEndpoint(Cookie cookie,
int listenPort,
java.lang.String[] secSuites)
Creates a listen endpoint. |
AOSapi.CreateRoleResult |
createRole(Cookie cookie,
RoleBitmap bitmap)
Creates a new role. |
int |
createSegment(Cookie cookie,
int acid,
int segmentType,
byte[] subtype,
byte[] description)
Creates a new empty segment and TOC entry in the given agent container, using the given parameters. |
void |
deleteAgentContainer(Cookie cookie,
int acid)
Deletes an agent container. |
void |
deleteRole(Cookie cookie,
Cookie childCookie)
Deletes an existing role and all kernel resources owned by that role (Agent containers, connection ports, listen ports, other roles etc.) |
void |
deleteSegment(Cookie cookie,
int acid,
int segID)
Removes the given segment from the given agent container. |
protected void |
finalize()
|
void |
finalizeAgentContainer(Cookie cookie,
int acid)
Finalizes an agent container: (a) computes checksums of the container's segments and signs the container using the AOS kernel's private key, and (b) writes the TOC, signature and AOS kernel's key certificate to the agent container's finalization segments. |
int |
getParam(Cookie cookie,
java.lang.String parameterName)
Returns the value of an AOS parameter, a positive integer |
void |
makePersistent(Cookie cookie,
int acid,
int segID)
Marks the given segment of the given agent container as persistent. |
byte[] |
peek(Cookie cookie,
int connectionID,
int max,
boolean blocking)
As receive() but leaves the data that was read in the connection. |
AOSapi.PrepareWaitACResult |
prepareWaitAgentContainer(Cookie cookie,
java.lang.String[] secSuites)
Prepares an incoming agent container shipment. |
byte[] |
readSegment(Cookie cookie,
int acid,
int segID,
int offset,
int length)
Reads a number of bytes from the given segment in the given agent container. |
TOCEntry[] |
readTOC(Cookie cookie,
int acid,
int offset,
int n)
Reads n TOC entries of an agent container, starting at the entry for segment ID 'offset'. |
byte[] |
receive(Cookie cookie,
int connectionID,
int max,
boolean blocking)
Reads available data from a connection up to a specified maximum. |
void |
reenableRole(Cookie cookie)
Used to reset the role so that it can be used again. |
SelectSets |
select(Cookie cookie,
SelectSets sets,
boolean blocking)
Cf. |
int |
send(Cookie cookie,
int connectionID,
byte[] buffer)
Writes data to a connection. |
void |
shipAgentContainer(Cookie cookie,
int acid,
Endpoint dest,
java.lang.String[] secSuites,
TransactionID tid)
Ships a finalized agent container to a remote AOS kernel. |
AOSapi.WaitACResult |
waitAgentContainer(Cookie cookie,
TransactionID[] tids,
int blockTime)
Waits for completion of an incoming agent container shipment with any of the given transaction ID. |
int |
writeSegment(Cookie cookie,
int acid,
int segID,
int offset,
byte[] frombuf)
Writes a number of bytes to the given segment in the given agent container. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_SUNRPC_TOC_ENTRY_SIZE
public static final int MINUS_SUNRPC_CLIENT_MAX_SEND_N
public int SUNRPC_CLIENT_MAX_SEND_N
public static final int MINUS_SUNRPC_CLIENT_MAX_WRITE_SEG_N
public int SUNRPC_CLIENT_MAX_WRITE_SEG_N
public static final int MINUS_SUNRPC_CLIENT_MAX_READ_TOC_N
public int SUNRPC_CLIENT_MAX_READ_TOC_N
public static final int MINUS_SUNRPC_CLIENT_MAX_READ_SEG_N
public int SUNRPC_CLIENT_MAX_READ_SEG_N
public static final int MINUS_SUNRPC_CLIENT_MAX_RECV_N
public int SUNRPC_CLIENT_MAX_RECV_N
protected aosapi_sunrpcClient xkernel
public static final java.lang.String COMM_HOSTNAME
| Constructor Detail |
|---|
public SunRpcKernelClient(Cookie cookie,
int sunRpcPort)
throws org.acplt.oncrpc.OncRpcException,
java.io.IOException,
KernelException
KernelClient
org.acplt.oncrpc.OncRpcException
java.io.IOException
KernelException
public SunRpcKernelClient(Cookie cookie,
int sunRpcPort,
int protocol)
throws org.acplt.oncrpc.OncRpcException,
java.io.IOException,
KernelException
KernelClient
org.acplt.oncrpc.OncRpcException
java.io.IOException
KernelException| Method Detail |
|---|
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable
public void close()
throws KernelException
KernelException
public AOSapi.AcceptResult accept(Cookie cookie,
int listenPort,
boolean blocking)
throws KernelException
AOSapi
accept in interface AOSapicookie - caller cookielistenPort - the listen port numberblocking - whether to allow this method to block
KernelException
public void closeConnection(Cookie cookie,
int connectionID)
throws KernelException
AOSapi
closeConnection in interface AOSapicookie - caller cookieconnectionID - the connection to close
KernelException
public void closeListenEndpoint(Cookie cookie,
int listenPort)
throws KernelException
AOSapi
closeListenEndpoint in interface AOSapicookie - caller cookielistenPort - the listen port number
KernelException
public AOSapi.ConnectResult connect(Cookie cookie,
Endpoint listenEndpoint,
java.lang.String[] secSuites)
throws KernelException
AOSapi
connect in interface AOSapicookie - caller cookielistenEndpoint - the address of the remote listen endpointsecSuites - a series of cipher suites acceptable to the
caller, or null or empty to leave unspecified
KernelException
public int createAgentContainer(Cookie cookie)
throws KernelException
AOSapi
createAgentContainer in interface AOSapicookie - caller cookie
KernelException
public Endpoint createListenEndpoint(Cookie cookie,
int listenPort,
java.lang.String[] secSuites)
throws KernelException
AOSapi
createListenEndpoint in interface AOSapicookie - caller cookielistenPort - the listen port number to use, or 0 to let the AOS
kernel pick onesecSuites - a series of cipher suites acceptable to the caller, or
null or empty to leave unspecified. Kernel will then
selected appropriate suites.
KernelException
public AOSapi.CreateRoleResult createRole(Cookie cookie,
RoleBitmap bitmap)
throws KernelException
AOSapi
createRole in interface AOSapicookie - caller cookiebitmap - the role bitmap for the new role
UnknownRoleException - if the caller is unknown
KernelException
public int createSegment(Cookie cookie,
int acid,
int segmentType,
byte[] subtype,
byte[] description)
throws KernelException
AOSapi
createSegment in interface AOSapicookie - caller cookieacid - agent container to create a segment insegmentType - see XDR documentation of TOC_ENTRYsubtype - see XDR documentation of TOC_ENTRYdescription - see XDR documentation of TOC_ENTRY
KernelException
public void deleteAgentContainer(Cookie cookie,
int acid)
throws KernelException
AOSapi
deleteAgentContainer in interface AOSapicookie - caller cookieacid - agent container to delete
KernelException
public void deleteSegment(Cookie cookie,
int acid,
int segID)
throws KernelException
AOSapi
deleteSegment in interface AOSapicookie - caller cookieacid - agent container to delete segment fromsegID - segment to delete
KernelException
public void finalizeAgentContainer(Cookie cookie,
int acid)
throws KernelException
AOSapi
finalizeAgentContainer in interface AOSapicookie - caller cookieacid - agent container to finalize
KernelException
public void makePersistent(Cookie cookie,
int acid,
int segID)
throws KernelException
AOSapi
makePersistent in interface AOSapicookie - caller cookieacid - agent container whose segment to make persistentsegID - segment to make persistent
KernelException
public byte[] peek(Cookie cookie,
int connectionID,
int max,
boolean blocking)
throws KernelException
AOSapi
peek in interface AOSapiKernelException
public byte[] readSegment(Cookie cookie,
int acid,
int segID,
int offset,
int length)
throws KernelException
AOSapi
readSegment in interface AOSapicookie - caller cookieacid - agent container to read fromsegID - segment to read fromoffset - offset in segment to start reading atlength - number of bytes requested
KernelException
public TOCEntry[] readTOC(Cookie cookie,
int acid,
int offset,
int n)
throws KernelException
AOSapi
readTOC in interface AOSapicookie - caller cookieacid - agent container to read TOC fromoffset - segment ID of first entry requestedn - the number of entries requested
KernelException
public byte[] receive(Cookie cookie,
int connectionID,
int max,
boolean blocking)
throws KernelException
AOSapi
receive in interface AOSapicookie - caller cookieconnectionID - the connection to readmax - maximum number of bytes to readblocking - whether to allow this method to block
KernelException
public int send(Cookie cookie,
int connectionID,
byte[] buffer)
throws KernelException
AOSapi
send in interface AOSapicookie - caller cookieconnectionID - the connection to write tobuffer - the buffer that holds the data
KernelException
public void shipAgentContainer(Cookie cookie,
int acid,
Endpoint dest,
java.lang.String[] secSuites,
TransactionID tid)
throws KernelException
AOSapi
shipAgentContainer in interface AOSapicookie - caller cookieacid - agent container to shipdest - the listen endpoint that the remote
kernel uses for incoming agent container
shipments (note: dest.port currently unused)secSuites - a series of cipher suites acceptable to the caller,
null or empty is equivalent to ALL_SEC_SUITES, as ACTP
requires authentication.tid - the transaction ID for this shipment,
created by the remote AOS kernel
KernelException
public AOSapi.WaitACResult waitAgentContainer(Cookie cookie,
TransactionID[] tids,
int blockTime)
AOSapi
waitAgentContainer in interface AOSapicookie - caller cookietids - TransactionIDs for the AC shipment. All exceptions
occuring will include the tid of the transaction that met
the error.blockTime - time in seconds in which the kernel will wait for an ACT
to be initiated. blockTime 0 means ``poll''.
public int writeSegment(Cookie cookie,
int acid,
int segID,
int offset,
byte[] frombuf)
throws KernelException
AOSapi
writeSegment in interface AOSapicookie - caller cookieacid - agent container to write tosegID - segment to write tooffset - offset in segment to start writing atfrombuf - buffer containing the bytes to write
KernelException
public AOSapi.PrepareWaitACResult prepareWaitAgentContainer(Cookie cookie,
java.lang.String[] secSuites)
throws KernelException
AOSapi
prepareWaitAgentContainer in interface AOSapicookie - caller cookiesecSuites - a series of cipher suites acceptable to the caller,
null or empty is equivalent to ALL_SEC_SUITES, as ACTP
requires authentication.
KernelException
public void deleteRole(Cookie cookie,
Cookie childCookie)
throws KernelException
AOSapi
deleteRole in interface AOSapicookie - caller cookie, must correspond to the parent role that
created this rolechildCookie - cookie of the role to be deleted
KernelException
public SelectSets select(Cookie cookie,
SelectSets sets,
boolean blocking)
throws KernelException
AOSapi
select in interface AOSapicookie - caller cookiesets - set of three sets: readSet, writeSet, exceptSet
readSet : set of local descriptors to check for data/connection
availability
writeSet set of local descriptors to check for writability
exceptSet set of local descriptors to check for exceptionsblocking - whether to block or not
KernelException
public int getParam(Cookie cookie,
java.lang.String parameterName)
throws KernelException
AOSapi
getParam in interface AOSapicookie - caller cookieparameterName - the name of the AOS parameter
KernelException
public void reenableRole(Cookie cookie)
throws KernelException
AOSapi
reenableRole in interface AOSapicookie - caller cookie
KernelException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||