|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection
java.util.AbstractList
java.util.ArrayList
codec.asn1.ASN1AbstractCollection
codec.asn1.ASN1Sequence
de.fhg.igd.atlas.lsp.LSPReply
Represents an LSP_Reply structure of the Location Service Protocol (LSP). This class encapsulates a reply of the LSP as message body with additional information about the corresponding message type, the result state and the used protocol version.
The ASN.1 structure of the reply is as follows
LSP_Reply := SEQUENCE
{
version INTEGER {lspVer1(1)} (lspVer1),
replyType INTEGER
{
stateOnly(0),
lookup(1)
refresh(5),
list(6),
},
replyState INTEGER
{
-- Success
acknowledge('0100'H),
implicitNameNotFound('0101'H),
-- Redirection
someImplicitNamesNotPresent('0200'H),
-- Client Error
cookieInvalid('0400'H),
contactAddressNotExistent('0401'H),
notAuthorized('0402'H),
implicitNameNotPresent('0403'H),
-- Server Error
wrongVersion('0800'H),
requestTypeInvalid('0801'H),
encodingNotSupported('0802'H),
encryptingNotSupported('0803'H),
-- IO Error
ioError('01000'H),
internalClientError('1001'H),
requestBodyInvalid('1002'H),
encodedDataInvalid('1003'H),
encryptedDataInvalid('1004'H),
-- Error Flags
clientErrorFlag('010000'H),
proxyErrorFlag('020000'H),
serverErrorFlag('040000'H)
},
replyBody ANY DEFINED BY replyType OPTIONAL
}
The Location Service Server
(LSServer) respectively the
Location Service Proxy (LSProxy)
can create an instance of this class by calling the public constructor,
encode it by calling getEncoded and send it to the Location
Service Client (LSClient) as
reply to a corresponding request. The LSClient can decode
the reply by calling createReply.
LSPRequest,
LSPLookupResult,
LSPRefreshResult,
LSPListResult,
Serialized Form| Nested Class Summary |
| Nested classes inherited from class java.util.AbstractList |
|
| Field Summary | |
static int |
ACKNOWLEDGE
Success reply state (see SUCCESS_MASK)
for the following case:
The corresponding request has been handled successfully. |
protected ASN1Type |
body_
The reply body. |
static int |
CLIENT_ERROR_FLAG
Error flag for the following case: An error has occured on client side. |
static int |
CLIENT_ERROR_MASK
Mask for all client error codes. |
static int |
CONTACT_ADDRESS_NOT_EXISTENT
Client error reply state (see CLIENT_ERROR_MASK)
for the following case:
The contact address of the corresponding LSPRegister
request is not existent. |
static int |
COOKIE_INVALID
Client error reply state (see CLIENT_ERROR_MASK)
for the following case:
The current cookie of the corresponding LSPRegister
request is invalid. |
static int |
ENCODED_DATA_INVALID
IO error reply state (see IO_ERROR_MASK)
for the following case:
The content of the corresponding LSPRegisterEncoded
request is invalid. |
static int |
ENCODING_NOT_SUPPORTED
Server error reply state (see SERVER_ERROR_MASK)
for the following case:
The LSServer respectively the LSProxy,
which received the corresponding LSPRegisterEncoded
request does not support encoded register requests. |
static int |
ENCRYPTED_DATA_INVALID
IO error reply state (see IO_ERROR_MASK)
for the following case:
The content of the corresponding LSPRegisterEncrypted
request is invalid. |
static int |
ENCRYPTING_NOT_SUPPORTED
Server error reply state (see SERVER_ERROR_MASK)
for the following case:
The LSServer respectively the LSProxy,
which received the corresponding LSPRegisterEncrypted
request does not support encrypted register requests. |
static int |
ERROR_FLAGS
Mask for all error flags. |
static int |
IMPLICIT_NAME_NOT_FOUND
Success reply state (see SUCCESS_MASK)
for the following case:
The implicit name of the corresponding LSPLookup
request has not been found. |
static int |
IMPLICIT_NAME_NOT_PRESENT
Client error reply state (see CLIENT_ERROR_MASK)
for the following case:
The implicit name of the corresponding LSPProxyInvalidate
or LSPRegister request is not present. |
static int |
INTERNAL_CLIENT_ERROR
IO error reply state (see IO_ERROR_MASK)
for the following case:
An internal client error occured. |
static int |
IO_ERROR
IO error reply state (see IO_ERROR_MASK)
for the following case:
The request could not be sent due to an IO error. |
static int |
IO_ERROR_MASK
Mask for all IO error codes. |
static int |
LIST
Message type for a LSPList reply. |
static int |
LOOKUP
Message type for a LSPLookup reply. |
static int |
NOT_AUTHORIZED
Client error reply state (see CLIENT_ERROR_MASK)
for the following case:
The corresponding LSPList request
has not been authorized. |
static int |
PROXY_ERROR_FLAG
Error flag for the following case: An error has occured on proxy side. |
static int |
REDIRECTION_MASK
Mask for status codes which indicate that further action needs to be taken by client in order to fulfill the request. |
static int |
REFRESH
Message type for a LSPRefresh reply. |
static int |
REQUEST_BODY_INVALID
IO error reply state (see IO_ERROR_MASK)
for the following case:
The request body of the corresponding request is invalid. |
static int |
REQUEST_TYPE_INVALID
Server error reply state (see SERVER_ERROR_MASK)
for the following case:
The request type of the corresponding request is invalid. |
static int |
SERVER_ERROR_FLAG
Error flag for the following case: An error has occured on server side. |
static int |
SERVER_ERROR_MASK
Mask for all server error codes. |
static int |
SOME_IMPLICIT_NAMES_NOT_PRESENT
Redirection reply state (see REDIRECTION_MASK)
for the following case:
Some of the implicit names of the corresponding
LSPRefresh request are not present. |
protected ASN1Integer |
state_
The reply state. |
protected static int |
STATE_MASK
Mask for all status codes. |
static int |
STATE_ONLY
Message type for a reply wihtout message body. |
static int |
SUCCESS_MASK
Mask for all status codes corresponding to requests which have been sucessfully received, understood and processed. |
protected ASN1Integer |
type_
The reply type. |
static int |
VERSION
The current version of the Location Service Protocol supported by this class. |
protected ASN1Integer |
version_
The version number of this reply. |
static int |
WRONG_VERSION
Server error reply state (see SERVER_ERROR_MASK)
for the following case:
The protocol version of the corresponding request
has not been accepted. |
| Fields inherited from class codec.asn1.ASN1AbstractCollection |
|
| Fields inherited from class java.util.ArrayList |
|
| Fields inherited from class java.util.AbstractList |
modCount |
| Constructor Summary | |
private |
LSPReply()
Creates an instance ready for decoding. |
|
LSPReply(int type,
int state,
ASN1Type body)
Creates an reply instance of the given type
with the given body and the given
state. |
| Method Summary | |
boolean |
checkClientError()
Checks the type of the reply state (see CLIENT_ERROR_MASK). |
boolean |
checkErrorFlags()
Checks error flags (see ERROR_FLAGS). |
boolean |
checkIOError()
Checks the type of the reply state (see IO_ERROR_MASK). |
boolean |
checkRedirection()
Checks the type of the reply state (see REDIRECTION_MASK). |
boolean |
checkServerError()
Checks the type of the reply state (see SERVER_ERROR_MASK). |
boolean |
checkSuccess()
Checks the type of the reply state (see SUCCESS_MASK). |
static LSPReply |
createReply(byte[] code)
Creates a new reply from the given encoded reply. |
static LSPReply |
createReply(InputStream in,
int limit)
Creates a new reply from the encoded reply, which will be read from the specified input stream. |
ASN1Type |
getBody()
Returns the reply body, or null,
if the current reply type is STATE_ONLY. |
byte[] |
getEncoded()
Returns the DER encoded reply. |
int |
getErrorFlags()
Retruns the error flags (see ERROR_FLAGS) |
int |
getState()
Returns the reply state. |
String |
getStateString()
Returns the string representation of the reply state |
int |
getType()
Returns the reply type. |
String |
getTypeString()
Returns the string representation of the reply type. |
int |
getVersion()
Returns the reply version. |
ASN1Type |
resolve(ASN1Type caller)
Returns the supposed ASN1Type of the reply body, corresponding to the current reply type, or null, if the current reply type is
STATE_ONLY. |
void |
setClientErrorFlag(boolean flag)
Sets the client error flag if flag is true,
deletes this flag if flag is false
(see CLIENT_ERROR_FLAG). |
void |
setErrorFlags(int flags)
Deletes all current error flags and sets the new flags
(see ERROR_FLAGS). |
void |
setProxyErrorFlag(boolean flag)
Sets the proxy error flag if flag is true,
deletes this flag if flag is false
(see PROXY_ERROR_FLAG). |
void |
setServerErrorFlag(boolean flag)
Sets the server error flag if flag is true,
deletes this flag if flag is false
(see SERVER_ERROR_FLAG). |
String |
toString()
Returns the string representation of this reply. |
| Methods inherited from class codec.asn1.ASN1Sequence |
getTag |
| Methods inherited from class codec.asn1.ASN1AbstractCollection |
checkConstraints, decode, encode, getCollection, getConstraint, getTagClass, getValue, isExplicit, isOptional, isType, setConstraint, setExplicit, setOptional |
| Methods inherited from class java.util.ArrayList |
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize |
| Methods inherited from class java.util.AbstractList |
equals, hashCode, iterator, listIterator, listIterator, subList |
| Methods inherited from class java.util.AbstractCollection |
containsAll, remove, removeAll, retainAll |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
| Methods inherited from interface java.util.List |
containsAll, equals, hashCode, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList |
| Field Detail |
public static final int VERSION
public static final int STATE_ONLY
public static final int LOOKUP
LSPLookup reply.
public static final int REFRESH
LSPRefresh reply.
public static final int LIST
LSPList reply.
protected static final int STATE_MASK
public static final int SUCCESS_MASK
ACKNOWLEDGE, IMPLICIT_NAME_NOT_FOUND)
public static final int ACKNOWLEDGE
SUCCESS_MASK)
for the following case:
The corresponding request has been handled successfully.
(Corresponding HTTP Error Code: 200 - OK (Success))
public static final int IMPLICIT_NAME_NOT_FOUND
SUCCESS_MASK)
for the following case:
The implicit name of the corresponding LSPLookup
request has not been found.
(Corresponding HTTP Error Code: 404 - Not Found (Client Error))
public static final int REDIRECTION_MASK
SOME_IMPLICIT_NAMES_NOT_PRESENT)
public static final int SOME_IMPLICIT_NAMES_NOT_PRESENT
REDIRECTION_MASK)
for the following case:
Some of the implicit names of the corresponding
LSPRefresh request are not present.
(Corresponding HTTP Error Code: 404 - Not Found (Client Error))
public static final int CLIENT_ERROR_MASK
COOKIE_INVALID,
CONTACT_ADDRESS_NOT_EXISTENT, NOT_AUTHORIZED,
IMPLICIT_NAME_NOT_PRESENT)
public static final int COOKIE_INVALID
CLIENT_ERROR_MASK)
for the following case:
The current cookie of the corresponding LSPRegister
request is invalid.
(Corresponding HTTP Error Code: 401 - Unauthorized (Client Error))
public static final int CONTACT_ADDRESS_NOT_EXISTENT
CLIENT_ERROR_MASK)
for the following case:
The contact address of the corresponding LSPRegister
request is not existent.
(Corresponding HTTP Error Code: 403 - Forbidden (Client Error))
public static final int NOT_AUTHORIZED
CLIENT_ERROR_MASK)
for the following case:
The corresponding LSPList request
has not been authorized.
(Corresponding HTTP Error Code: 401 - Unauthorized (Client Error))
public static final int IMPLICIT_NAME_NOT_PRESENT
CLIENT_ERROR_MASK)
for the following case:
The implicit name of the corresponding LSPProxyInvalidate
or LSPRegister request is not present.
(Corresponding HTTP Error Code: 404 - Not Found (Client Error))
public static final int SERVER_ERROR_MASK
WRONG_VERSION,
REQUEST_TYPE_INVALID, ENCODING_NOT_SUPPORTED,
ENCRYPTING_NOT_SUPPORTED)
public static final int WRONG_VERSION
SERVER_ERROR_MASK)
for the following case:
The protocol version of the corresponding request
has not been accepted.
(Corresponding HTTP Error Code: 505 - Version not supported (Server Error))
public static final int REQUEST_TYPE_INVALID
SERVER_ERROR_MASK)
for the following case:
The request type of the corresponding request is invalid.
(Corresponding HTTP Error Code: 501 - Not Implemented (Server Error))
public static final int ENCODING_NOT_SUPPORTED
SERVER_ERROR_MASK)
for the following case:
The LSServer respectively the LSProxy,
which received the corresponding LSPRegisterEncoded
request does not support encoded register requests.
(Corresponding HTTP Error Code: 501 - Not Implemented (Server Error))
public static final int ENCRYPTING_NOT_SUPPORTED
SERVER_ERROR_MASK)
for the following case:
The LSServer respectively the LSProxy,
which received the corresponding LSPRegisterEncrypted
request does not support encrypted register requests.
(Corresponding HTTP Error Code: 501 - Not Implemented (Server Error))
public static final int IO_ERROR_MASK
IO_ERROR, INTERNAL_CLIENT_ERROR,
REQUEST_BODY_INVALID, ENCODED_DATA_INVALID,
ENCRYPTED_DATA_INVALID).
public static final int IO_ERROR
IO_ERROR_MASK)
for the following case:
The request could not be sent due to an IO error.
(Corresponding HTTP Error Code: 504 - Gateway timeout (Server Error))
public static final int INTERNAL_CLIENT_ERROR
IO_ERROR_MASK)
for the following case:
An internal client error occured.
(Corresponding HTTP Error Code: 409 - Conflict (Client Error))
public static final int REQUEST_BODY_INVALID
IO_ERROR_MASK)
for the following case:
The request body of the corresponding request is invalid.
(Corresponding HTTP Error Code: 400 - Bad Request (Client Error))
public static final int ENCODED_DATA_INVALID
IO_ERROR_MASK)
for the following case:
The content of the corresponding LSPRegisterEncoded
request is invalid.
(Corresponding HTTP Error Code: 400 - Bad Request (Client Error))
public static final int ENCRYPTED_DATA_INVALID
IO_ERROR_MASK)
for the following case:
The content of the corresponding LSPRegisterEncrypted
request is invalid.
(Corresponding HTTP Error Code: 400 - Bad Request (Client Error))
public static final int ERROR_FLAGS
public static final int CLIENT_ERROR_FLAG
public static final int PROXY_ERROR_FLAG
public static final int SERVER_ERROR_FLAG
protected ASN1Integer version_
protected ASN1Integer type_
protected ASN1Integer state_
protected ASN1Type body_
| Constructor Detail |
private LSPReply()
createReply
method to decode a given encoded reply.
public LSPReply(int type,
int state,
ASN1Type body)
throws InvalidMessageTypeException,
NullPointerException
type
with the given body and the given
state.
type - The reply type.state - The reply state.body - The reply body.
InvalidMessageTypeException - if the given reply type
is not supported (RuntimeException).
NullPointerException - if body
is null and state is not
STATE_ONLY (RuntimeException).| Method Detail |
public static LSPReply createReply(byte[] code)
throws CorruptedCodeException,
WrongProtocolVersionException,
InvalidMessageTypeException,
IllegalStateException,
NullPointerException
code - The encoded reply.
CorruptedCodeException - if the code is bad.
WrongProtocolVersionException - if the protocol version
does not match with the expected one (RuntimeException).
InvalidMessageTypeException - if the message type of
the reply is not supported (RuntimeException).
IllegalStateException - if an error occurs
while decoding with DERDecoder (RuntimeException).
NullPointerException - if code
is null (RuntimeException).
public static LSPReply createReply(InputStream in,
int limit)
throws CorruptedCodeException,
WrongProtocolVersionException,
InvalidMessageTypeException,
IllegalStateException,
NullPointerException
IllegalStateException will be thrown.
CorruptedCodeException - if the code is bad.
WrongProtocolVersionException - if the protocol version
does not match with the expected one (RuntimeException).
InvalidMessageTypeException - if the message type of
the reply is not supported (RuntimeException).
IllegalStateException - if an error occurs
while decoding with DERDecoder (RuntimeException).
NullPointerException - if code
is null (RuntimeException).public void setClientErrorFlag(boolean flag)
flag is true,
deletes this flag if flag is false
(see CLIENT_ERROR_FLAG).
flag - The client error flag.public void setProxyErrorFlag(boolean flag)
flag is true,
deletes this flag if flag is false
(see PROXY_ERROR_FLAG).
flag - The proxy error flag.public void setServerErrorFlag(boolean flag)
flag is true,
deletes this flag if flag is false
(see SERVER_ERROR_FLAG).
flag - The client error flag.public void setErrorFlags(int flags)
flags
(see ERROR_FLAGS).
flags - The error flags.
public ASN1Type resolve(ASN1Type caller)
throws ResolverException
null, if the current reply type is
STATE_ONLY.
resolve in interface Resolvercaller - The caller of this method.
ResoverException - if the current reply type is not
supported.
ResolverExceptionpublic int getVersion()
public int getType()
public int getState()
public ASN1Type getBody()
null,
if the current reply type is STATE_ONLY.
public int getErrorFlags()
ERROR_FLAGS)
public boolean checkSuccess()
SUCCESS_MASK).
true if reply state is a success code,
false otherwise.public boolean checkRedirection()
REDIRECTION_MASK).
true if reply state is a redirection code,
false otherwise.public boolean checkClientError()
CLIENT_ERROR_MASK).
true if reply state is a client error,
false otherwise.public boolean checkServerError()
SERVER_ERROR_MASK).
true if reply state is a server error,
false otherwise.public boolean checkIOError()
IO_ERROR_MASK).
true if reply state is an IO error,
false otherwise.public boolean checkErrorFlags()
ERROR_FLAGS).
true if any error flags are set,
false otherwise.
public byte[] getEncoded()
throws IllegalStateException
IllegalStateException - if an exception occures
during ASN1 encoding (RuntimeException).public String getTypeString()
public String getStateString()
public String toString()
ASN1StructureName {
Property : Value
}
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||