public void setConfig(AlertLevel level, AlertDescription description) { config = new byte[2]; config[0] = level.getValue(); config[1] = description.getValue(); }
@Override public String toString() { return "AlertLevel{" + "value=" + this.name() + '}'; }
@Override public String toCompactString() { StringBuilder sb = new StringBuilder(); String levelString; String descriptionString; if (level != null && level.getValue() != null) { levelString = AlertLevel.getAlertLevel(level.getValue()).name(); } else { levelString = "null"; } if (description != null && description.getValue() != null) { AlertDescription desc = AlertDescription.getAlertDescription(description.getValue()); if (desc != null) { descriptionString = desc.name(); } else { descriptionString = "" + description.getValue(); } } else { descriptionString = "null"; } sb.append("Alert(").append(levelString).append(",").append(descriptionString).append(")"); return sb.toString(); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("AlertMessage:"); sb.append("\n Level: "); if (level != null) { if (AlertLevel.getAlertLevel(level.getValue()) == AlertLevel.UNDEFINED) { sb.append(level.getValue()); } else { sb.append(AlertLevel.getAlertLevel(level.getValue())); } } else { sb.append("null"); } sb.append("\n Description: "); if (description != null) { if (AlertDescription.getAlertDescription(description.getValue()) == null) { sb.append(description.getValue()); } else { sb.append(AlertDescription.getAlertDescription(description.getValue())); } } else { sb.append("null"); } return sb.toString(); }
if (lm.getProtocolMessageType() == ProtocolMessageType.ALERT) { AlertMessage am = ((AlertMessage) lm); LOGGER.info(" Last protocol message: Alert ({},{}) [{},{}]", AlertLevel.getAlertLevel(am.getLevel() .getValue()), AlertDescription.getAlertDescription(am.getDescription().getValue()), am.getLevel() .getValue(), am.getDescription().getValue());
private boolean receivedFatalAlert(List<ProtocolMessage> messages) { for (ProtocolMessage message : messages) { if (message instanceof AlertMessage) { AlertMessage alert = (AlertMessage) message; if (alert.getLevel().getValue() == AlertLevel.FATAL.getValue()) { return true; } } } return false; }
@Override public void adjustTLSContext(AlertMessage message) { if (tlsContext.getTalkingConnectionEndType() == tlsContext.getChooser().getMyConnectionPeer() && AlertLevel.FATAL.getValue() == message.getLevel().getValue()) { LOGGER.debug("Setting received Fatal Alert in Context"); tlsContext.setReceivedFatalAlert(true); } } }