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

org.jitsi.service.neomedia.DtlsControl Maven / Gradle / Ivy

/*
 * Copyright @ 2015 Atlassian Pty Ltd
 *
 * Licensed 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
 *
 *     http://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 org.jitsi.service.neomedia;

import java.util.*;

/**
 * Implements {@link SrtpControl} for DTSL-SRTP.
 *
 * @author Lyubomir Marinov
 */
public interface DtlsControl
    extends SrtpControl
{
    /**
     * The transport protocol (i.e. <proto>) to be specified in
     * a SDP media description (i.e. m= line) in order to denote a
     * RTP/SAVP stream transported over DTLS with UDP. 
     */
    public static final String UDP_TLS_RTP_SAVP = "UDP/TLS/RTP/SAVP";

    /**
     * The transport protocol (i.e. <proto>) to be specified in
     * a SDP media description (i.e. m= line) in order to denote a
     * RTP/SAVPF stream transported over DTLS with UDP. 
     */
    public static final String UDP_TLS_RTP_SAVPF = "UDP/TLS/RTP/SAVPF";

    /**
     * Gets the fingerprint of the local certificate that this instance uses to
     * authenticate its ends of DTLS sessions.
     *
     * @return the fingerprint of the local certificate that this instance uses
     * to authenticate its ends of DTLS sessions
     */
    public String getLocalFingerprint();

    /**
     * Gets the hash function with which the fingerprint of the local
     * certificate is computed i.e. the digest algorithm of the signature
     * algorithm of the local certificate.
     * 
     * @return the hash function with which the fingerprint of the local
     * certificate is computed
     */
    public String getLocalFingerprintHashFunction();

    /**
     * Sets the certificate fingerprints presented by the remote endpoint via
     * the signaling path.
     * 
     * @param remoteFingerprints a Map of hash functions to certificate
     * fingerprints that have been presented by the remote endpoint via the
     * signaling path
     */
    public void setRemoteFingerprints(Map remoteFingerprints);

    /**
     * Sets the value of the setup SDP attribute defined by RFC 4145
     * "TCP-Based Media Transport in the Session Description Protocol
     * (SDP)" which determines whether this instance is to act as a DTLS
     * client or a DTLS server.
     *
     * @param setup the value of the setup SDP attribute to set on this
     * instance in order to determine whether this instance is to act as a DTLS
     * client or a DTLS server
     */
    void setSetup(Setup setup);

    /**
     * Gets the value of the setup SDP attribute.
     */
    Setup getSetup();

    /**
     * Enables/disables rtcp-mux.
     * @param rtcpmux whether to enable or disable.
     */
    public void setRtcpmux(boolean rtcpmux);

    /**
     * Enumerates the possible values of the setup SDP attribute
     * defined by RFC 4145 "TCP-Based Media Transport in the Session
     * Description Protocol (SDP)".
     *
     * @author Lyubomir Marinov
     */
    public enum Setup
    {
        ACTIVE,
        ACTPASS,
        HOLDCONN,
        PASSIVE;

        /**
         * Parses a String into a Setup enum value. The
         * specified String to parse must be in a format as produced by
         * {@link #toString()}; otherwise, the method will throw an exception.
         *
         * @param s the String to parse into a Setup enum
         * value
         * @return a Setup enum value on which toString()
         * produces the specified s
         * @throws IllegalArgumentException if none of the Setup enum
         * values produce the specified s when toString() is
         * invoked on them
         * @throws NullPointerException if s is null
         */
        public static Setup parseSetup(String s)
        {
            if (s == null)
                throw new NullPointerException("s");
            for (Setup v : values())
            {
                if (v.toString().equalsIgnoreCase(s))
                    return v;
            }
            throw new IllegalArgumentException(s);
        }

        /**
         * {@inheritDoc}
         */
        @Override
        public String toString()
        {
            return name().toLowerCase();
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy