Home / File/ MqttReasonCodes.java — netty Source File

MqttReasonCodes.java — netty Source File

Architecture documentation for MqttReasonCodes.java, a java file in the netty codebase.

Entity Profile

Relationship Graph

Source Code

/*
 * Copyright 2023 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.netty.handler.codec.mqtt;

/**
 * Provides a set of enumeration that exposes standard MQTT 5 reason codes used by various messages.
 * */
public final class MqttReasonCodes {

    private MqttReasonCodes() {
    }

    /**
     * @return the corresponding enum value to the hex value.
     * */
    private static <E> E valueOfHelper(byte b, E[] values) {
        try {
            return values[b & 0xFF];
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new IllegalArgumentException("unknown reason code: " + b);
        }
    }

    /**
     * Reason codes for MQTT Disconnect message.
     */
    public enum Disconnect {
        NORMAL_DISCONNECT((byte) 0x00), //sent by: client or server
        DISCONNECT_WITH_WILL_MESSAGE((byte) 0x04), //sent by: client
        UNSPECIFIED_ERROR((byte) 0x80), //sent by: client or server
        MALFORMED_PACKET((byte) 0x81), //sent by: client or server
        PROTOCOL_ERROR((byte) 0x82), //sent by: client or server
        IMPLEMENTATION_SPECIFIC_ERROR((byte) 0x83), //sent by: client or server
        NOT_AUTHORIZED((byte) 0x87), //sent by: server
        SERVER_BUSY((byte) 0x89), //sent by: server
        SERVER_SHUTTING_DOWN((byte) 0x8B), //sent by: server
        KEEP_ALIVE_TIMEOUT((byte) 0x8D), //sent by: Server
        SESSION_TAKEN_OVER((byte) 0x8E), //sent by: Server
        TOPIC_FILTER_INVALID((byte) 0x8F), //sent by: Server
        TOPIC_NAME_INVALID((byte) 0x90), //sent by: Client or Server
        RECEIVE_MAXIMUM_EXCEEDED((byte) 0x93), //sent by: Client or Server
        TOPIC_ALIAS_INVALID((byte) 0x94), //sent by: Client or Server
        PACKET_TOO_LARGE((byte) 0x95), //sent by: Client or Server
        MESSAGE_RATE_TOO_HIGH((byte) 0x96), //sent by: Client or Server
        QUOTA_EXCEEDED((byte) 0x97), //sent by: Client or Server
        ADMINISTRATIVE_ACTION((byte) 0x98), //sent by: Client or Server
// ... (363 more lines)

Domain

Subdomains

Classes

Frequently Asked Questions

What does MqttReasonCodes.java do?
MqttReasonCodes.java is a source file in the netty codebase, written in java. It belongs to the Buffer domain, Allocators subdomain.
Where is MqttReasonCodes.java in the architecture?
MqttReasonCodes.java is located at codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttReasonCodes.java (domain: Buffer, subdomain: Allocators, directory: codec-mqtt/src/main/java/io/netty/handler/codec/mqtt).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free