blob: 7367085afef263db7229356e80c9a1d40ee89779 [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001/*
kjellanderb24317b2016-02-10 07:54:43 -08002 * Copyright 2013 The WebRTC project authors. All Rights Reserved.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00003 *
kjellanderb24317b2016-02-10 07:54:43 -08004 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00009 */
10
henrike@webrtc.org28e20752013-07-10 00:45:36 +000011package org.webrtc;
12
sakal037b93a2017-01-16 04:57:32 -080013import java.util.Locale;
14
henrike@webrtc.org28e20752013-07-10 00:45:36 +000015/**
16 * Description of an RFC 4566 Session.
17 * SDPs are passed as serialized Strings in Java-land and are materialized
18 * to SessionDescriptionInterface as appropriate in the JNI layer.
19 */
20public class SessionDescription {
21 /** Java-land enum version of SessionDescriptionInterface's type() string. */
22 public static enum Type {
sakalb6760f92016-09-29 04:12:44 -070023 OFFER,
24 PRANSWER,
25 ANSWER;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000026
27 public String canonicalForm() {
sakal037b93a2017-01-16 04:57:32 -080028 return name().toLowerCase(Locale.US);
henrike@webrtc.org28e20752013-07-10 00:45:36 +000029 }
30
31 public static Type fromCanonicalForm(String canonical) {
sakal037b93a2017-01-16 04:57:32 -080032 return Type.valueOf(Type.class, canonical.toUpperCase(Locale.US));
henrike@webrtc.org28e20752013-07-10 00:45:36 +000033 }
34 }
35
36 public final Type type;
37 public final String description;
38
39 public SessionDescription(Type type, String description) {
40 this.type = type;
41 this.description = description;
42 }
43}