All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.netty.incubator.codec.http3.Http3SettingsFrame Maven / Gradle / Ivy

/*
 * Copyright 2020 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.incubator.codec.http3;

import java.util.Map;

/**
 * See SETTINGS.
 */
public interface Http3SettingsFrame extends Http3ControlStreamFrame, Iterable> {

    /**
     * See 
     *     SETTINGS_QPACK_MAX_TABLE_CAPACITY.
     */
    long HTTP3_SETTINGS_QPACK_MAX_TABLE_CAPACITY = 0x1;
    /**
     * See 
     *     SETTINGS_QPACK_BLOCKED_STREAMS.
     */
    long HTTP3_SETTINGS_QPACK_BLOCKED_STREAMS = 0x7;
    /**
     * See 
     *     SETTINGS_MAX_FIELD_SECTION_SIZE.
     */
    long HTTP3_SETTINGS_MAX_FIELD_SECTION_SIZE = 0x6;

    @Override
    default long type() {
        return Http3CodecUtils.HTTP3_SETTINGS_FRAME_TYPE;
    }

    /**
     * Get a setting from the frame.
     *
     * @param key   the key of the setting.
     * @return      the value of the setting or {@code null} if none was found with the given key.
     */
    Long get(long key);

    /**
     * Get a setting from the frame.
     *
     * @param key   the key of the setting.
     * @param defaultValue If the setting does not exist.
     * @return the value of the setting or {@code defaultValue} if none was found with the given key.
     */
    default Long getOrDefault(long key, long defaultValue) {
        final Long val = get(key);
        return val == null ? defaultValue : val;
    }

    /**
     * Put a setting in the frame.
     *
     * @param key       the key of the setting
     * @param value     the value of the setting.
     * @return          the previous stored valued for the given key or {@code null} if none was stored before.
     */
    Long put(long key, Long value);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy