[bt][l2cap] PDU: allow Copy()-ing zero bytes

As part of the upcoming L2CAP channel modes support, we'll need to
support segmentation and reassembly. And to support segmentation and
reassembly, we need to make PDUs and SDUs distinct entities.

After some discussion (see BT-61), we decided to represent SDUs as
simple ByteBuffers, rather than something more complicated
(e.g. linked-list of PDUs). This means that the Channel object will
soon provide a ByteBuffer when it calls |rx_callback|, rather than a
PDU.

Since various existing |rx_callback|s expect to be able to receive a
PDU with an empty body, we need to support passing an empty L2CAP
frame body up as a ByteBuffer. To that end, remove the assertion in
PDU::Copy(), which requires that the PDU have non-zero bytes available
past |pos|.

Bug: BT-716
Test: fx run-test bluetooth-tests -t bt-host-unittests

Change-Id: I62f467b4c39f46e31b97475ed5a3910ce28ba887
2 files changed
tree: 23131bc107ffa0ac7e14526b860b7a1221d6c2e9
  1. boards/
  2. build/
  3. buildtools/
  4. bundles/
  5. docs/
  6. garnet/
  7. peridot/
  8. products/
  9. scripts/
  10. sdk/
  11. src/
  12. zircon/
  13. .clang-format
  14. .dir-locals.el
  15. .gitattributes
  16. .gitignore
  17. AUTHORS
  18. CODE_OF_CONDUCT.md
  19. CONTRIBUTING.md
  20. LICENSE
  21. OWNERS
  22. PATENTS
  23. README.md
  24. rustfmt.toml
README.md

Fuchsia

Pink + Purple == Fuchsia (a new operating system)

What is Fuchsia?

Fuchsia is a modular, capability-based operating system. Fuchsia runs on modern 64-bit Intel and ARM processors.

Fuchsia is an open source project with a code of conduct that we expect everyone who interacts with the project to respect.

How can I build and run Fuchsia?

See Getting Started.

Where can I learn more about Fuchsia?

See the documentation.