Struct desfire::file_access_rights

Struct Documentation

struct file_access_rights

Struct representing the access rights for any file type. All the members of this struct support having a free_access option.

Comparison operators

inline bool operator==(file_access_rights const &other) const
inline bool operator!=(file_access_rights const &other) const

Public Functions

constexpr file_access_rights() = default

Default-constructs the structure. Only the master key holds all rights.

constexpr file_access_rights(no_key_t)

Constructs the structure in such a way that no key has any right.

constexpr file_access_rights(free_access_t)

Constructs the structure in such a way that no authentication is required for any operation.

explicit constexpr file_access_rights(std::uint8_t single_key)

Constructs the structure in such a way that only single_key holds all the rights.

Parameters:

single_key – Key number

explicit file_access_rights(bool) = delete

Prevent accidental cast from bool.

constexpr file_access_rights(key_actor<free_access_t> rw, key_actor<free_access_t> chg)

Constructs the structure assigning read and write rights simultaneously.

Parameters:
  • rw – Read and write rights. This will be copied to read and write.

  • chg – Change right value.

constexpr file_access_rights(key_actor<free_access_t> rw, key_actor<free_access_t> chg, key_actor<free_access_t> r, key_actor<free_access_t> w)

Construts the structure assigning explicitly all members

Parameters:
inline void set_word(std::uint16_t v)

Unpacks v into the various members of this struct. Meant for internal use.

Parameters:

v – Word-packed access rights.

inline std::uint16_t get_word() const

Packs the various members of this struct into a single word. Meant for internal use.

Returns:

Word-packed access rights.

bool is_free(file_access access) const

Checks if the given file_access access is free_access.

Parameters:

access – Access to test.

Returns:

True if there is free_access for this type of operation.

Public Members

key_actor<free_access_t> change

Right to change the file settings.

key_actor<free_access_t> read_write

Read and write right. This is combined with read or write with an “or” logical operator.

key_actor<free_access_t> write

Right to change the file content (covers tag::debit and tag::credit as well).

key_actor<free_access_t> read

Right to read the file content or value.

Public Static Functions

static inline file_access_rights from_word(std::uint16_t word)

Factory method that calls set_word. Meant for internal use.

Parameters:

word – Word-packed access rights.

Returns:

A file_access_rights data structure on which set_word was called.