1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.libraries.rcs.simpleclient.protocol.msrp; 18 19 import static java.nio.charset.StandardCharsets.UTF_8; 20 21 /** 22 * Several constants used for MSRP parsing and serializing. 23 */ 24 public class MsrpConstants { 25 public static final byte[] HEADER_DELIMITER_BYTES = ": ".getBytes(); 26 public static final String MSRP_PROTOCOL = "MSRP"; 27 public static final byte[] MSRP_PROTOCOL_BYTES = MSRP_PROTOCOL.getBytes(UTF_8); 28 public static final String NEW_LINE = "\r\n"; 29 public static final byte[] NEW_LINE_BYTES = NEW_LINE.getBytes(UTF_8); 30 public static final String END_MSRP_MSG = "-------"; 31 public static final byte[] END_MSRP_MSG_BYTES = END_MSRP_MSG.getBytes(UTF_8); 32 public static final String NEW_LINE_END_MSRP_MSG = NEW_LINE + END_MSRP_MSG; 33 public static final int END_MSRP_MSG_LENGTH = END_MSRP_MSG.length(); 34 public static final int FLAG_LAST_CHUNK = '$'; 35 public static final int FLAG_MORE_CHUNK = '+'; 36 public static final int FLAG_ABORT_CHUNK = '#'; 37 public static final byte CHAR_SP = ' '; 38 public static final byte CHAR_LF = '\r'; 39 public static final byte CHAR_MIN = '-'; 40 public static final byte CHAR_DOUBLE_POINT = ':'; 41 public static final String HEADER_BYTE_RANGE = "Byte-Range"; 42 public static final String HEADER_CONTENT_TYPE = "Content-Type"; 43 public static final String HEADER_MESSAGE_ID = "Message-ID"; 44 public static final String HEADER_TO_PATH = "To-Path"; 45 public static final String HEADER_FROM_PATH = "From-Path"; 46 public static final String HEADER_FAILURE_REPORT = "Failure-Report"; 47 public static final String HEADER_SUCCESS_REPORT = "Success-Report"; 48 public static final String REPORT_VALUE_YES = "yes"; 49 public static final String REPORT_VALUE_NO = "no"; 50 51 public static final int RESPONSE_CODE_OK = 200; 52 MsrpConstants()53 private MsrpConstants() { 54 } 55 } 56