#pragma once

#ifdef _WIN32
#ifdef SOFTBUS_PLUGIN_EXPORTS
#define SOFTBUS_PLUGIN_API __declspec(dllexport)
#else
#define SOFTBUS_PLUGIN_API __declspec(dllimport)
#endif
#else
#define SOFTBUS_PLUGIN_API __attribute__((visibility("default")))
#endif

#include <cstddef>
#include <cstdint>
#include <vector>

namespace softbus::core {

struct FrameResult {
    bool success{false};
    std::size_t consumedBytes{0};
    std::size_t frameStartOffset{0};
    std::vector<uint8_t> frame;
};

class IFramer {
public:
    virtual ~IFramer() = default;
    virtual FrameResult extract(const uint8_t* data, std::size_t size) = 0;
    virtual const char* protocolName() const = 0;
};

extern "C" SOFTBUS_PLUGIN_API IFramer* create_framer();
extern "C" SOFTBUS_PLUGIN_API void destroy_framer(IFramer* framer);

} // namespace softbus::core
