[Yunq] Create libyunq and move parsing code to it.
This commit is contained in:
parent
91f3f8ee43
commit
7d9f9a7ae9
16 changed files with 310 additions and 260 deletions
23
lib/yunq/serialize.cpp
Normal file
23
lib/yunq/serialize.cpp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#include "serialize.h"
|
||||
|
||||
namespace yunq {
|
||||
|
||||
glcr::Status CheckHeader(const glcr::ByteBuffer& buffer) {
|
||||
// TODO: Check ident.
|
||||
// TODO: Parse core size.
|
||||
// TODO: Parse extension size.
|
||||
// TODO: Check CRC32
|
||||
// TODO: Parse options.
|
||||
return glcr::Status::Ok();
|
||||
}
|
||||
|
||||
void WriteHeader(glcr::ByteBuffer& bytes, uint64_t offset, uint32_t core_size,
|
||||
uint32_t extension_size) {
|
||||
bytes.WriteAt<uint32_t>(
|
||||
offset + 0, 0xDEADBEEF); // TODO: Chose a more unique ident sequence.
|
||||
bytes.WriteAt<uint32_t>(offset + 4, core_size);
|
||||
bytes.WriteAt<uint32_t>(offset + 8, extension_size);
|
||||
bytes.WriteAt<uint32_t>(offset + 12, 0); // TODO: Calculate CRC32.
|
||||
}
|
||||
|
||||
} // namespace yunq
|
||||
Loading…
Add table
Add a link
Reference in a new issue