1 /*
2  * Copyright 2019 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 #pragma once
18 
19 #include "l2cap/l2cap_packets.h"
20 #include "l2cap/mtu.h"
21 
22 namespace bluetooth {
23 namespace l2cap {
24 namespace classic {
25 namespace internal {
26 
27 struct ChannelConfigurationState {
28  public:
29   enum State {
30     /**
31      * for the initiator path, a request has been sent but a positive response has not yet been received, and for the
32      * acceptor path, a request with acceptable options has not yet been received.
33      */
34     WAIT_CONFIG_REQ_RSP,
35     /**
36      * the acceptor path is complete after having responded to acceptable options, but for the initiator path, a
37      * positive response on the recent request has not yet been received.
38      */
39     WAIT_CONFIG_RSP,
40     /**
41      * the initiator path is complete after having received a positive response, but for the acceptor path, a request
42      * with acceptable options has not yet been received.
43      */
44     WAIT_CONFIG_REQ,
45     /**
46      * Configuration is complete
47      */
48     CONFIGURED,
49   };
50   State state_ = State::WAIT_CONFIG_REQ_RSP;
51 
52   Mtu incoming_mtu_ = kDefaultClassicMtu;
53   Mtu outgoing_mtu_ = kDefaultClassicMtu;
54   RetransmissionAndFlowControlModeOption retransmission_and_flow_control_mode_;
55   RetransmissionAndFlowControlConfigurationOption local_retransmission_and_flow_control_;
56   RetransmissionAndFlowControlConfigurationOption remote_retransmission_and_flow_control_;
57   FcsType fcs_type_ = FcsType::DEFAULT;
58 };
59 }  // namespace internal
60 }  // namespace classic
61 }  // namespace l2cap
62 }  // namespace bluetooth
63