Home / Class/ TcpMd5Util Class — netty Architecture

TcpMd5Util Class — netty Architecture

Architecture documentation for the TcpMd5Util class in TcpMd5Util.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  9b256397_7b66_3f2f_bcfc_d85563e386ee["TcpMd5Util"]
  dd3e86fb_1ba8_d341_22ad_bd2ece538eb8["TcpMd5Util.java"]
  9b256397_7b66_3f2f_bcfc_d85563e386ee -->|defined in| dd3e86fb_1ba8_d341_22ad_bd2ece538eb8
  5940a575_dc34_e2c4_8786_b0f92e6de764["newTcpMd5Sigs()"]
  9b256397_7b66_3f2f_bcfc_d85563e386ee -->|method| 5940a575_dc34_e2c4_8786_b0f92e6de764
  e59021d4_b03a_8333_381b_b9a43a4a4f07["TcpMd5Util()"]
  9b256397_7b66_3f2f_bcfc_d85563e386ee -->|method| e59021d4_b03a_8333_381b_b9a43a4a4f07

Relationship Graph

Source Code

transport-classes-epoll/src/main/java/io/netty/channel/epoll/TcpMd5Util.java lines 30–73

final class TcpMd5Util {

    static Collection<InetAddress> newTcpMd5Sigs(AbstractEpollChannel channel, Collection<InetAddress> current,
                                         Map<InetAddress, byte[]> newKeys) throws IOException {
        checkNotNull(channel, "channel");
        checkNotNull(current, "current");
        checkNotNull(newKeys, "newKeys");

        // Validate incoming values
        for (Entry<InetAddress, byte[]> e : newKeys.entrySet()) {
            final byte[] key = e.getValue();
            checkNotNullWithIAE(e.getKey(), "e.getKey");
            checkNonEmpty(key, e.getKey().toString());
            if (key.length > Native.TCP_MD5SIG_MAXKEYLEN) {
                throw new IllegalArgumentException("newKeys[" + e.getKey() +
                    "] has a key with invalid length; should not exceed the maximum length (" +
                        Native.TCP_MD5SIG_MAXKEYLEN + ')');
            }
        }

        // Remove mappings not present in the new set.
        for (InetAddress addr : current) {
            if (!newKeys.containsKey(addr)) {
                channel.socket.setTcpMd5Sig(addr, null);
            }
        }

        if (newKeys.isEmpty()) {
            return Collections.emptySet();
        }

        // Set new mappings and store addresses which we set.
        final Collection<InetAddress> addresses = new ArrayList<InetAddress>(newKeys.size());
        for (Entry<InetAddress, byte[]> e : newKeys.entrySet()) {
            channel.socket.setTcpMd5Sig(e.getKey(), e.getValue());
            addresses.add(e.getKey());
        }

        return addresses;
    }

    private TcpMd5Util() {
    }
}

Frequently Asked Questions

What is the TcpMd5Util class?
TcpMd5Util is a class in the netty codebase, defined in transport-classes-epoll/src/main/java/io/netty/channel/epoll/TcpMd5Util.java.
Where is TcpMd5Util defined?
TcpMd5Util is defined in transport-classes-epoll/src/main/java/io/netty/channel/epoll/TcpMd5Util.java at line 30.

Analyze Your Own Codebase

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

Try Supermodel Free