1 /*
2  * Copyright (C) 2023 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.adservices.service.common.bhttp;
18 
19 import android.annotation.IntDef;
20 
21 import java.lang.annotation.Retention;
22 import java.lang.annotation.RetentionPolicy;
23 
24 /**
25  * The start of each binary message is a framing indicator that is a single integer that describes
26  * the structure of the subsequent sections. The framing indicator can take just four values:
27  *
28  * <ul>
29  *   <li>A value of 0 describes a request of known length.
30  *   <li>A value of 1 describes a response of known length.
31  * </ul>
32  *
33  * <p>We only support known length encryption for now. So, only 0 and 1 are included here.
34  *
35  * @see <a
36  *     href="https://www.ietf.org/archive/id/draft-ietf-httpbis-binary-message-06.html#name-framing-indicator">Binary
37  *     HTTP Framing Indicator</a>
38  */
39 @IntDef(
40         prefix = "FRAMING_INDICATOR_",
41         value = {
42             FramingIndicator.FRAMING_INDICATOR_REQUEST_OF_KNOWN_LENGTH,
43             FramingIndicator.FRAMING_INDICATOR_RESPONSE_OF_KNOWN_LENGTH,
44         })
45 @Retention(RetentionPolicy.SOURCE)
46 public @interface FramingIndicator {
47     byte FRAMING_INDICATOR_REQUEST_OF_KNOWN_LENGTH = 0;
48     byte FRAMING_INDICATOR_RESPONSE_OF_KNOWN_LENGTH = 1;
49 }
50