Fields Summary |
---|
protected static final byte | WARNINGDefines the severity of alert as warning |
protected static final byte | FATALDefines the severity of alert as fatal |
protected static final byte | CLOSE_NOTIFYDefines the description code of the close_notify alert |
protected static final byte | UNEXPECTED_MESSAGEDefines the description code of the unexpected_message alert |
protected static final byte | BAD_RECORD_MACDefines the description code of the bad_record_mac alert |
protected static final byte | DECRYPTION_FAILEDDefines the description code of the decryption_failed alert |
protected static final byte | RECORD_OVERFLOWDefines the description code of the record_overflow alert |
protected static final byte | DECOMPRESSION_FAILUREDefines the description code of the decompression_failure alert |
protected static final byte | HANDSHAKE_FAILUREDefines the description code of the handshake_failure alert |
protected static final byte | BAD_CERTIFICATEDefines the description code of the bad_certificate alert |
protected static final byte | UNSUPPORTED_CERTIFICATEDefines the description code of the unsupported_certificate alert |
protected static final byte | CERTIFICATE_REVOKEDDefines the description code of the certificate_revoked alert |
protected static final byte | CERTIFICATE_EXPIREDDefines the description code of the certificate_expired alert |
protected static final byte | CERTIFICATE_UNKNOWNDefines the description code of the certificate_unknown alert |
protected static final byte | ILLEGAL_PARAMETERDefines the description code of the illegal_parameter alert |
protected static final byte | UNKNOWN_CADefines the description code of the unknown_ca alert |
protected static final byte | ACCESS_DENIEDDefines the description code of the access_denied alert |
protected static final byte | DECODE_ERRORDefines the description code of the decode_error alert |
protected static final byte | DECRYPT_ERRORDefines the description code of the decrypt_error alert |
protected static final byte | EXPORT_RESTRICTIONDefines the description code of the export_restriction alert |
protected static final byte | PROTOCOL_VERSIONDefines the description code of the protocol_version alert |
protected static final byte | INSUFFICIENT_SECURITYDefines the description code of the insufficient_security alert |
protected static final byte | INTERNAL_ERRORDefines the description code of the internal_error alert |
protected static final byte | USER_CANCELEDDefines the description code of the user_canceled alert |
protected static final byte | NO_RENEGOTIATIONDefines the description code of the no_renegotiation alert |
private final byte[] | alert |
private org.apache.harmony.xnet.provider.jsse.SSLRecordProtocol | recordProtocol |
private Logger.Stream | logger |
Methods Summary |
---|
protected void | alert(byte level, byte description)Reports an alert to be sent/received by transport.
This method is usually called during processing
of the income TSL record: if it contains alert message from another
peer, or if warning alert occured during the processing of the
message and this warning should be sent to another peer.
if (logger != null) {
logger.println("Alert.alert: "+level+" "+description);
}
this.alert[0] = level;
this.alert[1] = description;
|
protected java.lang.String | getAlertDescription()Returns the string representation of occured alert.
If no alert has occured null is returned.
switch (alert[1]) {
case CLOSE_NOTIFY:
return "close_notify";
case UNEXPECTED_MESSAGE:
return "unexpected_message";
case BAD_RECORD_MAC:
return "bad_record_mac";
case DECRYPTION_FAILED:
return "decryption_failed";
case RECORD_OVERFLOW:
return "record_overflow";
case DECOMPRESSION_FAILURE:
return "decompression_failure";
case HANDSHAKE_FAILURE:
return "handshake_failure";
case BAD_CERTIFICATE:
return "bad_certificate";
case UNSUPPORTED_CERTIFICATE:
return "unsupported_certificate";
case CERTIFICATE_REVOKED:
return "certificate_revoked";
case CERTIFICATE_EXPIRED:
return "certificate_expired";
case CERTIFICATE_UNKNOWN:
return "certificate_unknown";
case ILLEGAL_PARAMETER:
return "illegal_parameter";
case UNKNOWN_CA:
return "unknown_ca";
case ACCESS_DENIED:
return "access_denied";
case DECODE_ERROR:
return "decode_error";
case DECRYPT_ERROR:
return "decrypt_error";
case EXPORT_RESTRICTION:
return "export_restriction";
case PROTOCOL_VERSION:
return "protocol_version";
case INSUFFICIENT_SECURITY:
return "insufficient_security";
case INTERNAL_ERROR:
return "internal_error";
case USER_CANCELED:
return "user_canceled";
case NO_RENEGOTIATION:
return "no_renegotiation";
}
return null;
|
protected byte | getDescriptionCode()Returns the description code of alert or -100 if there
is no alert.
return (alert[0] != 0) ? alert[1] : -100;
|
protected boolean | hasAlert()Checks if any alert has occured.
return (alert[0] != 0);
|
protected boolean | isFatalAlert()Checks if occured alert is fatal alert.
return (alert[0] == 2);
|
protected void | setProcessed()Resets the protocol to be in "no alert" state.
This method shoud be called after processing of the reported alert.
// free the info about alert
if (logger != null) {
logger.println("Alert.setProcessed");
}
this.alert[0] = 0;
|
protected void | setRecordProtocol(org.apache.harmony.xnet.provider.jsse.SSLRecordProtocol recordProtocol)Sets up the record protocol to be used by this allert protocol.
this.recordProtocol = recordProtocol;
|
protected void | shutdown()Shutdownes the protocol. It will be impossiblke to use the instance
after the calling of this method.
alert[0] = 0;
alert[1] = 0;
recordProtocol = null;
|
protected byte[] | wrap()Returns the record with reported alert message.
The returned array of bytes is ready to be sent to another peer.
Note, that this method does not automatically set the state of allert
protocol in "no alert" state, so after wrapping the method setProcessed
should be called.
byte[] res = recordProtocol.wrap(ContentType.ALERT, alert, 0, 2);
return res;
|