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

51 lines
1.3 KiB
C
Raw Normal View History

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