mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 21:45:37 +00:00
[#3323] typed enums to appease ubsan
example of UBSan error: runtime error: load of value 65536, which is not a valid value for type 'const HeaderFlag'
This commit is contained in:
@@ -136,7 +136,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// any is a special type used in list specifications, specifying that the
|
/// any is a special type used in list specifications, specifying that the
|
||||||
/// elements can be of any type.
|
/// elements can be of any type.
|
||||||
enum types {
|
enum types : int {
|
||||||
integer = 0,
|
integer = 0,
|
||||||
real = 1,
|
real = 1,
|
||||||
boolean = 2,
|
boolean = 2,
|
||||||
|
@@ -199,7 +199,7 @@ public:
|
|||||||
/// introducing a separately defined class considering the balance
|
/// introducing a separately defined class considering the balance
|
||||||
/// between the complexity and advantage, but hopefully the cast notation
|
/// between the complexity and advantage, but hopefully the cast notation
|
||||||
/// is sufficiently ugly to prevent proliferation of the usage.
|
/// is sufficiently ugly to prevent proliferation of the usage.
|
||||||
enum HeaderFlag {
|
enum HeaderFlag : int {
|
||||||
HEADERFLAG_QR = 0x8000, // Query (if cleared) or response (if set)
|
HEADERFLAG_QR = 0x8000, // Query (if cleared) or response (if set)
|
||||||
HEADERFLAG_AA = 0x0400, // Authoritative answer
|
HEADERFLAG_AA = 0x0400, // Authoritative answer
|
||||||
HEADERFLAG_TC = 0x0200, // Truncation
|
HEADERFLAG_TC = 0x0200, // Truncation
|
||||||
@@ -239,7 +239,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// <b>Future Extension:</b> We'll probably also define constants for
|
/// <b>Future Extension:</b> We'll probably also define constants for
|
||||||
/// the section names used in dynamic updates in future versions.
|
/// the section names used in dynamic updates in future versions.
|
||||||
enum Section {
|
enum Section : int {
|
||||||
SECTION_QUESTION = 0, // Question section
|
SECTION_QUESTION = 0, // Question section
|
||||||
SECTION_ANSWER = 1, // Answer section
|
SECTION_ANSWER = 1, // Answer section
|
||||||
SECTION_AUTHORITY = 2, // Authority section
|
SECTION_AUTHORITY = 2, // Authority section
|
||||||
|
@@ -542,7 +542,7 @@ class TokenPkt : public Token {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/// @brief enum value that determines the field.
|
/// @brief enum value that determines the field.
|
||||||
enum MetadataType {
|
enum MetadataType : int {
|
||||||
IFACE, ///< interface name (string)
|
IFACE, ///< interface name (string)
|
||||||
SRC, ///< source (IP address)
|
SRC, ///< source (IP address)
|
||||||
DST, ///< destination (IP address)
|
DST, ///< destination (IP address)
|
||||||
@@ -591,7 +591,7 @@ class TokenPkt4 : public Token {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/// @brief enum value that determines the field.
|
/// @brief enum value that determines the field.
|
||||||
enum FieldType {
|
enum FieldType : int {
|
||||||
CHADDR, ///< chaddr field (up to 16 bytes link-layer address)
|
CHADDR, ///< chaddr field (up to 16 bytes link-layer address)
|
||||||
GIADDR, ///< giaddr (IPv4 address)
|
GIADDR, ///< giaddr (IPv4 address)
|
||||||
CIADDR, ///< ciaddr (IPv4 address)
|
CIADDR, ///< ciaddr (IPv4 address)
|
||||||
@@ -644,7 +644,7 @@ private:
|
|||||||
class TokenPkt6 : public Token {
|
class TokenPkt6 : public Token {
|
||||||
public:
|
public:
|
||||||
/// @brief enum value that determines the field.
|
/// @brief enum value that determines the field.
|
||||||
enum FieldType {
|
enum FieldType : int {
|
||||||
MSGTYPE, ///< msg type
|
MSGTYPE, ///< msg type
|
||||||
TRANSID ///< transaction id (integer but manipulated as a string)
|
TRANSID ///< transaction id (integer but manipulated as a string)
|
||||||
};
|
};
|
||||||
@@ -696,7 +696,7 @@ class TokenRelay6Field : public Token {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/// @brief enum value that determines the field.
|
/// @brief enum value that determines the field.
|
||||||
enum FieldType {
|
enum FieldType : int {
|
||||||
PEERADDR, ///< Peer address field (IPv6 address)
|
PEERADDR, ///< Peer address field (IPv6 address)
|
||||||
LINKADDR ///< Link address field (IPv6 address)
|
LINKADDR ///< Link address field (IPv6 address)
|
||||||
};
|
};
|
||||||
@@ -1091,7 +1091,7 @@ class TokenVendor : public TokenOption {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/// @brief Specifies a field of the vendor option
|
/// @brief Specifies a field of the vendor option
|
||||||
enum FieldType {
|
enum FieldType : int {
|
||||||
SUBOPTION, ///< If this token fetches a suboption, not a field.
|
SUBOPTION, ///< If this token fetches a suboption, not a field.
|
||||||
ENTERPRISE_ID, ///< enterprise-id field (vendor-info, vendor-class)
|
ENTERPRISE_ID, ///< enterprise-id field (vendor-info, vendor-class)
|
||||||
EXISTS, ///< vendor[123].exists
|
EXISTS, ///< vendor[123].exists
|
||||||
|
Reference in New Issue
Block a user