Files
IM-server-new/broker/src/main/java/io/moquette/interception/messages/InterceptConnectMessage.java
T

86 lines
2.2 KiB
Java
Raw Normal View History

2017-04-12 17:40:32 +02:00
/*
2019-03-16 17:04:23 +08:00
* Copyright (c) 2012-2017 The original author or authors
2017-04-12 17:40:32 +02:00
* ------------------------------------------------------
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.moquette.interception.messages;
2015-08-17 17:41:29 -03:00
import io.netty.handler.codec.mqtt.MqttConnectMessage;
2015-08-17 17:41:29 -03:00
public class InterceptConnectMessage extends InterceptAbstractMessage {
private final MqttConnectMessage msg;
2015-08-17 17:41:29 -03:00
public InterceptConnectMessage(MqttConnectMessage msg) {
2015-08-17 17:41:29 -03:00
super(msg);
this.msg = msg;
}
public String getClientID() {
return msg.payload().clientIdentifier();
2015-08-17 17:41:29 -03:00
}
public boolean isCleanSession() {
return msg.variableHeader().isCleanSession();
2015-08-17 17:41:29 -03:00
}
public int getKeepAlive() {
return msg.variableHeader().keepAliveTimeSeconds();
2015-08-17 17:41:29 -03:00
}
public boolean isPasswordFlag() {
return msg.variableHeader().hasPassword();
2015-08-17 17:41:29 -03:00
}
public byte getProtocolVersion() {
return (byte) msg.variableHeader().version();
2015-08-17 17:41:29 -03:00
}
public String getProtocolName() {
return msg.variableHeader().name();
2015-08-17 17:41:29 -03:00
}
public boolean isUserFlag() {
return msg.variableHeader().hasUserName();
2015-08-17 17:41:29 -03:00
}
public boolean isWillFlag() {
return msg.variableHeader().isWillFlag();
2015-08-17 17:41:29 -03:00
}
public byte getWillQos() {
return (byte) msg.variableHeader().willQos();
2015-08-17 17:41:29 -03:00
}
public boolean isWillRetain() {
return msg.variableHeader().isWillRetain();
2015-08-17 17:41:29 -03:00
}
public String getUsername() {
return msg.payload().userName();
2015-08-17 17:41:29 -03:00
}
public byte[] getPassword() {
2022-09-18 22:05:22 +08:00
return msg.payload().passwordInBytes();
2015-08-17 17:41:29 -03:00
}
public String getWillTopic() {
return msg.payload().willTopic();
2015-08-17 17:41:29 -03:00
}
public byte[] getWillMessage() {
2019-03-16 17:04:23 +08:00
return msg.payload().willMessage().getBytes();
2015-08-17 17:41:29 -03:00
}
}