2 #ifndef __SS_MODE_HPP__
3 #define __SS_MODE_HPP__
7 #define INTERNAL_MODE_FLAG "int"
10 #define PROT_INTERNAL_MODE_FLAG "prot_int"
13 #define EXTERNAL_MODE_FLAG "ext"
21 SSMode(
const char *
const m );
28 const char *
const str;
53 static constexpr
bool str_equal(
const char *
const s1,
const char *
const s2 ) {
54 return ( s1[0] != s2[0] ) ?
false :
55 ( s1[0] == 0 ) ?
true :
str_equal( s1 + 1, s2 + 1 );
61 "internal mode flag cannot equal external mode flag" );
63 "internal mode flag cannot equal protected internal mode flag" );
65 "protected iternal mode flag cannot equal external mode flag" );
const bool is_valid_mode
True if any mode is valid.
Definition: ss_mode.hpp:40
const bool is_external
True if mode = external.
Definition: ss_mode.hpp:37
#define INTERNAL_MODE_FLAG
The flag that must be passed to invoke internal mode.
Definition: ss_mode.hpp:7
const bool is_internal
True if mode = internal.
Definition: ss_mode.hpp:31
const bool is_protected_internal
True if mode = protected internal.
Definition: ss_mode.hpp:34
const char *const str
The mode.
Definition: ss_mode.hpp:28
#define PROT_INTERNAL_MODE_FLAG
The flag that must be passed to invoke protected internal mode.
Definition: ss_mode.hpp:10
static constexpr bool str_equal(const char *const s1, const char *const s2)
A compile time strcmp Recursively checks if the first characters of the strings match.
Definition: ss_mode.hpp:53
A tiny struct that represents a shadow stack mode.
Definition: ss_mode.hpp:17
#define EXTERNAL_MODE_FLAG
The flag that must be passed to invoke external mode.
Definition: ss_mode.hpp:13
SSMode()=delete
Disable the default constructor.