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 "common/bidi_queue.h"
20 #include "l2cap/cid.h"
21 #include "l2cap/l2cap_packets.h"
22 
23 namespace bluetooth {
24 namespace l2cap {
25 namespace internal {
26 class Sender;
27 
28 /**
29  * Common interface for internal channel implementation
30  */
31 class ChannelImpl {
32  public:
33   virtual ~ChannelImpl() = default;
34 
35   /**
36    * Return the queue end for upper layer (L2CAP user)
37    */
38   virtual common::BidiQueueEnd<packet::BasePacketBuilder, packet::PacketView<packet::kLittleEndian>>*
39   GetQueueUpEnd() = 0;
40 
41   /**
42    * Return the queue end for lower layer (sender and receiver)
43    */
44   virtual common::BidiQueueEnd<packet::PacketView<packet::kLittleEndian>, packet::BasePacketBuilder>*
45   GetQueueDownEnd() = 0;
46 
47   virtual Cid GetCid() const = 0;
48 
49   virtual Cid GetRemoteCid() const = 0;
50 };
51 
52 }  // namespace internal
53 }  // namespace l2cap
54 }  // namespace bluetooth
55