nstool/lib/libhac/include/nn/hac/ServiceAccessControlEntry.h

51 lines
1.2 KiB
C
Raw Normal View History

#pragma once
#include <string>
#include <fnd/types.h>
2018-06-24 16:18:54 +08:00
#include <fnd/ISerialisable.h>
2018-08-07 15:17:51 +08:00
namespace nn
{
namespace hac
{
2018-06-29 12:00:15 +08:00
class ServiceAccessControlEntry :
2018-06-24 16:18:54 +08:00
public fnd::ISerialisable
{
2017-07-06 21:17:21 +10:00
public:
2018-06-29 12:00:15 +08:00
ServiceAccessControlEntry();
ServiceAccessControlEntry(const std::string& name, bool isServer);
ServiceAccessControlEntry(const ServiceAccessControlEntry& other);
2017-07-06 21:17:21 +10:00
2018-06-29 12:00:15 +08:00
void operator=(const ServiceAccessControlEntry& other);
bool operator==(const ServiceAccessControlEntry& other) const;
bool operator!=(const ServiceAccessControlEntry& other) const;
2017-07-06 21:17:21 +10:00
// export/import binary
2018-06-24 16:18:54 +08:00
void toBytes();
void fromBytes(const byte_t* bytes, size_t len);
const fnd::Vec<byte_t>& getBytes() const;
2017-07-06 21:17:21 +10:00
// variables
void clear();
2017-07-06 21:17:21 +10:00
bool isServer() const;
void setIsServer(bool isServer);
const std::string& getName() const;
void setName(const std::string& name);
private:
2018-06-29 12:00:15 +08:00
const std::string kModuleName = "SERVICE_ACCESS_CONTROL_ENTRY";
2017-07-06 21:17:21 +10:00
static const size_t kMaxServiceNameLen = 8;
2018-06-29 12:00:15 +08:00
enum ServiceAccessControlEntryFlag
2017-07-06 21:17:21 +10:00
{
2018-06-24 16:18:54 +08:00
SAC_IS_SERVER = _BIT(7),
SAC_NAME_LEN_MASK = _BIT(7) - 1
2017-07-06 21:17:21 +10:00
};
// raw binary
2018-06-24 16:18:54 +08:00
fnd::Vec<byte_t> mRawBinary;
2017-07-06 21:17:21 +10:00
// variables
bool mIsServer;
std::string mName;
};
2018-08-07 15:17:51 +08:00
}
2017-07-06 21:17:21 +10:00
}