nstool/lib/libes/include/es/ETicketSectionHeader_V2.h

86 lines
1.9 KiB
C
Raw Normal View History

2017-07-22 08:59:06 +00:00
#pragma once
#include <string>
#include <fnd/MemoryBlob.h>
2017-07-22 08:59:06 +00:00
#include <fnd/ISerialiseableBinary.h>
namespace es
{
class ETicketSectionHeader_V2 :
public fnd::ISerialiseableBinary
{
public:
enum SectionType
{
PERMANENT = 1,
SUBSCRIPTION = 2,
CONTENT = 3,
CONTENT_CONSUMPTION = 4,
ACCESS_TITLE = 5,
LIMITED_RESOURCE = 6,
};
ETicketSectionHeader_V2();
ETicketSectionHeader_V2(const ETicketSectionHeader_V2& other);
2018-03-22 05:26:22 +00:00
ETicketSectionHeader_V2(const byte_t* bytes, size_t len);
2017-07-22 08:59:06 +00:00
bool operator==(const ETicketSectionHeader_V2& other) const;
bool operator!=(const ETicketSectionHeader_V2& other) const;
void operator=(const ETicketSectionHeader_V2& other);
// to be used after export
2018-03-22 05:26:22 +00:00
const byte_t* getBytes() const;
2017-07-22 08:59:06 +00:00
size_t getSize() const;
// export/import binary
virtual void exportBinary();
2018-03-22 05:26:22 +00:00
virtual void importBinary(const byte_t* bytes, size_t len);
2017-07-22 08:59:06 +00:00
// variables
virtual void clear();
2018-03-22 05:26:22 +00:00
uint32_t getSectionOffset() const;
void setSectionOffset(uint32_t offset);
2017-07-22 08:59:06 +00:00
2018-03-22 05:26:22 +00:00
uint32_t getRecordSize() const;
void setRecordSize(uint32_t size);
2017-07-22 08:59:06 +00:00
2018-03-22 05:26:22 +00:00
uint32_t getSectionSize() const;
void getSectionSize(uint32_t size);
2017-07-22 08:59:06 +00:00
2018-03-22 05:26:22 +00:00
uint16_t getRecordNum() const;
void setRecordNum(uint16_t record_num);
2017-07-22 08:59:06 +00:00
SectionType getSectionType() const;
void setSectionType(SectionType type);
private:
const std::string kModuleName = "ETICKET_SECTION_HEADER_V2";
#pragma pack (push, 1)
struct sSectionHeader_v2
{
le_uint32_t section_offset;
le_uint32_t record_size;
le_uint32_t section_size;
le_uint16_t record_num;
le_uint16_t section_type;
2017-07-22 08:59:06 +00:00
};
#pragma pack (pop)
// raw binary
fnd::MemoryBlob mBinaryBlob;
// variables
2018-03-22 05:26:22 +00:00
uint32_t mSectionOffset;
uint32_t mRecordSize;
uint32_t mSectionSize;
uint16_t mRecordNum;
2017-07-22 08:59:06 +00:00
SectionType mSectionType;
// helpers
bool isEqual(const ETicketSectionHeader_V2& other) const;
void copyFrom(const ETicketSectionHeader_V2& other);
};
}