#ifndef THIRD_PARTY_UPB_WASM_ABI_MEMORY_H_
#define THIRD_PARTY_UPB_WASM_ABI_MEMORY_H_

#include <cstdint>

#include "third_party/absl/base/nullability.h"
#include "wasm_abi/status_util.h"

namespace upb::wasm {

// Aliases memory from the embedded user to hostspace.
class EmbeddedMemory {
 public:
  virtual ~EmbeddedMemory() = default;

  // Converts `offset` into hostspace ptr, optionally checking bounds.
  virtual const void* ResolveMemoryOffset(MaybeErrorStatus* absl_nonnull status,
                                          uint32_t offset, uint32_t size) = 0;

  // Writes the provided data into the embedded space.
  virtual uint32_t ExportBuffer(MaybeErrorStatus* absl_nonnull status,
                                const void* data, uint32_t size) = 0;
};
}  // namespace upb::wasm

#endif  // THIRD_PARTY_UPB_WASM_ABI_MEMORY_H_
