Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7c8e8f4 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I4be323bc,I737488ed,Iba0c6ee1

* changes:
  L2CAP: Simplify parameters for segmenter and reassembler
  L2CAP: Make a common ChannelImpl interface
  L2CAP Segmenter: Keep a reference to DynamicChannelImpl
parents 5c1e1a99 cbfa2222
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -105,11 +105,11 @@ void DynamicChannelImpl::SetIncomingMtu(Mtu mtu) {
  incoming_mtu_ = mtu;
}

RetransmissionAndFlowControlModeOption DynamicChannelImpl::GetMode() const {
RetransmissionAndFlowControlModeOption DynamicChannelImpl::GetChannelMode() const {
  return mode_;
}

void DynamicChannelImpl::SetMode(RetransmissionAndFlowControlModeOption mode) {
void DynamicChannelImpl::SetChannelMode(RetransmissionAndFlowControlModeOption mode) {
  mode_ = mode;
}

+4 −3
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include "hci/address.h"
#include "l2cap/cid.h"
#include "l2cap/classic/dynamic_channel.h"
#include "l2cap/internal/channel_impl.h"
#include "l2cap/l2cap_packets.h"
#include "l2cap/mtu.h"
#include "l2cap/psm.h"
@@ -33,7 +34,7 @@ namespace internal {

class Link;

class DynamicChannelImpl {
class DynamicChannelImpl : public l2cap::internal::ChannelImpl {
 public:
  DynamicChannelImpl(Psm psm, Cid cid, Cid remote_cid, Link* link, os::Handler* l2cap_handler);

@@ -78,8 +79,8 @@ class DynamicChannelImpl {
  virtual Mtu GetIncomingMtu() const;
  virtual void SetIncomingMtu(Mtu mtu);

  virtual RetransmissionAndFlowControlModeOption GetMode() const;
  virtual void SetMode(RetransmissionAndFlowControlModeOption mode);
  virtual RetransmissionAndFlowControlModeOption GetChannelMode() const;
  virtual void SetChannelMode(RetransmissionAndFlowControlModeOption mode);

  virtual FcsType GetFcsType() const;
  virtual void SetFcsType(FcsType fcs_type);
+19 −1
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@
#include "common/bidi_queue.h"
#include "l2cap/cid.h"
#include "l2cap/classic/fixed_channel.h"
#include "l2cap/internal/channel_impl.h"
#include "l2cap/l2cap_packets.h"
#include "os/handler.h"
#include "os/log.h"

@@ -29,7 +31,7 @@ namespace internal {

class Link;

class FixedChannelImpl {
class FixedChannelImpl : public l2cap::internal::ChannelImpl {
 public:
  FixedChannelImpl(Cid cid, Link* link, os::Handler* l2cap_handler);

@@ -65,6 +67,22 @@ class FixedChannelImpl {
    return channel_queue_.GetDownEnd();
  }

  Cid GetCid() const {
    return cid_;
  }

  Cid GetRemoteCid() const {
    return cid_;
  }

  RetransmissionAndFlowControlModeOption GetChannelMode() const {
    return RetransmissionAndFlowControlModeOption::L2CAP_BASIC;
  }

  void SetChannelMode(RetransmissionAndFlowControlModeOption) {
    LOG_ERROR("Setting channel mode on a fixed channel cid 0x%02hx", cid_);
  }

 private:
  // Constructor states
  // For logging purpose only
+6 −6
Original line number Diff line number Diff line
@@ -60,8 +60,8 @@ void Link::Disconnect() {

std::shared_ptr<FixedChannelImpl> Link::AllocateFixedChannel(Cid cid, SecurityPolicy security_policy) {
  auto channel = fixed_channel_allocator_.AllocateChannel(cid, security_policy);
  scheduler_->AttachChannel(cid, channel->GetQueueDownEnd(), cid);
  reassembler_.AttachChannel(cid, channel->GetQueueDownEnd(), nullptr);
  scheduler_->AttachChannel(cid, channel);
  reassembler_.AttachChannel(cid, channel);
  return channel;
}

@@ -95,8 +95,8 @@ std::shared_ptr<DynamicChannelImpl> Link::AllocateDynamicChannel(Psm psm, Cid re
                                                                 SecurityPolicy security_policy) {
  auto channel = dynamic_channel_allocator_.AllocateChannel(psm, remote_cid, security_policy);
  if (channel != nullptr) {
    scheduler_->AttachChannel(channel->GetCid(), channel->GetQueueDownEnd(), channel->GetRemoteCid());
    reassembler_.AttachChannel(channel->GetCid(), channel->GetQueueDownEnd(), channel);
    scheduler_->AttachChannel(channel->GetCid(), channel);
    reassembler_.AttachChannel(channel->GetCid(), channel);
  }
  channel->local_initiated_ = false;
  return channel;
@@ -106,8 +106,8 @@ std::shared_ptr<DynamicChannelImpl> Link::AllocateReservedDynamicChannel(Cid res
                                                                         SecurityPolicy security_policy) {
  auto channel = dynamic_channel_allocator_.AllocateReservedChannel(reserved_cid, psm, remote_cid, security_policy);
  if (channel != nullptr) {
    scheduler_->AttachChannel(channel->GetCid(), channel->GetQueueDownEnd(), channel->GetRemoteCid());
    reassembler_.AttachChannel(channel->GetCid(), channel->GetQueueDownEnd(), channel);
    scheduler_->AttachChannel(channel->GetCid(), channel);
    reassembler_.AttachChannel(channel->GetCid(), channel);
  }
  channel->local_initiated_ = true;
  return channel;
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ class Link {

  // FixedChannel methods

  virtual std::shared_ptr<FixedChannelImpl> AllocateFixedChannel(Cid cid, SecurityPolicy security_policy);
  std::shared_ptr<FixedChannelImpl> AllocateFixedChannel(Cid cid, SecurityPolicy security_policy);

  virtual bool IsFixedChannelAllocated(Cid cid);

Loading