blob: 8b7aec561b786457c0419c41bae2312a81154436 [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#pragma once
#include "garnet/drivers/bluetooth/lib/common/byte_buffer.h"
#include "garnet/drivers/bluetooth/lib/common/packet_view.h"
#include "garnet/drivers/bluetooth/lib/sm/smp.h"
namespace btlib {
namespace sm {
// Utilities for processing SMP packets.
class PacketReader : public common::PacketView<Header> {
public:
explicit PacketReader(const common::ByteBuffer* buffer);
inline Code code() const { return header().code; }
};
class PacketWriter : public common::MutablePacketView<Header> {
public:
// Constructor writes |code| into |buffer|.
PacketWriter(Code code, common::MutableByteBuffer* buffer);
};
} // namespace sm
} // namespace btlib