com.github.netty.protocol.mqtt.MqttUtil Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2012-2018 The original author or authors
* ------------------------------------------------------
* 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 com.github.netty.protocol.mqtt;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.mqtt.MqttMessage;
import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader;
import io.netty.util.Attribute;
import io.netty.util.AttributeKey;
import java.nio.charset.Charset;
import java.util.Map;
/**
* Some Netty's channels utilities.
*/
public final class MqttUtil {
private static final AttributeKey ATTR_KEY_KEEPALIVE = AttributeKey.valueOf(String.class + "#keepAlive");
private static final AttributeKey ATTR_KEY_CLEANSESSION = AttributeKey.valueOf(Boolean.class + "#removeTemporaryQoS2");
private static final AttributeKey ATTR_KEY_CLIENTID = AttributeKey.valueOf(String.class + "#ClientID");
private static final AttributeKey ATTR_KEY_USERNAME = AttributeKey.valueOf(String.class + "#username");
private MqttUtil() {
}
public static Object getAttribute(ChannelHandlerContext ctx, AttributeKey